summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb3
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb3
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb1
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java10
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java12
-rw-r--r--catalog-be/src/main/resources/config/configuration.yaml13
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java190
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java603
-rw-r--r--catalog-be/src/test/resources/config/catalog-be/configuration.yaml11
12 files changed, 351 insertions, 503 deletions
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
index 14d3bdff95..49ac86aaec 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
@@ -33,3 +33,6 @@ default['UEB']['PublicKey'] = "sSJc5qiBnKy2qrlc"
default['UEB']['SecretKey'] = "4ZRPzNJfEUK0sSNBvccd2m7X"
default['Pair_EnvName'] = ""
+
+#DmaapConsumer
+default['DMAAP']['active'] = false \ No newline at end of file
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
index 155ea24077..74d867d699 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb
@@ -61,7 +61,8 @@ template "catalog-be-config" do
:cassandra_usr => node['cassandra'][:cassandra_user],
:cassandra_truststore_password => node['cassandra'][:truststore_password],
:cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}",
- :dcae_be_vip => node['DCAE_BE_VIP']
+ :dcae_be_vip => node['DCAE_BE_VIP'],
+ :dmaap_active => node['DMAAP']['active']
})
end
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
index af1e5fadf7..c7710c503e 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
@@ -668,6 +668,7 @@ environmentContext:
- General_Non-Revenue
dmaapConsumerConfiguration:
+ active: <%= @dmaap_active %>
hosts: localhost:3905
consumerGroup: sdc
consumerId: mama
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java
index 9d428c812a..334b3f63d9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java
@@ -94,7 +94,6 @@ public class DistributionEngine implements IDistributionEngine {
@PostConstruct
private void init() {
-
LOGGER.trace("Enter init method of DistributionEngine");
DistributionEngineConfiguration distributionEngineConfiguration = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration();
@@ -131,7 +130,6 @@ public class DistributionEngine implements IDistributionEngine {
distributionEngineClusterHealth.startHealthCheckTask(envNamePerStatus);
LOGGER.trace("Exit init method of DistributionEngine");
-
}
@PreDestroy
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java
index b48ed78190..653c9c6510 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java
@@ -73,6 +73,10 @@ public class DmaapHealth {
@PostConstruct
public DmaapHealth init() {
+ if(!ConfigurationManager.getConfigurationManager().getConfiguration().getDmaapConsumerConfiguration().isActive()){
+ log.debug("Dmaap health check task disabled");
+ return this;
+ }
log.trace("Enter init method of Dmaap health");
synchronized (DmaapHealth.class){
this.configuration = ConfigurationManager.getConfigurationManager().getConfiguration().getDmaapConsumerConfiguration();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java
index 7eb00ba988..9a875e5d48 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java
@@ -51,7 +51,7 @@ public class EnvironmentsEngine implements INotificationHandler {
private static final Logger log = Logger.getLogger(EnvironmentsEngine.class.getName());
private ConfigurationManager configurationManager = ConfigurationManager.getConfigurationManager();
- private Map<String, OperationalEnvironmentEntry> environments;
+ private Map<String, OperationalEnvironmentEntry> environments = new HashMap<>();
private Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>();
private Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>();
private Map<String, DistributionEngineInitTask> envNamePerInitTask = new HashMap<>();
@@ -79,13 +79,17 @@ public class EnvironmentsEngine implements INotificationHandler {
@VisibleForTesting
@PostConstruct
void init() {
- log.trace("Environments engine has been initialized. ");
try {
environments = populateEnvironments();
createUebTopicsForEnvironments();
initDmeGlobalConfig();
+ if(!configurationManager.getConfiguration().getDmaapConsumerConfiguration().isActive()){
+ log.info("Environments engine is disabled");
+ return;
+ }
dmaapConsumer.consumeDmaapTopic(this::handleMessage,
- (t, e) -> log.error("An error occurred upon consuming topic by Dmaap consumer client: ", e));
+ (t, e) -> log.error("An error occurred upon consuming topic by Dmaap consumer client: ", e));
+ log.info("Environments engine has been initialized.");
} catch (Exception e) {
log.error("An error occurred upon consuming topic by Dmaap consumer client.", e);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
index be534f326a..c0a89d6954 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java
@@ -126,6 +126,7 @@ public class HealthCheckBusinessLogic {
//Dmaap
getDmaapHealthCheck(healthCheckInfos);
+
// BE
getBeHealthCheck(healthCheckInfos);
@@ -182,9 +183,14 @@ public class HealthCheckBusinessLogic {
}
private List<HealthCheckInfo> getDmaapHealthCheck(List<HealthCheckInfo> healthCheckInfos) {
- String appVersion = getAppVersion();
- dmaapHealth.getHealthCheckInfo().setVersion(appVersion);
- healthCheckInfos.add(dmaapHealth.getHealthCheckInfo());
+ if(ConfigurationManager.getConfigurationManager().getConfiguration().getDmaapConsumerConfiguration().isActive()){
+ String appVersion = getAppVersion();
+ dmaapHealth.getHealthCheckInfo().setVersion(appVersion);
+ healthCheckInfos.add(dmaapHealth.getHealthCheckInfo());
+ } else {
+ log.debug("Dmaap health check disabled");
+ }
+
return healthCheckInfos;
}
diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml
index 36cb54c788..3c5565ee36 100644
--- a/catalog-be/src/main/resources/config/configuration.yaml
+++ b/catalog-be/src/main/resources/config/configuration.yaml
@@ -7,7 +7,7 @@ identificationHeaderFields:
# catalog backend hostname
beFqdn: localhost
-# sdccatalog.att.com
+# sdccatalog.com
# catalog backend http port
beHttpPort: 8080
@@ -670,17 +670,18 @@ environmentContext:
- General_Non-Revenue
dmaapConsumerConfiguration:
- hosts: olsd004.wnsnet.attws.com:3905
+ active: true
+ hosts: olsd004.wnsnet.ws.com:3905
consumerGroup: asdc
consumerId: mama #mama - in Order To Consume Remove This String And Replace It With -> mama
timeoutMs: 15000
limit: 1
pollingInterval: 2
- topic: com.att.sdc.23911-SDCforTestDev-v001
+ topic: com.sdc.23911-SDCforTestDev-v001
latitude: 32.109333
longitude: 34.855499
version: 1.0
- serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+ serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.com/events
environment: TEST
partner: BOT_R
routeOffer: MR1
@@ -694,8 +695,8 @@ dmaapConsumerConfiguration:
dme2preferredRouterFilePath: DME2preferredRouter.txt
timeLimitForNotificationHandleMs: 120000
credential:
- username: m09875@sdc.att.com
- password: hmXYcznAljMSisdy8zgcag==
+ username: m09875@sdc.com
+ password: mockhmXYcznAljMSisdy8zgcag==
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
index 8090649613..1ef72856a4 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
+++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
@@ -1,7 +1,5 @@
{
"heat": [
- "configuration",
- "fabricConfiguration",
"Generic_PNF"
],
"normative": [
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java
deleted file mode 100644
index f1ec0d8da6..0000000000
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.openecomp.sdc.be.components.distribution.engine;
-
-import fj.data.Either;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
-import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao;
-import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
-import org.openecomp.sdc.be.info.OperationalEnvInfo;
-import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
-import org.openecomp.sdc.common.http.client.api.HttpResponse;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-@RunWith(value = MockitoJUnitRunner.class)
-public class EnvironmentsEngineMockTest {
-
- @InjectMocks
- private EnvironmentsEngine envEngine;
- @Mock
- private DmaapConsumer dmaapConsumer;
- @Mock
- private OperationalEnvironmentDao operationalEnvironmentDao;
- @Mock
- private DME2EndpointIteratorCreator epIterCreator;
- @Mock
- private ConfigurationManager configurationManager;
- @Mock
- private DistributionEngineConfiguration distributionEngineConfiguration;
- @Mock
- private AaiRequestHandler aaiRequestHandler;
-
- @Before
- public void preStart() {
- when(configurationManager.getDistributionEngineConfiguration()).thenReturn(distributionEngineConfiguration);
- envEngine.setConfigurationManager(configurationManager);
- }
-
- @Test
- public void testInit() {
- List<OperationalEnvironmentEntry> entryList = Arrays.asList(createOpEnvEntry("Env1"), createOpEnvEntry("Env2"));
- Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> successEither = Either.left(entryList);
- when(operationalEnvironmentDao.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED)).thenReturn(successEither);
-
- when(distributionEngineConfiguration.getEnvironments()).thenReturn(Arrays.asList("Env Loaded From Configuration"));
- when(distributionEngineConfiguration.getUebPublicKey()).thenReturn("Dummy Public Key");
- when(distributionEngineConfiguration.getUebSecretKey()).thenReturn("Dummy Private Key");
- when(distributionEngineConfiguration.getUebServers()).thenReturn(
- Arrays.asList("uebsb91kcdc.it.att.com:3904", "uebsb92kcdc.it.att.com:3904", "uebsb91kcdc.it.att.com:3904"));
-
- envEngine.init();
-
- Map<String, OperationalEnvironmentEntry> mapEnvs = envEngine.getEnvironments();
- assertEquals("unexpected size of map",3, mapEnvs.size());
- }
-
-
- @Test
- public void testGetFullOperationalEnvByIdSuccess() {
- String json = getFullOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isLeft());
-
- OperationalEnvInfo operationalEnvInfo = response.left().value();
-
- assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
- }
-
- @Test
- public void testGetPartialOperationalEnvByIdSuccess() {
- String json = getPartialOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isLeft());
-
- OperationalEnvInfo operationalEnvInfo = response.left().value();
-
- assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
- }
-
-
- @Test
- public void testGetOperationalEnvByIdFailedByJsonConvert() {
- String jsonCorrupted = getCorruptedOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(jsonCorrupted, HttpStatus.SC_OK, "Successfully Completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isRight());
- assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_INTERNAL_SERVER_ERROR, response.right().value());
- }
-
- @Test
- public void testGetOperationalEnvByIdFailed404() {
- String json = getFullOperationalEnvJson();
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_NOT_FOUND, "Not Found");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isRight());
- assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_NOT_FOUND, response.right().value());
- }
-
-
- @Test(expected = IOException.class)
- public void testCorruptedOperationalEnvJson() throws IOException {
- String jsonCorrupted = getCorruptedOperationalEnvJson();
- OperationalEnvInfo.createFromJson(jsonCorrupted);
- }
-
- private String getCorruptedOperationalEnvJson() {
- return "{\"OPERATIONAL-environment-name\":\"Op Env Name\","
- + "\"OPERATIONAL-environment-type\":\"VNF\","
- + "\"OPERATIONAL-environment-status\":\"Activate\","
- + "\"tenant-context\":\"Test\"}";
- }
-
- private String getPartialOperationalEnvJson() {
- return "{" +
- "\"operational-environment-id\":\"UUID of Operational Environment\"," +
- "\"operational-environment-name\":\"Op Env Name\"," +
- "\"operational-environment-type\":\"VNF\"," +
- "\"operational-environment-status\":\"Activate\"," +
- "\"tenant-context\":\"Test\"," +
- "\"workload-context\":\"VNF_Development\"," +
- "\"resource-version\":\"1505228226913\"," +
- "\"relationship-list\":{" +
- "\"relationship\":[]" +
- "}" +
- "}";
- }
-
- private String getFullOperationalEnvJson() {
- return "{" +
- "\"operational-environment-id\":\"OEid1\"," +
- "\"operational-environment-name\":\"OEname1\"," +
- "\"operational-environment-type\":\"OEtype1\"," +
- "\"operational-environment-status\":\"OEstatus1\"," +
- "\"tenant-context\":\"OEtenantcontext1\"," +
- "\"workload-context\":\"OEworkloadcontext1\"," +
- "\"resource-version\":\"1511363173278\"," +
- "\"relationship-list\":{" +
- "\"relationship\":[" +
- "{" +
- "\"related-to\":\"operational-environment\"," +
- "\"relationship-label\":\"managedBy\"," +
- "\"related-link\":\"/aai/v12/cloud-infrastructure/operational-environments/operational-environment/OEid3\"," +
- "\"relationship-data\":[" +
- "{" +
- "\"relationship-key\":\"operational-environment.operational-environment-id\"," +
- "\"relationship-value\":\"OEid3\"" +
- "}" +
- "]," +
- "\"related-to-property\":[" +
- "{" +
- "\"property-key\":\"operational-environment.operational-environment-name\"," +
- "\"property-value\":\"OEname3\"" +
- "}]}]}}";
- }
-
- private OperationalEnvironmentEntry createOpEnvEntry(String name) {
- OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
- entry.setEnvironmentId(name);
- return entry;
- }
-
-}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
index bec17b5d08..1050d9a321 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
@@ -3,310 +3,331 @@ package org.openecomp.sdc.be.components.distribution.engine;
import com.att.nsa.apiClient.credentials.ApiCredential;
import fj.data.Either;
import mockit.Deencapsulation;
+import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.be.components.BeConfDependentTest;
-import org.openecomp.sdc.be.components.distribution.engine.IDmaapNotificationData.DmaapActionEnum;
-import org.openecomp.sdc.be.components.distribution.engine.IDmaapNotificationData.OperationaEnvironmentTypeEnum;
+import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
+import org.openecomp.sdc.be.config.DmaapConsumerConfiguration;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao;
import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
-import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.info.OperationalEnvInfo;
import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.common.http.client.api.HttpResponse;
-import org.springframework.test.util.ReflectionTestUtils;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.io.IOException;
+import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
-public class EnvironmentsEngineTest extends BeConfDependentTest {
-
- @InjectMocks
- EnvironmentsEngine testSubject;
-
- @Mock
- ComponentsUtils componentUtils;
-
- @Mock
- OperationalEnvironmentDao operationalEnvironmentDao;
-
- @Mock
- CambriaHandler cambriaHandler;
-
- @Mock
- AaiRequestHandler aaiRequestHandler;
-
- @Before
- public void setUpMocks() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testInit() throws Exception {
-
- // default test
- Deencapsulation.invoke(testSubject, "init");
- }
-
- @Test
- public void testConnectUebTopicTenantIsolation() throws Exception {
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
- opEnvEntry.setEnvironmentId("mock");
- AtomicBoolean status = null;
- Map<String, DistributionEngineInitTask> envNamePerInitTask = new HashMap<>();
- Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>();
-
- // default test
- testSubject.connectUebTopicTenantIsolation(opEnvEntry, status, envNamePerInitTask, envNamePerPollingTask);
- }
-
- @Test
- public void testConnectUebTopic() throws Exception {
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
- AtomicBoolean status = new AtomicBoolean(true);
- Map<String, DistributionEngineInitTask> envNamePerInitTask = new HashMap<>();
- Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>();
-
- // default test
- Deencapsulation.invoke(testSubject, "connectUebTopic", opEnvEntry, status, envNamePerInitTask,
- envNamePerPollingTask);
- }
-
- @Test
- public void testHandleMessage() throws Exception {
- String notification = "";
- boolean result;
-
- // default test
- result = testSubject.handleMessage(notification);
- }
-
- @Test
- public void testHandleMessageLogic() throws Exception {
- String notification = "";
- boolean result;
-
- // default test
- result = testSubject.handleMessageLogic(notification);
- }
-
- @Test
- public void testValidateNotification() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- errorWrapper.setInnerElement(true);
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
- IDmaapAuditNotificationData auditNotificationData = Mockito.mock(IDmaapAuditNotificationData.class);
-
- // default test
- Deencapsulation.invoke(testSubject, "validateNotification", errorWrapper, notificationData,
- auditNotificationData);
- }
-
- @Test
- public void testSaveEntryWithFailedStatus() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
-
- // default test
- Deencapsulation.invoke(testSubject, "saveEntryWithFailedStatus", errorWrapper, opEnvEntry);
- }
-
- @Test
- public void testRetrieveUebAddressesFromAftDme() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
-
- // default test
- Deencapsulation.invoke(testSubject, "retrieveUebAddressesFromAftDme", errorWrapper, opEnvEntry);
- }
-
- @Test
- public void testCreateUebKeys() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
-
- Set<String> dmaapUebAddress = new HashSet<>();
- dmaapUebAddress.add("mock");
- opEnvEntry.setDmaapUebAddress(dmaapUebAddress);
-
- Mockito.when(cambriaHandler.createUebKeys(Mockito.any())).thenReturn(Either.left(new ApiCredential("mock", "mock")));
-
- // default test
- Deencapsulation.invoke(testSubject, "createUebKeys", errorWrapper, opEnvEntry);
- }
-
- @Test
- public void testCreateUebKeysError() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
-
- Set<String> dmaapUebAddress = new HashSet<>();
- dmaapUebAddress.add("mock");
- opEnvEntry.setDmaapUebAddress(dmaapUebAddress);
-
- Mockito.when(cambriaHandler.createUebKeys(Mockito.any())).thenReturn(Either.right(new CambriaErrorResponse()));
-
- // default test
- Deencapsulation.invoke(testSubject, "createUebKeys", errorWrapper, opEnvEntry);
- }
-
- @Test
- public void testRetrieveOpEnvInfoFromAAI() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
- opEnvEntry.setEnvironmentId("mock");
- Mockito.when(aaiRequestHandler.getOperationalEnvById(Mockito.nullable(String.class))).thenReturn(new HttpResponse<String>("{}", 200));
- // default test
- Deencapsulation.invoke(testSubject, "retrieveOpEnvInfoFromAAI", new Wrapper<>(), opEnvEntry);
- }
-
- @Test
- public void testRetrieveOpEnvInfoFromAAIError() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
- opEnvEntry.setEnvironmentId("mock");
- Mockito.when(aaiRequestHandler.getOperationalEnvById(Mockito.nullable(String.class))).thenReturn(new HttpResponse<String>("{}", 500));
- // default test
- Deencapsulation.invoke(testSubject, "retrieveOpEnvInfoFromAAI", new Wrapper<>(), opEnvEntry);
- }
-
- @Test
- public void testSaveEntryWithInProgressStatus() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- Wrapper<OperationalEnvironmentEntry> opEnvEntryWrapper = new Wrapper<>();
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
-
- Deencapsulation.invoke(testSubject, "saveEntryWithInProgressStatus", errorWrapper, opEnvEntryWrapper,
- notificationData);
- }
-
- @Test
- public void testValidateStateGeneralError() throws Exception {
- Wrapper<Boolean> errorWrapper = null;
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
-
- Mockito.when(operationalEnvironmentDao.get(Mockito.nullable(String.class)))
- .thenReturn(Either.right(CassandraOperationStatus.GENERAL_ERROR));
-
- Deencapsulation.invoke(testSubject, "validateState", new Wrapper<>(), notificationData);
- }
-
- @Test
- public void testValidateState() throws Exception {
- Wrapper<Boolean> errorWrapper = null;
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
-
- OperationalEnvironmentEntry a = new OperationalEnvironmentEntry();
- a.setStatus(EnvironmentStatusEnum.IN_PROGRESS.getName());
- Mockito.when(operationalEnvironmentDao.get(Mockito.nullable(String.class))).thenReturn(Either.left(a));
-
- Deencapsulation.invoke(testSubject, "validateState", new Wrapper<>(), notificationData);
- }
-
- @Test
- public void testValidateActionType() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
- Mockito.when(notificationData.getAction()).thenReturn(DmaapActionEnum.DELETE);
-
- Deencapsulation.invoke(testSubject, "validateActionType", errorWrapper, notificationData);
- }
-
- @Test
- public void testValidateActionType2() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
- Mockito.when(notificationData.getAction()).thenReturn(DmaapActionEnum.CREATE);
-
- Deencapsulation.invoke(testSubject, "validateActionType", errorWrapper, notificationData);
- }
-
- @Test
- public void testValidateEnvironmentType() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
- IDmaapAuditNotificationData auditNotificationData = Mockito.mock(IDmaapAuditNotificationData.class);
- Mockito.when(auditNotificationData.getOperationalEnvironmentName()).thenReturn("mock");
- Mockito.when(notificationData.getOperationalEnvironmentType()).thenReturn(OperationaEnvironmentTypeEnum.ECOMP);
-
- // default test
- Deencapsulation.invoke(testSubject, "validateEnvironmentType", errorWrapper, notificationData,
- auditNotificationData);
- }
-
- @Test
- public void testValidateEnvironmentType1() throws Exception {
- Wrapper<Boolean> errorWrapper = new Wrapper<>();
- IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
- IDmaapAuditNotificationData auditNotificationData = Mockito.mock(IDmaapAuditNotificationData.class);
- Mockito.when(auditNotificationData.getOperationalEnvironmentName()).thenReturn("mock");
- Mockito.when(notificationData.getOperationalEnvironmentType()).thenReturn(OperationaEnvironmentTypeEnum.UNKONW);
- Mockito.when(notificationData.getAction()).thenReturn(DmaapActionEnum.CREATE);
-
- Deencapsulation.invoke(testSubject, "validateEnvironmentType", errorWrapper, notificationData,
- auditNotificationData);
- }
-
- @Test
- public void testMap2OpEnvKey() throws Exception {
- OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
- String result;
-
- // default test
- result = Deencapsulation.invoke(testSubject, "map2OpEnvKey", entry);
- }
-
- @Test
- public void testReadEnvFromConfig() throws Exception {
- OperationalEnvironmentEntry result;
-
- // default test
- result = Deencapsulation.invoke(testSubject, "readEnvFromConfig");
- }
-
- @Test
- public void testCreateUebTopicsForEnvironment() throws Exception {
- OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
-
- // default test
- testSubject.createUebTopicsForEnvironment(opEnvEntry);
- }
-
- @Test
- public void testSetConfigurationManager() throws Exception {
- ConfigurationManager configurationManager = null;
-
- // default test
- Deencapsulation.invoke(testSubject, "setConfigurationManager", new Object[] { ConfigurationManager.class });
- }
-
- @Test
- public void testGetEnvironments() throws Exception {
- Map<String, OperationalEnvironmentEntry> result;
-
- // default test
- result = testSubject.getEnvironments();
- }
-
- @Test
- public void testIsInMap() throws Exception {
- OperationalEnvironmentEntry env = new OperationalEnvironmentEntry();
- env.setEnvironmentId("mock");
- Map<String, OperationalEnvironmentEntry> mockEnvironments = new HashMap<>();
- mockEnvironments.put("mock", new OperationalEnvironmentEntry());
- boolean result;
-
- // default test
- ReflectionTestUtils.setField(testSubject, "environments", mockEnvironments);
- result = testSubject.isInMap(env);
- }
-} \ No newline at end of file
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+public class EnvironmentsEngineTest {
+
+ @InjectMocks
+ private EnvironmentsEngine envEngine;
+ @Mock
+ private OperationalEnvironmentDao operationalEnvironmentDao;
+ @Mock
+ private ConfigurationManager configurationManager;
+ @Mock
+ private DistributionEngineConfiguration distributionEngineConfiguration;
+ @Mock
+ private AaiRequestHandler aaiRequestHandler;
+
+ @Before
+ public void preStart() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testInit() {
+ envEngine.setConfigurationManager(configurationManager);
+ Configuration config = Mockito.mock(Configuration.class);
+ DmaapConsumerConfiguration dmaapConf = Mockito.mock(DmaapConsumerConfiguration.class);
+ List<OperationalEnvironmentEntry> entryList = Arrays.asList(createOpEnvEntry("Env1"), createOpEnvEntry("Env2"));
+ Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> successEither = Either.left(entryList);
+ when(operationalEnvironmentDao.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED)).thenReturn(successEither);
+ when(configurationManager.getDistributionEngineConfiguration()).thenReturn(distributionEngineConfiguration);
+ when(distributionEngineConfiguration.getEnvironments()).thenReturn(Arrays.asList("Env Loaded From Configuration"));
+ when(distributionEngineConfiguration.getUebPublicKey()).thenReturn("Dummy Public Key");
+ when(distributionEngineConfiguration.getUebSecretKey()).thenReturn("Dummy Private Key");
+ when(distributionEngineConfiguration.getUebServers()).thenReturn(
+ Arrays.asList("uebsb91kcdc.it.com:3904", "uebsb92kcdc.it.com:3904", "uebsb91kcdc.it.com:3904"));
+ when(configurationManager.getConfiguration()).thenReturn(config);
+ when(config.getDmaapConsumerConfiguration()).thenReturn(dmaapConf);
+ when(dmaapConf.isActive()).thenReturn(false);
+ envEngine.init();
+
+ Map<String, OperationalEnvironmentEntry> mapEnvs = envEngine.getEnvironments();
+ assertEquals("unexpected size of map",3, mapEnvs.size());
+ }
+
+
+ @Test
+ public void testGetFullOperationalEnvByIdSuccess() {
+ String json = getFullOperationalEnvJson();
+
+ HttpResponse restResponse = new HttpResponse(json, HttpStatus.SC_OK, "Successfully completed");
+ when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
+
+ Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
+ assertTrue("The operational environment request ran as not expected", response.isLeft());
+
+ OperationalEnvInfo operationalEnvInfo = response.left().value();
+
+ assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
+ }
+
+ @Test
+ public void testGetPartialOperationalEnvByIdSuccess() {
+ String json = getPartialOperationalEnvJson();
+
+ HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed");
+ when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
+
+ Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
+ assertTrue("The operational environment request ran as not expected", response.isLeft());
+
+ OperationalEnvInfo operationalEnvInfo = response.left().value();
+
+ assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
+ }
+
+
+ @Test
+ public void testGetOperationalEnvByIdFailedByJsonConvert() {
+ String jsonCorrupted = getCorruptedOperationalEnvJson();
+
+ HttpResponse<String> restResponse = new HttpResponse<String>(jsonCorrupted, HttpStatus.SC_OK, "Successfully Completed");
+ when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
+
+ Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
+ assertTrue("The operational environment request ran as not expected", response.isRight());
+ assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_INTERNAL_SERVER_ERROR, response.right().value());
+ }
+
+ @Test
+ public void testGetOperationalEnvByIdFailed404() {
+ String json = getFullOperationalEnvJson();
+ HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_NOT_FOUND, "Not Found");
+ when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
+
+ Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
+ assertTrue("The operational environment request ran as not expected", response.isRight());
+ assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_NOT_FOUND, response.right().value());
+ }
+
+
+ @Test(expected = IOException.class)
+ public void testCorruptedOperationalEnvJson() throws IOException {
+ String jsonCorrupted = getCorruptedOperationalEnvJson();
+ OperationalEnvInfo.createFromJson(jsonCorrupted);
+ }
+
+ @Test
+ public void getEnvironmentById() {
+ OperationalEnvironmentEntry oe = new OperationalEnvironmentEntry();
+ oe.setEnvironmentId("mock");
+ envEngine.addToMap(oe);
+ assertTrue(envEngine.isInMap("mock"));
+ assertTrue(envEngine.isInMap(oe));
+ OperationalEnvironmentEntry returnedOe = envEngine.getEnvironmentById("mock");
+ assertTrue(oe == returnedOe);
+ }
+
+ private String getCorruptedOperationalEnvJson() {
+ return "{\"OPERATIONAL-environment-name\":\"Op Env Name\","
+ + "\"OPERATIONAL-environment-type\":\"VNF\","
+ + "\"OPERATIONAL-environment-status\":\"Activate\","
+ + "\"tenant-context\":\"Test\"}";
+ }
+
+ private String getPartialOperationalEnvJson() {
+ return "{" +
+ "\"operational-environment-id\":\"UUID of Operational Environment\"," +
+ "\"operational-environment-name\":\"Op Env Name\"," +
+ "\"operational-environment-type\":\"VNF\"," +
+ "\"operational-environment-status\":\"Activate\"," +
+ "\"tenant-context\":\"Test\"," +
+ "\"workload-context\":\"VNF_Development\"," +
+ "\"resource-version\":\"1505228226913\"," +
+ "\"relationship-list\":{" +
+ "\"relationship\":[]" +
+ "}" +
+ "}";
+ }
+
+ private String getFullOperationalEnvJson() {
+ return "{" +
+ "\"operational-environment-id\":\"OEid1\"," +
+ "\"operational-environment-name\":\"OEname1\"," +
+ "\"operational-environment-type\":\"OEtype1\"," +
+ "\"operational-environment-status\":\"OEstatus1\"," +
+ "\"tenant-context\":\"OEtenantcontext1\"," +
+ "\"workload-context\":\"OEworkloadcontext1\"," +
+ "\"resource-version\":\"1511363173278\"," +
+ "\"relationship-list\":{" +
+ "\"relationship\":[" +
+ "{" +
+ "\"related-to\":\"operational-environment\"," +
+ "\"relationship-label\":\"managedBy\"," +
+ "\"related-link\":\"/aai/v12/cloud-infrastructure/operational-environments/operational-environment/OEid3\"," +
+ "\"relationship-data\":[" +
+ "{" +
+ "\"relationship-key\":\"operational-environment.operational-environment-id\"," +
+ "\"relationship-value\":\"OEid3\"" +
+ "}" +
+ "]," +
+ "\"related-to-property\":[" +
+ "{" +
+ "\"property-key\":\"operational-environment.operational-environment-name\"," +
+ "\"property-value\":\"OEname3\"" +
+ "}]}]}}";
+ }
+
+ private OperationalEnvironmentEntry createOpEnvEntry(String name) {
+ OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
+ entry.setEnvironmentId(name);
+ return entry;
+ }
+
+ public void testHandleMessageLogic() throws Exception {
+ String notification = "";
+ boolean result;
+
+ // default test
+ result = envEngine.handleMessageLogic(notification);
+ }
+
+ @Test
+ public void testValidateNotification() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ errorWrapper.setInnerElement(true);
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+ IDmaapAuditNotificationData auditNotificationData = Mockito.mock(IDmaapAuditNotificationData.class);
+
+ // default test
+ Deencapsulation.invoke(envEngine, "validateNotification", errorWrapper, notificationData,
+ auditNotificationData);
+ }
+
+ @Test
+ public void testSaveEntryWithFailedStatus() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ // default test
+ Deencapsulation.invoke(envEngine, "saveEntryWithFailedStatus", errorWrapper, opEnvEntry);
+ }
+
+ @Test
+ public void testRetrieveUebAddressesFromAftDme() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ // default test
+ Deencapsulation.invoke(envEngine, "retrieveUebAddressesFromAftDme", errorWrapper, opEnvEntry);
+ }
+
+ @Test
+ public void testRetrieveOpEnvInfoFromAAI() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+ opEnvEntry.setEnvironmentId("mock");
+ Mockito.when(aaiRequestHandler.getOperationalEnvById(Mockito.nullable(String.class))).thenReturn(new HttpResponse<String>("{}", 200));
+ // default test
+ Deencapsulation.invoke(envEngine, "retrieveOpEnvInfoFromAAI", new Wrapper<>(), opEnvEntry);
+ }
+
+ @Test
+ public void testRetrieveOpEnvInfoFromAAIError() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+ opEnvEntry.setEnvironmentId("mock");
+ Mockito.when(aaiRequestHandler.getOperationalEnvById(Mockito.nullable(String.class))).thenReturn(new HttpResponse<String>("{}", 500));
+ // default test
+ Deencapsulation.invoke(envEngine, "retrieveOpEnvInfoFromAAI", new Wrapper<>(), opEnvEntry);
+ }
+
+ @Test
+ public void testSaveEntryWithInProgressStatus() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ Wrapper<OperationalEnvironmentEntry> opEnvEntryWrapper = new Wrapper<>();
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+
+ Deencapsulation.invoke(envEngine, "saveEntryWithInProgressStatus", errorWrapper, opEnvEntryWrapper,
+ notificationData);
+ }
+
+ @Test
+ public void testValidateStateGeneralError() throws Exception {
+ Wrapper<Boolean> errorWrapper = null;
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+
+ Mockito.when(operationalEnvironmentDao.get(Mockito.nullable(String.class)))
+ .thenReturn(Either.right(CassandraOperationStatus.GENERAL_ERROR));
+
+ Deencapsulation.invoke(envEngine, "validateState", new Wrapper<>(), notificationData);
+ }
+
+ @Test
+ public void testValidateState() throws Exception {
+ Wrapper<Boolean> errorWrapper = null;
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+
+ OperationalEnvironmentEntry a = new OperationalEnvironmentEntry();
+ a.setStatus(EnvironmentStatusEnum.IN_PROGRESS.getName());
+ Mockito.when(operationalEnvironmentDao.get(Mockito.nullable(String.class))).thenReturn(Either.left(a));
+
+ Deencapsulation.invoke(envEngine, "validateState", new Wrapper<>(), notificationData);
+ }
+
+ @Test
+ public void testValidateActionType() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+ Mockito.when(notificationData.getAction()).thenReturn(IDmaapNotificationData.DmaapActionEnum.DELETE);
+
+ Deencapsulation.invoke(envEngine, "validateActionType", errorWrapper, notificationData);
+ }
+
+ @Test
+ public void testValidateActionType2() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+ Mockito.when(notificationData.getAction()).thenReturn(IDmaapNotificationData.DmaapActionEnum.CREATE);
+
+ Deencapsulation.invoke(envEngine, "validateActionType", errorWrapper, notificationData);
+ }
+
+ @Test
+ public void testValidateEnvironmentType() throws Exception {
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ IDmaapNotificationData notificationData = Mockito.mock(IDmaapNotificationData.class);
+ IDmaapAuditNotificationData auditNotificationData = Mockito.mock(IDmaapAuditNotificationData.class);
+ Mockito.when(auditNotificationData.getOperationalEnvironmentName()).thenReturn("mock");
+ Mockito.when(notificationData.getOperationalEnvironmentType()).thenReturn(IDmaapNotificationData.OperationaEnvironmentTypeEnum.ECOMP);
+
+ // default test
+ Deencapsulation.invoke(envEngine, "validateEnvironmentType", errorWrapper, notificationData,
+ auditNotificationData);
+ }
+
+ @Test
+ public void testMap2OpEnvKey() throws Exception {
+ OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
+ String result;
+
+ // default test
+ result = Deencapsulation.invoke(envEngine, "map2OpEnvKey", entry);
+ }
+}
diff --git a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/configuration.yaml
index b54e072291..6211a77042 100644
--- a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml
+++ b/catalog-be/src/test/resources/config/catalog-be/configuration.yaml
@@ -7,7 +7,7 @@ identificationHeaderFields:
# catalog backend hostname
beFqdn: localhost
-# sdccatalog.att.com
+# sdccatalog.com
# catalog backend http port
beHttpPort: 8080
@@ -645,17 +645,18 @@ environmentContext:
- General_Non-Revenue
dmaapConsumerConfiguration:
- hosts: olsd004.wnsnet.attws.com:3905
+ active: true
+ hosts: olsd004.wnsnet.com:3905
consumerGroup: asdc
consumerId: invalidMamaUser #mama - in Order To Consume Remove This String And Replace It With -> mama
timeoutMs: 15000
limit: 1
pollingInterval: 2
- topic: com.att.sdc.23911-SDCforTestDev-v001
+ topic: com.sdc.23911-SDCforTestDev-v001
latitude: 32.109333
longitude: 34.855499
version: 1.0
- serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+ serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.com/events
environment: TEST
partner: BOT_R
routeOffer: MR1
@@ -669,7 +670,7 @@ dmaapConsumerConfiguration:
dme2preferredRouterFilePath: DME2preferredRouter.txt
timeLimitForNotificationHandleMs: 0
credential:
- username: m09875@sdc.att.com
+ username: m09875@sdc.com
password: hmXYcznAljMSisdy8zgcag==
dmeConfiguration: