summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-24 10:42:15 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-24 16:10:26 -0500
commit20e1b6517b1c64a82cb52be8a2a2882c86b1318b (patch)
tree68acb7b130d6c479eaaa6ba91275b5b2b2897bb6 /asdc-controller/src/test
parent57af0e334073b329ca9f48b353ab4cc3bd2027a8 (diff)
Prevent race conditions on same distributionId.
- Code to include optimistic lock to prevent race conditions on same distributionId. Change-Id: Ibe110b32f2472d991a4a3e03e3d15d5e4deefd65 Issue-ID: SO-1566 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'asdc-controller/src/test')
-rw-r--r--asdc-controller/src/test/resources/data.sql26
-rw-r--r--asdc-controller/src/test/resources/schema.sql1
2 files changed, 14 insertions, 13 deletions
diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql
index 70737abf5a..7cd972ca63 100644
--- a/asdc-controller/src/test/resources/data.sql
+++ b/asdc-controller/src/test/resources/data.sql
@@ -24,19 +24,19 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_
--------START Request DB INSERTS --------
-insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS) values
-('watchdogTestStatusSuccess', 'SUCCESS'),
-('watchdogTestStatusFailure', 'FAILURE'),
-('watchdogTestStatusTimeout', 'TIMEOUT'),
-('watchdogTestStatusIncomplete', 'INCOMPLETE'),
-('watchdogTestStatusException', 'EXCEPTION'),
-('watchdogTestStatusNull', 'NULL'),
-('testStatusSuccessTosca', 'SUCCESS'),
-('testStatusFailureTosca', 'FAILURE'),
-('testStatusTimeoutTosca', 'TIMEOUT'),
-('testStatusIncompleteTosca', 'INCOMPLETE'),
-('testStatusExceptionTosca', 'EXCEPTION'),
-('testStatusNullTosca', 'NULL');
+insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS,LOCK_VERSION) values
+('watchdogTestStatusSuccess', 'SUCCESS',0),
+('watchdogTestStatusFailure', 'FAILURE',0),
+('watchdogTestStatusTimeout', 'TIMEOUT',0),
+('watchdogTestStatusIncomplete', 'INCOMPLETE',0),
+('watchdogTestStatusException', 'EXCEPTION',0),
+('watchdogTestStatusNull', 'NULL',0),
+('testStatusSuccessTosca', 'SUCCESS',0),
+('testStatusFailureTosca', 'FAILURE',0),
+('testStatusTimeoutTosca', 'TIMEOUT',0),
+('testStatusIncompleteTosca', 'INCOMPLETE',0),
+('testStatusExceptionTosca', 'EXCEPTION',0),
+('testStatusNullTosca', 'NULL',0);
--WatchdogDistrubutionTest
insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID, COMPONENT_NAME, COMPONENT_DISTRIBUTION_STATUS) values
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 010b36dcf1..43572c476d 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -990,6 +990,7 @@ CREATE TABLE `site_status` (
CREATE TABLE `watchdog_distributionid_status` (
`DISTRIBUTION_ID` varchar(45) NOT NULL,
`DISTRIBUTION_ID_STATUS` varchar(45) DEFAULT NULL,
+ `LOCK_VERSION` int NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`DISTRIBUTION_ID`)