aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-requests-db-adapter/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-19 09:56:15 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-20 16:01:40 -0400
commita9696cdf3dd5da824eb23456b39e2897a15f03a8 (patch)
tree88b631cb9fad84b4be4c53e5236c40f7fa589531 /adapters/mso-requests-db-adapter/src/test
parent7728df703f403ffc09e79b1bb85df412aa3cbd0d (diff)
various bugfixes for casablanca
fixed unit tests after addition of A&AI edge label added option for edgelabel between vnf inst group added belongs to in connecting a vnf to instance group - Adding test for getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAn dWorkStep method in the catalogdb client correct default RainyDay table search input updated custom resolver to include float and added comment to explain timestamp configuration added a custom resolver and updated snake yaml version Replacing bowman client with restTemplate.exchange | Add Accept and Content-Type to headers Removing the unused imports as well Implementing some review comments for hte tests being ignored Replacing bowman client with restTemplate.exchange |Fixing Junits Replacing bowman client with restTemplate.exchange | Making Data inserts to go specifically in requestDB Replacing bowman client with restTemplate.exchange | Adding Junits Replacing bowman client with restTemplate.exchange | Adding Junits Replacing bowman client with restTemplate.exchange | Adding Junits Replacing bowman client with restTemplate.exchange - Updated tosca parser version to 1.4.3 and upgraded vnfc test case with new csar to pass with latest parser code. added test case for when workflow has not called all flows fixed issue with rollback and retry in workflowaction Reverted homing changes and changes assign vnf to use the homing produced GeneralBuildingBlock. fixed unit test to build the correct format hashmap reverted extraction back to LinkedHashMap marshal sdnc output to an object removed unused variables and imports extract response code/message from embedded map add junits to parse SDNC assign response removed missed org.openecomp.mso imports from bpmn Change-Id: Ib2b6591a744ecb5b08c522494cdf1ad7dae18a08 Issue-ID: SO-1069 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-requests-db-adapter/src/test')
-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
2 files changed, 52 insertions, 2 deletions
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