From c22110ebcc4df14891b0f3af3739a5a3fb4d51ef Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Fri, 10 May 2019 10:01:06 -0400 Subject: Update Rainy day handling to be more robust Clean up unused tests and code, update UT Fix issue with junits and conflicts on id field Update Rainy day handling to be more robust Change-Id: I2ce9a1288457017613dece19357e44b8566867c5 Issue-ID: SO-1866 Signed-off-by: Benjamin, Max (mb388a) --- .../V5.7.2__Add_Error_Message_Rainy_Day.sql | 2 + .../so/db/catalog/client/CatalogDbClientTest.java | 16 ++--- .../test/resources/db/migration/afterMigrate.sql | 5 +- .../src/test/resources/logback-test.xml | 79 +++++++++++----------- 4 files changed, 50 insertions(+), 52 deletions(-) create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql (limited to 'adapters/mso-catalog-db-adapter') diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql new file mode 100644 index 0000000000..cf54d55fde --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql @@ -0,0 +1,2 @@ +use catalogdb; +ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS REG_EX_ERROR_MESSAGE varchar(300) DEFAULT NULL; \ No newline at end of file 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 4127d07c5f..31cb1248d6 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 @@ -79,20 +79,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { client.wiremockPort = String.valueOf(port); } - @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); + public void testGetRainyDayHandler_Regex() { + RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*", + "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found."); + Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy()); } @Test diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 0229dd0d85..0e981f2b70 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -183,7 +183,10 @@ VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459', 'toscaNodeType', 'testVnfcCustomizationDescription', '2018-07-17 14:05:08'); - + +INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`) +VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.'); + INSERT INTO `cvnfc_customization` (`id`, `model_customization_uuid`, diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml index 463be2e527..97a4503190 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml @@ -1,45 +1,46 @@ - - - + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit 1.2.3-korg