aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2019-05-10 10:01:06 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-05-10 10:26:10 -0400
commitc22110ebcc4df14891b0f3af3739a5a3fb4d51ef (patch)
tree880260bbe5c59fe2065d50a59e8536d232a75cc4 /adapters/mso-catalog-db-adapter/src
parentb9bb7f60815cd1e07b81d72b34ea1dcb4fa8d8c9 (diff)
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) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java16
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml79
4 files changed, 50 insertions, 52 deletions
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 @@
<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
</encoder>
- </appender>
-
- <appender name="test"
- class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
-
- <logger name="com.att.ecomp.audit" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </logger>
-
- <logger name="org.flywaydb" level="DEBUG" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <logger name="ch.vorburger" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </root>
+ </appender>
+
+ <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
+
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
+
+ <logger name="org.flywaydb" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
</configuration> \ No newline at end of file