Skip to content
Snippets Groups Projects
Commit 6d604528 authored by Hema Vishnu Pola [Microsoft]'s avatar Hema Vishnu Pola [Microsoft]
Browse files

Merge branch 'users/komakkar/core_it_changes' into 'master'

Core change: Making topic name configurable in ITs.

See merge request !33
parents a7e31835 faed9150
No related branches found
No related tags found
1 merge request!33Core change: Making topic name configurable in ITs.
Pipeline #14349 passed with warnings
...@@ -23,6 +23,7 @@ import org.opengroup.osdu.register.util.TestPayloadReader; ...@@ -23,6 +23,7 @@ import org.opengroup.osdu.register.util.TestPayloadReader;
public class CreateSubscriberDescriptor extends RestDescriptor { public class CreateSubscriberDescriptor extends RestDescriptor {
private final TestPayloadReader reader = new TestPayloadReader(); private final TestPayloadReader reader = new TestPayloadReader();
private static String topicName = System.getProperty("TEST_TOPIC_NAME", System.getenv("TEST_TOPIC_NAME"));
@Override @Override
public String getPath() { public String getPath() {
...@@ -48,12 +49,17 @@ public class CreateSubscriberDescriptor extends RestDescriptor { ...@@ -48,12 +49,17 @@ public class CreateSubscriberDescriptor extends RestDescriptor {
url = pushPath; url = pushPath;
} }
String secret = Config.Instance().SUBSCRIBER_SECRET; String secret = Config.Instance().SUBSCRIBER_SECRET;
if(Strings.isNullOrEmpty(topicName)) {
topicName = "records-changed";
}
return "{\n" + return "{\n" +
"\t\"id\": \"" + getArg() + "\",\n" + "\t\"id\": \"" + getArg() + "\",\n" +
"\t\"name\": \"My listener\",\n" + "\t\"name\": \"My listener\",\n" +
"\t\"description\": \"My test listener.\",\n" + "\t\"description\": \"My test listener.\",\n" +
"\t\"pushEndpoint\":\"" + url + "\",\n" + "\t\"pushEndpoint\":\"" + url + "\",\n" +
"\t\"topic\":\"records-changed\",\n" + "\t\"topic\":\"" + topicName + "\",\n" +
"\t\"secret\": {\n" + "\t\"secret\": {\n" +
"\t\t\"secretType\" : \"HMAC\",\n" + "\t\t\"secretType\" : \"HMAC\",\n" +
"\t\"value\":\"" + secret + "\"\n" + "\t\"value\":\"" + secret + "\"\n" +
......
...@@ -31,6 +31,7 @@ import java.security.SecureRandom; ...@@ -31,6 +31,7 @@ import java.security.SecureRandom;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -81,12 +82,14 @@ public abstract class TestUtils { ...@@ -81,12 +82,14 @@ public abstract class TestUtils {
public static Map<String, String> getOsduTenantHeaders() { public static Map<String, String> getOsduTenantHeaders() {
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("data-partition-id", getOsduTenant()); headers.put("data-partition-id", getOsduTenant());
headers.put("correlation-id", UUID.randomUUID().toString());
return headers; return headers;
} }
public static Map<String, String> getCustomerTenantHeaders() { public static Map<String, String> getCustomerTenantHeaders() {
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("data-partition-id", getCustomerTenant()); headers.put("data-partition-id", getCustomerTenant());
headers.put("correlation-id", UUID.randomUUID().toString());
return headers; return headers;
} }
...@@ -166,4 +169,4 @@ public abstract class TestUtils { ...@@ -166,4 +169,4 @@ public abstract class TestUtils {
return Client.create(); return Client.create();
} }
} }
\ No newline at end of file
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