Commit 01a33adf authored by Rucha Deshpande's avatar Rucha Deshpande
Browse files

bug fix

parent f71ef981
...@@ -24,6 +24,7 @@ import org.opengroup.osdu.core.common.model.http.DpsHeaders; ...@@ -24,6 +24,7 @@ import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.notification.HmacSecret; import org.opengroup.osdu.core.common.model.notification.HmacSecret;
import org.opengroup.osdu.core.common.model.notification.Subscription; import org.opengroup.osdu.core.common.model.notification.Subscription;
import org.opengroup.osdu.core.common.notification.ISubscriptionService; import org.opengroup.osdu.core.common.notification.ISubscriptionService;
import org.opengroup.osdu.core.common.notification.SubscriptionAPIConfig;
import org.opengroup.osdu.core.common.notification.SubscriptionException; import org.opengroup.osdu.core.common.notification.SubscriptionException;
import org.opengroup.osdu.core.common.notification.SubscriptionFactory; import org.opengroup.osdu.core.common.notification.SubscriptionFactory;
import org.opengroup.osdu.notification.util.*; import org.opengroup.osdu.notification.util.*;
...@@ -37,11 +38,13 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { ...@@ -37,11 +38,13 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
private String subscriptionId = null; private String subscriptionId = null;
private String notificationId = null; private String notificationId = null;
private ISubscriptionService subscriptionService; private ISubscriptionService awssubscriptionService;
private static SubscriptionFactory factory; private static SubscriptionFactory awsfactory;
@BeforeClass @BeforeClass
public static void classSetup() throws Exception { public static void classSetup() throws Exception {
PubsubEndpointHMACTests.classSetup(); PubsubEndpointHMACTests.classSetup();
SubscriptionAPIConfig config = SubscriptionAPIConfig.builder().rootUrl(Config.Instance().RegisterServicePath).build();
awsfactory = new SubscriptionFactory(config);
} }
@AfterClass @AfterClass
...@@ -90,7 +93,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { ...@@ -90,7 +93,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
//hardcoding user here for 200 response tests. This is just initializing the subscription creation //hardcoding user here for 200 response tests. This is just initializing the subscription creation
headers.put("x-user-id", AwsConfig.getAWSCognitoUser()); headers.put("x-user-id", AwsConfig.getAWSCognitoUser());
DpsHeaders dpsHeaders = DpsHeaders.createFromMap(headers); DpsHeaders dpsHeaders = DpsHeaders.createFromMap(headers);
subscriptionService = factory.create(dpsHeaders); awssubscriptionService = awsfactory.create(dpsHeaders);
System.out.println("****NOTIFICATION Created subscriptionService using following headers*******"); System.out.println("****NOTIFICATION Created subscriptionService using following headers*******");
Map<String,String> h = dpsHeaders.getHeaders(); Map<String,String> h = dpsHeaders.getHeaders();
...@@ -110,7 +113,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { ...@@ -110,7 +113,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
subscription.setSecret(secret); subscription.setSecret(secret);
try { try {
Subscription subscriptionCreated = subscriptionService.create(subscription); Subscription subscriptionCreated = awssubscriptionService.create(subscription);
notificationId = subscriptionCreated.getNotificationId(); notificationId = subscriptionCreated.getNotificationId();
subscriptionId = subscriptionCreated.getId(); subscriptionId = subscriptionCreated.getId();
Config.Instance().NotificationId = notificationId; Config.Instance().NotificationId = notificationId;
...@@ -122,7 +125,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { ...@@ -122,7 +125,7 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
@Override @Override
protected void deleteResource() throws Exception { protected void deleteResource() throws Exception {
subscriptionService.delete(subscriptionId); awssubscriptionService.delete(subscriptionId);
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment