summaryrefslogtreecommitdiffstats
path: root/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service
diff options
context:
space:
mode:
Diffstat (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service')
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql19
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/resources/application.yaml7
3 files changed, 15 insertions, 14 deletions
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
index 85a732b83e..7f50c791f6 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
@@ -1,7 +1,7 @@
use nfvo;
CREATE TABLE IF NOT EXISTS `JOB` (
- `JOB_ID` varchar(255) NOT NULL,
+ `JOB_ID` varchar(255) PRIMARY KEY NOT NULL,
`JOB_TYPE` varchar(255) NOT NULL,
`JOB_ACTION` varchar(255) NOT NULL,
`RESOURCE_ID` varchar(255) NOT NULL,
@@ -10,26 +10,24 @@ CREATE TABLE IF NOT EXISTS `JOB` (
`START_TIME` DATETIME DEFAULT NULL,
`END_TIME` DATETIME DEFAULT NULL,
`PROGRESS` int(11) DEFAULT NULL,
- `PROCESS_INSTANCE_ID` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`JOB_ID`)
+ `PROCESS_INSTANCE_ID` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `JOB_STATUS` (
- `ID` INT NOT NULL AUTO_INCREMENT,
+ `ID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`UPDATED_TIME` DATETIME NOT NULL,
`DESCRIPTION` longtext DEFAULT NULL,
`STATUS` varchar(255) NOT NULL,
`JOB_ID` varchar(255) NOT NULL,
- PRIMARY KEY (`ID`),
FOREIGN KEY (JOB_ID)
REFERENCES JOB(JOB_ID)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `NS_INST` (
- `NS_INST_ID` varchar(255) NOT NULL,
+ `NS_INST_ID` varchar(255) PRIMARY KEY NOT NULL,
`NAME` varchar(255) NOT NULL,
`NS_PACKAGE_ID` varchar(255) DEFAULT NULL,
`NSD_ID` varchar(255) NOT NULL,
@@ -38,12 +36,11 @@ CREATE TABLE IF NOT EXISTS `NS_INST` (
`STATUS` varchar(255) NOT NULL,
`STATUS_UPDATED_TIME` DATETIME NOT NULL,
`GLOBAL_CUSTOMER_ID` varchar(255) DEFAULT NULL,
- `SERVICE_TYPE` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`NS_INST_ID`)
+ `SERVICE_TYPE` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `NF_INST` (
- `NF_INST_ID` varchar(255) NOT NULL,
+ `NF_INST_ID` varchar(255) PRIMARY KEY NOT NULL,
`NAME` varchar(255) DEFAULT NULL,
`VNFD_ID` varchar(255) DEFAULT NULL,
`PACKAGE_ID` varchar(255) DEFAULT NULL,
@@ -51,14 +48,13 @@ CREATE TABLE IF NOT EXISTS `NF_INST` (
`STATUS` varchar(255) NOT NULL,
`CREATE_TIME` DATETIME DEFAULT NULL,
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL,
- PRIMARY KEY (`NF_INST_ID`),
FOREIGN KEY (NS_INST_ID)
REFERENCES NS_INST(NS_INST_ID)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `NS_LCM_OP_OCCS` (
- `ID` varchar(255) NOT NULL,
+ `ID` varchar(255) PRIMARY KEY NOT NULL,
`OPERATION_STATE` varchar(255) NOT NULL,
`STATE_ENTERED_TIME` DATETIME DEFAULT NULL,
`START_TIME` DATETIME DEFAULT NULL,
@@ -68,7 +64,6 @@ CREATE TABLE IF NOT EXISTS `NS_LCM_OP_OCCS` (
`OPERATION_PARAMS` longtext NOT NULL,
`IS_CANCEL_PENDING` varchar(255) NOT NULL,
`CANCEL_MODE` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`ID`),
FOREIGN KEY (NS_INST_ID)
REFERENCES NS_INST(NS_INST_ID)
ON UPDATE CASCADE ON DELETE CASCADE
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
index fcf7f9c373..b9858a8dd5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -55,7 +56,7 @@ public class DatabaseServiceProviderTest {
private static final String RANDOM_ID = UUID.randomUUID().toString();
private static final String DUMMY_NAME = "NAME";
- private static final LocalDateTime CURRENT_DATE_TIME = LocalDateTime.now();
+ private static final LocalDateTime CURRENT_DATE_TIME = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
@Autowired
private DatabaseServiceProvider databaseServiceProvider;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/resources/application.yaml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/resources/application.yaml
index adc36aca1d..478a5b5ac7 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/resources/application.yaml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/resources/application.yaml
@@ -17,14 +17,19 @@ spring:
datasource:
hikari:
nfvo:
- jdbcUrl: jdbc:h2:mem:nfvo;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS nfvo;
+ jdbcUrl: jdbc:h2:mem:nfvo;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS nfvo;MODE=MYSQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
driver-class-name: org.h2.Driver
pool-name: ns-lcm-bpmn-pool
registerMbeans: true
+ test:
+ database:
+ replace: NONE
jpa:
generate-ddl: true
+ dialect: org.hibernate.dialect.MySQL5Dialect
hibernate:
ddl-auto: create
+ database-platform: org.hibernate.dialect.MariaDBDialect
hibernate:
dialect: org.hibernate.dialect.H2Dialect
hbm2ddl: