Skip to content
Snippets Groups Projects
Commit a67c6191 authored by Gitlab Runner's avatar Gitlab Runner
Browse files
parents cbce3631 b7ce7cd3
No related branches found
No related tags found
4 merge requests!73Register Service: Audit Logs Implementation (GONRG-1761),!71Logging Enhancements for GCP modules (GONRG-1735, GONRG-1779),!67GCP release/0.5 - fix GSA Challenge (GONRG-1796),!56Gcp fix sonar comments (GONRG-1370)
Showing
with 50 additions and 78 deletions
...@@ -15,9 +15,7 @@ variables: ...@@ -15,9 +15,7 @@ variables:
AZURE_SERVICE: register AZURE_SERVICE: register
AZURE_BUILD_SUBDIR: provider/register-azure AZURE_BUILD_SUBDIR: provider/register-azure
AZURE_TEST_SUBDIR: testing/register-test-core AZURE_TEST_SUBDIR: testing/register-test-azure
AZURE_SKIP_TEST: 'true'
AZURE_DEPLOYMENTS_SUBDIR: deployments/scripts/azure
include: include:
- project: "osdu/platform/ci-cd-pipelines" - project: "osdu/platform/ci-cd-pipelines"
......
...@@ -92,10 +92,6 @@ spec: ...@@ -92,10 +92,6 @@ spec:
value: osdu-db value: osdu-db
- name: ENTITLEMENTS_API - name: ENTITLEMENTS_API
value: http://entitlements-azure/entitlements/v1 value: http://entitlements-azure/entitlements/v1
- name: entitlements_service_api_key
value: "OBSOLETE"
- name: azure_istioauth_enabled
value: "true"
- name: RECORDS_CHANGE_PUBSUB_ENDPOINT - name: RECORDS_CHANGE_PUBSUB_ENDPOINT
value: https://haaggarw-eventgrid-viewer.azurewebsites.net/api/updates value: https://haaggarw-eventgrid-viewer.azurewebsites.net/api/updates
- name: SUBSCRIBER_SECRET - name: SUBSCRIBER_SECRET
......
...@@ -75,19 +75,19 @@ public class AzureBootstrapConfig { ...@@ -75,19 +75,19 @@ public class AzureBootstrapConfig {
} }
private void setEventGridTopicName(SecretClient kv) { private void setEventGridTopicName(SecretClient kv) {
eventGridTopicName = "dummy"; // getKeyVaultSecret(kv, "opendes-eventgrid-recordstopic").split("\\.")[0].replace("https://", ""); eventGridTopicName = getKeyVaultSecret(kv, "opendes-eventgrid-recordstopic").split("\\.")[0].replace("https://", "");
} }
private void setResourceGroupName(SecretClient kv) { private void setResourceGroupName(SecretClient kv) {
resourceGroupName = "dummy"; //getKeyVaultSecret(kv, "opendes-eventgrid-resourcegroup"); resourceGroupName = getKeyVaultSecret(kv, "opendes-eventgrid-resourcegroup");
} }
private void setAzureSubscriptionId(SecretClient kv) { private void setAzureSubscriptionId(SecretClient kv) {
azureSubscriptionId = "dummy"; //getKeyVaultSecret(kv, "subscription-id"); azureSubscriptionId = getKeyVaultSecret(kv, "subscription-id");
} }
private void setKeyIdentifier(SecretClient kv) { private void setKeyIdentifier(SecretClient kv) {
keyIdentifier = "dummy"; //getKeyVaultSecret(kv, "opendes-encryption-key-identifier"); keyIdentifier = getKeyVaultSecret(kv, "opendes-encryption-key-identifier");
} }
@Bean @Bean
...@@ -102,32 +102,32 @@ public class AzureBootstrapConfig { ...@@ -102,32 +102,32 @@ public class AzureBootstrapConfig {
return getKeyVaultSecret(kv, "opendes-cosmos-primary-key"); return getKeyVaultSecret(kv, "opendes-cosmos-primary-key");
} }
/*@Bean @Bean
public CryptographyClient getCryptographyClient(SecretClient kv) { public CryptographyClient getCryptographyClient(SecretClient kv) {
setKeyIdentifier(kv); setKeyIdentifier(kv);
setAzureSubscriptionId(kv);
TokenCredential credential = new DefaultAzureCredentialBuilder().build(); TokenCredential credential = new DefaultAzureCredentialBuilder().build();
return new CryptographyClientBuilder().buildClient();*//*new CryptographyClientBuilder() return new CryptographyClientBuilder()
.keyIdentifier(keyIdentifier) .keyIdentifier(keyIdentifier)
.credential(credential) .credential(credential)
.buildClient();*//* .buildClient();
}*/ }
/* @Bean @Bean
public EventGridManager eventGridManager(SecretClient kv) { public EventGridManager eventGridManager(SecretClient kv) {
setResourceGroupName(kv); setResourceGroupName(kv);
setAzureSubscriptionId(kv); setAzureSubscriptionId(kv);
setEventGridTopicName(kv); setEventGridTopicName(kv);
AzureTokenCredentials azureTokenCredentials = getAzureTokenCredentials(); AzureTokenCredentials azureTokenCredentials = getAzureTokenCredentials();
return EventGridManager.configure().authenticate(azureTokenCredentials, "dummy");*//*EventGridManager return EventGridManager
.configure() .configure()
.withLogLevel(LogLevel.BASIC) .withLogLevel(LogLevel.BASIC)
.authenticate(azureTokenCredentials, azureTokenCredentials.defaultSubscriptionId());*//* .authenticate(azureTokenCredentials, azureTokenCredentials.defaultSubscriptionId());
}*/ }
private AzureTokenCredentials getAzureTokenCredentials() {
/* private AzureTokenCredentials getAzureTokenCredentials() {
AzureEnvironment azureEnvironment = new AzureEnvironment(new HashMap<>()); AzureEnvironment azureEnvironment = new AzureEnvironment(new HashMap<>());
azureEnvironment.endpoints().putAll(AzureEnvironment.AZURE.endpoints()); azureEnvironment.endpoints().putAll(AzureEnvironment.AZURE.endpoints());
return new ApplicationTokenCredentials( return new ApplicationTokenCredentials(
...@@ -135,7 +135,7 @@ public class AzureBootstrapConfig { ...@@ -135,7 +135,7 @@ public class AzureBootstrapConfig {
azureTenantId, azureTenantId,
azureClientSecret, azureClientSecret,
azureEnvironment).withDefaultSubscriptionId(azureSubscriptionId); azureEnvironment).withDefaultSubscriptionId(azureSubscriptionId);
}*/ }
String getKeyVaultSecret(SecretClient kv, String secretName) { String getKeyVaultSecret(SecretClient kv, String secretName) {
KeyVaultSecret secret = kv.getSecret(secretName); KeyVaultSecret secret = kv.getSecret(secretName);
......
...@@ -17,8 +17,8 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -17,8 +17,8 @@ import java.util.concurrent.atomic.AtomicReference;
public class PushSubscription { public class PushSubscription {
private static final String RESOURCE_PROVISIONING_ERROR_MESSAGE = "Resource cannot be updated during provisioning"; private static final String RESOURCE_PROVISIONING_ERROR_MESSAGE = "Resource cannot be updated during provisioning";
/*@Autowired @Autowired
private EventGridManager eventGridManager;*/ private EventGridManager eventGridManager;
@Autowired @Autowired
private AzureBootstrapConfig azureBootstrapConfig; private AzureBootstrapConfig azureBootstrapConfig;
...@@ -38,7 +38,7 @@ public class PushSubscription { ...@@ -38,7 +38,7 @@ public class PushSubscription {
String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName); String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName);
AtomicReference<Throwable> error = new AtomicReference<>(); AtomicReference<Throwable> error = new AtomicReference<>();
/*eventGridManager.eventSubscriptions().define(subscriptionId) eventGridManager.eventSubscriptions().define(subscriptionId)
.withScope(scope) .withScope(scope)
.withDestination(subscriptionDestination) .withDestination(subscriptionDestination)
.createAsync() .createAsync()
...@@ -58,14 +58,14 @@ public class PushSubscription { ...@@ -58,14 +58,14 @@ public class PushSubscription {
logger.error("Creating Push Subscription failed with error: " + error.get().toString()); logger.error("Creating Push Subscription failed with error: " + error.get().toString());
throw new AppException(500, "Server Error", "Unexpected error creating Push subscription"); throw new AppException(500, "Server Error", "Unexpected error creating Push subscription");
} }
}*/ }
} }
public void deletePushSubscription(String subscriptionId, String topicName) { public void deletePushSubscription(String subscriptionId, String topicName) {
String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName); String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName);
AtomicReference<Throwable> error = new AtomicReference<>(); AtomicReference<Throwable> error = new AtomicReference<>();
/* eventGridManager.eventSubscriptions().deleteAsync(scope, subscriptionId) eventGridManager.eventSubscriptions().deleteAsync(scope, subscriptionId)
.subscribe(() -> logger.info(String.format("Push Subscription with id %s deleted successfully", subscriptionId)), error::set); .subscribe(() -> logger.info(String.format("Push Subscription with id %s deleted successfully", subscriptionId)), error::set);
if(error.get() != null) { if(error.get() != null) {
...@@ -78,13 +78,13 @@ public class PushSubscription { ...@@ -78,13 +78,13 @@ public class PushSubscription {
logger.error("Deleting Push Subscription failed with error: " + error.get().toString()); logger.error("Deleting Push Subscription failed with error: " + error.get().toString());
throw new AppException(500, "Server Error", "Unexpected error deleting Push subscription"); throw new AppException(500, "Server Error", "Unexpected error deleting Push subscription");
} }
}*/ }
} }
public void checkIfPushSubscriptionExists(String subscriptionId, String topicName) { public void checkIfPushSubscriptionExists(String subscriptionId, String topicName) {
String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName); String scope = String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/topics/%s", azureBootstrapConfig.getAzureSubscriptionId(), azureBootstrapConfig.getResourceGroupName(), topicName);
AtomicReference<Throwable> error = new AtomicReference<>(); AtomicReference<Throwable> error = new AtomicReference<>();
/*eventGridManager.eventSubscriptions().getAsync(scope, subscriptionId) eventGridManager.eventSubscriptions().getAsync(scope, subscriptionId)
.subscribe( .subscribe(
(Indexable indexable) -> {}, (Indexable indexable) -> {},
error::set, error::set,
...@@ -100,7 +100,7 @@ public class PushSubscription { ...@@ -100,7 +100,7 @@ public class PushSubscription {
logger.error("Fetching Push subscription failed with error: " + error.get().toString()); logger.error("Fetching Push subscription failed with error: " + error.get().toString());
throw new AppException(500, "Server Error", "Unexpected error while Fetching Push subscription"); throw new AppException(500, "Server Error", "Unexpected error while Fetching Push subscription");
} }
}*/ }
} }
} }
...@@ -35,7 +35,6 @@ import org.opengroup.osdu.register.subscriber.model.Subscription; ...@@ -35,7 +35,6 @@ import org.opengroup.osdu.register.subscriber.model.Subscription;
import org.opengroup.osdu.register.utils.Constants; import org.opengroup.osdu.register.utils.Constants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import sun.util.calendar.LocalGregorianCalendar;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -59,8 +58,8 @@ public class SubscriptionRepository implements ISubscriptionRepository { ...@@ -59,8 +58,8 @@ public class SubscriptionRepository implements ISubscriptionRepository {
@Autowired @Autowired
private JaxRsDpsLog logger; private JaxRsDpsLog logger;
/* @Autowired @Autowired
private CryptographyUtil cryptographyUtil;*/ private CryptographyUtil cryptographyUtil;
@Autowired @Autowired
private PushSubscription pushSubscription; private PushSubscription pushSubscription;
...@@ -96,10 +95,10 @@ public class SubscriptionRepository implements ISubscriptionRepository { ...@@ -96,10 +95,10 @@ public class SubscriptionRepository implements ISubscriptionRepository {
public Subscription create(Subscription input) { public Subscription create(Subscription input) {
SubscriptionDoc doc = new SubscriptionDoc(input, dpsHeaders.getPartitionId()); SubscriptionDoc doc = new SubscriptionDoc(input, dpsHeaders.getPartitionId());
/*String encryptedSecret = cryptographyUtil.encryptData(input.getSecret().toString()); String encryptedSecret = cryptographyUtil.encryptData(input.getSecret().toString());
doc.setSecretValue(encryptedSecret); doc.setSecretValue(encryptedSecret);
doc.setKeyName(cryptographyUtil.getKeyName()); doc.setKeyName(cryptographyUtil.getKeyName());
doc.setKeyVersion(cryptographyUtil.getKeyVersion());*/ doc.setKeyVersion(cryptographyUtil.getKeyVersion());
try { try {
cosmosStore.createItem(dpsHeaders.getPartitionId(), azureBootstrapConfig.getCosmosDBName(), cosmosContainerConfig.getSubscriptionContainerName(), doc); cosmosStore.createItem(dpsHeaders.getPartitionId(), azureBootstrapConfig.getCosmosDBName(), cosmosContainerConfig.getSubscriptionContainerName(), doc);
...@@ -288,7 +287,7 @@ public class SubscriptionRepository implements ISubscriptionRepository { ...@@ -288,7 +287,7 @@ public class SubscriptionRepository implements ISubscriptionRepository {
private boolean updateSecret(Subscription subscription, Secret secret) { private boolean updateSecret(Subscription subscription, Secret secret) {
SubscriptionDoc doc = new SubscriptionDoc(subscription, dpsHeaders.getPartitionId()); SubscriptionDoc doc = new SubscriptionDoc(subscription, dpsHeaders.getPartitionId());
doc.setSecretType(secret.getSecretType()); doc.setSecretType(secret.getSecretType());
//doc.setSecretValue(cryptographyUtil.encryptData(secret.toString())); doc.setSecretValue(cryptographyUtil.encryptData(secret.toString()));
cosmosStore.upsertItem(dpsHeaders.getPartitionId(), azureBootstrapConfig.getCosmosDBName(), cosmosContainerConfig.getSubscriptionContainerName(), doc); cosmosStore.upsertItem(dpsHeaders.getPartitionId(), azureBootstrapConfig.getCosmosDBName(), cosmosContainerConfig.getSubscriptionContainerName(), doc);
return true; return true;
...@@ -296,7 +295,7 @@ public class SubscriptionRepository implements ISubscriptionRepository { ...@@ -296,7 +295,7 @@ public class SubscriptionRepository implements ISubscriptionRepository {
private Subscription convertToSubscriptionClass(SubscriptionDoc doc) { private Subscription convertToSubscriptionClass(SubscriptionDoc doc) {
String secretValue = "dummy";//cryptographyUtil.decryptData(doc.getSecretValue()); String secretValue = cryptographyUtil.decryptData(doc.getSecretValue());
Secret secret; Secret secret;
if (doc.getSecretType().equals(Constants.GSASecret)) { if (doc.getSecretType().equals(Constants.GSASecret)) {
GsaSecret gsaSecret = new GsaSecret(); GsaSecret gsaSecret = new GsaSecret();
......
...@@ -13,21 +13,21 @@ import java.util.Base64; ...@@ -13,21 +13,21 @@ import java.util.Base64;
@Component @Component
public class CryptographyUtil { public class CryptographyUtil {
/*@Autowired @Autowired
private CryptographyClient cryptographyClient;*/ private CryptographyClient cryptographyClient;
@Autowired @Autowired
private AzureBootstrapConfig azureBootstrapConfig; private AzureBootstrapConfig azureBootstrapConfig;
public String encryptData(String plainText) { public String encryptData(String plainText) {
/*EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText.getBytes()); EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText.getBytes());
byte[] val = encryptResult.getCipherText();*/ byte[] val = encryptResult.getCipherText();
return "dummy";//Base64.getEncoder().encodeToString(val); return Base64.getEncoder().encodeToString(val);
} }
public String decryptData(String cipherText) { public String decryptData(String cipherText) {
//DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, Base64.getDecoder().decode(cipherText)); DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, Base64.getDecoder().decode(cipherText));
return "dummy";//new String(decryptResult.getPlainText(), StandardCharsets.UTF_8); return new String(decryptResult.getPlainText(), StandardCharsets.UTF_8);
} }
public String getKeyName() { public String getKeyName() {
......
...@@ -36,10 +36,8 @@ import rx.Completable; ...@@ -36,10 +36,8 @@ import rx.Completable;
import rx.Observable; import rx.Observable;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
...@@ -64,8 +62,8 @@ public class PushSubscriptionTest { ...@@ -64,8 +62,8 @@ public class PushSubscriptionTest {
private final Observable<EventSubscription> observableError500ExceptionGetSubscription = Observable.error(new Throwable(errorMessage)); private final Observable<EventSubscription> observableError500ExceptionGetSubscription = Observable.error(new Throwable(errorMessage));
private final Completable completable = Completable.complete(); private final Completable completable = Completable.complete();
/* @Mock @Mock
private EventGridManager eventGridManager;*/ private EventGridManager eventGridManager;
@Mock @Mock
private AzureBootstrapConfig azureBootstrapConfig; private AzureBootstrapConfig azureBootstrapConfig;
...@@ -94,7 +92,7 @@ public class PushSubscriptionTest { ...@@ -94,7 +92,7 @@ public class PushSubscriptionTest {
@InjectMocks @InjectMocks
private PushSubscription pushSubscription; private PushSubscription pushSubscription;
/* @BeforeEach @BeforeEach
public void init() { public void init() {
lenient().when(azureBootstrapConfig.getResourceGroupName()).thenReturn(resourceGroupName); lenient().when(azureBootstrapConfig.getResourceGroupName()).thenReturn(resourceGroupName);
lenient().when(azureBootstrapConfig.getAzureSubscriptionId()).thenReturn(subscriptionId); lenient().when(azureBootstrapConfig.getAzureSubscriptionId()).thenReturn(subscriptionId);
...@@ -245,5 +243,5 @@ public class PushSubscriptionTest { ...@@ -245,5 +243,5 @@ public class PushSubscriptionTest {
verify(azureBootstrapConfig, times(1)).getResourceGroupName(); verify(azureBootstrapConfig, times(1)).getResourceGroupName();
verify(azureBootstrapConfig, times(1)).getAzureSubscriptionId(); verify(azureBootstrapConfig, times(1)).getAzureSubscriptionId();
verify(eventGridManager, times(1)).eventSubscriptions(); verify(eventGridManager, times(1)).eventSubscriptions();
}*/ }
} }
/*
// Copyright © Microsoft Corporation // Copyright © Microsoft Corporation
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -561,4 +560,3 @@ public class SubscriptionRepositoryTest { ...@@ -561,4 +560,3 @@ public class SubscriptionRepositoryTest {
} }
} }
*/
/*
// Copyright © Microsoft Corporation // Copyright © Microsoft Corporation
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -98,4 +97,3 @@ public class CryptographyUtilTest { ...@@ -98,4 +97,3 @@ public class CryptographyUtilTest {
} }
} }
*/
...@@ -96,20 +96,16 @@ public class TestCreateSubscriberApi extends CreateSubscriberApiTest { ...@@ -96,20 +96,16 @@ public class TestCreateSubscriberApi extends CreateSubscriberApiTest {
List<Future<ClientResponse>> responses = executor.invokeAll(tasks); List<Future<ClientResponse>> responses = executor.invokeAll(tasks);
executor.shutdown(); executor.shutdown();
executor.awaitTermination(120, TimeUnit.SECONDS); executor.awaitTermination(300, TimeUnit.SECONDS);
int sucessResponseCount = 0; int sucessResponseCount = 0;
int non409ErrorResponseCount = 0;
for (Future<ClientResponse> future : responses) { for (Future<ClientResponse> future : responses) {
if (future.get().getStatus() == expectedOkResponseCode()) if (future.get().getStatus() == expectedOkResponseCode())
sucessResponseCount++; sucessResponseCount++;
else if (future.get().getStatus() != 409)
non409ErrorResponseCount++;
} }
deleteResource(); deleteResource();
assertTrue(error("Expected 1 successful response. Actual " + sucessResponseCount), sucessResponseCount <= 1); assertTrue(error("Expected 1 successful response. Actual " + sucessResponseCount), sucessResponseCount <= 1);
assertEquals(error("Unexpected error response returned"), 0, non409ErrorResponseCount);
} }
} }
...@@ -75,22 +75,15 @@ public class TestDeleteSubscriberApi extends DeleteSubscriberApiTest { ...@@ -75,22 +75,15 @@ public class TestDeleteSubscriberApi extends DeleteSubscriberApiTest {
List<Future<ClientResponse>> responses = executor.invokeAll(tasks); List<Future<ClientResponse>> responses = executor.invokeAll(tasks);
executor.shutdown(); executor.shutdown();
executor.awaitTermination(120, TimeUnit.SECONDS); executor.awaitTermination(300, TimeUnit.SECONDS);
List<Integer> errors = new ArrayList<>();
int sucessResponseCount = 0; int sucessResponseCount = 0;
int non404or409ErrorResponseCount = 0;
for (Future<ClientResponse> future : responses) { for (Future<ClientResponse> future : responses) {
if (future.get() == null) if (future.get() == null)
fail(String.format("Failed to get response in time for %s %s %s", descriptor.getHttpMethod(), descriptor.getPath(), descriptor.getArg())); fail(String.format("Failed to get response in time for %s %s %s", descriptor.getHttpMethod(), descriptor.getPath(), descriptor.getArg()));
if (future.get().getStatus() == expectedOkResponseCode()) if (future.get().getStatus() == expectedOkResponseCode())
sucessResponseCount++; sucessResponseCount++;
else if (future.get().getStatus() != 409 && future.get().getStatus() != 404) {
non404or409ErrorResponseCount++;
errors.add(future.get().getStatus());
}
} }
assertTrue(error("Expected 1 successful response. Actual " + sucessResponseCount), sucessResponseCount <= 1); assertTrue(error("Expected 1 successful response. Actual " + sucessResponseCount), sucessResponseCount <= 1);
assertEquals(error("Unexpected error response returned " + errors.toString()), 0, non404or409ErrorResponseCount);
} }
} }
...@@ -89,18 +89,14 @@ public class TestGetSubscriberByIdApi extends GetSubscriberByIdApiTest { ...@@ -89,18 +89,14 @@ public class TestGetSubscriberByIdApi extends GetSubscriberByIdApiTest {
List<Future<ClientResponse>> responses = executor.invokeAll(tasks); List<Future<ClientResponse>> responses = executor.invokeAll(tasks);
executor.shutdown(); executor.shutdown();
executor.awaitTermination(120, TimeUnit.SECONDS); executor.awaitTermination(300, TimeUnit.SECONDS);
int sucessResponseCount = 0; int sucessResponseCount = 0;
int errorResponseCount = 0;
for (Future<ClientResponse> future : responses) { for (Future<ClientResponse> future : responses) {
if (future.get().getStatus() == expectedOkResponseCode()) if (future.get().getStatus() == expectedOkResponseCode())
sucessResponseCount++; sucessResponseCount++;
else
errorResponseCount++;
} }
deleteResource(); deleteResource();
assertEquals(error("Expected all successful responses. Actual " + sucessResponseCount), 10, sucessResponseCount); assertEquals(error("Expected all successful responses. Actual " + sucessResponseCount), 10, sucessResponseCount);
assertEquals(error("Unexpected error response returned"), 0, errorResponseCount);
} }
} }
...@@ -41,7 +41,7 @@ public class Config { ...@@ -41,7 +41,7 @@ public class Config {
config.subscriptionId = System.getProperty("TEST_SUBSCRIPTION_ID", System.getenv("TEST_SUBSCRIPTION_ID")); config.subscriptionId = System.getProperty("TEST_SUBSCRIPTION_ID", System.getenv("TEST_SUBSCRIPTION_ID"));
config.subscriptionId = Base64.getEncoder().encodeToString(("records-changed"+ config.securePushUrl).getBytes()); config.subscriptionId = Base64.getEncoder().encodeToString(("records-changed"+ config.securePushUrl).getBytes());
config.PushUrl = config.HostUrl; config.PushUrl = config.HostUrl;
} else if (env.equalsIgnoreCase("DEV")) { } else if (env.equalsIgnoreCase("DEV") || env.equalsIgnoreCase("CLOUD")) {
String custom_push_url = System.getProperty("REGISTER_CUSTOM_PUSH_URL1", System.getenv("REGISTER_CUSTOM_PUSH_URL1")); String custom_push_url = System.getProperty("REGISTER_CUSTOM_PUSH_URL1", System.getenv("REGISTER_CUSTOM_PUSH_URL1"));
config.subscriptionId = getEnvironmentVariableOrDefaultValue("SUBSCRIPTION_ID", config.subscriptionId = getEnvironmentVariableOrDefaultValue("SUBSCRIPTION_ID",
......
...@@ -105,8 +105,8 @@ public abstract class TestUtils { ...@@ -105,8 +105,8 @@ public abstract class TestUtils {
throws Exception { throws Exception {
Client client = getClient(); Client client = getClient();
client.setConnectTimeout(120000); client.setConnectTimeout(300000);
client.setReadTimeout(120000); client.setReadTimeout(300000);
client.setFollowRedirects(false); client.setFollowRedirects(false);
String url = getApiPath(path + query); String url = getApiPath(path + query);
if (isHttp) { if (isHttp) {
......
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