Skip to content
Snippets Groups Projects
Commit 5adacfcd authored by Nikhil Patil's avatar Nikhil Patil
Browse files

test fix

parent ceb19e9c
No related branches found
No related tags found
1 merge request!478test fix
Pipeline #238789 failed
package org.opengroup.osdu.notification.api;
import org.opengroup.osdu.notification.util.Config;
import org.opengroup.osdu.notification.util.RestDescriptor;
import org.opengroup.osdu.notification.util.TestUtils;
import java.util.HashMap;
import java.util.Map;
public class PubsubEndpointHMACDescriptor extends RestDescriptor{
@Override
public String getPath() {
return "push-handlers/records-changed";
}
@Override
public String getHttpMethod() {
return "POST";
}
@Override
public String getValidBody() {
return "{\n" +
"\t\"Type\": \"Notification\",\n" +
"\t\"message\": {\n" +
"\t\"attributes\": {\n" +
"\t\"correlation-id\": \"39137f49-67d6-4001-a6aa-15521ef4f49e\",\n" +
"\t\"data-partition-id\": \"" + TestUtils.getOsduTenant() + "\"\n" +
"\t},\n" +
"\t\"data\": \"W3sia2luZCI6InRlc3RraW5kIiwiaWQiOiJ0ZXN0aWQiLCJvcGVyYXRpb250eXBlIjoiY3JlYXRlIn0seyJraW5kIjoidGVzdGtpbmQyIiwiaWQiOiJ0ZXN0aWQyIiwib3BlcmF0aW9udHlwZSI6InVwZGF0ZSJ9XQ\",\n" +
"\t\"messageId\": \"136969346945\"\n" +
"\t},\n" +
"\t\"subscription\": \""+ arg() +"\"\n" +
"}\n";
}
@Override
public Map<String,String> getOsduTenantHeaders(){
Map<String, String> headers = new HashMap<>();
headers.put("data-partition-id", Config.Instance().OsduTenant);
return headers;
}
@Override
public Map<String,String> getCustomerTenantHeaders(){
Map<String, String> headers = new HashMap<>();
headers.put("data-partition-id", Config.Instance().ClientTenant);
return headers;
}
}
......@@ -8,15 +8,22 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.opengroup.osdu.core.common.notification.SubscriptionAPIConfig;
import org.opengroup.osdu.core.common.notification.SubscriptionFactory;
import org.opengroup.osdu.notification.util.Config;
import org.opengroup.osdu.notification.util.IBMTestUtils;
import com.sun.jersey.api.client.ClientResponse;
public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
private static SubscriptionFactory factory;
@BeforeClass
public static void classSetup() throws Exception {
PubsubEndpointHMACTests.classSetup();
descriptor = new PubsubEndpointHMACDescriptor();
//Configure Register Service Client Library
SubscriptionAPIConfig config = SubscriptionAPIConfig.builder().rootUrl(Config.Instance().RegisterServicePath).build();
config.setApiKey("apiKey");
factory = new SubscriptionFactory(config);
}
@AfterClass
......@@ -36,6 +43,8 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests {
}
@Override
@Test
@Ignore
public void should_return400_when_makingHttpRequestWithoutToken()throws Exception{
ClientResponse response = descriptor.run(getArg(), "");
assertEquals(error( response.getEntity(String.class)), 403, response.getStatus());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment