summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-09-21 15:24:50 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-21 15:24:50 +0000
commit47b07012807ef3b3c6d39f8bb2afbe21e51dfffd (patch)
tree83f86b157f0811bb497550ae670dbf1a8791adbc /adapters
parentbe96dc7c39eed6142430d8c0486b1140a5c3a921 (diff)
parenta9696cdf3dd5da824eb23456b39e2897a15f03a8 (diff)
Merge "various bugfixes for casablanca"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java13
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java43
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql11
3 files changed, 65 insertions, 2 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 4ec5839cb6..3783a51689 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -38,6 +38,7 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
@@ -63,6 +64,18 @@ public class CatalogDbClientTest {
}
@Test
+ public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*");
+ Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ }
+
+ @Test
+ public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*");
+ Assert.assertNull(rainyDayHandlerStatus);
+ }
+
+ @Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
Assert.assertNotNull(cloudSite);
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
index f1269f412b..7c037e4885 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,6 +26,9 @@ import org.junit.runner.RunWith;
import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.beans.RequestProcessingData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
@@ -41,6 +44,8 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -90,6 +95,7 @@ public class RequestsDbClientTest {
assertThat(request, sameBeanAs(response).ignoring("operateAt").ignoring("finishedAt"));
}
+
private void verifyInfraActiveRequests(InfraActiveRequests infraActiveRequestsResponse) {
assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log"));
}
@@ -189,4 +195,37 @@ public class RequestsDbClientTest {
assertNull(requestsDbClient.getOneByServiceIdAndOperationId(UUID.randomUUID().toString(),operationStatus.getOperationId()));
}
+
+
+ @Test
+ public void getRequestProcessingDataBySoRequestIdTest(){
+ List<RequestProcessingData> requestProcessingDataList = requestsDbClient
+ .getRequestProcessingDataBySoRequestId("00032ab7-na18-42e5-965d-8ea592502018");
+ assertNotNull(requestProcessingDataList);
+ assertFalse(requestProcessingDataList.isEmpty());
+ assertEquals(2,requestProcessingDataList.size());
+ }
+
+ @Test
+ public void findOneByOperationalEnvIdAndServiceModelVersionIdTest(){
+ OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionId("1234","TEST1234");
+ assertNotNull(operationalEnvServiceModelStatus);
+ assertEquals("1234",operationalEnvServiceModelStatus.getOperationalEnvId());
+ assertEquals("TEST1234",operationalEnvServiceModelStatus.getServiceModelVersionId());
+ }
+
+ @Test
+ public void getAllByOperationalEnvIdAndRequestId(){
+ List<OperationalEnvServiceModelStatus> operationalEnvServiceModelStatuses =requestsDbClient.getAllByOperationalEnvIdAndRequestId("1234","00032ab7-3fb3-42e5-965d-8ea592502017");
+ assertNotNull(operationalEnvServiceModelStatuses);
+ assertFalse(operationalEnvServiceModelStatuses.isEmpty());
+ assertEquals(2,operationalEnvServiceModelStatuses.size());
+ }
+
+ @Test
+ public void getDistributionStatusByIdTest(){
+ OperationalEnvDistributionStatus operationalEnvDistributionStatus =requestsDbClient.getDistributionStatusById("111");
+ assertNotNull(operationalEnvDistributionStatus);
+ assertEquals("111",operationalEnvDistributionStatus.getDistributionId());
+ }
}
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index ae5f5e9124..fcfd1483da 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -36,3 +36,14 @@ VALUES
(1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest'),
(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'),
(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig');
+
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+VALUES
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+VALUES
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+
+INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`)
+VALUES
+('111', 'TEST', 'ERROR', '2018-09-12 19:29:24', '2018-09-12 19:29:25', '1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017'); \ No newline at end of file