summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-requests-db')
-rw-r--r--mso-api-handlers/mso-requests-db/hibernate.properties4
-rw-r--r--mso-api-handlers/mso-requests-db/hibernate.reveng.xml20
-rw-r--r--mso-api-handlers/mso-requests-db/pom.xml206
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java91
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java93
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java)262
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java239
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java79
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java177
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java190
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java)106
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java)135
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java91
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java105
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java40
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java140
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java)69
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java111
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java)57
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java41
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java57
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java566
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java42
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java59
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java)24
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java33
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java)142
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java)131
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java)2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java72
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java228
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java196
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java121
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java243
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java888
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java47
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java72
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java194
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java71
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java197
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml161
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml47
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml56
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml54
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml44
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml37
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml46
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml46
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml38
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/beans.xml12
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml44
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java (renamed from mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestDatabaseTest.java)39
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java82
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java80
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java77
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java86
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java71
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java129
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java61
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDbTest.java112
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java249
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDbTest.java120
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java271
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java287
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java58
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java44
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDbTest.java127
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java177
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDbTest.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java150
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDbTest.java86
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml40
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml46
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/schema.sql212
82 files changed, 3750 insertions, 5738 deletions
diff --git a/mso-api-handlers/mso-requests-db/hibernate.properties b/mso-api-handlers/mso-requests-db/hibernate.properties
index c7803eab12..cf56960f4b 100644
--- a/mso-api-handlers/mso-requests-db/hibernate.properties
+++ b/mso-api-handlers/mso-requests-db/hibernate.properties
@@ -1,2 +1,2 @@
-hibernate.show_sql=true
-hibernate.format_sql=true
+hibernate.show_sql=true
+hibernate.format_sql=true
diff --git a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml b/mso-api-handlers/mso-requests-db/hibernate.reveng.xml
index dfbf9ed4c4..cb1e8c6669 100644
--- a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml
+++ b/mso-api-handlers/mso-requests-db/hibernate.reveng.xml
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >
-
-<hibernate-reverse-engineering>
-
- <schema-selection match-schema="MSO"/>
- <type-mapping>
- <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />
- </type-mapping>
- <table-filter match-schema="MSO" match-name=".*"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >
+
+<hibernate-reverse-engineering>
+
+ <schema-selection match-schema="MSO"/>
+ <type-mapping>
+ <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />
+ </type-mapping>
+ <table-filter match-schema="MSO" match-name=".*"/>
</hibernate-reverse-engineering> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml
index fb463fbef8..006058e98d 100644
--- a/mso-api-handlers/mso-requests-db/pom.xml
+++ b/mso-api-handlers/mso-requests-db/pom.xml
@@ -2,10 +2,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
+ <parent>
<groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
</parent>
<artifactId>mso-requests-db</artifactId>
@@ -16,191 +16,89 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
-
<dependencies>
<dependency>
+ <groupId>uk.co.blackpepper.bowman</groupId>
+ <artifactId>bowman-client</artifactId>
+ <version>0.3.0</version>
+ </dependency>
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>4.3.6.Final</version>
- <exclusions>
- <!-- Avoid hibernate inclusion as provided in Jboss -->
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jandex</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.spec.javax.transaction</groupId>
- <artifactId>jboss-transaction-api_1.2_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- </exclusions>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>4.3.6.Final</version>
- <exclusions>
- <!-- Avoid hibernate inclusion as provided in Jboss -->
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jandex</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.spec.javax.transaction</groupId>
- <artifactId>jboss-transaction-api_1.2_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- </exclusions>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ <optional>true</optional>
</dependency>
-
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-rest</artifactId>
+ </dependency>
</dependencies>
<packaging>jar</packaging>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
- <plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate4-maven-plugin</artifactId>
- <version>1.1.0</version>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
<executions>
- <!-- MySQL -->
<execution>
- <id>MySQL</id>
+ <phase>package</phase>
<goals>
- <goal>export</goal>
+ <goal>jar</goal>
</goals>
<configuration>
- <hibernateDialect>org.hibernate.dialect.MySQL5Dialect</hibernateDialect>
- <hibernateMapping>
- ${project.basedir}/src/main/resources/InfraActiveRequests.hbm.xml,
- ${project.basedir}/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml,
- ${project.basedir}/src/main/resources/OperationalEnvDistributionStatus.hbm.xml,
- ${project.basedir}/src/main/resources/OperationStatus.hbm.xml,
- ${project.basedir}/src/main/resources/SiteStatus.hbm.xml,
- ${project.basedir}/src/main/resources/ResourceOperationStatus.hbm.xml,
- ${project.basedir}/src/main/resources/WatchdogDistributionStatus.hbm.xml,
- ${project.basedir}/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml,
- ${project.basedir}/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml
- </hibernateMapping>
- <target>SCRIPT</target>
- <skip>false</skip>
- <force>true</force>
- <outputFile>${project.build.directory}/MySQL-Requests-schema.sql</outputFile>
+ <classifier>beans</classifier>
+ <includes>
+ <include>**/beans/**</include>
+ </includes>
</configuration>
</execution>
</executions>
</plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>3.0.1</version>
- <executions>
-
- <execution>
- <id>copy-sql-file</id>
- <phase>install</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <overwrite>true</overwrite>
-
- <outputDirectory>${project.basedir}/../../packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas</outputDirectory>
-
- <resources>
- <resource>
- <directory>${project.build.directory}</directory>
- <filtering>false</filtering>
- <includes>
- <include>*.sql</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>de.juplo</groupId>
- <artifactId>
- hibernate4-maven-plugin
- </artifactId>
- <versionRange>
- [1.0.3,)
- </versionRange>
- <goals>
- <goal>export</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
-</project>
+</project> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java
new file mode 100644
index 0000000000..b66e027a35
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.util.Objects;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "archived_infra_requests")
+public class ArchivedInfraRequests extends InfraRequests {
+
+ private static final long serialVersionUID = 7132783898142451603L;
+
+ public ArchivedInfraRequests() {
+ }
+
+ public ArchivedInfraRequests(String requestId, String action) {
+ setRequestId(requestId);
+ setAction(action);
+ }
+
+ public ArchivedInfraRequests(String requestId) {
+ setRequestId(requestId);
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ArchivedInfraRequests)) {
+ return false;
+ }
+ ArchivedInfraRequests castOther = (ArchivedInfraRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
new file mode 100644
index 0000000000..84ff458698
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.util.Objects;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * InfraActiveRequests generated by hbm2java
+ */
+@Entity
+@Table(name = "infra_active_requests")
+public class InfraActiveRequests extends InfraRequests {
+
+ private static final long serialVersionUID = -6818265918910035170L;
+
+ public InfraActiveRequests() {
+ }
+
+ public InfraActiveRequests(String requestId, String action) {
+ setRequestId(requestId);
+ setAction(action);
+ }
+
+ public InfraActiveRequests(String requestId) {
+ setRequestId(requestId);
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof InfraActiveRequests)) {
+ return false;
+ }
+ InfraActiveRequests castOther = (InfraActiveRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index d2db8fb35b..48a6cf3ff0 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -18,83 +18,135 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
-
-// Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1
+package org.onap.so.db.request.beans;
+import java.net.URI;
import java.sql.Timestamp;
-
+import java.util.Date;
+import java.util.Objects;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.openecomp.mso.requestsdb.adapter.TimestampXMLAdapter;
-
-/**
- * InfraActiveRequests generated by hbm2java
- */
-public class InfraRequests implements java.io.Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -661307666798018192L;
-
- private String requestId = null;
- private String clientRequestId = null;
- private String action = null;
- private String requestStatus = null;
- private String statusMessage = null;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.onap.so.requestsdb.adapter.TimestampXMLAdapter;
+
+import uk.co.blackpepper.bowman.annotation.ResourceId;
+
+@MappedSuperclass
+public abstract class InfraRequests implements java.io.Serializable {
+
+ private static final long serialVersionUID = -5497583682393936143L;
+ private static final String UNKNOWN = "unknown";
+
+
+ @Id
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Column(name = "CLIENT_REQUEST_ID", length=45, unique=true)
+ private String clientRequestId;
+ @Column(name = "ACTION", length=45)
+ private String action;
+ @Column(name = "REQUEST_STATUS", length=20)
+ private String requestStatus;
+ @Column(name = "STATUS_MESSAGE", length=2000)
+ private String statusMessage;
+ @Column(name = "PROGRESS", precision=11)
private Long progress;
- private Timestamp startTime = null;
- private Timestamp endTime = null;
- private String source = null;
- private String vnfId = null;
- private String vnfName = null;
- private String vnfType = null;
- private String serviceType = null;
- private String aicNodeClli = null;
- private String tenantId = null;
- private String provStatus = null;
- private String vnfParams = null;
- private String vnfOutputs = null;
- private String requestBody = null;
- private String responseBody = null;
- private String lastModifiedBy = null;
- private Timestamp modifyTime = null;
- private String requestType = null;
- private String volumeGroupId = null;
- private String volumeGroupName = null;
- private String vfModuleId = null;
- private String vfModuleName = null;
- private String vfModuleModelName = null;
- private String aaiServiceId = null;
- private String aicCloudRegion = null;
- private String callBackUrl = null;
- private String correlator = null;
- private String serviceInstanceId = null;
- private String serviceInstanceName = null;
- private String requestScope = null;
- private String requestAction = null;
- private String networkId = null;
- private String networkName = null;
- private String networkType = null;
- private String requestorId = null;
- private String configurationId = null;
- private String configurationName = null;
- private String operationalEnvId = null;
- private String operationalEnvName = null;
-
- public InfraRequests() {
- }
-
- public InfraRequests(String requestId, String action) {
- this.requestId = requestId;
- this.action = action;
+
+ @Column(name = "START_TIME")
+ private Timestamp startTime;
+ @Column(name = "END_TIME")
+ private Timestamp endTime;
+ @Column(name = "SOURCE", length=45)
+ private String source;
+ @Column(name = "VNF_ID", length=45)
+ private String vnfId;
+ @Column(name = "VNF_NAME", length=80)
+ private String vnfName;
+ @Column(name = "VNF_TYPE", length=200)
+ private String vnfType;
+ @Column(name = "SERVICE_TYPE", length=45)
+ private String serviceType;
+ @Column(name = "AIC_NODE_CLLI", length=11)
+ private String aicNodeClli;
+ @Column(name = "TENANT_ID", length=45)
+ private String tenantId;
+ @Column(name = "PROV_STATUS", length=20)
+ private String provStatus;
+ @Column(name = "VNF_PARAMS")
+ private String vnfParams;
+ @Column(name = "VNF_OUTPUTS")
+ private String vnfOutputs;
+ @Column(name = "REQUEST_BODY")
+ private String requestBody;
+ @Column(name = "RESPONSE_BODY")
+ private String responseBody;
+ @Column(name = "LAST_MODIFIED_BY", length=50)
+ private String lastModifiedBy;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+ @Column(name = "REQUEST_TYPE", length=20)
+ private String requestType;
+ @Column(name = "VOLUME_GROUP_ID", length=45)
+ private String volumeGroupId;
+ @Column(name = "VOLUME_GROUP_NAME", length=45)
+ private String volumeGroupName;
+ @Column(name = "VF_MODULE_ID", length=45)
+ private String vfModuleId;
+ @Column(name = "VF_MODULE_NAME", length=200)
+ private String vfModuleName;
+ @Column(name = "VF_MODULE_MODEL_NAME", length=200)
+ private String vfModuleModelName;
+ @Column(name = "AAI_SERVICE_ID", length=50)
+ private String aaiServiceId;
+ @Column(name = "AIC_CLOUD_REGION", length=11)
+ private String aicCloudRegion;
+ @Column(name = "CALLBACK_URL", length=200)
+ private String callBackUrl;
+ @Column(name = "CORRELATOR", length=80)
+ private String correlator;
+ @Column(name = "SERVICE_INSTANCE_ID", length=45)
+ private String serviceInstanceId;
+ @Column(name = "SERVICE_INSTANCE_NAME", length=80)
+ private String serviceInstanceName;
+ @Column(name = "REQUEST_SCOPE", length=45)
+ private String requestScope;
+ @Column(name = "REQUEST_ACTION", length=45)
+ private String requestAction;
+ @Column(name = "NETWORK_ID", length=45)
+ private String networkId;
+ @Column(name = "NETWORK_NAME", length=80)
+ private String networkName;
+ @Column(name = "NETWORK_TYPE", length=80)
+ private String networkType;
+ @Column(name = "REQUESTOR_ID", length=80)
+ private String requestorId;
+ @Column(name = "CONFIGURATION_ID", length=45)
+ private String configurationId;
+ @Column(name = "CONFIGURATION_NAME", length=200)
+ private String configurationName;
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Column(name = "OPERATIONAL_ENV_NAME", length=200)
+ private String operationalEnvName;
+
+ @ResourceId
+ public URI getRequestURI() {
+ return URI.create(this.requestId);
}
public String getRequestId() {
return this.requestId;
}
-
+
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@@ -261,15 +313,10 @@ public class InfraRequests implements java.io.Serializable {
this.lastModifiedBy = lastModifiedBy;
}
- @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
- public Timestamp getModifyTime() {
+ public Date getModifyTime() {
return this.modifyTime;
}
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
+
public String getRequestType() {
return this.requestType;
}
@@ -445,4 +492,65 @@ public class InfraRequests implements java.io.Serializable {
public void setOperationalEnvName(String operationalEnvName) {
this.operationalEnvName = operationalEnvName;
}
+
+ @PrePersist
+ protected void onCreate() {
+ if(requestScope==null)
+ requestScope=UNKNOWN;
+ if(requestAction==null)
+ requestAction=UNKNOWN;
+ this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ if(requestScope==null)
+ requestScope=UNKNOWN;
+ if(requestAction==null)
+ requestAction=UNKNOWN;
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof InfraRequests)) {
+ return false;
+ }
+ InfraRequests castOther = (InfraRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java
new file mode 100644
index 0000000000..dff9dd6687
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * The service operation status
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+
+@IdClass(OperationStatusId.class)
+@Entity
+@Table(name = "operation_status")
+public class OperationStatus implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "SERVICE_ID")
+ private String serviceId;
+ @Id
+ @Column(name = "OPERATION_ID", length=256)
+ private String operationId;
+
+ @Column(name = "SERVICE_NAME", length=256)
+ private String serviceName;
+
+ @Column(name = "OPERATION_TYPE", length=256)
+ private String operation;
+
+ @Column(name = "USER_ID", length=256)
+ private String userId;
+
+ @Column(name = "RESULT", length=256)
+ private String result;
+
+ @Column(name = "OPERATION_CONTENT", length=256)
+ private String operationContent;
+
+ @Column(name = "PROGRESS", length=256)
+ private String progress = "0";
+
+ @Column(name = "REASON", length=256)
+ private String reason;
+
+ @Column(name = "OPERATE_AT", length=256, updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date operateAt;
+
+ @Column(name = "FINISHED_AT", length=256)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date finishedAt;
+
+ public OperationStatus() {
+
+ }
+
+ public OperationStatus(String serviceId, String operationId) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ }
+
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+
+ public String getOperation() {
+ return operation;
+ }
+
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+
+ public String getResult() {
+ return result;
+ }
+
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+
+ public String getProgress() {
+ return progress;
+ }
+
+
+ public void setProgress(String progress) {
+ this.progress = progress;
+ }
+
+
+ public String getReason() {
+ return reason;
+ }
+
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+
+ public Date getOperateAt() {
+ return operateAt;
+ }
+
+ public Date getFinishedAt() {
+ return finishedAt;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.finishedAt = this.operateAt = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.finishedAt = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationStatus)) {
+ return false;
+ }
+ OperationStatus castOther = (OperationStatus) other;
+ return Objects.equals(getServiceId(), castOther.getServiceId())
+ && Objects.equals(getOperationId(), castOther.getOperationId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getServiceId(), getOperationId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("operation", getOperation()).append("userId", getUserId()).append("result", getResult())
+ .append("operationContent", getOperationContent()).append("progress", getProgress())
+ .append("reason", getReason()).append("operateAt", getOperateAt()).append("finishedAt", getFinishedAt())
+ .toString();
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java
new file mode 100644
index 0000000000..d07788e55c
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class OperationStatusId implements Serializable {
+
+ private static final long serialVersionUID = 3114959241155882723L;
+
+ @BusinessKey
+ private String serviceId;
+ @BusinessKey
+ private String operationId;
+
+ public OperationStatusId() {
+
+ }
+ public OperationStatusId(String serviceId, String operationId) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public String getOperationId() {
+ return operationId;
+ }
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationStatusId)) {
+ return false;
+ }
+ OperationStatusId castOther = (OperationStatusId) other;
+ return Objects.equals(this.getServiceId(), castOther.getServiceId())
+ && Objects.equals(this.getOperationId(), castOther.getOperationId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getServiceId(), this.getOperationId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java
new file mode 100644
index 0000000000..a1e1278306
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+@Entity
+@Table(name = "activate_operational_env_per_distributionid_status")
+public class OperationalEnvDistributionStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 7398393659281364650L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Column(name = "DISTRIBUTION_ID_STATUS", length=45)
+ private String distributionIdStatus;
+ @Column(name = "DISTRIBUTION_ID_ERROR_REASON", length=250)
+ private String distributionIdErrorReason;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+
+ public OperationalEnvDistributionStatus() {
+
+ }
+
+ public OperationalEnvDistributionStatus(String distributionId, String operationalEnvId, String serviceModelVersionId) {
+ this.distributionId = distributionId;
+ this.operationalEnvId = operationalEnvId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getOperationalEnvId() {
+ return operationalEnvId;
+ }
+
+ public void setOperationalEnvId(String operationalEnvId) {
+ this.operationalEnvId = operationalEnvId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getDistributionIdStatus() {
+ return distributionIdStatus;
+ }
+
+ public void setDistributionIdStatus(String distributionIdStatus) {
+ this.distributionIdStatus = distributionIdStatus;
+ }
+
+ public String getDistributionIdErrorReason() {
+ return distributionIdErrorReason;
+ }
+
+ public void setDistributionIdErrorReason(String distributionIdErrorReason) {
+ this.distributionIdErrorReason = distributionIdErrorReason;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvDistributionStatus)) {
+ return false;
+ }
+ OperationalEnvDistributionStatus castOther = (OperationalEnvDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).append("requestId", getRequestId())
+ .append("distributionIdStatus", getDistributionIdStatus())
+ .append("distributionIdErrorReason", getDistributionIdErrorReason())
+ .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
new file mode 100644
index 0000000000..588822cce0
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
@@ -0,0 +1,190 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * @author PB6115
+ *
+ */
+@IdClass(OperationalEnvServiceModelStatusId.class)
+@Entity
+@Table(name = "activate_operational_env_service_model_distribution_status")
+public class OperationalEnvServiceModelStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 8197084996598869656L;
+
+ @Id
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Id
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Id
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "SERVICE_MOD_VER_FINAL_DISTR_STATUS", length=45)
+ private String serviceModelVersionDistrStatus;
+ @Column(name = "RECOVERY_ACTION", length=30)
+ private String recoveryAction;
+ @Column(name = "RETRY_COUNT_LEFT")
+ private Integer retryCount;
+ @Column(name = "WORKLOAD_CONTEXT", length=80)
+ private String workloadContext;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public OperationalEnvServiceModelStatus() {
+
+ }
+
+ public OperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId) {
+ this.requestId = requestId;
+ this.operationalEnvId = operationalEnvId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getOperationalEnvId() {
+ return operationalEnvId;
+ }
+
+ public void setOperationalEnvId(String operationalEnvId) {
+ this.operationalEnvId = operationalEnvId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getServiceModelVersionDistrStatus() {
+ return serviceModelVersionDistrStatus;
+ }
+
+ public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
+ this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
+ }
+
+ public String getRecoveryAction() {
+ return recoveryAction;
+ }
+
+ public void setRecoveryAction(String recoveryAction) {
+ this.recoveryAction = recoveryAction;
+ }
+
+ public Integer getRetryCount() {
+ return retryCount;
+ }
+
+ public void setRetryCount(Integer retryCount) {
+ this.retryCount = retryCount;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvServiceModelStatus)) {
+ return false;
+ }
+ OperationalEnvServiceModelStatus castOther = (OperationalEnvServiceModelStatus) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId())
+ && Objects.equals(getOperationalEnvId(), castOther.getOperationalEnvId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId(), getOperationalEnvId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId())
+ .append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
+ .append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
+ .append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
+ .append("modifyTime", getModifyTime()).toString();
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java
index c5df122816..301e24f8ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.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.
@@ -18,89 +18,65 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class OperationalEnvDistributionStatus implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 7398393659281364650L;
+public class OperationalEnvServiceModelStatusId implements Serializable {
- private String distributionId = null;
- private String operationalEnvId = null;
- private String serviceModelVersionId = null;
- private String requestId = null;
- private String distributionIdStatus = null;
- private String distributionIdErrorReason = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
+ private static final long serialVersionUID = 6885534735320068787L;
- public String getDistributionId() {
- return distributionId;
- }
+ @BusinessKey
+ private String requestId;
+ @BusinessKey
+ private String operationalEnvId;
+ @BusinessKey
+ private String serviceModelVersionId;
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
}
-
public String getOperationalEnvId() {
return operationalEnvId;
}
-
public void setOperationalEnvId(String operationalEnvId) {
this.operationalEnvId = operationalEnvId;
}
-
public String getServiceModelVersionId() {
return serviceModelVersionId;
}
-
public void setServiceModelVersionId(String serviceModelVersionId) {
this.serviceModelVersionId = serviceModelVersionId;
}
-
- public String getRequestId() {
- return requestId;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvServiceModelStatusId)) {
+ return false;
+ }
+ OperationalEnvServiceModelStatusId castOther = (OperationalEnvServiceModelStatusId) other;
+ return Objects.equals(this.getRequestId(), castOther.getRequestId())
+ && Objects.equals(this.getOperationalEnvId(), castOther.getOperationalEnvId())
+ && Objects.equals(this.getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getRequestId(), this.getOperationalEnvId(), this.getServiceModelVersionId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).toString();
}
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getDistributionIdStatus() {
- return distributionIdStatus;
- }
-
- public void setDistributionIdStatus(String distributionIdStatus) {
- this.distributionIdStatus = distributionIdStatus;
- }
-
- public String getDistributionIdErrorReason() {
- return distributionIdErrorReason;
- }
-
- public void setDistributionIdErrorReason(String distributionIdErrorReason) {
- this.distributionIdErrorReason = distributionIdErrorReason;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java
index 07650ac417..386daa6dbb 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java
@@ -17,10 +17,19 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+
+package org.onap.so.db.request.beans;
import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
/**
* The Resource operation status
* <br>
@@ -30,6 +39,10 @@ import java.io.Serializable;
* @author
* @version ONAP Amsterdam Release 2017-08-28
*/
+
+@IdClass(ResourceOperationStatusId.class)
+@Entity
+@Table(name = "resource_operation_status")
public class ResourceOperationStatus implements Serializable{
/**
@@ -37,25 +50,36 @@ public class ResourceOperationStatus implements Serializable{
*/
private static final long serialVersionUID = 1L;
- private String serviceId = null;
-
- private String operationId = null;
-
- private String resourceTemplateUUID = null;
-
- private String operType = null;
-
- private String resourceInstanceID = null;
-
- private String jobId = null;
-
- private String status = null;
-
+ @Id
+ @Column(name = "SERVICE_ID")
+ private String serviceId;
+ @Id
+ @Column(name = "OPERATION_ID", length=256)
+ private String operationId;
+ @Id
+ @Column(name = "RESOURCE_TEMPLATE_UUID")
+ private String resourceTemplateUUID;
+
+ @Column(name = "OPER_TYPE", length=256)
+ private String operType;
+
+ @Column(name = "RESOURCE_INSTANCE_ID", length=256)
+ private String resourceInstanceID;
+
+ @Column(name = "JOB_ID", length=256)
+ private String jobId;
+
+ @Column(name = "STATUS", length=256)
+ private String status;
+
+ @Column(name = "PROGRESS", length=256)
private String progress = "0";
- private String errorCode = null;
+ @Column(name = "ERROR_CODE", length=256)
+ private String errorCode;
- private String statusDescription = null;
+ @Column(name = "STATUS_DESCRIPOTION", length=256)
+ private String statusDescription;
public ResourceOperationStatus(){
@@ -169,54 +193,31 @@ public class ResourceOperationStatus implements Serializable{
this.operType = operType;
}
- /**
- * <br>
- *
- * @return
- * @since ONAP Amsterdam Release
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());
- result = prime * result + ((resourceTemplateUUID == null) ? 0 : resourceTemplateUUID.hashCode());
- result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
- return result;
- }
-
- /**
- * <br>
- *
- * @param obj
- * @return
- * @since ONAP Amsterdam Release
- */
- @Override
- public boolean equals(Object obj) {
- if(this == obj)
- return true;
- if(obj == null)
- return false;
- if(getClass() != obj.getClass())
- return false;
- ResourceOperationStatus other = (ResourceOperationStatus)obj;
- if(operationId == null) {
- if(other.operationId != null)
- return false;
- } else if(!operationId.equals(other.operationId))
- return false;
- if(resourceTemplateUUID == null) {
- if(other.resourceTemplateUUID != null)
- return false;
- } else if(!resourceTemplateUUID.equals(other.resourceTemplateUUID))
- return false;
- if(serviceId == null) {
- if(other.serviceId != null)
- return false;
- } else if(!serviceId.equals(other.serviceId))
- return false;
- return true;
- }
-
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ResourceOperationStatus)) {
+ return false;
+ }
+ ResourceOperationStatus castOther = (ResourceOperationStatus) other;
+ return Objects.equals(getServiceId(), castOther.getServiceId())
+ && Objects.equals(getOperationId(), castOther.getOperationId())
+ && Objects.equals(getResourceTemplateUUID(), castOther.getResourceTemplateUUID());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getServiceId(), getOperationId(), getResourceTemplateUUID());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("resourceTemplateUUID", getResourceTemplateUUID()).append("operType", getOperType())
+ .append("resourceInstanceID", getResourceInstanceID()).append("jobId", getJobId())
+ .append("status", getStatus()).append("progress", getProgress()).append("errorCode", getErrorCode())
+ .append("statusDescription", getStatusDescription()).toString();
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java
new file mode 100644
index 0000000000..0f3656cd31
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class ResourceOperationStatusId implements Serializable {
+
+ private static final long serialVersionUID = -7425019928845751157L;
+
+ @BusinessKey
+ private String serviceId;
+ @BusinessKey
+ private String operationId;
+ @BusinessKey
+ private String resourceTemplateUUID;
+
+ public ResourceOperationStatusId() {
+
+ }
+
+ public ResourceOperationStatusId(String serviceId, String operationId, String resourceTemplateUUID) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ this.resourceTemplateUUID = resourceTemplateUUID;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public String getOperationId() {
+ return operationId;
+ }
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+ public String getResourceTemplateUUID() {
+ return resourceTemplateUUID;
+ }
+ public void setResourceTemplateUUID(String resourceTemplateUUID) {
+ this.resourceTemplateUUID = resourceTemplateUUID;
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ResourceOperationStatusId)) {
+ return false;
+ }
+ ResourceOperationStatusId castOther = (ResourceOperationStatusId) other;
+ return Objects.equals(this.getServiceId(), castOther.getServiceId())
+ && Objects.equals(this.getOperationId(), castOther.getOperationId())
+ && Objects.equals(this.getResourceTemplateUUID(), castOther.getResourceTemplateUUID());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getServiceId(), this.getOperationId(),this.getResourceTemplateUUID());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("resourceTemplateUUID", getResourceTemplateUUID()).toString();
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
new file mode 100644
index 0000000000..4e83ea5911
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.onap.so.logger.MsoLogger;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "site_status")
+public class SiteStatus {
+
+ @Column(name = "STATUS")
+ private boolean status;
+ @Id
+ @Column(name = "SITE_NAME")
+ private String siteName;
+ @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ public SiteStatus() {
+ }
+
+ public SiteStatus(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getSiteName() {
+ return siteName;
+ }
+
+ public void setSiteName(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public void setStatus(boolean status) {
+ this.status = status;
+ }
+
+ public boolean getStatus() {
+ return status;
+ }
+
+ @PrePersist
+ protected void createdAt() {
+ this.created = new Date();
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof SiteStatus)) {
+ return false;
+ }
+ SiteStatus castOther = (SiteStatus) other;
+ return Objects.equals(getSiteName(), castOther.getSiteName());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getSiteName());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("status", getStatus()).append("siteName", getSiteName())
+ .append("created", getCreated()).toString();
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java
new file mode 100644
index 0000000000..f6ee5086c9
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Status {
+ PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT;
+
+ public boolean isFinished () {
+ switch (this) {
+ case COMPLETED:
+ case FAILED:
+ case TIMEOUT:
+ return true;
+ default:
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java
new file mode 100644
index 0000000000..f72a7b327a
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@IdClass(WatchdogComponentDistributionStatusId.class)
+@Entity
+@Table(name = "watchdog_per_component_distribution_status")
+public class WatchdogComponentDistributionStatus implements Serializable {
+
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = -4344508954204488669L;
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Id
+ @Column(name = "COMPONENT_NAME", length=45)
+ private String componentName;
+ @Column(name = "COMPONENT_DISTRIBUTION_STATUS", length=45)
+ private String componentDistributionStatus;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public WatchdogComponentDistributionStatus() {
+
+ }
+
+ public WatchdogComponentDistributionStatus(String distributionId, String componentName) {
+ this.distributionId = distributionId;
+ this.componentName = componentName;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public String getComponentDistributionStatus() {
+ return componentDistributionStatus;
+ }
+
+ public void setComponentDistributionStatus(String componentDistributionStatus) {
+ this.componentDistributionStatus = componentDistributionStatus;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogComponentDistributionStatus)) {
+ return false;
+ }
+ WatchdogComponentDistributionStatus castOther = (WatchdogComponentDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getComponentName(), castOther.getComponentName());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId(), getComponentName());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("componentName", getComponentName())
+ .append("componentDistributionStatus", getComponentDistributionStatus())
+ .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java
index 8f2bda3728..79e6fbaced 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.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.
@@ -18,63 +18,56 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class WatchdogComponentDistributionStatus implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+public class WatchdogComponentDistributionStatusId implements Serializable {
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -4344508954204488669L;
-
- private String distributionId = null;
- private String componentName = null;
- private String componentDistributionStatus = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
+ private static final long serialVersionUID = -4785382368168200031L;
+ @BusinessKey
+ private String distributionId;
+ @BusinessKey
+ private String componentName;
public String getDistributionId() {
return distributionId;
}
-
public void setDistributionId(String distributionId) {
this.distributionId = distributionId;
}
-
public String getComponentName() {
return componentName;
}
-
public void setComponentName(String componentName) {
this.componentName = componentName;
}
-
- public String getComponentDistributionStatus() {
- return componentDistributionStatus;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogComponentDistributionStatusId)) {
+ return false;
+ }
+ WatchdogComponentDistributionStatusId castOther = (WatchdogComponentDistributionStatusId) other;
+ return Objects.equals(this.getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(this.getComponentName(), castOther.getComponentName());
}
-
- public void setComponentDistributionStatus(String componentDistributionStatus) {
- this.componentDistributionStatus = componentDistributionStatus;
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getDistributionId(), this.getComponentName());
}
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("componentName", getComponentName()).toString();
}
+
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
new file mode 100644
index 0000000000..40c81b96e7
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "watchdog_distributionid_status")
+public class WatchdogDistributionStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = -4449711060885719079L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Column(name = "DISTRIBUTION_ID_STATUS", length=45)
+ private String distributionIdStatus;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public WatchdogDistributionStatus() {
+
+ }
+
+ public WatchdogDistributionStatus(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getDistributionIdStatus() {
+ return distributionIdStatus;
+ }
+
+ public void setDistributionIdStatus(String distributionIdStatus) {
+ this.distributionIdStatus = distributionIdStatus;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogDistributionStatus)) {
+ return false;
+ }
+ WatchdogDistributionStatus castOther = (WatchdogDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("distributionIdStatus", getDistributionIdStatus()).append("createTime", getCreateTime())
+ .append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
new file mode 100644
index 0000000000..77089cbbdc
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@IdClass(WatchdogServiceModVerIdLookupId.class)
+@Entity
+@Table(name = "watchdog_service_mod_ver_id_lookup")
+public class WatchdogServiceModVerIdLookup implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 7783869906430250355L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Id
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ public WatchdogServiceModVerIdLookup() {
+
+ }
+ public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId) {
+ this.distributionId = distributionId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = new Date();
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogServiceModVerIdLookup)) {
+ return false;
+ }
+ WatchdogServiceModVerIdLookup castOther = (WatchdogServiceModVerIdLookup) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId(), getServiceModelVersionId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).append("createTime", getCreateTime())
+ .toString();
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java
index ced4f4f0a5..2c0b67bac2 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.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.
@@ -18,44 +18,57 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class WatchdogServiceModVerIdLookup implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 7783869906430250355L;
-
- private String distributionId = null;
- private String serviceModelVersionId = null;
- private Timestamp createTime = null;
-
+public class WatchdogServiceModVerIdLookupId implements Serializable{
+
+ private static final long serialVersionUID = 9112709226209619993L;
+ @BusinessKey
+ private String distributionId;
+ @BusinessKey
+ private String serviceModelVersionId;
public String getDistributionId() {
return distributionId;
}
-
public void setDistributionId(String distributionId) {
this.distributionId = distributionId;
}
-
public String getServiceModelVersionId() {
return serviceModelVersionId;
}
-
public void setServiceModelVersionId(String serviceModelVersionId) {
this.serviceModelVersionId = serviceModelVersionId;
}
-
- public Timestamp getCreateTime() {
- return createTime;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogServiceModVerIdLookupId)) {
+ return false;
+ }
+ WatchdogServiceModVerIdLookupId castOther = (WatchdogServiceModVerIdLookupId) other;
+ return Objects.equals(this.getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getDistributionId(), this.getServiceModelVersionId());
}
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).toString();
}
+
+
+
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
new file mode 100644
index 0000000000..f3e92ed16a
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.ArchivedInfraRequests;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
new file mode 100644
index 0000000000..cd25b122be
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.util.Date;
+import java.util.List;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+
+@RepositoryRestResource(collectionResourceRel = "infraActiveRequests", path = "infraActiveRequests")
+public interface InfraActiveRequestsRepository extends JpaRepository<InfraActiveRequests, String>, InfraActiveRequestsRepositoryCustom {
+
+ InfraActiveRequests findOneByRequestIdOrClientRequestId(String requestId, String clientRequestId);
+ InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId,String clientRequestId, String requestType);
+ InfraActiveRequests findOneByRequestId(String string);
+ InfraActiveRequests findOneByRequestBody(String requestBody);
+ List<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request);
+ List<InfraActiveRequests> findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
new file mode 100644
index 0000000000..ba237bfa35
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface InfraActiveRequestsRepositoryCustom {
+
+ public boolean healthCheck();
+
+ public InfraActiveRequests getRequestFromInfraActive(String requestId);
+
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ String requestScope);
+
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
+
+ // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
+ // (infra_active_requests table) for operationalEnvId and OperationalEnvName
+ public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap);
+
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, String queryValue,
+ String requestType);
+
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType);
+
+ public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType);
+
+ public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType);
+
+ public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId);
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
new file mode 100644
index 0000000000..3240972a58
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -0,0 +1,566 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NonUniqueResultException;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Order;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDbConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Repository
+@Transactional(readOnly = true)
+public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRepositoryCustom {
+
+ @Qualifier("requestEntityManagerFactory")
+ @Autowired
+ private EntityManager entityManager;
+
+ protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, InfraActiveRequestsRepositoryImpl.class);
+
+ protected static final String SOURCE = "source";
+ protected static final String START_TIME = "startTime";
+ protected static final String REQUEST_TYPE = "requestType";
+ protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ protected static final String VNF_INSTANCE_NAME = "vnfName";
+ protected static final String VNF_INSTANCE_ID = "vnfId";
+ protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName";
+ protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId";
+ protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName";
+ protected static final String VFMODULE_INSTANCE_ID = "vfModuleId";
+ protected static final String NETWORK_INSTANCE_NAME = "networkName";
+ protected static final String CONFIGURATION_INSTANCE_ID = "configurationId";
+ protected static final String CONFIGURATION_INSTANCE_NAME= "configurationName";
+ protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
+ protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName";
+ protected static final String NETWORK_INSTANCE_ID = "networkId";
+ protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId";
+ protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId";
+ protected static final String SERVICE_ID = "serviceId";
+ protected static final String SERVICE_VERSION = "serviceVersion";
+ protected static final String REQUEST_ID = "requestId";
+ protected static final String REQUESTOR_ID = "requestorId";
+
+ @Autowired
+ private OperationStatusRepository operationStatusRepository;
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#healthCheck()
+ */
+ @Override
+ public boolean healthCheck () {
+
+ Query query = entityManager.createNativeQuery(" show tables ");
+
+ List<?> list = query.getResultList();
+
+ return true;
+ }
+
+ private List<InfraActiveRequests> executeInfraQuery (CriteriaQuery<InfraActiveRequests> crit, List <Predicate> predicates, Order order) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Execute query on infra active request table");
+
+ List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
+
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ crit.where(cb.and(predicates.toArray(new Predicate[0])));
+ crit.orderBy(order);
+ results = entityManager.createQuery(crit).getResultList();
+
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getInfraActiveRequest", null);
+ }
+ return results;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests getRequestFromInfraActive (String requestId) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB");
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
+ query.setParameter (REQUEST_ID, requestId);
+ ar = this.getSingleResult(query);
+ } finally {
+
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null);
+ }
+ return ar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java.util.HashMap, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+
+ if(instanceName != null && !instanceName.equals("")) {
+
+ if("service".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_NAME), instanceName));
+ } else if("vnf".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_NAME), instanceName));
+ } else if("volumeGroup".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_NAME), instanceName));
+ } else if("vfModule".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_NAME), instanceName));
+ } else if("network".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName));
+ } else if(requestScope.equals("configuration")) {
+ predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName));
+ } else if(requestScope.equals("operationalEnvironment")) {
+ predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName));
+ }
+
+ } else {
+ if(instanceIdMap != null){
+ if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId")));
+ }
+
+ if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_ID), instanceIdMap.get("vnfInstanceId" )));
+ }
+
+ if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_ID), instanceIdMap.get("vfModuleInstanceId")));
+ }
+
+ if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_ID), instanceIdMap.get("volumeGroupInstanceId")));
+ }
+
+ if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_ID), instanceIdMap.get("networkInstanceId")));
+ }
+
+ if(requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_ID), instanceIdMap.get("configurationInstanceId")));
+ }
+
+ if(requestScope.equals("operationalEnvironment") && instanceIdMap.get("operationalEnvironmentId") != null) {
+ predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId")));
+ }
+ }
+ }
+
+ predicates.add (tableRoot.get("requestStatus").in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK")));
+
+ Order order = cb.desc(tableRoot.get(START_TIME));
+
+ List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
+
+ InfraActiveRequests infraActiveRequests = null;
+
+ if(dupList != null && !dupList.isEmpty()){
+ infraActiveRequests = dupList.get(0);
+ }
+
+ return infraActiveRequests;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getOrchestrationFiltersFromInfraActive(java.util.Map)
+ */
+ @Override
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) {
+
+
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+ for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet())
+ {
+ String mapKey = entry.getKey();
+ if("serviceInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "serviceInstanceId";
+ } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "serviceInstanceName";
+ } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){
+ mapKey = "vnfId";
+ } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "vnfName";
+ } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "vfModuleId";
+ } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "vfModuleName";
+ } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "volumeGroupId";
+ } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "volumeGroupName";
+ } else if("networkInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "networkId";
+ } else if("networkInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "networkName";
+ } else if(mapKey.equalsIgnoreCase("configurationInstanceId")) {
+ mapKey = "configurationId";
+ } else if(mapKey.equalsIgnoreCase("configurationInstanceName")) {
+ mapKey = "configurationName";
+ } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) {
+ mapKey = "aicCloudRegion";
+ } else if("tenantId".equalsIgnoreCase(mapKey)) {
+ mapKey = "tenantId";
+ } else if("modelType".equalsIgnoreCase(mapKey)) {
+ mapKey = "requestScope";
+ } else if("requestorId".equalsIgnoreCase(mapKey)) {
+ mapKey = "requestorId";
+ } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) {
+ mapKey = "startTime";
+ }
+
+ String propertyValue = entry.getValue().get(1);
+ if ("startTime".equals(mapKey)) {
+ SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
+ try {
+ Date thisDate = format.parse(propertyValue);
+ Timestamp minTime = new Timestamp(thisDate.getTime());
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+
+ if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime), cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime)));
+ } else {
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
+ }
+ }
+ catch (Exception e){
+ msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
+ return null;
+ }
+ }
+ else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue));
+ } else {
+ predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));
+ }
+
+ }
+
+ Order order = cb.asc(tableRoot.get(START_TIME));
+
+ return executeInfraQuery (crit, predicates, order);
+ }
+
+ // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
+ // (infra_active_requests table) for operationalEnvId and OperationalEnvName
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getCloudOrchestrationFiltersFromInfraActive(java.util.Map)
+ */
+ @Override
+ public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive (Map<String, String> orchestrationMap) {
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+
+ // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in the filter
+ // as the same requestorId can also match on different API methods
+ String resourceType = orchestrationMap.get("resourceType");
+ if(resourceType == null) {
+ predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment"));
+ }
+
+ for (Map.Entry<String, String> entry : orchestrationMap.entrySet()) {
+ String mapKey = entry.getKey();
+ if(mapKey.equalsIgnoreCase("requestorId")) {
+ mapKey = "requestorId";
+ } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) {
+ mapKey = "startTime";
+ } else if(mapKey.equalsIgnoreCase("operationalEnvironmentId")) {
+ mapKey = "operationalEnvId";
+ } else if(mapKey.equalsIgnoreCase("operationalEnvironmentName")) {
+ mapKey = "operationalEnvName";
+ } else if(mapKey.equalsIgnoreCase("resourceType")) {
+ mapKey = "requestScope";
+ }
+
+ String propertyValue = entry.getValue();
+ if (mapKey.equals("startTime")) {
+ SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
+ try {
+ Date thisDate = format.parse(propertyValue);
+ Timestamp minTime = new Timestamp(thisDate.getTime());
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
+ }
+ catch (Exception e){
+ msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
+ return null;
+ }
+ } else {
+ predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));
+ }
+ }
+
+ Order order = cb.asc(tableRoot.get(START_TIME));
+ return executeInfraQuery (crit, predicates, order);
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue);
+
+
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class);
+ Predicate isEqual = cb.equal(candidateRoot.get(queryAttributeName), queryValue);
+ Predicate equalRequestType = cb.equal(candidateRoot.get(REQUEST_TYPE), requestType);
+ Predicate isNull = cb.isNull(candidateRoot.get(REQUEST_TYPE));
+ Predicate orClause = cb.or(equalRequestType, isNull);
+ Order orderDesc = cb.desc(candidateRoot.get(START_TIME));
+ Order orderAsc = cb.asc(candidateRoot.get(SOURCE));
+ crit.where(cb.and(isEqual, orClause)).orderBy(orderDesc, orderAsc);
+
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> arList = entityManager.createQuery(crit).getResultList();
+ if (arList != null && !arList.isEmpty ()) {
+ return arList;
+ }
+ } finally {
+ // msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestListFromInfraActive", null);
+ }
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get infra request from DB with id " + requestId);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
+ query.setParameter (REQUEST_ID, requestId);
+ query.setParameter (REQUEST_TYPE, requestType);
+ ar = this.getSingleResult(query);
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestFromInfraActive", null);
+ }
+ return ar;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ query.setParameter ("vnfName", vnfName);
+ query.setParameter ("action", action);
+ query.setParameter (REQUEST_TYPE, requestType);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
+ }
+
+ return ar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ query.setParameter ("vnfId", vnfId);
+ query.setParameter ("action", action);
+ query.setParameter (REQUEST_TYPE, requestType);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfId", null);
+ }
+
+ return ar;
+ }
+
+ /**
+ * update service operation status when a operation resource status updated
+ * <br>
+ *
+ * @param operStatus the resource operation status
+ * @since ONAP Amsterdam Release
+ */
+ private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) {
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("Request database - query Resource Operation Status with service Id:"
+ + operStatus.getServiceId() + ", operationId:" + operStatus.getOperationId());
+ try {
+ // query all resources of the service
+ String hql = "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
+ Query query = entityManager.createQuery(hql);
+ query.setParameter("service_id", operStatus.getServiceId());
+ query.setParameter("operation_id", operStatus.getOperationId());
+ @SuppressWarnings("unchecked")
+ List<ResourceOperationStatus> lstResourceStatus = (List<ResourceOperationStatus>)query.getResultList();
+ // count the total progress
+ int resourceCount = lstResourceStatus.size();
+ int progress = 0;
+ boolean isFinished = true;
+ for(int i = 0; i < resourceCount; i++) {
+ progress = progress + Integer.valueOf(lstResourceStatus.get(i).getProgress()) / resourceCount;
+ if(RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatus.get(i).getStatus())) {
+ isFinished = false;
+ }
+ }
+
+ OperationStatus serviceOperStatus = new OperationStatus(operStatus.getServiceId(), operStatus.getOperationId());
+ serviceOperStatus = operationStatusRepository.findOne(Example.of(serviceOperStatus));
+ progress = progress > 100 ? 100 : progress;
+ serviceOperStatus.setProgress(String.valueOf(progress));
+ serviceOperStatus.setOperationContent(operStatus.getStatusDescription());
+ // if current resource failed. service failed.
+ if(RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) {
+ serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR);
+ serviceOperStatus.setReason(operStatus.getStatusDescription());
+ } else if(isFinished) {
+ // if finished
+ serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED);
+ serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED);
+ }
+ operationStatusRepository.save(serviceOperStatus);
+ } finally {
+ msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully", "RequestDB", "updateResOperStatus", null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId);
+
+ InfraActiveRequests ar = null;
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class);
+ Predicate operationalEnvEq = cb.equal(candidateRoot.get("operationalEnvId"), operationalEnvironmentId);
+ Predicate requestStatusNotEq = cb.notEqual(candidateRoot.get("requestStatus"), "COMPLETE");
+ Predicate actionEq = cb.equal(candidateRoot.get("action"), "create");
+ Order startTimeOrder = cb.desc(candidateRoot.get("startTime"));
+ crit.select(candidateRoot);
+ crit.where(cb.and(operationalEnvEq, requestStatusNotEq, actionEq));
+ crit.orderBy(startTimeOrder);
+ TypedQuery<InfraActiveRequests> query = entityManager.createQuery(crit);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
+ }
+
+ return ar;
+ }
+
+ protected <T> T getSingleResult(Query query) {
+ query.setMaxResults(1);
+ List<T> list = query.getResultList();
+ if (list == null || list.isEmpty()) {
+ return null;
+ } else if (list.size() == 1) {
+ return list.get(0);
+ } else {
+ throw new NonUniqueResultException();
+ }
+
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
new file mode 100644
index 0000000000..c51e4edcea
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> {
+
+ OperationStatus findOneByServiceIdAndOperationId(String serviceId, String operationId);
+ public OperationStatus findOneByServiceName(String serviceName);
+ public OperationStatus findOneByServiceId(String serviceId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
new file mode 100644
index 0000000000..799e5ad147
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface OperationalEnvDistributionStatusRepository extends JpaRepository<OperationalEnvDistributionStatus, String> {
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus where "
+ + "distributionId = :distributionId and operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
+ public int setDistributionIdStatus(@Param("distributionIdStatus") String distributionIdStatus,
+ @Param("distributionId") String distributionId,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
new file mode 100644
index 0000000000..ee2baedf61
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface OperationalEnvServiceModelStatusRepository extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId>{
+
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
+ public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvId, String serviceModelVersionId);
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
+ + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
+ public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
+ @Param("retryCount") int retryCount,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId);
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
+ + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId and requestId = :requestId")
+ public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
+ @Param("retryCount") int retryCount,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId,
+ @Param("requestId") String requestId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
new file mode 100644
index 0000000000..2d77f7589e
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ResourceOperationStatusRepository extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> {
+
+ List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
index 1d62efb18d..11923512a5 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
@@ -18,24 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.data.repository;
+import org.onap.so.db.request.beans.SiteStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
-/**
- * InfraActiveRequests
- */
-public class InfraActiveRequests extends InfraRequests {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 5003555140088137254L;
-
- public InfraActiveRequests() {
- super ();
- }
+@Repository
+public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> {
+ SiteStatus findOneBySiteName(String siteName);
- public InfraActiveRequests(String requestId, String action) {
- super (requestId, action);
- }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
new file mode 100644
index 0000000000..8310d79a5b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogComponentDistributionStatusRepository extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> {
+
+ public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
new file mode 100644
index 0000000000..6e37181380
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogDistributionStatusRepository extends JpaRepository<WatchdogDistributionStatus, String> {
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
new file mode 100644
index 0000000000..b83481b88b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookupId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogServiceModVerIdLookupRepository extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> {
+
+ public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId);
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
index 29e55b8042..6eb00ea1e9 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.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.
@@ -18,54 +18,90 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-public class RequestsDBHelper {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- private String className = this.getClass().getSimpleName() +" class\'s ";
- private String methodName = "";
- private String classMethodMessage = "";
-
- /**
- * This util method is to update the InfraRequest table to Complete
- * @param msg - string, unique message for each caller
- * @param requestId - string
- * @param operationalEnvironmentId - string
- * @return void - nothing
- * @throws Exception
- */
- public void updateInfraSuccessCompletion(String msg, String requestId, String operationalEnvironmentId) {
- methodName = "updateInfraSuccessCompletion() method.";
- classMethodMessage = className + " " + methodName;
- msoLogger.debug("Begin of " + classMethodMessage);
-
- RequestsDatabase requestDB = RequestsDatabase.getInstance();
- requestDB.updateInfraFinalStatus(requestId, "COMPLETE", "SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg,
- 100L, null, "APIH");
- msoLogger.debug("End of " + classMethodMessage);
-
- }
-
- /**
- * This util method is to update the InfraRequest table to Failure
- * @param msg - string, unique message for each caller
- * @param requestId - string
- * @param operationalEnvironmentId - string
- * @return void - nothing
- * @throws Exception
- */
- public void updateInfraFailureCompletion(String msg, String requestId, String operationalEnvironmentId) {
- methodName = "updateInfraFailureCompletion() method.";
- classMethodMessage = className + " " + methodName;
- msoLogger.debug("Begin of " + classMethodMessage);
-
- RequestsDatabase requestDB = RequestsDatabase.getInstance();
- requestDB.updateInfraFinalStatus(requestId, "FAILED", "FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg,
- 100L, null, "APIH");
- msoLogger.debug("End of " + classMethodMessage);
-
- }
-}
+package org.onap.so.requestsdb;
+
+import java.sql.Timestamp;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestsDBHelper {
+
+ private static final String UNKNOWN = "UNKNOWN";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, RequestsDBHelper.class);
+ private String className = this.getClass().getSimpleName() +" class\'s ";
+ private String methodName = "";
+ private String classMethodMessage = "";
+ @Autowired
+ private InfraActiveRequestsRepository infraActiveRequestsRepository;
+ /**
+ * This util method is to update the InfraRequest table to Complete
+ * @param msg - string, unique message for each caller
+ * @param requestId - string
+ * @param operationalEnvironmentId - string
+ * @return void - nothing
+ * @throws Exception
+ */
+ public void updateInfraSuccessCompletion(String msg, String requestId, String operationalEnvironmentId) {
+ methodName = "updateInfraSuccessCompletion() method.";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+
+ request.setRequestStatus("COMPLETE");
+ request.setStatusMessage("SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg);
+ request.setProgress(100L);
+ request.setLastModifiedBy("APIH");
+ request.setOperationalEnvId(operationalEnvironmentId);
+ if(request.getAction() == null){
+ request.setRequestAction(UNKNOWN);
+ }
+ if(request.getRequestScope() == null){
+ request.setRequestScope(UNKNOWN);
+ }
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTimeStamp);
+ infraActiveRequestsRepository.save(request);
+
+ msoLogger.debug("End of " + classMethodMessage);
+
+ }
+
+ /**
+ * This util method is to update the InfraRequest table to Failure
+ * @param msg - string, unique message for each caller
+ * @param requestId - string
+ * @param operationalEnvironmentId - string
+ * @return void - nothing
+ * @throws Exception
+ */
+ public void updateInfraFailureCompletion(String msg, String requestId, String operationalEnvironmentId) {
+ methodName = "updateInfraFailureCompletion() method.";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+ request.setRequestStatus("FAILED");
+ request.setStatusMessage("FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg);
+ request.setProgress(100L);
+ request.setLastModifiedBy("APIH");
+ request.setOperationalEnvId(operationalEnvironmentId);
+ if(request.getAction() == null){
+ request.setRequestAction(UNKNOWN);
+ }
+ if(request.getRequestScope() == null){
+ request.setRequestScope(UNKNOWN);
+ }
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTimeStamp);
+ infraActiveRequestsRepository.save(request);
+
+ msoLogger.debug("End of " + classMethodMessage);
+
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java
index 18e51cef16..60bad3791c 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java
@@ -1,65 +1,66 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.requestsdb;
-
-/**
- * The constants of the request db
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class RequestsDbConstant {
-
- public static class Progress {
-
- public static final String ONE_HUNDRED = "100";
-
- private Progress() {
-
- }
- }
-
- public static class Status {
-
- public static final String FINISHED = "finished";
-
- public static final String PROCESSING = "processing";
-
- public static final String ERROR = "error";
-
- private Status() {
-
- }
- }
-
- public static class OperationType {
-
- public static final String CREATE = "create";
-
- public static final String DELETE = "delete";
-
- private OperationType() {
-
- }
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.requestsdb;
+
+/**
+ * The constants of the request db
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+public class RequestsDbConstant {
+
+ public static class Progress {
+
+ public static final String ONE_HUNDRED = "100";
+
+ private Progress() {
+
+ }
+ }
+
+ public static class Status {
+
+ public static final String FINISHED = "finished";
+
+ public static final String PROCESSING = "processing";
+
+ public static final String ERROR = "error";
+
+ private Status() {
+
+ }
+ }
+
+ public static class OperationType {
+
+ public static final String CREATE = "create";
+
+ public static final String DELETE = "delete";
+
+ private OperationType() {
+
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java
index 37ea2924a3..1cde1aac51 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb.adapter;
+package org.onap.so.requestsdb.adapter;
import java.sql.Timestamp;
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
deleted file mode 100644
index c88f31c819..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MockRequestsDatabase {
-
- private Map<String, InfraActiveRequests> activeRequests;
-
- public MockRequestsDatabase() {
- activeRequests = new HashMap<>();
- }
-
- public void addRecord(InfraActiveRequests record) {
- String serviceType = record.getServiceType();
- String serviceInstanceId = record.getServiceInstanceId();
- String key = serviceType + "::" + serviceInstanceId;
- activeRequests.put(key, record);
- }
-
- public void deleteRecord(String serviceType, String serviceInstanceId) {
- String key = serviceType + "::" + serviceInstanceId;
- activeRequests.remove(key);
- }
-
- public InfraActiveRequests getRecord(String serviceType, String serviceInstanceId) {
- String key = serviceType + "::" + serviceInstanceId;
- InfraActiveRequests record = activeRequests.get(key);
- return record;
- }
-
- public InfraActiveRequests checkDuplicate(String serviceType, String serviceInstanceId) {
- return getRecord(serviceType, serviceInstanceId);
- }
-
- public InfraActiveRequests checkRetry(String serviceType, String serviceInstanceId) {
- InfraActiveRequests record = getRecord(serviceType, serviceInstanceId);
- InfraActiveRequests returnRecord = null;
- if (record != null) {
- String requestAction = record.getRequestAction();
- if (!"GetLayer3ServiceDetailsRequest".equals(requestAction)) {
- String status = record.getRequestStatus();
- if ("COMPLETED".equals(status)) {
- returnRecord = record;
- }
- }
- }
- return returnRecord;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
deleted file mode 100644
index f61b2729e8..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.requestsdb;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * The service operation status
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class OperationStatus implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private String serviceId = null;
-
- private String operationId = null;
-
- private String serviceName = null;
-
- private String operation = null;
-
- private String userId = null;
-
- private String result = null;
-
- private String operationContent = null;
-
- private String progress = "0";
-
- private String reason = null;
-
- private Timestamp operateAt = null;
-
- private Timestamp finishedAt = null;
-
-
- public String getServiceId() {
- return serviceId;
- }
-
-
- public void setServiceId(String serviceId) {
- this.serviceId = serviceId;
- }
-
-
- public String getOperationId() {
- return operationId;
- }
-
-
- public void setOperationId(String operationId) {
- this.operationId = operationId;
- }
-
-
- public String getOperation() {
- return operation;
- }
-
-
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
-
- public String getUserId() {
- return userId;
- }
-
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
-
- public String getResult() {
- return result;
- }
-
-
- public void setResult(String result) {
- this.result = result;
- }
-
-
- public String getOperationContent() {
- return operationContent;
- }
-
-
- public void setOperationContent(String operationContent) {
- this.operationContent = operationContent;
- }
-
-
- public String getProgress() {
- return progress;
- }
-
-
- public void setProgress(String progress) {
- this.progress = progress;
- }
-
-
- public String getReason() {
- return reason;
- }
-
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
-
- public Timestamp getOperateAt() {
- return operateAt;
- }
-
-
- public void setOperateAt(Timestamp operateAt) {
- this.operateAt = operateAt;
- }
-
-
- public Timestamp getFinishedAt() {
- return finishedAt;
- }
-
-
- public void setFinishedAt(Timestamp finishedAt) {
- this.finishedAt = finishedAt;
- }
-
-
-
- /**
- * @return Returns the serviceName.
- */
- public String getServiceName() {
- return serviceName;
- }
-
-
-
- /**
- * @param serviceName The serviceName to set.
- */
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
-
- /**
- * <br>
- *
- * @return
- * @since ONAP Amsterdam Release
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());
- result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
- return result;
- }
-
-
- /**
- * <br>
- *
- * @param obj
- * @return
- * @since ONAP Amsterdam Release
- */
- @Override
- public boolean equals(Object obj) {
- if(this == obj)
- return true;
- if(obj == null)
- return false;
- if(getClass() != obj.getClass())
- return false;
- OperationStatus other = (OperationStatus)obj;
- if(operationId == null) {
- if(other.operationId != null)
- return false;
- } else if(!operationId.equals(other.operationId))
- return false;
- if(serviceId == null) {
- if(other.serviceId != null)
- return false;
- } else if(!serviceId.equals(other.serviceId))
- return false;
- return true;
- }
-
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java
deleted file mode 100644
index ce2e1f6906..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class OperationalEnvDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String REQUEST_ID = "requestId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String DISTRIBUTION_ID_STATUS = "distributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static OperationalEnvDistributionStatusDb getInstance() {
- return new OperationalEnvDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected OperationalEnvDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Retrieve OperationalEnvDistributionStatus from getSecgiven distributionId
- * @param distributionId
- * @return
- */
- public OperationalEnvDistributionStatus getOperationalEnvDistributionStatus(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve Operational Environment Distribution Status with distributionId: " + distributionId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from OperationalEnvDistributionStatus where distributionId = :distributionId");
- query.setParameter (DISTRIBUTION_ID, distributionId);
- request = (OperationalEnvDistributionStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvDistributionStatus", "getOperationalEnvDistributionStatus", null);
- }
- return request;
- }
-
- /**
- * Retrieve OperationalEnvDistributionStatus from given distributionId and requestId
- * @param distributionId
- * @param requestId
- * @return OperationalEnvDistributionStatus
- */
- public OperationalEnvDistributionStatus getOperationalEnvDistributionStatusPerReqId(String distributionId, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve Operational Environment Distribution Status with distributionId: " + distributionId + ", requestId: " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from OperationalEnvDistributionStatus where distributionId = :distributionId AND requestId = :requestId");
- query.setParameter (DISTRIBUTION_ID, distributionId);
- query.setParameter (REQUEST_ID, requestId);
- request = (OperationalEnvDistributionStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvDistributionStatus", "getOperationalEnvDistributionStatusPerReqId", null);
- }
- return request;
- }
-
- /**
- * Update OperationalEnvDistributionStatus with distributionIdStatus for given distributionId, serviceModelVersionId, serviceModelVersionId
- * @param asdcStatus
- * @param distributionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- */
- public int updateOperationalEnvDistributionStatus(String asdcStatus, String distributionId,
- String operationalEnvId, String serviceModelVersionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvDistributionStatus DISTRIBUTION_ID_STATUS with asdcStatus: " + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus, modifyTime = :modifyTime where distributionId = :distributionId and "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId ");
- query.setParameter (DISTRIBUTION_ID_STATUS, asdcStatus);
- query.setParameter ("distributionId", distributionId);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateOperationalEnvDistributionStatus", null);
- }
- return result;
- }
-
- /**
- * Insert into OperationalEnvDistributionStatus with distributionId, operationalEnvId, serviceModelVersionId, distributionIdStatus
- * @param distributionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param distributionIdStatus
- */
- public void insertOperationalEnvDistributionStatus(String distributionId, String operationalEnvId, String serviceModelVersionId,
- String distributionIdStatus, String requestId) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into OperationalEnvDistributionStatus " );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus oed = new OperationalEnvDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- oed.setDistributionId (distributionId);
- oed.setOperationalEnvId (operationalEnvId);
- oed.setServiceModelVersionId (serviceModelVersionId);
- oed.setDistributionIdStatus (distributionIdStatus);
- oed.setRequestId(requestId);
- oed.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- oed.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into OperationalEnvDistributionStatus");
-
- session.save (oed);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertOperationalEnvDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "OperationalEnvDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- }
- finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvDistributionStatusDB", "insertOperationalEnvDistributionStatus", null);
- }
- }
-
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java
deleted file mode 100644
index fe581de71b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- *
- */
-package org.openecomp.mso.requestsdb;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @author PB6115
- *
- */
-public class OperationalEnvServiceModelStatus implements Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 8197084996598869656L;
-
- private String requestId = null;
- private String operationalEnvId = null;
- private String serviceModelVersionId = null;
- private String serviceModelVersionDistrStatus = null;
- private String recoveryAction = null;
- private int retryCount;
- private String workloadContext = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getOperationalEnvId() {
- return operationalEnvId;
- }
-
- public void setOperationalEnvId(String operationalEnvId) {
- this.operationalEnvId = operationalEnvId;
- }
-
- public String getServiceModelVersionId() {
- return serviceModelVersionId;
- }
-
- public void setServiceModelVersionId(String serviceModelVersionId) {
- this.serviceModelVersionId = serviceModelVersionId;
- }
-
- public String getServiceModelVersionDistrStatus() {
- return serviceModelVersionDistrStatus;
- }
-
- public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
- this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
- }
-
- public String getRecoveryAction() {
- return recoveryAction;
- }
-
- public void setRecoveryAction(String recoveryAction) {
- this.recoveryAction = recoveryAction;
- }
-
- public int getRetryCount() {
- return retryCount;
- }
-
- public void setRetryCount(int retryCount) {
- this.retryCount = retryCount;
- }
-
- public String getWorkloadContext() {
- return workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java
deleted file mode 100644
index 1c2055ee91..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class OperationalEnvServiceModelStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String REQUEST_ID = "requestId";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String SERVICE_MOD_VER_DISTR_STATUS = "serviceModelVersionDistrStatus";
- protected static final String RECOVERY_ACTION = "recoveryAction";
- protected static final int RETRY_COUNT_LEFT = 0;
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static OperationalEnvServiceModelStatusDb getInstance() {
- return new OperationalEnvServiceModelStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected OperationalEnvServiceModelStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Retrieve OperationalEnvServiceModelStatus from given OperationalEnvironmentId and serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @return
- */
- public OperationalEnvServiceModelStatus getOperationalEnvServiceModelStatus(String operationalEnvId, String serviceModelVersionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve OperationalEnvironmentServiceModel with operationalEnvironmentId: " + operationalEnvId + ", serviceModelVersionId: " + serviceModelVersionId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvServiceModelStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM OperationalEnvServiceModelStatus WHERE operationalEnvId = :operationalEnvId AND serviceModelVersionId = :serviceModelVersionId");
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- request = (OperationalEnvServiceModelStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvServiceModelStatus", "getOperationalEnvServiceModelStatus", null);
- }
- return request;
- }
-
-
- /**
- * Retrieve OperationalEnvServiceModelStatus from given OperationalEnvironmentId and serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @return
- */
- @SuppressWarnings("unchecked")
- public List<OperationalEnvServiceModelStatus> getOperationalEnvIdStatus(String operationalEnvId, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve OperationalEnvironmentServiceModel with operationalEnvironmentId: " + operationalEnvId + ", requestId: " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- List<OperationalEnvServiceModelStatus> requests = new ArrayList<OperationalEnvServiceModelStatus>();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM OperationalEnvServiceModelStatus WHERE operationalEnvId = :operationalEnvId AND requestId = :requestId");
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("requestId", requestId);
- requests = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvServiceModelStatus", "getOperationalEnvIdStatus", null);
- }
- return requests;
- }
-
-
- /**
- * Update OperationalEnvServiceModelStatus serviceModelVersionDistrStatus with asdcStatus and retryCount for given operationalEnvId, serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param asdcStatus
- * @param retryCount
- */
- public int updateOperationalEnvRetryCountStatus(String operationalEnvId, String serviceModelVersionId, String asdcStatus, int retryCount) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvServiceModelStatus retryCount: " + retryCount + " and serviceModelVersionDistrStatus :" + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :serviceModelVersionDistrStatus, retryCount = :retryCount, modifyTime = :modifyTime where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId ");
- query.setParameter ("retryCount", retryCount);
- query.setParameter (SERVICE_MOD_VER_DISTR_STATUS, asdcStatus);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelDB", "updateOperationalEnvRetryCountStatus", null);
- }
- return result;
- }
-
- /**
- * Update OperationalEnvServiceModelStatus serviceModelVersionDistrStatus with asdcStatus and retryCount for given operationalEnvId, serviceModelVersionId, requestId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param asdcStatus
- * @param retryCount
- * @param requestId
- */
- public int updateOperationalEnvRetryCountStatusPerReqId(String operationalEnvId, String serviceModelVersionId, String asdcStatus, int retryCount, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvServiceModelStatus retryCount: " + retryCount + " and serviceModelVersionDistrStatus :" + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount, modifyTime = :modifyTime where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId and requestId = :requestId ");
- query.setParameter ("retryCount", retryCount);
- query.setParameter (SERVICE_MOD_VER_DISTR_STATUS, asdcStatus);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- query.setParameter ("requestId", requestId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelDB", "updateOperationalEnvRetryCountStatusPerReqId", null);
- }
- return result;
- }
-
-
- /**
- * Insert into OperationalEnvServiceModelStatus with operationalEnvId, serviceModelVersionId, distributionIdStatus, recoveryAction, retryCount
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param distributionIdStatus
- * @param distributionId
- * @param recoveryAction
- * @param retryCount
- */
- public void insertOperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId,
- String distributionIdStatus, String recoveryAction, int retryCount, String workloadContext) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into OperationalEnvServiceModelStatus " );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvServiceModelStatus oesm = new OperationalEnvServiceModelStatus ();
-
- try {
- session.beginTransaction ();
-
- oesm.setRequestId (requestId);
- oesm.setOperationalEnvId (operationalEnvId);
- oesm.setServiceModelVersionId (serviceModelVersionId);
- oesm.setServiceModelVersionDistrStatus (distributionIdStatus);
- oesm.setRecoveryAction (recoveryAction);
- oesm.setRetryCount (retryCount);
- oesm.setWorkloadContext(workloadContext);
- oesm.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- oesm.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into OperationalEnvServiceModelStatus");
-
- session.save (oesm);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertOperationalEnvServiceModelStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "OperationalEnvServiceModelStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelStatusDB", "insertOperationalEnvServiceModelStatus", null);
- }
-
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
deleted file mode 100644
index 9964b93df4..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ /dev/null
@@ -1,888 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.requestsdb.RequestsDbConstant.Status;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class RequestsDatabase {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- protected static final String SOURCE = "source";
- protected static final String START_TIME = "startTime";
- protected static final String REQUEST_TYPE = "requestType";
- protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
- protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
- protected static final String VNF_INSTANCE_NAME = "vnfName";
- protected static final String VNF_INSTANCE_ID = "vnfId";
- protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName";
- protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId";
- protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName";
- protected static final String VFMODULE_INSTANCE_ID = "vfModuleId";
- protected static final String NETWORK_INSTANCE_NAME = "networkName";
- protected static final String CONFIGURATION_INSTANCE_ID = "configurationId";
- protected static final String CONFIGURATION_INSTANCE_NAME= "configurationName";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName";
- protected static final String NETWORK_INSTANCE_ID = "networkId";
- protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId";
- protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId";
- protected static final String SERVICE_ID = "serviceId";
- protected static final String SERVICE_VERSION = "serviceVersion";
- protected static final String REQUEST_ID = "requestId";
- protected static final String REQUESTOR_ID = "requestorId";
-
- protected static MockRequestsDatabase mockDB = null;
-
- public static RequestsDatabase getInstance() {
- return new RequestsDatabase(new RequestsDbSessionFactoryManager ());
- }
-
- protected RequestsDatabase (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
- public boolean healthCheck () {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- Query query = session.createSQLQuery (" show tables ");
-
- List<?> list = query.list();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- }
- return true;
- }
-
-
- public int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, modifyTime = :modifyTime, lastModifiedBy = :lastModifiedBy where requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraStatus", null);
- }
- return result;
- }
-
- public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, modifyTime = :modifyTime, progress = :progress, lastModifiedBy = :lastModifiedBy where requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter ("progress", progress);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraStatus", null);
- }
- return result;
- }
-
- public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, statusMessage = :statusMessage, progress = :progress, endTime = :endTime, responseBody = :responseBody, lastModifiedBy = :lastModifiedBy where id.requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter ("requestId", requestId);
- Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("endTime", endTimeStamp);
- query.setParameter ("statusMessage", statusMessage);
- query.setParameter ("progress", progress);
- query.setParameter ("responseBody", responseBody);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraFinalStatus", null);
- }
- return result;
- }
-
-
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Execute query on infra active request table");
-
- List <InfraActiveRequests> results = new ArrayList<>();
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- session.beginTransaction ();
- Criteria crit = session.createCriteria (InfraActiveRequests.class);
- for (Criterion criterion : criteria) {
- crit.add (criterion);
- }
- crit.addOrder (order);
-
- // @SuppressWarnings("unchecked")
- results = crit.list ();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getInfraActiveRequest", null);
- }
- return results;
- }
-
- public InfraActiveRequests getRequestFromInfraActive (String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB");
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- InfraActiveRequests ar = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
- query.setParameter (REQUEST_ID, requestId);
- ar = (InfraActiveRequests) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null);
- }
- return ar;
- }
-
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
-
- List <Criterion> criteria = new LinkedList <> ();
-
- if(instanceName != null && !instanceName.equals("")) {
-
- if("service".equals(requestScope)){
- criteria.add (Restrictions.eq (SERVICE_INSTANCE_NAME, instanceName));
- } else if("vnf".equals(requestScope)){
- criteria.add (Restrictions.eq (VNF_INSTANCE_NAME, instanceName));
- } else if("volumeGroup".equals(requestScope)){
- criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_NAME, instanceName));
- } else if("vfModule".equals(requestScope)){
- criteria.add (Restrictions.eq (VFMODULE_INSTANCE_NAME, instanceName));
- } else if("network".equals(requestScope)){
- criteria.add (Restrictions.eq (NETWORK_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("configuration")) {
- criteria.add (Restrictions.eq (CONFIGURATION_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("operationalEnvironment")) {
- criteria.add (Restrictions.eq (OPERATIONAL_ENV_NAME, instanceName));
- }
-
- } else {
- if(instanceIdMap != null){
- if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){
- criteria.add (Restrictions.eq (SERVICE_INSTANCE_ID, instanceIdMap.get("serviceInstanceId")));
- }
-
- if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){
- criteria.add (Restrictions.eq (VNF_INSTANCE_ID, instanceIdMap.get("vnfInstanceId")));
- }
-
- if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){
- criteria.add (Restrictions.eq (VFMODULE_INSTANCE_ID, instanceIdMap.get("vfModuleInstanceId")));
- }
-
- if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){
- criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_ID, instanceIdMap.get("volumeGroupInstanceId")));
- }
-
- if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){
- criteria.add (Restrictions.eq (NETWORK_INSTANCE_ID, instanceIdMap.get("networkInstanceId")));
- }
-
- if(requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null){
- criteria.add (Restrictions.eq (CONFIGURATION_INSTANCE_ID, instanceIdMap.get("configurationInstanceId")));
- }
-
- if(requestScope.equals("operationalEnvironment") && instanceIdMap.get("operationalEnvironmentId") != null) {
- criteria.add (Restrictions.eq (OPERATIONAL_ENV_ID, instanceIdMap.get("operationalEnvironmentId")));
- }
- }
- }
-
- criteria.add (Restrictions.in ("requestStatus", new String[] { "PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK" }));
-
- Order order = Order.desc (START_TIME);
-
- List<InfraActiveRequests> dupList = executeInfraQuery(criteria, order);
-
- InfraActiveRequests infraActiveRequests = null;
-
- if(dupList != null && !dupList.isEmpty()){
- infraActiveRequests = dupList.get(0);
- }
-
- return infraActiveRequests;
- }
-
- public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) {
-
-
- List <Criterion> criteria = new LinkedList <> ();
- for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet())
- {
- String mapKey = entry.getKey();
- if("serviceInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "serviceInstanceId";
- } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "serviceInstanceName";
- } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){
- mapKey = "vnfId";
- } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "vnfName";
- } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "vfModuleId";
- } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "vfModuleName";
- } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "volumeGroupId";
- } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "volumeGroupName";
- } else if("networkInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "networkId";
- } else if("networkInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "networkName";
- } else if(mapKey.equalsIgnoreCase("configurationInstanceId")) {
- mapKey = "configurationId";
- } else if(mapKey.equalsIgnoreCase("configurationInstanceName")) {
- mapKey = "configurationName";
- } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) {
- mapKey = "aicCloudRegion";
- } else if("tenantId".equalsIgnoreCase(mapKey)) {
- mapKey = "tenantId";
- } else if("modelType".equalsIgnoreCase(mapKey)) {
- mapKey = "requestScope";
- } else if("requestorId".equalsIgnoreCase(mapKey)) {
- mapKey = "requestorId";
- } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) {
- mapKey = "startTime";
- }
-
- String propertyValue = entry.getValue().get(1);
- if ("startTime".equals(mapKey)) {
- SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
- try {
- Date thisDate = format.parse(propertyValue);
- Timestamp minTime = new Timestamp(thisDate.getTime());
- Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
-
- if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
- criteria.add(Restrictions.or(Restrictions.lt(mapKey, minTime),
- Restrictions.ge(mapKey, maxTime)));
- } else {
- criteria.add(Restrictions.between(mapKey, minTime, maxTime));
- }
- }
- catch (Exception e){
- msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
- return null;
- }
- }
- else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
- criteria.add(Restrictions.ne(mapKey, propertyValue));
- } else {
- criteria.add(Restrictions.eq(mapKey, propertyValue));
- }
-
- }
-
- Order order = Order.asc (START_TIME);
-
- return executeInfraQuery (criteria, order);
- }
-
- // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
- // (infra_active_requests table) for operationalEnvId and OperationalEnvName
- public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive (Map<String, String> orchestrationMap) {
- List <Criterion> criteria = new LinkedList <> ();
-
- // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in the filter
- // as the same requestorId can also match on different API methods
- String resourceType = orchestrationMap.get("resourceType");
- if(resourceType == null) {
- criteria.add(Restrictions.eq("requestScope", "operationalEnvironment"));
- }
-
- for (Map.Entry<String, String> entry : orchestrationMap.entrySet()) {
- String mapKey = entry.getKey();
- if(mapKey.equalsIgnoreCase("requestorId")) {
- mapKey = "requestorId";
- } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) {
- mapKey = "startTime";
- } else if(mapKey.equalsIgnoreCase("operationalEnvironmentId")) {
- mapKey = "operationalEnvId";
- } else if(mapKey.equalsIgnoreCase("operationalEnvironmentName")) {
- mapKey = "operationalEnvName";
- } else if(mapKey.equalsIgnoreCase("resourceType")) {
- mapKey = "requestScope";
- }
-
- String propertyValue = entry.getValue();
- if (mapKey.equals("startTime")) {
- SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
- try {
- Date thisDate = format.parse(propertyValue);
- Timestamp minTime = new Timestamp(thisDate.getTime());
- Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
-
- criteria.add(Restrictions.between(mapKey, minTime, maxTime));
- }
- catch (Exception e){
- msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
- return null;
- }
- } else {
- criteria.add(Restrictions.eq(mapKey, propertyValue));
- }
- }
-
- Order order = Order.asc (START_TIME);
- return executeInfraQuery (criteria, order);
- }
-
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- session.beginTransaction ();
- Criteria crit = session.createCriteria (InfraActiveRequests.class)
- .add (Restrictions.eq (queryAttributeName, queryValue));
- crit.add (Restrictions.eqOrIsNull (REQUEST_TYPE, requestType));
- crit.addOrder (Order.desc (START_TIME));
- crit.addOrder (Order.asc (SOURCE));
-
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> arList = crit.list ();
- if (arList != null && !arList.isEmpty ()) {
- return arList;
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- // msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestListFromInfraActive", null);
- }
- return null;
- }
-
-
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get infra request from DB with id " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- InfraActiveRequests ar = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter (REQUEST_TYPE, requestType);
- ar = (InfraActiveRequests) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestFromInfraActive", null);
- }
- return ar;
- }
-
-
- public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
- query.setParameter ("vnfName", vnfName);
- query.setParameter ("action", action);
- query.setParameter (REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
- }
-
- return ar;
- }
-
- public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
- query.setParameter ("vnfId", vnfId);
- query.setParameter ("action", action);
- query.setParameter (REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfId", null);
- }
-
- return ar;
- }
-
- public void setMockDB(MockRequestsDatabase mockDB) {
- RequestsDatabase.mockDB = mockDB;
- }
-
- /**
- * Fetch a specific SiteStatus by SiteName.
- *
- * @param siteName The unique name of the site
- * @return SiteStatus object or null if none found
- */
- public SiteStatus getSiteStatus (String siteName) {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- SiteStatus siteStatus = null;
- msoLogger.debug ("Request database - get Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery (hql);
- query.setParameter ("site_name", siteName);
-
- siteStatus = (SiteStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getSiteStatus - Successfully: " + siteStatus);
- }
- return siteStatus;
- }
-
- /**
- * Fetch a specific SiteStatus by SiteName.
- *
- * @param siteName The unique name of the site
- * @param status The updated status of the Site
- */
- public void updateSiteStatus (String siteName, boolean status) {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- session.beginTransaction ();
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Request database - save Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery (hql);
- query.setParameter ("site_name", siteName);
-
- SiteStatus siteStatus = (SiteStatus) query.uniqueResult ();
- if (siteStatus == null) {
- siteStatus = new SiteStatus ();
- siteStatus.setSiteName (siteName);
- siteStatus.setStatus (status);
- //siteStatus.setCreated(new Timestamp(new Date().getTime()));
- session.save (siteStatus);
- } else {
- siteStatus.setStatus(status);
- //siteStatus.setCreated(new Timestamp(new Date().getTime()));
- session.merge (siteStatus);
- }
- session.getTransaction ().commit ();
- } finally {
- session.close ();
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateSiteStatus", null);
- }
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceId the serviceId
- * @param operationId the operation id
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatus(String serviceId, String operationId) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- query.setParameter("operation_id", operationId);
- operStatus = (OperationStatus)query.uniqueResult();
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceId the serviceId
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatusByServiceId(String serviceId) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- List<Object> list = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- list = query.list();
- if(list != null && list.size() >= 1) {
- operStatus = (OperationStatus) list.get(0);
- }
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceName the serviceName
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatusByServiceName(String serviceName) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_NAME = :service_name";
- Query query = session.createQuery(hql);
- query.setParameter("service_name", serviceName);
- operStatus = (OperationStatus)query.uniqueResult();
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * update the operation status
- * <br>
- *
- * @param operstatus the operation object
- * @since ONAP Amsterdam Release
- */
- public void updateOperationStatus(OperationStatus operstatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - save Operation Status with service Id:" + operstatus.getServiceId()
- + ", operationId:" + operstatus.getOperationId());
- try {
- String hql =
- "FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", operstatus.getServiceId());
- query.setParameter("operation_id", operstatus.getOperationId());
- OperationStatus exsitingStatus = (OperationStatus)query.uniqueResult();
- if(exsitingStatus == null) {
- session.save(operstatus);
- } else {
- session.merge(operstatus);
- }
- session.getTransaction().commit();
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateOperationStatus", null);
- }
- }
-
- /**
- * get a operation status of a resource
- * <br>
- *
- * @param serviceId the service Id
- * @param operationId the operation id
- * @param resourceTemplateUUID the resource template uuid
- * @return the progress status of a resource
- * @since ONAP Amsterdam Release
- */
- public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
- String resourceTemplateUUID) {
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- ResourceOperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql =
- "FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- query.setParameter("operation_id", operationId);
- query.setParameter("uuid", resourceTemplateUUID);
- operStatus = (ResourceOperationStatus)query.uniqueResult();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * update the resource operation
- * <br>
- *
- * @param operStatus the resource operation object
- * @since ONAP Amsterdam Release
- */
- public void updateResOperStatus(ResourceOperationStatus operStatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - save Resource Operation Status with service Id:" + operStatus.getServiceId()
- + ", operationId:" + operStatus.getOperationId() + ", resourceUUId:"
- + operStatus.getResourceTemplateUUID());
- try {
- String hql =
- "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id and RESOURCE_TEMPLATE_UUID = :res_uuid";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", operStatus.getServiceId());
- query.setParameter("operation_id", operStatus.getOperationId());
- query.setParameter("res_uuid", operStatus.getResourceTemplateUUID());
- ResourceOperationStatus exsitingStatus = (ResourceOperationStatus)query.uniqueResult();
- if(exsitingStatus == null) {
- session.save(operStatus);
- } else {
- session.merge(operStatus);
- }
- session.getTransaction().commit();
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateResOperStatus", null);
- }
- updateOperationStatusBasedOnResourceStatus(operStatus);
- }
-
- /**
- * update service operation status when a operation resource status updated
- * <br>
- *
- * @param operStatus the resource operation status
- * @since ONAP Amsterdam Release
- */
- private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - query Resource Operation Status with service Id:"
- + operStatus.getServiceId() + ", operationId:" + operStatus.getOperationId());
- try {
- // query all resources of the service
- String hql = "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", operStatus.getServiceId());
- query.setParameter("operation_id", operStatus.getOperationId());
- @SuppressWarnings("unchecked")
- List<ResourceOperationStatus> lstResourceStatus = (List<ResourceOperationStatus>)query.list();
- // count the total progress
- int resourceCount = lstResourceStatus.size();
- int progress = 0;
- boolean isFinished = true;
- for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) {
- progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount;
- if (Status.PROCESSING.equals(lstResourceStatu.getStatus())) {
- isFinished = false;
- }
- }
- OperationStatus serviceOperStatus =
- getOperationStatus(operStatus.getServiceId(), operStatus.getOperationId());
- progress = progress > 100 ? 100 : progress;
- serviceOperStatus.setProgress(String.valueOf(progress));
- serviceOperStatus.setOperationContent(operStatus.getStatusDescription());
- // if current resource failed. service failed.
- if(RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) {
- serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR);
- serviceOperStatus.setReason(operStatus.getStatusDescription());
- } else if(isFinished) {
- // if finished
- serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED);
- serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED);
- }
- updateOperationStatus(serviceOperStatus);
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateResOperStatus", null);
- }
- }
-
- public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM InfraActiveRequests WHERE operationalEnvId = :operationalEnvId AND requestStatus != 'COMPLETE' AND action = 'create' ORDER BY startTime DESC");
- query.setParameter ("operationalEnvId", operationalEnvironmentId);
-
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
- }
-
- return ar;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java
deleted file mode 100644
index 674867af65..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.requestsdb;
-
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import java.net.URL;
-
-public class RequestsDbSessionFactoryManager extends AbstractSessionFactoryManager {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
-
- @Override
- protected URL getHibernateConfigFile() {
- try {
-
- if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) {
- return this.getClass().getClassLoader().getResource("hibernate-requests-core-mysql.cfg.xml");
- } else {
- LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC");
- return null;
- }
- } catch (Exception ex) {
- LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex);
- return null;
- }
-
- }
-} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java
deleted file mode 100644
index 3685093740..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import org.openecomp.mso.logger.MsoLogger;
-
-import java.sql.Timestamp;
-
-
-public class SiteStatus {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
- private boolean status;
- private String siteName = null;
- private Timestamp created = null;
-
- public SiteStatus() {
- }
-
- public Timestamp getCreated() {
- return created;
- }
-
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
- public String getSiteName() {
- return siteName;
- }
-
- public void setSiteName(String siteName) {
- this.siteName = siteName;
- }
-
- public void setStatus(boolean status) {
- this.status = status;
- }
-
- public boolean getStatus() {
- return status;
- }
-
- @Override
- public String toString() {
- return "SiteStatus{" +
- "status=" + status +
- ", siteName='" + siteName + '\'' +
- ", created=" + created +
- '}';
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java
deleted file mode 100644
index 10114348a0..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogComponentDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String COMPONENT_NAME = "componentName";
- protected static final String COMPONENT_DISTRIBUTION_STATUS = "componentDistributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static WatchdogComponentDistributionStatusDb getInstance() {
- return new WatchdogComponentDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogComponentDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into watchdog_per_component_distribution_status.
- *
- * @param distributionId
- * @param componentName
- * @param componentDistributionStatus
- * @return void
- */
- public void insertWatchdogComponentDistributionStatus(String distributionId, String componentName, String componentDistributionStatus ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogPerComponentDistributionStatus for DistributionId: " + distributionId + " ComponentName: " + componentName + " and ComponentDistributionStatus: " + componentDistributionStatus);
-
- List<WatchdogComponentDistributionStatus> componentList = getWatchdogComponentDistributionStatus(distributionId, componentName);
-
- if((componentList == null) || componentList.isEmpty())
- {
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogComponentDistributionStatus wdcds = new WatchdogComponentDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- wdcds.setDistributionId (distributionId);
- wdcds.setComponentName (componentName);
- wdcds.setComponentDistributionStatus (componentDistributionStatus);
- wdcds.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- wdcds.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogPerComponentDistributionStatus");
-
- session.save (wdcds);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogComponentDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogComponentDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogComponentDistributionStatusDB", "insertWatchdogComponentDistributionStatus", null);
- }
- }
-
- }
-
- /**
- * Retrieve records from WatchdogComponentDistributionStatus.
- *
- * @param distributionId
- * @return WatchdogComponentDistributionStatus
- */
- @SuppressWarnings("unchecked")
- public List<WatchdogComponentDistributionStatus> getWatchdogComponentDistributionStatus(String distributionId) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<WatchdogComponentDistributionStatus>();
- msoLogger.debug("Request database - getWatchdogComponentDistributionStatus:" + distributionId);
- try {
- String hql = "FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentDistributionStatus - Successfully");
- }
- return results;
- }
-
- /**
- * Retrieve records from WatchdogComponentDistributionStatus.
- *
- * @param distributionId
- * @param componentName
- * @return WatchdogComponentDistributionStatus
- */
- @SuppressWarnings("unchecked")
- public List<WatchdogComponentDistributionStatus> getWatchdogComponentDistributionStatus(String distributionId, String componentName) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<WatchdogComponentDistributionStatus>();
- msoLogger.debug("Request database - getWatchdogComponentDistributionStatus:" + distributionId + " and componentName:" + componentName);
- try {
- String hql = "FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId AND componentName = :componentName";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- query.setParameter("componentName", componentName);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentDistributionStatus by ComponentName - Successfully");
- }
- return results;
- }
-
- /**
- * Retrieve records from getWatchdogComponentNames.
- *
- * @param distributionId
- * @return String
- */
- @SuppressWarnings("unchecked")
- public List<String> getWatchdogComponentNames(String distributionId) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<String> results = new ArrayList<String>();
- msoLogger.debug("Request database - getWatchdogComponentNames:" + distributionId);
- try {
- String hql = "Select componentName FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentNames - Successfully");
- }
- return results;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java
deleted file mode 100644
index deb2b6824d..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-public class WatchdogDistributionStatus implements Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -4449711060885719079L;
-
-
- private String distributionId = null;
- private String distributionIdStatus = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
-
-
- public String getDistributionId() {
- return distributionId;
- }
-
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
- }
-
- public String getDistributionIdStatus() {
- return distributionIdStatus;
- }
-
- public void setDistributionIdStatus(String distributionIdStatus) {
- this.distributionIdStatus = distributionIdStatus;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java
deleted file mode 100644
index f1fab18df0..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String DISTRIBUTION_ID_STATUS = "distributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static WatchdogDistributionStatusDb getInstance() {
- return new WatchdogDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into WATCHDOG_DISTRIBUTIONID_STATUS.
- *
- * @param distributionId
- * @return void
- */
- public void insertWatchdogDistributionId(String distributionId ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogDistributionStatus - DistributionId: " + distributionId);
-
- if(getWatchdogDistributionId(distributionId) == null){
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogDistributionStatus wds = new WatchdogDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- wds.setDistributionId (distributionId);
- wds.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- wds.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogDistributionStatus ");
-
- session.save (wds);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogDistributionId", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogDistributionStatusDB", "insertWatchdogDistributionId", null);
- }
-
- }
-
- }
-
-
- /**
- * Update WATCHDOG_DISTRIBUTIONID_STATUS with new status for a given distributionid.
- *
- * @param distributionId
- * @param distributionStatus
- * @return void
- */
- public void updateWatchdogDistributionIdStatus(String distributionId, String distributionIdStatus ) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update WatchdogDistributionStatus status with distributionId: " + distributionId + " and distributionStatus: " + distributionIdStatus );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update WatchdogDistributionStatus set distributionIdStatus = :distributionIdStatus where "
- + "distributionId = :distributionId ");
-
- query.setParameter ("distributionId", distributionId);
- query.setParameter ("distributionIdStatus", distributionIdStatus);
-
- //Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- //query.setParameter ("modifyTime", modifyTimeStamp);
- query.executeUpdate ();
- session.getTransaction ().commit ();
-
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in updateWatchdogDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogDistributionStatusDB", "insertWatchdogDistributionStatus", null);
- }
- }
-
- /**
- * Retrieve records from WatchdogDistributionIdStatus.
- *
- * @param distributionId
- * @return WatchdogDistributionIdStatus
- */
- public String getWatchdogDistributionIdStatus(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve records from WatchdogDistributionStatus for distributionId : " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String distributionStatus = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("SELECT distributionIdStatus FROM WatchdogDistributionStatus WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- distributionStatus = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogDistributionStatusDB", "getWatchdogDistributionIdStatus", null);
- }
- return distributionStatus;
- }
-
- /**
- * Retrieve records from WatchdogDistributionId.
- *
- * @param distributionId
- * @return WatchdogDistributionIdStatus
- */
- public String getWatchdogDistributionId(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve distributionId from WatchdogDistributionStatus for distributionId : " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String existingDistributionId = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("SELECT distributionId FROM WatchdogDistributionStatus WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- existingDistributionId = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogDistributionStatusDB", "getWatchdogDistributionIdStatus", null);
- }
- return existingDistributionId;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java
deleted file mode 100644
index f081bbf55c..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogServiceModVerIdLookupDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String CREATE_TIME = "startTime";
-
-
- public static WatchdogServiceModVerIdLookupDb getInstance() {
- return new WatchdogServiceModVerIdLookupDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogServiceModVerIdLookupDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP.
- *
- * @param distributionId
- * @param serviceModelVersionId
- * @return void
- */
- public void insertWatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogServiceModVerIdLookup for DistributionId: " + distributionId + " and ServiceModelVersionId: " + serviceModelVersionId );
-
- if(getWatchdogServiceModVerId(distributionId) == null){
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogServiceModVerIdLookup wdsm = new WatchdogServiceModVerIdLookup ();
-
- try {
- session.beginTransaction ();
-
- wdsm.setDistributionId (distributionId);
- wdsm.setServiceModelVersionId (serviceModelVersionId);
- wdsm.setCreateTime (startTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogServiceModVerIdLookup");
-
- session.save (wdsm);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogServiceModVerIdLookup", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogServiceModVerIdLookupDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogServiceModVerIdLookupDB", "insertWatchdogServiceModVerIdLookup", null);
- }
- }
-
- }
-
- /**
- * Retrieve from WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP.
- *
- * @param distributionId
- * @return WatchdogServiceModVerIdLookup
- */
- public String getWatchdogServiceModVerId(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve WatchdogServiceModVerIdLookup with distributionId: " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String serviceModelVersionId = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("Select serviceModelVersionId FROM WatchdogServiceModVerIdLookup WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- serviceModelVersionId = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogServiceModVerIdLookupDB", "getWatchdogServiceModVerId", null);
- }
- return serviceModelVersionId;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
deleted file mode 100644
index 79ead1de15..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.InfraActiveRequests" table="INFRA_ACTIVE_REQUESTS">
- <id name="requestId" type="string">
- <column name="REQUEST_ID" length="45"/>
- <generator class="assigned"/>
- </id>
- <property name="clientRequestId" type="string" unique="true">
- <column name="CLIENT_REQUEST_ID" length="45" unique="true"/>
- </property>
- <property name="action" type="string">
- <column name="ACTION" length="45" not-null="true"/>
- </property>
- <property name="requestStatus" type="string">
- <column name="REQUEST_STATUS" length="20"/>
- </property>
- <property name="statusMessage" type="string">
- <column name="STATUS_MESSAGE" length="2000"/>
- </property>
- <property name="progress" type="java.lang.Long">
- <column name="PROGRESS" precision="11" scale="0"/>
- </property>
- <property name="startTime" type="timestamp">
- <column name="START_TIME"/>
- </property>
- <property name="endTime" type="timestamp">
- <column name="END_TIME"/>
- </property>
- <property name="source" type="string">
- <column name="SOURCE" length="45"/>
- </property>
- <property name="vnfId" type="string">
- <column name="VNF_ID" length="45"/>
- </property>
- <property name="vnfName" type="string">
- <column name="VNF_NAME" length="80"/>
- </property>
- <property name="vnfType" type="string">
- <column name="VNF_TYPE" length="200"/>
- </property>
- <property name="serviceType" type="string">
- <column name="SERVICE_TYPE" length="45"/>
- </property>
- <property name="aicNodeClli" type="string">
- <column name="AIC_NODE_CLLI" length="11"/>
- </property>
- <property name="tenantId" type="string">
- <column name="TENANT_ID" length="45"/>
- </property>
- <property name="provStatus" type="string">
- <column name="PROV_STATUS" length="20"/>
- </property>
- <property name="vnfParams" type="text">
- <column name="VNF_PARAMS"/>
- </property>
- <property name="vnfOutputs" type="text">
- <column name="VNF_OUTPUTS"/>
- </property>
- <property name="requestBody" type="text">
- <column name="REQUEST_BODY"/>
- </property>
- <property name="responseBody" type="text">
- <column name="RESPONSE_BODY"/>
- </property>
- <property name="lastModifiedBy" type="string">
- <column name="LAST_MODIFIED_BY" length="50"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
- <property name="requestType" type="string">
- <column name="REQUEST_TYPE" length="20"/>
- </property>
- <property name="volumeGroupId" type="string">
- <column name="VOLUME_GROUP_ID" length="45"/>
- </property>
- <property name="volumeGroupName" type="string">
- <column name="VOLUME_GROUP_NAME" length="45"/>
- </property>
- <property name="vfModuleId" type="string">
- <column name="VF_MODULE_ID" length="45"/>
- </property>
- <property name="vfModuleName" type="string">
- <column name="VF_MODULE_NAME" length="200"/>
- </property>
- <property name="vfModuleModelName" type="string">
- <column name="VF_MODULE_MODEL_NAME" length="200"/>
- </property>
- <property name="aaiServiceId" type="string">
- <column name="AAI_SERVICE_ID" length="50"/>
- </property>
- <property name="aicCloudRegion" type="string">
- <column name="AIC_CLOUD_REGION" length="200"/>
- </property>
- <property name="callBackUrl" type="string">
- <column name="CALLBACK_URL" length="200"/>
- </property>
- <property name="correlator" type="string">
- <column name="CORRELATOR" length="80"/>
- </property>
- <property name="serviceInstanceId" type="string">
- <column name="SERVICE_INSTANCE_ID" length="45"/>
- </property>
- <property name="serviceInstanceName" type="string">
- <column name="SERVICE_INSTANCE_NAME" length="80"/>
- </property>
- <property name="requestScope" type="string">
- <column name="REQUEST_SCOPE" length="45"/>
- </property>
- <property name="requestAction" type="string">
- <column name="REQUEST_ACTION" length="45" not-null="true"/>
- </property>
- <property name="networkId" type="string">
- <column name="NETWORK_ID" length="45"/>
- </property>
- <property name="networkName" type="string">
- <column name="NETWORK_NAME" length="80"/>
- </property>
- <property name="networkType" type="string">
- <column name="NETWORK_TYPE" length="80"/>
- </property>
- <property name="requestorId" type="string">
- <column name="REQUESTOR_ID" length="80"/>
- </property>
- <property name="configurationId" type="string">
- <column name="CONFIGURATION_ID" length="45"/>
- </property>
- <property name="configurationName" type="string">
- <column name="CONFIGURATION_NAME" length="200"/>
- </property>
- <property name="operationalEnvId" type="string">
- <column name="OPERATIONAL_ENV_ID" length="45"/>
- </property>
- <property name="operationalEnvName" type="string">
- <column name="OPERATIONAL_ENV_NAME" length="200"/>
- </property>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
deleted file mode 100644
index 44094a1394..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="OperationStatus" table="OPERATION_STATUS">
- <meta attribute="class-description">
- This class describes a operation status
- </meta>
- <composite-id>
- <key-property name="serviceId" type="string" column="SERVICE_ID"/>
- <key-property name="operationId" column="OPERATION_ID" type="string" length="256"/>
- </composite-id>
- <property name="serviceName" column="SERVICE_NAME" type="string" length="256"/>
- <property name="operation" column="OPERATION_TYPE" type="string" length="256"/>
- <property name="userId" column="USER_ID" type="string" length="256"/>
- <property name="result" column="RESULT" type="string" length="256"/>
- <property name="operationContent" column="OPERATION_CONTENT" type="string" length="256"/>
- <property name="progress" column="PROGRESS" type="string" length="256"/>
- <property name="reason" column="REASON" type="string" length="256"/>
- <property name="operateAt" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
- <column name="OPERATE_AT" default="CURRENT_TIMESTAMP"/>
- </property>
- <property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="always" insert="false" update="false"/>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml
deleted file mode 100644
index 08e60b2641..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus" table="ACTIVATE_OPERATIONAL_ENV_PER_DISTRIBUTIONID_STATUS">
-
- <id name="distributionId" type="string">
- <column name="DISTRIBUTION_ID" length="45"/>
- <generator class="assigned"/>
- </id>
-
- <property name="operationalEnvId" type="string">
- <column name="OPERATIONAL_ENV_ID" length="45"/>
- </property>
- <property name="serviceModelVersionId" type="string">
- <column name="SERVICE_MODEL_VERSION_ID" length="45"/>
- </property>
- <property name="distributionIdStatus" type="string">
- <column name="DISTRIBUTION_ID_STATUS" length="45" />
- </property>
- <property name="distributionIdErrorReason" type="string">
- <column name="DISTRIBUTION_ID_ERROR_REASON" length="250" />
- </property>
- <property name="requestId" type="string">
- <column name="REQUEST_ID" length="45" />
- </property>
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml
deleted file mode 100644
index 99a6232e0e..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus" table="ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS">
-
- <composite-id>
- <key-property name="operationalEnvId" column="OPERATIONAL_ENV_ID" type="string" length="45" />
- <key-property name="serviceModelVersionId" column="SERVICE_MODEL_VERSION_ID" type="string" length="45"/>
- <key-property name="requestId" column="REQUEST_ID" type="string" length="45"/>
- </composite-id>
-
- <property name="serviceModelVersionDistrStatus" type="string">
- <column name="SERVICE_MOD_VER_FINAL_DISTR_STATUS" length="45"/>
- </property>
- <property name="recoveryAction" type="string">
- <column name="RECOVERY_ACTION" length="30" />
- </property>
- <property name="retryCount" type="integer">
- <column name="RETRY_COUNT_LEFT"/>
- </property>
- <property name="workloadContext" type="string">
- <column name="WORKLOAD_CONTEXT" length="80" />
- </property>
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
deleted file mode 100644
index 22d147402d..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="ResourceOperationStatus" table="RESOURCE_OPERATION_STATUS">
- <meta attribute="class-description">
- This class describes a progress status
- </meta>
- <composite-id>
- <key-property name="serviceId" type="string" column="SERVICE_ID"/>
- <key-property name="operationId" type="string" column="OPERATION_ID" length="256"/>
- <key-property name="resourceTemplateUUID" type="string" column="RESOURCE_TEMPLATE_UUID"/>
- </composite-id>
- <property name="operType" column="OPER_TYPE" type="string" length="256"/>
- <property name="resourceInstanceID" column="RESOURCE_INSTANCE_ID" type="string" length="256"/>
- <property name="jobId" column="JOB_ID" type="string" length="256"/>
- <property name="status" column="STATUS" type="string" length="256"/>
- <property name="progress" column="PROGRESS" type="string" length="256"/>
- <property name="errorCode" column="ERROR_CODE" type="string" length="256"/>
- <property name="statusDescription" column="STATUS_DESCRIPOTION" type="string" length="256"/>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
deleted file mode 100644
index f755ad0b0b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="SiteStatus" table="SITE_STATUS">
- <meta attribute="class-description">
- This class describes a Site Status
- </meta>
-
- <id name="siteName" type="string" column="SITE_NAME"/>
-
- <property name="status" column="STATUS" type="boolean" length="256"/>
- <property name="created" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
- <column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
- </property>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml
deleted file mode 100644
index ea66153157..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatus" table="WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS">
-
- <composite-id>
- <key-property name="distributionId" column="DISTRIBUTION_ID" type="string" length="45" />
- <key-property name="componentName" column="COMPONENT_NAME" type="string" length="45"/>
- </composite-id>
-
- <property name="componentDistributionStatus" type="string">
- <column name="COMPONENT_DISTRIBUTION_STATUS" length="45" />
- </property>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml
deleted file mode 100644
index 2da3071c71..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogDistributionStatus" table="WATCHDOG_DISTRIBUTIONID_STATUS">
-
- <id name="distributionId" type="string">
- <column name="DISTRIBUTION_ID" length="45"/>
- <generator class="assigned"/>
- </id>
-
- <property name="distributionIdStatus" type="string">
- <column name="DISTRIBUTION_ID_STATUS" length="45" />
- </property>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml
deleted file mode 100644
index b6b1d9bf58..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogServiceModVerIdLookup" table="WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP">
-
- <composite-id>
- <key-property name="distributionId" column="DISTRIBUTION_ID" type="string" length="45" />
- <key-property name="serviceModelVersionId" column="SERVICE_MODEL_VERSION_ID" type="string" length="45"/>
- </composite-id>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml b/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml
new file mode 100644
index 0000000000..cd1bc8b7d7
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/data/jpa
+ http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
+
+ <jpa:repositories base-package="org.onap.so.db.request.data.repository" />
+
+</beans> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml b/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
deleted file mode 100644
index 1305dfb97b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
- <session-factory>
- <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
- <property name="hibernate.show_sql">false</property>
- <property name="hibernate.format_sql">true</property>
- <property name="connection.datasource">java:jboss/datasources/mso-requests</property>
-
-<!-- <property name="hibernate.hbm2ddl.auto">create</property> -->
-
- <mapping resource="InfraActiveRequests.hbm.xml"></mapping>
- <mapping resource="OperationalEnvServiceModelStatus.hbm.xml"></mapping>
- <mapping resource="OperationalEnvDistributionStatus.hbm.xml"></mapping>
- <mapping resource="OperationStatus.hbm.xml"></mapping>
- <mapping resource="ResourceOperationStatus.hbm.xml"></mapping>
- <mapping resource="SiteStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogDistributionStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogComponentDistributionStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogServiceModVerIdLookup.hbm.xml"></mapping>
- </session-factory>
-</hibernate-configuration>
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java
index a26f417634..ec2c41bf8c 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestDatabaseTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.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.
@@ -18,23 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-
-public class RequestDatabaseTest {
-
- @Test
- public void testCheckVnfIdStatus() {
- RequestsDatabase reqDb = mock(RequestsDatabase.class);
- when(reqDb.checkVnfIdStatus(any(String.class))).thenReturn(new InfraActiveRequests());
-
- InfraActiveRequests response = reqDb.checkVnfIdStatus("123456");
- assertNotNull(response);
- }
-}
+package org.onap.so;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Profile;
+
+@SpringBootApplication(scanBasePackages = { "org.onap" })
+@Profile("test")
+public class TestApplication {
+ public static void main(String... args) {
+ SpringApplication.run(TestApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java
new file mode 100644
index 0000000000..a10d948b8f
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Date;
+
+import javax.transaction.Transactional;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationStatusId;
+import org.onap.so.db.request.data.repository.OperationStatusRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class OperationStatusTest {
+
+ @Autowired
+ private OperationStatusRepository repository;
+
+ @Test
+ @Transactional
+ public void timeStampCreated() throws InterruptedException {
+
+ final String testServiceId = "test-service-id";
+ final String testOperationId = "test-operation-id";
+ final OperationStatusId id = new OperationStatusId(testServiceId, testOperationId);
+ OperationStatus status = new OperationStatus();
+
+ status.setServiceId(testServiceId);
+ status.setOperationId(testOperationId);
+
+ status = repository.saveAndFlush(status);
+
+ OperationStatus found = repository.findOne(id);
+
+ Date operateAt = found.getOperateAt();
+ assertNotNull(operateAt);
+ assertEquals(testServiceId, found.getServiceId());
+ Date finishedAt = found.getFinishedAt();
+ status.setProgress("test-progress");
+ //timestamps only set to save on 1 second changes
+ Thread.sleep(1000);
+ repository.saveAndFlush(status);
+
+ OperationStatus foundUpdate = repository.findOne(id);
+
+ assertEquals(operateAt.toString(), foundUpdate.getOperateAt().toString());
+ assertNotNull(foundUpdate.getFinishedAt());
+ assertNotEquals(finishedAt.toString(), foundUpdate.getFinishedAt().toString());
+ assertEquals("test-progress", foundUpdate.getProgress());
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
new file mode 100644
index 0000000000..c12d3cbb7b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.domain.Example;
+import org.springframework.data.domain.ExampleMatcher;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class OperationalEnvServiceModelStatusTest {
+
+ @Autowired
+ private OperationalEnvServiceModelStatusRepository repository;
+
+
+ @Test
+ public void updateWithoutAllKeys() throws Exception {
+
+ OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus();
+ status.setRequestId("request-id-1");
+ status.setOperationalEnvId("oper-env-id-1");
+ status.setServiceModelVersionId("service-model-ver-id-1");
+ status.setRetryCount(0);
+
+ repository.saveAndFlush(status);
+ OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionId("oper-env-id-1", "service-model-ver-id-1");
+ status2.setRetryCount(1);
+
+ repository.saveAndFlush(status2);
+
+ OperationalEnvServiceModelStatus status3 = new OperationalEnvServiceModelStatus();
+
+ status3.setRequestId("request-id-2");
+ status3.setOperationalEnvId("oper-env-id-1");
+ status3.setServiceModelVersionId("service-model-ver-id-2");
+ status3.setRetryCount(2);
+
+ repository.saveAndFlush(status3);
+
+ OperationalEnvServiceModelStatus exampleObj = new OperationalEnvServiceModelStatus();
+ exampleObj.setOperationalEnvId("oper-env-id-1");
+ exampleObj.setServiceModelVersionId("service-model-ver-id-1");
+ ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("requestId");
+ OperationalEnvServiceModelStatus foundStatus = repository.findOne(Example.of(exampleObj,matcher));
+ if(foundStatus== null)
+ throw new Exception("No status found");
+
+ assertEquals(new Integer(1), foundStatus.getRetryCount());
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java
new file mode 100644
index 0000000000..9bcff13699
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+ basePackages = { "org.onap.so.db.request.data.repository" }
+ )
+public class RequestDBConfig {
+
+ @Primary
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Primary
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.request.beans")
+ .persistenceUnit("requestDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java
new file mode 100644
index 0000000000..917f52d4ad
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.transaction.Transactional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.request.beans.SiteStatus;
+import org.onap.so.db.request.data.repository.SiteStatusRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.domain.Example;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort.Direction;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class SiteStatusTest {
+
+ @Autowired
+ private SiteStatusRepository repository;
+
+ @Test
+ @Transactional
+ public void timeStampCreated() throws InterruptedException {
+ SiteStatus found = repository.findOne("test name4");
+ assertNotNull(found.getCreated());
+ assertEquals("test name4", found.getSiteName());
+ }
+
+ @Test
+ public void sortByCreated() {
+
+ final PageRequest page1 = new PageRequest(
+ 0, 20, Direction.DESC, "created"
+ );
+
+ SiteStatus example = new SiteStatus();
+ example.setStatus(true);
+ Page<SiteStatus> found = repository.findAll(Example.of(example), page1);
+
+ assertEquals("test name4", found.getContent().get(0).getSiteName());
+
+ }
+
+ @Test
+ public void updateStatus() {
+
+ SiteStatus status = repository.findOne("test name update");
+ status.setStatus(false);
+
+ repository.saveAndFlush(status);
+
+ assertEquals(false, repository.findOne("test name update").getStatus());
+
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java
new file mode 100644
index 0000000000..3f9443ff4a
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation;
+
+import javax.persistence.Temporal;
+
+import org.junit.Test;
+import org.onap.so.openpojo.rules.CustomSetterMustExistRule;
+import org.onap.so.openpojo.rules.EqualsAndHashCodeTester;
+import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule;
+import org.onap.so.openpojo.rules.HasToStringRule;
+import org.onap.so.openpojo.rules.ToStringTester;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class BeansTest {
+
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.db.request.beans");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new GetterMustExistRule())
+ .with(new CustomSetterMustExistRule().exclude(hasAnnotation(Temporal.class)))
+ .with(new HasEqualsAndHashCodeRule())
+ .with(new HasToStringRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .with(new EqualsAndHashCodeTester())
+ .with(new ToStringTester())
+ .build();
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterEnum());
+ }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java
deleted file mode 100644
index 33f1fbbb76..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-
-import org.junit.Test;
-
-public class InfraRequestsTest {
-
- InfraRequests ir=new InfraRequests();
- InfraRequests ir1=new InfraRequests("requestId", "action");
- Timestamp time=new Timestamp(123);
- long progress=111;
- @Test
- public void test() {
- ir.setAaiServiceId("aaiServiceId");
- ir.setAction("action");
- ir.setAicCloudRegion("aicCloudRegion");
- ir.setAicNodeClli("aicNodeClli");
- ir.setCallBackUrl("callBackUrl");
- ir.setClientRequestId("clientRequestId");
- ir.setConfigurationId("configurationId");
- ir.setConfigurationName("configurationName");
- ir.setCorrelator("correlator");
- ir.setEndTime(time);
- ir.setLastModifiedBy("lastModifiedBy");
- ir.setModifyTime(time);
- ir.setNetworkId("networkId");
- ir.setNetworkName("networkName");
- ir.setNetworkType("networkType");
- ir.setOperationalEnvId("operationalEnvId");
- ir.setOperationalEnvName("operationalEnvName");
- ir.setProgress(progress);
- ir.setProvStatus("provStatus");
- ir.setRequestAction("requestAction");
- ir.setRequestBody("requestBody");
- ir.setRequestId("requestId");
- ir.setRequestorId("requestorId");
- ir.setRequestScope("requestScope");
- ir.setRequestStatus("requestStatus");
- ir.setRequestType("requestType");
- ir.setResponseBody("responseBody");
- ir.setServiceInstanceId("serviceInstanceId");
- ir.setServiceInstanceName("serviceInstanceName");
- ir.setServiceType("serviceType");
- ir.setSource("source");
- ir.setStartTime(time);
- ir.setStatusMessage("statusMessage");
- ir.setTenantId("tenantId");
- ir.setVfModuleId("vfModuleId");
- ir.setVfModuleModelName("vfModuleModelName");
- ir.setVfModuleName("vfModuleName");
- ir.setVnfId("vnfId");
- ir.setVnfName("vnfName");
- ir.setVnfOutputs("vnfOutputs");
- ir.setVnfParams("vnfParams");
- ir.setVnfType("vnfType");
- ir.setVolumeGroupId("volumeGroupId");
- ir.setVolumeGroupName("volumeGroupName");
-
- assertEquals(ir.getAaiServiceId(), "aaiServiceId");
- assertEquals(ir.getAction(),"action");
- assertEquals(ir.getAicCloudRegion(),"aicCloudRegion");
- assertEquals(ir.getAicNodeClli(),"aicNodeClli");
- assertEquals(ir.getCallBackUrl(),"callBackUrl");
- assertEquals(ir.getClientRequestId(),"clientRequestId");
- assertEquals(ir.getConfigurationId(),"configurationId");
- assertEquals(ir.getConfigurationName(),"configurationName");
- assertEquals(ir.getCorrelator(),"correlator");
- assertEquals(ir.getEndTime(),time);
- assertEquals(ir.getLastModifiedBy(),"lastModifiedBy");
- assertEquals(ir.getModifyTime(),time);
- assertEquals(ir.getNetworkId(),"networkId");
- assertEquals(ir.getNetworkName(),"networkName");
- assertEquals(ir.getNetworkType(),"networkType");
- assertEquals(ir.getOperationalEnvId(),"operationalEnvId");
- assertEquals(ir.getOperationalEnvName(),"operationalEnvName");
- assert(ir.getProgress().equals(progress));
- assertEquals(ir.getProvStatus(),"provStatus");
- assertEquals(ir.getRequestAction(),"requestAction");
- assertEquals(ir.getRequestBody(),"requestBody");
- assertEquals(ir.getRequestId(),"requestId");
- assertEquals(ir.getRequestorId(),"requestorId");
- assertEquals(ir.getRequestScope(),"requestScope");
- assertEquals(ir.getRequestStatus(),"requestStatus");
- assertEquals(ir.getRequestType(),"requestType");
- assertEquals(ir.getResponseBody(),"responseBody");
- assertEquals(ir.getServiceInstanceId(),"serviceInstanceId");
- assertEquals(ir.getServiceInstanceName(),"serviceInstanceName");
- assertEquals(ir.getServiceType(),"serviceType");
- assertEquals(ir.getSource(),"source");
- assertEquals(ir.getStartTime(),time);
- assertEquals(ir.getStatusMessage(),"statusMessage");
- assertEquals(ir.getTenantId(),"tenantId");
- assertEquals(ir.getVfModuleId(),"vfModuleId");
- assertEquals(ir.getVfModuleModelName(),"vfModuleModelName");
- assertEquals(ir.getVfModuleName(),"vfModuleName");
- assertEquals(ir.getVnfId(),"vnfId");
- assertEquals(ir.getVnfName(),"vnfName");
- assertEquals(ir.getVnfOutputs(),"vnfOutputs");
- assertEquals(ir.getVnfParams(),"vnfParams");
- assertEquals(ir.getVnfType(),"vnfType");
- assertEquals(ir.getVolumeGroupId(),"volumeGroupId");
- assertEquals(ir.getVolumeGroupName(),"volumeGroupName");
-
- }
-
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java
deleted file mode 100644
index cf18524ee1..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.*;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class OperationStatusTest {
-
- OperationStatus os=new OperationStatus();
- Timestamp time=new Timestamp(10);
- Object obj=new Object();
- @Test
- public void test() {
- os.setFinishedAt(time);
- os.setOperateAt(time);
- os.setOperation("operation");
- os.setOperationContent("operationContent");
- os.setOperationId("operationId");
- os.setProgress("progress");
- os.setReason("reason");
- os.setResult("result");
- os.setServiceId("serviceId");
- os.setServiceName("serviceName");
- os.setUserId("userId");
-
- assertEquals(os.getFinishedAt(), time);
- assertEquals(os.getOperateAt(), time);
- assertEquals(os.getOperation(), "operation");
- assertEquals(os.getOperationContent(), "operationContent");
- assertEquals(os.getOperationId(), "operationId");
- assertEquals(os.getProgress(), "progress");
- assertEquals(os.getReason(), "reason");
- assertEquals(os.getResult(), "result");
- assertEquals(os.getServiceId(), "serviceId");
- assertEquals(os.getServiceName(), "serviceName");
- assertEquals(os.getUserId(), "userId");
-
- os.equals(obj);
- os.hashCode();
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDbTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDbTest.java
deleted file mode 100644
index 89213f9948..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDbTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-
-public class OperationalEnvDistributionStatusDbTest {
- @Mock
- private AbstractSessionFactoryManager sessionFactoryRequest;
- @Mock
- private SessionFactory sessionFactory;
- @Mock
- private Session session;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(sessionFactory.openSession()).thenReturn(session);
- when(sessionFactoryRequest.getSessionFactory()).thenReturn(sessionFactory);
-
- }
-
- @Test
- public void insertFailure() {
- OperationalEnvDistributionStatusDb omsDB = new OperationalEnvDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- omsDB.insertOperationalEnvDistributionStatus("myDistId", "myEnvId", "myModelVerId", "myDistIdStatus", "myReqId");
- }
-
- @Test
- public void updateFailureRetryCount() {
- OperationalEnvDistributionStatusDb omsDB = new OperationalEnvDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- omsDB.updateOperationalEnvDistributionStatus("asdcStatus", "myDistId", "myEnvId", "myVerId");
- }
-
- @Test
- public void getOperationalEnvIdStatusTest() {
- OperationalEnvDistributionStatusDb omsDB = new OperationalEnvDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- OperationalEnvDistributionStatus status = new OperationalEnvDistributionStatus();
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(status);
- when(session.isOpen()).thenReturn(true);
- assertEquals(status, omsDB.getOperationalEnvDistributionStatusPerReqId("myDistId", "myReqId"));
- }
-
- @Test
- public void getOperationalEnvServiceModelStatusTest() {
- OperationalEnvDistributionStatusDb omsDB = new OperationalEnvDistributionStatusDb(this.sessionFactoryRequest);
- OperationalEnvDistributionStatus status = new OperationalEnvDistributionStatus();
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(status);
- when(session.isOpen()).thenReturn(true);
- assertEquals(status, omsDB.getOperationalEnvDistributionStatus("myDistId"));
- }
-} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java
deleted file mode 100644
index 6381ec63b9..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import java.sql.Timestamp;
-
-public class OperationalEnvDistributionStatusTest {
-
- OperationalEnvDistributionStatus oeds=new OperationalEnvDistributionStatus();
- Timestamp time=new Timestamp(10);
- @Test
- public void test(){
- oeds.setCreateTime(time);
- oeds.setDistributionId("distributionId");
- oeds.setDistributionIdErrorReason("distributionIdErrorReason");
- oeds.setDistributionIdStatus("distributionIdStatus");
- oeds.setModifyTime(time);
- oeds.setOperationalEnvId("operationalEnvId");
- oeds.setRequestId("requestId");
- oeds.setServiceModelVersionId("serviceModelVersionId");
-
- assertEquals(oeds.getCreateTime(), time);
- assertEquals(oeds.getDistributionId(), "distributionId");
- assertEquals(oeds.getDistributionIdErrorReason(), "distributionIdErrorReason");
- assertEquals(oeds.getDistributionIdStatus(), "distributionIdStatus");
- assertEquals(oeds.getModifyTime(),time);
- assertEquals(oeds.getOperationalEnvId(), "operationalEnvId");
- assertEquals(oeds.getRequestId(), "requestId");
- assertEquals(oeds.getServiceModelVersionId(), "serviceModelVersionId");
- }
-}
-
- /*protected String _distributionId;
- protected String _operationalEnvId;
- protected String _serviceModelVersionId;
- protected String _requestId;
- protected String _distributionIdStatus;
- protected String _distributionIdErrorReason;
- protected Timestamp _createTime;
- protected Timestamp _modifyTime;
-
- public OperationalEnvDistributionStatusTest() {
- }
-
- @Before
- public void setUp() {
- _operationalEnvDistributionStatus = mock(OperationalEnvDistributionStatus.class);
- _distributionId = "12abad84e7ff";
- _operationalEnvId = "28122015552391";
- _serviceModelVersionId = "28122015552391-aa";
- _requestId = "1234";
- _distributionIdStatus = "SENT";
- _distributionIdErrorReason = "Fail";
- _createTime = new Timestamp (System.currentTimeMillis());
- _modifyTime = new Timestamp (System.currentTimeMillis());
-
- when(_operationalEnvDistributionStatus.getDistributionId()).thenReturn(_distributionId);
- when(_operationalEnvDistributionStatus.getOperationalEnvId()).thenReturn(_operationalEnvId);
- when(_operationalEnvDistributionStatus.getServiceModelVersionId()).thenReturn(_serviceModelVersionId);
- when(_operationalEnvDistributionStatus.getRequestId()).thenReturn(_requestId);
- when(_operationalEnvDistributionStatus.getDistributionIdStatus()).thenReturn(_distributionIdStatus);
- when(_operationalEnvDistributionStatus.getDistributionIdErrorReason()).thenReturn(_distributionIdErrorReason);
- when(_operationalEnvDistributionStatus.getCreateTime()).thenReturn(_createTime);
- when(_operationalEnvDistributionStatus.getModifyTime()).thenReturn(_modifyTime);
- }
-
-
- @After
- public void tearDown() {
- _operationalEnvDistributionStatus = null;
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetDistributionId() {
- _operationalEnvDistributionStatus.setDistributionId(_distributionId);
- assertEquals(_operationalEnvDistributionStatus.getDistributionId(),_distributionId);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetDistributionId() {
- _operationalEnvDistributionStatus.setDistributionId(_distributionId);
- verify(_operationalEnvDistributionStatus).setDistributionId(_distributionId);
- }
-
- *//**
- * Test of getOperationalEnvId method
- *//*
- @Test
- public void testGetOperationalEnvId() {
- _operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId);
- assertEquals(_operationalEnvDistributionStatus.getOperationalEnvId(),_operationalEnvId);
-
- }
-
- *//**
- * Test setOperationalEnvId method
- *//*
- @Test
- public void testSetOperationalEnvId() {
- _operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId);
- verify(_operationalEnvDistributionStatus).setOperationalEnvId(_operationalEnvId);
- }
-
- *//**
- * Test of getServiceModelVersionId method
- *//*
- @Test
- public void testGetServiceModelVersionId() {
- _operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId);
- assertEquals(_operationalEnvDistributionStatus.getServiceModelVersionId(),_serviceModelVersionId);
-
- }
-
- *//**
- * Test setServiceModelVersionId method
- *//*
- @Test
- public void testSetServiceModelVersionId() {
- _operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId);
- verify(_operationalEnvDistributionStatus).setServiceModelVersionId(_serviceModelVersionId);
- }
-
- *//**
- * Test of getRequestId method
- *//*
- @Test
- public void testGetRequestId() {
- _operationalEnvDistributionStatus.setRequestId(_requestId);
- assertEquals(_operationalEnvDistributionStatus.getRequestId(),_requestId);
-
- }
-
- *//**
- * Test setRequestId method
- *//*
- @Test
- public void testSetRequestId() {
- _operationalEnvDistributionStatus.setRequestId(_requestId);
- verify(_operationalEnvDistributionStatus).setRequestId(_requestId);
- }
-
- *//**
- * Test of getDistributionIdStatus method
- *//*
- @Test
- public void testGetDistributionIdStatus() {
- _operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
- assertEquals(_operationalEnvDistributionStatus.getDistributionIdStatus(),_distributionIdStatus);
-
- }
-
- *//**
- * Test setDistributionIdStatus method
- *//*
- @Test
- public void testSetDistributionIdStatus() {
- _operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
- verify(_operationalEnvDistributionStatus).setDistributionIdStatus(_distributionIdStatus);
- }
-
- *//**
- * Test of getDistributionIdErrorReason method
- *//*
- @Test
- public void testGetDistributionIdErrorReason() {
- _operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason);
- assertEquals(_operationalEnvDistributionStatus.getDistributionIdErrorReason(),_distributionIdErrorReason);
-
- }
-
- *//**
- * Test setDistributionIdErrorReason method
- *//*
- @Test
- public void testSetDistributionIdErrorReason() {
- _operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason);
- verify(_operationalEnvDistributionStatus).setDistributionIdErrorReason(_distributionIdErrorReason);
- }
-
- *//**
- * Test of getCreateTime method
- *//*
- @Test
- public void testGetCreateTime() {
- _operationalEnvDistributionStatus.setCreateTime(_createTime);
- System.out.println("CreateTime : " + _createTime);
- assertEquals(_operationalEnvDistributionStatus.getCreateTime(),_createTime);
-
- }
-
- *//**
- * Test setCreateTime method
- *//*
- @Test
- public void testSetCreateTime() {
- _operationalEnvDistributionStatus.setCreateTime(_createTime);
- verify(_operationalEnvDistributionStatus).setCreateTime(_createTime);
- }
-
- *//**
- * Test of getModifyTime method
- *//*
- @Test
- public void testGetModifyTime() {
- _operationalEnvDistributionStatus.setModifyTime(_modifyTime);
- System.out.println("ModifyTime : " + _modifyTime);
- assertEquals(_operationalEnvDistributionStatus.getModifyTime(),_modifyTime);
-
- }
-
- *//**
- * Test setModifyTime method
- *//*
- @Test
- public void testSetModifyTime() {
- _operationalEnvDistributionStatus.setModifyTime(_modifyTime);
- verify(_operationalEnvDistributionStatus).setModifyTime(_modifyTime);
- }
-
-
-}
-*/ \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDbTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDbTest.java
deleted file mode 100644
index fb2a5a44d2..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDbTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-public class OperationalEnvServiceModelStatusDbTest {
-
- @Mock
- private AbstractSessionFactoryManager sessionFactoryRequest;
- @Mock
- private SessionFactory sessionFactory;
- @Mock
- private Session session;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(sessionFactory.openSession()).thenReturn(session);
- when(sessionFactoryRequest.getSessionFactory()).thenReturn(sessionFactory);
-
- }
-
- @Test
- public void insertFailure() {
- OperationalEnvServiceModelStatusDb omsDB = new OperationalEnvServiceModelStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- omsDB.insertOperationalEnvServiceModelStatus("myRequestId", "myOperationalEnvId", "myServiceModelVersionId", "myVal", "myRecoveryAction", 1, "myWorkloadContext");
- }
-
- @Test
- public void updateFailureRetryCount() {
- OperationalEnvServiceModelStatusDb omsDB = new OperationalEnvServiceModelStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- omsDB.updateOperationalEnvRetryCountStatus("myOperationalEnvId", "myServiceModelVersionId", "status", 1);
- }
-
- @Test
- public void updateFailureRetryCountPerReqId() {
- OperationalEnvServiceModelStatusDb omsDB = new OperationalEnvServiceModelStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- omsDB.updateOperationalEnvRetryCountStatusPerReqId("myOperationalEnvId", "myServiceModelVersionId", "status", 1, "myReqId");
- }
-
-
- @Test
- public void getOperationalEnvIdStatusTest() {
- OperationalEnvServiceModelStatusDb omsDB = new OperationalEnvServiceModelStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus();
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.list()).thenReturn(Arrays.asList(status));
- when(session.isOpen()).thenReturn(true);
- assertEquals(status, omsDB.getOperationalEnvIdStatus("myEnvId", "myReqId").get(0));
- }
-
- @Test
- public void getOperationalEnvServiceModelStatusTest() {
- OperationalEnvServiceModelStatusDb omsDB = new OperationalEnvServiceModelStatusDb(this.sessionFactoryRequest);
- OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus();
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(status);
- when(session.isOpen()).thenReturn(true);
- assertEquals(status, omsDB.getOperationalEnvServiceModelStatus("myEnvId", "myModelId"));
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java
deleted file mode 100644
index ecde7b36f6..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class OperationalEnvServiceModelStatusTest {
-
- OperationalEnvServiceModelStatus oesms=new OperationalEnvServiceModelStatus();
- Timestamp time=new Timestamp(10);
- @Test
- public void test(){
- oesms.setCreateTime(time);
- oesms.setModifyTime(time);
- oesms.setOperationalEnvId("operationalEnvId");
- oesms.setRecoveryAction("recoveryAction");
- oesms.setRequestId("requestId");
- oesms.setRetryCount(0);
- oesms.setServiceModelVersionDistrStatus("serviceModelVersionDistrStatus");
- oesms.setServiceModelVersionId("serviceModelVersionId");
- oesms.setWorkloadContext("workloadContext");
-
- assertEquals(oesms.getCreateTime(), time);
- assertEquals(oesms.getModifyTime(), time);
- assertEquals(oesms.getOperationalEnvId(), "operationalEnvId");
- assertEquals(oesms.getRecoveryAction(), "recoveryAction");
- assertEquals(oesms.getRequestId(), "requestId");
- assertEquals(oesms.getRetryCount(), 0);
- assertEquals(oesms.getServiceModelVersionDistrStatus(), "serviceModelVersionDistrStatus");
- assertEquals(oesms.getServiceModelVersionId(), "serviceModelVersionId");
- assertEquals(oesms.getWorkloadContext(), "workloadContext");
- }
-}
- /*OperationalEnvServiceModelStatus _operationalEnvServiceModelStatus;
-
- protected String _requestId;
- protected String _operationalEnvId;
- protected String _serviceModelVersionId;
- protected String _serviceModelVersionDistrStatus;
- protected String _recoveryAction;
- private int _retryCount;
- private String _workloadContext;
- protected Timestamp _createTime;
- protected Timestamp _modifyTime;
-
-
- public OperationalEnvServiceModelStatusTest() {
- }
-
- @Before
- public void setUp() {
- _operationalEnvServiceModelStatus = mock(OperationalEnvServiceModelStatus.class);
- _requestId = "1234";
- _operationalEnvId = "28122015552391";
- _serviceModelVersionId = "28122015552391-aa";
- _serviceModelVersionDistrStatus = "SENT";
- _recoveryAction = "Retry";
- _retryCount = 0;
- _workloadContext = "VNF_E2E-IST";
- _createTime = new Timestamp (System.currentTimeMillis());
- _modifyTime = new Timestamp (System.currentTimeMillis());
-
- when(_operationalEnvServiceModelStatus.getRequestId()).thenReturn(_requestId);
- when(_operationalEnvServiceModelStatus.getOperationalEnvId()).thenReturn(_operationalEnvId);
- when(_operationalEnvServiceModelStatus.getServiceModelVersionId()).thenReturn(_serviceModelVersionId);
- when(_operationalEnvServiceModelStatus.getServiceModelVersionDistrStatus()).thenReturn(_serviceModelVersionDistrStatus);
- when(_operationalEnvServiceModelStatus.getRecoveryAction()).thenReturn(_recoveryAction);
- when(_operationalEnvServiceModelStatus.getRetryCount()).thenReturn(_retryCount);
- when(_operationalEnvServiceModelStatus.getWorkloadContext()).thenReturn(_workloadContext);
- when(_operationalEnvServiceModelStatus.getCreateTime()).thenReturn(_createTime);
- when(_operationalEnvServiceModelStatus.getModifyTime()).thenReturn(_modifyTime);
- }
-
-
- @After
- public void tearDown() {
- _operationalEnvServiceModelStatus = null;
- }
-
- *//**
- * Test of getRequestId method
- *//*
- @Test
- public void testGetRequestId() {
- _operationalEnvServiceModelStatus.setRequestId(_requestId);
- assertEquals(_operationalEnvServiceModelStatus.getRequestId(),_requestId);
-
- }
-
- *//**
- * Test setRequestId method
- *//*
- @Test
- public void testSetRequestId() {
- _operationalEnvServiceModelStatus.setRequestId(_requestId);
- verify(_operationalEnvServiceModelStatus).setRequestId(_requestId);
- }
-
- *//**
- * Test of getOperationalEnvId method
- *//*
- @Test
- public void testGetOperationalEnvId() {
- _operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId);
- assertEquals(_operationalEnvServiceModelStatus.getOperationalEnvId(),_operationalEnvId);
-
- }
-
- *//**
- * Test setOperationalEnvId method
- *//*
- @Test
- public void testSetOperationalEnvId() {
- _operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId);
- verify(_operationalEnvServiceModelStatus).setOperationalEnvId(_operationalEnvId);
- }
-
- *//**
- * Test of getServiceModelVersionId method
- *//*
- @Test
- public void testGetServiceModelVersionId() {
- _operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId);
- assertEquals(_operationalEnvServiceModelStatus.getServiceModelVersionId(),_serviceModelVersionId);
-
- }
-
- *//**
- * Test setServiceModelVersionId method
- *//*
- @Test
- public void testSetServiceModelVersionId() {
- _operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId);
- verify(_operationalEnvServiceModelStatus).setServiceModelVersionId(_serviceModelVersionId);
- }
-
- *//**
- * Test of getServiceModelVersionId method
- *//*
- @Test
- public void testGetServiceModelVersionDistrStatus() {
- _operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
- assertEquals(_operationalEnvServiceModelStatus.getServiceModelVersionDistrStatus(),_serviceModelVersionDistrStatus);
-
- }
-
- *//**
- * Test setServiceModelVersionId method
- *//*
- @Test
- public void testSetServiceModelVersionDistrStatus() {
- _operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
- verify(_operationalEnvServiceModelStatus).setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
- }
-
- *//**
- * Test of getOperationalEnvId method
- *//*
- @Test
- public void testGetRecoveryAction() {
- _operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction);
- assertEquals(_operationalEnvServiceModelStatus.getRecoveryAction(),_recoveryAction);
-
- }
-
- *//**
- * Test setOperationalEnvId method
- *//*
- @Test
- public void testSetRecoveryAction() {
- _operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction);
- verify(_operationalEnvServiceModelStatus).setRecoveryAction(_recoveryAction);
- }
-
- *//**
- * Test of getOperationalEnvId method
- *//*
- @Test
- public void testGetRetryCount() {
- _operationalEnvServiceModelStatus.setRetryCount(_retryCount);
- assertEquals(_operationalEnvServiceModelStatus.getRetryCount(),_retryCount);
-
- }
-
- *//**
- * Test setOperationalEnvId method
- *//*
- @Test
- public void testSetRetryCount() {
- _operationalEnvServiceModelStatus.setRetryCount(_retryCount);
- verify(_operationalEnvServiceModelStatus).setRetryCount(_retryCount);
- }
-
- *//**
- * Test of getOperationalEnvId method
- *//*
- @Test
- public void testGetWorkloadContext() {
- _operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext);
- assertEquals(_operationalEnvServiceModelStatus.getWorkloadContext(),_workloadContext);
-
- }
-
- *//**
- * Test setOperationalEnvId method
- *//*
- @Test
- public void testSetWorkloadContext() {
- _operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext);
- verify(_operationalEnvServiceModelStatus).setWorkloadContext(_workloadContext);
- }
-
- *//**
- * Test of getCreateTime method
- *//*
- @Test
- public void testGetCreateTime() {
- _operationalEnvServiceModelStatus.setCreateTime(_createTime);
- assertEquals(_operationalEnvServiceModelStatus.getCreateTime(),_createTime);
-
- }
-
- *//**
- * Test setCreateTime method
- *//*
- @Test
- public void testSetCreateTime() {
- _operationalEnvServiceModelStatus.setCreateTime(_createTime);
- verify(_operationalEnvServiceModelStatus).setCreateTime(_createTime);
- }
-
- *//**
- * Test of getModifyTime method
- *//*
- @Test
- public void testGetModifyTime() {
- _operationalEnvServiceModelStatus.setModifyTime(_modifyTime);
- assertEquals(_operationalEnvServiceModelStatus.getModifyTime(),_modifyTime);
-
- }
-
- *//**
- * Test setModifyTime method
- *//*
- @Test
- public void testSetModifyTime() {
- _operationalEnvServiceModelStatus.setModifyTime(_modifyTime);
- verify(_operationalEnvServiceModelStatus).setModifyTime(_modifyTime);
- }
- */
-
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
deleted file mode 100644
index aacdd96420..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.requestsdb;
-
-
-import mockit.Expectations;
-import mockit.Mocked;
-import mockit.integration.junit4.JMockit;
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.SQLQuery;
-import org.hibernate.Session;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(JMockit.class)
-public class RequestsDatabaseTest {
-
- RequestsDatabase requestsDatabase = RequestsDatabase.getInstance();
-
- @Test
- public void getInstanceTest() throws Exception {
- RequestsDatabase instance = RequestsDatabase.getInstance();
- assertEquals(RequestsDatabase.class, instance.getClass());
- }
-
- @Test
- public void healthCheckTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked SQLQuery query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createSQLQuery(" show tables "); result = query;
- query.list(); result = Arrays.asList("table1", "table2");
- }};
-
- assertTrue(requestsDatabase.healthCheck());
- }
-
- @Test
- public void updateInfraStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
- }};
- assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", "unknown"));
- }
-
- @Test
- public void updateInfraStatus1Test(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
- }};
- assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", 0, "unknown"));
- }
-
- @Test
- public void updateInfraFinalStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
- }};
- assertEquals(1, requestsDatabase.updateInfraFinalStatus("123",
- "unknown",
- "statusMessage",
- 0,
- "responsebody",
- "lastmodifiedby"));
- }
-
- @Test
- public void getRequestFromInfraActiveTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
- }};
- assertEquals("123",
- requestsDatabase.getRequestFromInfraActive("123").getRequestId());
- }
-
- @Test
- public void getOrchestrationFiltersFromInfraActiveTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Criteria criteria) throws Exception {
-
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
- }};
- assertEquals(1,
- requestsDatabase.getRequestListFromInfraActive("queryattr",
- "queryvalue",
- "type").size());
- }
-
- @Test
- public void getRequestListFromInfraActiveTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); result = query;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
- }};
- assertEquals("123",
- requestsDatabase.getRequestFromInfraActive("123", "requestType").getRequestId());
- }
-
- @Test
- public void getRequestFromInfraActive1Test(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Criteria criteria) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests());
- }};
- assertEquals(1,
- requestsDatabase.getRequestListFromInfraActive("queryAttr",
- "queryvalue",
- "type").size());
- }
-
- @Test
- @Ignore // 1802 merge
- public void checkDuplicateByVnfNameTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
- }};
- assertEquals("123",
- requestsDatabase.checkDuplicateByVnfName("vnfname",
- "action",
- "requesttype").getRequestId());
- }
-
- @Test
- @Ignore // 1802 merge
- public void checkDuplicateByVnfIdTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
- }};
- assertEquals("123",
- requestsDatabase.checkDuplicateByVnfId("vnfname",
- "action",
- "requesttype").getRequestId());
- }
-
- @Test
- public void setMockDBTest() throws Exception {
- requestsDatabase.setMockDB(null);
- }
-
- @Test
- public void getSiteStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
- }};
- assertEquals(SiteStatus.class,
- requestsDatabase.getSiteStatus("site").getClass());
- }
-
- @Test
- public void updateSiteStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
- }};
- requestsDatabase.updateSiteStatus("site", true);
- }
-
- @Test
- public void getOperationStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
- }};
- assertEquals(OperationStatus.class,
- requestsDatabase.getOperationStatus("123",
- "Unknown").getClass());
- }
-
- @Test
- public void getOperationStatusByServiceIdTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc"); result = query;
- List<Object>list = query.list(); result = new OperationStatus();
- }};
- assertEquals(OperationStatus.class,
- requestsDatabase.getOperationStatusByServiceId("123").getClass());
- }
-
- @Test
- public void getOperationStatusByServiceNameTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name"); result = query;
- query.uniqueResult(); result = new OperationStatus();
- }};
- assertEquals(OperationStatus.class,
- requestsDatabase.getOperationStatusByServiceName("servicename").getClass());
- }
-
- @Test
- public void updateOperationStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
- }};
- requestsDatabase.updateOperationStatus(new OperationStatus());
- }
-
- @Test
- public void getResourceOperationStatusTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
- @Mocked Session session,
- @Mocked Query query) throws Exception {
- new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid"); result = query;
- query.uniqueResult(); result = new ResourceOperationStatus();
- }};
- assertEquals(ResourceOperationStatus.class,
- requestsDatabase.getResourceOperationStatus("serviceId",
- "operationid",
- "123-uuid").getClass());
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java
deleted file mode 100644
index a9773c3bae..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ResourceOperationStatusTest {
-
- ResourceOperationStatus ros=new ResourceOperationStatus();
- ResourceOperationStatus ros1=new ResourceOperationStatus("serviceId", "operationId", "resourceTemplateUUID");
- Object obj=new Object();
- @Test
- public void test() {
- ros.setErrorCode("errorCode");
- ros.setJobId("jobId");
- ros.setOperationId("operationId");
- ros.setOperType("operType");
- ros.setProgress("progress");
- ros.setResourceInstanceID("resourceInstanceID");
- ros.setResourceTemplateUUID("resourceTemplateUUId");
- ros.setServiceId("serviceId");
- ros.setStatus("101");
- ros.setStatusDescription("statusDescription");
-
- assertEquals(ros.getErrorCode(), "errorCode");
- assertEquals(ros.getJobId(), "jobId");
- assertEquals(ros.getOperationId(), "operationId");
- assertEquals(ros.getOperType(), "operType");
- assertEquals(ros.getProgress(), "progress");
- assertEquals(ros.getResourceInstanceID(), "resourceInstanceID");
- assertEquals(ros.getResourceTemplateUUID(), "resourceTemplateUUId");
- assertEquals(ros.getServiceId(), "serviceId");
- assertEquals(ros.getStatus(), "101");
- assertEquals(ros.getStatusDescription(), "statusDescription");
- ros.equals(obj);
- ros.hashCode();
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java
deleted file mode 100644
index b989dac262..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.*;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class SiteStatusTest {
-
- SiteStatus ss=new SiteStatus();
- Timestamp time=new Timestamp(10);
- @Test
- public void test() {
- ss.setCreated(time);
- ss.setSiteName("siteName");
- ss.setStatus(true);
-
- assertEquals(ss.getCreated(), time);
- assertEquals(ss.getSiteName(), "siteName");
- assertEquals(ss.getStatus(), true);
- }
- @Test
- public void testToString(){
- assert(ss.toString()!=null);
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDbTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDbTest.java
deleted file mode 100644
index a86812e167..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDbTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-
-public class WatchdogComponentDistributionStatusDbTest {
-
- @Mock
- private AbstractSessionFactoryManager sessionFactoryRequest;
- @Mock
- private SessionFactory sessionFactory;
- @Mock
- private Session session;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(sessionFactory.openSession()).thenReturn(session);
- when(sessionFactoryRequest.getSessionFactory()).thenReturn(sessionFactory);
-
- }
-
- @Test
- public void insertFailure() {
- WatchdogComponentDistributionStatusDb wds = new WatchdogComponentDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- wds.insertWatchdogComponentDistributionStatus("myId", "myComponentName", "myStatus");
- }
-
-
- @Test
- public void getWatchdogComponentNamesTest() {
- WatchdogComponentDistributionStatusDb wds = new WatchdogComponentDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.list()).thenReturn(Arrays.asList("myValue"));
- when(session.isOpen()).thenReturn(true);
- assertEquals("myValue", wds.getWatchdogComponentNames("myId").get(0));
- }
-
- @Test
- public void getWatchdogComponentDistributionStatusTest() {
- WatchdogComponentDistributionStatusDb wds = new WatchdogComponentDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.list()).thenReturn(Arrays.asList("myValue"));
- when(session.isOpen()).thenReturn(true);
- assertEquals("myValue", wds.getWatchdogComponentDistributionStatus("myStatus").get(0));
- assertEquals("myValue", wds.getWatchdogComponentDistributionStatus("myId", "myName").get(0));
- }
-
- @Test
- public void testGetWatchdogDistributionIdNotFound() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- assertEquals(null, wds.getWatchdogDistributionId("test"));
- }
-
- @Test
- public void testGetWatchdogDistributionIdStatus() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn("myValue");
- when(session.isOpen()).thenReturn(true);
- assertEquals("myValue", wds.getWatchdogDistributionIdStatus("test"));
- }
-
- @Test
- public void testGetWatchdogDistributionIdStatusNotFound() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- assertEquals(null, wds.getWatchdogDistributionIdStatus("test"));
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java
deleted file mode 100644
index 0d68c12a0a..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class WatchdogComponentDistributionStatusTest {
-
- WatchdogComponentDistributionStatus wcds=new WatchdogComponentDistributionStatus();
- Timestamp time=new Timestamp(10);
-
- @Test
- public void test(){
- wcds.setComponentDistributionStatus("componentDistributionStatus");
- wcds.setComponentName("componentName");
- wcds.setCreateTime(time);
- wcds.setDistributionId("distributionId");
- wcds.setModifyTime(time);
-
- assertEquals(wcds.getComponentDistributionStatus(), "componentDistributionStatus");
- assertEquals(wcds.getComponentName(), "componentName");
- assertEquals(wcds.getCreateTime(), time);
- assertEquals(wcds.getDistributionId(), "distributionId");
- assertEquals(wcds.getModifyTime(), time);
- }
-}
-
- /*WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
-
- protected String _distributionId;
- protected String _componentName;
- protected String _componentDistributionStatus;
- protected Timestamp _createTime;
- protected Timestamp _modifyTime;
-
- public WatchdogComponentDistributionStatusTest() {
- }
-
- @Before
- public void setUp() {
- _watchdogComponentDistributionStatus = mock(WatchdogComponentDistributionStatus.class);
- _distributionId = "12abad84e7ff";
- _componentName = "MSO";
- _componentDistributionStatus = "SENT";
- _createTime = new Timestamp (System.currentTimeMillis());
- _modifyTime = new Timestamp (System.currentTimeMillis());
-
- when(_watchdogComponentDistributionStatus.getDistributionId()).thenReturn(_distributionId);
- when(_watchdogComponentDistributionStatus.getComponentName()).thenReturn(_componentName);
- when(_watchdogComponentDistributionStatus.getComponentDistributionStatus()).thenReturn(_componentDistributionStatus);
- when(_watchdogComponentDistributionStatus.getCreateTime()).thenReturn(_createTime);
- when(_watchdogComponentDistributionStatus.getModifyTime()).thenReturn(_modifyTime);
- }
-
- @After
- public void tearDown() {
- _watchdogComponentDistributionStatus = null;
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetDistributionId() {
- _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
- assertEquals(_watchdogComponentDistributionStatus.getDistributionId(),_distributionId);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetDistributionId() {
- _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
- verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId);
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetComponentName() {
- _watchdogComponentDistributionStatus.setComponentName(_componentName);
- assertEquals(_watchdogComponentDistributionStatus.getComponentName(),_componentName);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetComponentName() {
- _watchdogComponentDistributionStatus.setComponentName(_componentName);
- verify(_watchdogComponentDistributionStatus).setComponentName(_componentName);
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetComponentDistributionStatus() {
- _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
- assertEquals(_watchdogComponentDistributionStatus.getComponentDistributionStatus(),_componentDistributionStatus);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetComponentDistributionStatus() {
- _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
- verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus);
- }
-
- *//**
- * Test of getCreateTime method
- *//*
- @Test
- public void testGetCreateTime() {
- _watchdogComponentDistributionStatus.setCreateTime(_createTime);
- System.out.println("CreateTime : " + _createTime);
- assertEquals(_watchdogComponentDistributionStatus.getCreateTime(),_createTime);
-
- }
-
- *//**
- * Test setCreateTime method
- *//*
- @Test
- public void testSetCreateTime() {
- _watchdogComponentDistributionStatus.setCreateTime(_createTime);
- verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime);
- }
-
- *//**
- * Test of getModifyTime method
- *//*
- @Test
- public void testGetModifyTime() {
- _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
- System.out.println("ModifyTime : " + _modifyTime);
- assertEquals(_watchdogComponentDistributionStatus.getModifyTime(),_modifyTime);
-
- }
-
- *//**
- * Test setModifyTime method
- *//*
- @Test
- public void testSetModifyTime() {
- _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
- verify(_watchdogComponentDistributionStatus).setModifyTime(_modifyTime);
- }
-
-}
-*/ \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDbTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDbTest.java
deleted file mode 100644
index 3371018605..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDbTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-public class WatchdogDistributionStatusDbTest {
-
- @Mock
- private AbstractSessionFactoryManager sessionFactoryRequest;
- @Mock
- private SessionFactory sessionFactory;
- @Mock
- private Session session;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(sessionFactory.openSession()).thenReturn(session);
- when(sessionFactoryRequest.getSessionFactory()).thenReturn(sessionFactory);
-
- }
-
- @Test
- public void insertFailure() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- wds.insertWatchdogDistributionId("myId");
- }
-
- @Test
- public void updateFailure() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- wds.updateWatchdogDistributionIdStatus("myId", "myStatus");
- }
-
- @Test
- public void testGetWatchdogDistributionId() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn("myValue");
- when(session.isOpen()).thenReturn(true);
- assertEquals("myValue", wds.getWatchdogDistributionId("test"));
- }
-
- @Test
- public void testGetWatchdogDistributionIdNotFound() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- assertEquals(null, wds.getWatchdogDistributionId("test"));
- }
-
- @Test
- public void testGetWatchdogDistributionIdStatus() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn("myValue");
- when(session.isOpen()).thenReturn(true);
- assertEquals("myValue", wds.getWatchdogDistributionIdStatus("test"));
- }
-
- @Test
- public void testGetWatchdogDistributionIdStatusNotFound() {
- WatchdogDistributionStatusDb wds = new WatchdogDistributionStatusDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- assertEquals(null, wds.getWatchdogDistributionIdStatus("test"));
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java
deleted file mode 100644
index c10d7ae15b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class WatchdogDistributionStatusTest {
-
- WatchdogDistributionStatus wds=new WatchdogDistributionStatus();
- Timestamp time=new Timestamp(10);
- @Test
- public void test() {
- wds.setCreateTime(time);
- wds.setDistributionId("distributionId");
- wds.setDistributionIdStatus("distributionIdStatus");
- wds.setModifyTime(time);
-
- assertEquals(wds.getCreateTime(), time);
- assertEquals(wds.getDistributionId(), "distributionId");
- assertEquals(wds.getDistributionIdStatus(), "distributionIdStatus");
- assertEquals(wds.getModifyTime(), time);
-
- }
-
-
-/* WatchdogDistributionStatus _watchdogDistributionStatus;
-
- protected String _distributionId;
- protected String _distributionIdStatus;
- protected Timestamp _createTime;
- protected Timestamp _modifyTime;
-
- public WatchdogDistributionStatusTest() {
- }
-
- @Before
- public void setUp() {
- _watchdogDistributionStatus = mock(WatchdogDistributionStatus.class);
- _distributionId = "12abad84e7ff";
- _distributionIdStatus = "SENT";
- _createTime = new Timestamp (System.currentTimeMillis());
- _modifyTime = new Timestamp (System.currentTimeMillis());
-
- when(_watchdogDistributionStatus.getDistributionId()).thenReturn(_distributionId);
- when(_watchdogDistributionStatus.getDistributionIdStatus()).thenReturn(_distributionIdStatus);
- when(_watchdogDistributionStatus.getCreateTime()).thenReturn(_createTime);
- when(_watchdogDistributionStatus.getModifyTime()).thenReturn(_modifyTime);
- }
-
- @After
- public void tearDown() {
- _watchdogDistributionStatus = null;
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetDistributionId() {
- _watchdogDistributionStatus.setDistributionId(_distributionId);
- assertEquals(_watchdogDistributionStatus.getDistributionId(),_distributionId);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetDistributionId() {
- _watchdogDistributionStatus.setDistributionId(_distributionId);
- verify(_watchdogDistributionStatus).setDistributionId(_distributionId);
- }
-
- *//**
- * Test of getDistributionIdStatus method
- *//*
- @Test
- public void testGetComponentDistributionStatus() {
- _watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
- assertEquals(_watchdogDistributionStatus.getDistributionIdStatus(),_distributionIdStatus);
-
- }
-
- *//**
- * Test setDistributionIdStatus method
- *//*
- @Test
- public void testSetComponentDistributionStatus() {
- _watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
- verify(_watchdogDistributionStatus).setDistributionIdStatus(_distributionIdStatus);
- }
-
- *//**
- * Test of getCreateTime method
- *//*
- @Test
- public void testGetCreateTime() {
- _watchdogDistributionStatus.setCreateTime(_createTime);
- assertEquals(_watchdogDistributionStatus.getCreateTime(),_createTime);
-
- }
-
- *//**
- * Test setCreateTime method
- *//*
- @Test
- public void testSetCreateTime() {
- _watchdogDistributionStatus.setCreateTime(_createTime);
- verify(_watchdogDistributionStatus).setCreateTime(_createTime);
- }
-
- *//**
- * Test of getModifyTime method
- *//*
- @Test
- public void testGetModifyTime() {
- _watchdogDistributionStatus.setModifyTime(_modifyTime);
- assertEquals(_watchdogDistributionStatus.getModifyTime(),_modifyTime);
-
- }
-
- *//**
- * Test setModifyTime method
- *//*
- @Test
- public void testSetModifyTime() {
- _watchdogDistributionStatus.setModifyTime(_modifyTime);
- verify(_watchdogDistributionStatus).setModifyTime(_modifyTime);
- }*/
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDbTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDbTest.java
deleted file mode 100644
index 42224b0238..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDbTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- *
- */
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-
-
-public class WatchdogServiceModVerIdLookupDbTest {
- @Mock
- private AbstractSessionFactoryManager sessionFactoryRequest;
- @Mock
- private SessionFactory sessionFactory;
- @Mock
- private Session session;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(sessionFactory.openSession()).thenReturn(session);
- when(sessionFactoryRequest.getSessionFactory()).thenReturn(sessionFactory);
-
- }
-
- @Test
- public void getWatchdogServiceModVerIdTest() {
- WatchdogServiceModVerIdLookupDb wds = new WatchdogServiceModVerIdLookupDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- assertEquals(null, wds.getWatchdogServiceModVerId("test"));
- }
-
- @Test
- public void insertWatchdogServiceModVerIdLookupTest() {
- WatchdogServiceModVerIdLookupDb wds = new WatchdogServiceModVerIdLookupDb(this.sessionFactoryRequest);
- Query mockQuery = mock(Query.class);
- when(session.createQuery(any(String.class))).thenReturn(mockQuery);
- when(mockQuery.uniqueResult()).thenReturn(null);
- when(session.isOpen()).thenReturn(true);
- when(session.getTransaction()).thenThrow(Exception.class);
- thrown.expect(Exception.class);
-
- wds.insertWatchdogServiceModVerIdLookup("myId", "myModelVersion");
- }
-
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java
deleted file mode 100644
index d27c1b817e..0000000000
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.requestsdb;
-
-import static org.junit.Assert.assertEquals;
-import java.sql.Timestamp;
-import org.junit.Test;
-
-public class WatchdogServiceModVerIdLookupTest {
-
- WatchdogServiceModVerIdLookup wsmil=new WatchdogServiceModVerIdLookup();
- Timestamp time=new Timestamp(10);
- @Test
- public void test(){
- wsmil.setCreateTime(time);
- wsmil.setDistributionId("distributionId");
- wsmil.setServiceModelVersionId("serviceModelVersionId");
-
- assertEquals(wsmil.getCreateTime(),time);
- assertEquals(wsmil.getDistributionId(), "distributionId");
- assertEquals(wsmil.getServiceModelVersionId(), "serviceModelVersionId");
- }
-}
-/*WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup;
-
- protected String _distributionId;
- protected String _serviceModelVersionId;
- protected Timestamp _createTime;
-
- public WatchdogServiceModVerIdLookupTest() {
- }
-
- @Before
- public void setUp() {
- _watchdogServiceModVerIdLookup = mock(WatchdogServiceModVerIdLookup.class);
- _serviceModelVersionId = "12abad84e7ff";
- _createTime = new Timestamp (System.currentTimeMillis());
-
- when(_watchdogServiceModVerIdLookup.getDistributionId()).thenReturn(_distributionId);
- when(_watchdogServiceModVerIdLookup.getServiceModelVersionId()).thenReturn(_serviceModelVersionId);
- when(_watchdogServiceModVerIdLookup.getCreateTime()).thenReturn(_createTime);
- }
-
- @After
- public void tearDown() {
- _watchdogServiceModVerIdLookup = null;
- }
-
- *//**
- * Test of getDistributionId method
- *//*
- @Test
- public void testGetDistributionId() {
- _watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
- assertEquals(_watchdogServiceModVerIdLookup.getDistributionId(),_distributionId);
-
- }
-
- *//**
- * Test setDistributionId method
- *//*
- @Test
- public void testSetDistributionId() {
- _watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
- verify(_watchdogServiceModVerIdLookup).setDistributionId(_distributionId);
- }
-
- *//**
- * Test of getServiceModelVersionId method
- *//*
- @Test
- public void testGetServiceModelVersionId() {
- _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
- assertEquals(_watchdogServiceModVerIdLookup.getServiceModelVersionId(),_serviceModelVersionId);
-
- }
-
- *//**
- * Test setServiceModelVersionId method
- *//*
- @Test
- public void testSetServiceModelVersionId() {
- _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
- verify(_watchdogServiceModVerIdLookup).setServiceModelVersionId(_serviceModelVersionId);
- }
-
- *//**
- * Test of getCreateTime method
- *//*
- @Test
- public void testGetCreateTime() {
- _watchdogServiceModVerIdLookup.setCreateTime(_createTime);
- assertEquals(_watchdogServiceModVerIdLookup.getCreateTime(),_createTime);
-
- }
-
- *//**
- * Test setCreateTime method
- *//*
- @Test
- public void testSetCreateTime() {
- _watchdogServiceModVerIdLookup.setCreateTime(_createTime);
- verify(_watchdogServiceModVerIdLookup).setCreateTime(_createTime);
- }
-
-}*/ \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..c8e90c3d8b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
@@ -0,0 +1,40 @@
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+ssl-enable: false
+mso:
+ site-name: localDevEnv
+ logPath: logs
+# H2
+spring:
+ datasource:
+ url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;
+ username: sa
+ password: sa
+ driver-class-name: org.h2.Driver
+ h2:
+ console:
+ enabled: true
+ path: /h2
+
+ jpa:
+ show-sql: true
+ hibernate:
+ dialect: org.hibernate.dialect.MySQL5Dialect
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+
+
+#Actuator
+management:
+ security:
+ enabled: false
+ basic:
+ enabled: false
+
+
+
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml b/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..1951484752
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml
@@ -0,0 +1,46 @@
+<configuration >
+
+
+ <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>
+
+
+ <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="trace" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <root level="debug">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <!-- Spring related loggers -->
+ <logger name="org.springframework" level="WARN" />
+ <logger name="org.springframework.beans" level="WARN" />
+ <logger name="org.springframework.web" level="WARN" />
+ <logger name="com.blog.spring.jms" level="WARN" />
+
+ <logger name="org.hibernate" level="WARN" />
+
+
+ <!-- Tomcat related loggers -->
+ <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" />
+ <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" />
+ <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" />
+ <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" />
+ <logger name="wiremock.org.eclipse.jetty" level="WARN" />
+
+</configuration> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
new file mode 100644
index 0000000000..a01153a43c
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
@@ -0,0 +1,212 @@
+
+create table ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
+ REQUEST_ID varchar(255) not null,
+ OPERATIONAL_ENV_ID varchar(255) not null,
+ SERVICE_MODEL_VERSION_ID varchar(255) not null,
+ SERVICE_MOD_VER_FINAL_DISTR_STATUS varchar(255),
+ RECOVERY_ACTION varchar(255),
+ RETRY_COUNT_LEFT varchar(255),
+ WORKLOAD_CONTEXT varchar(255),
+ CREATE_TIME datetime,
+ MODIFY_TIME datetime,
+ primary key (REQUEST_ID,OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID)
+ );
+
+create table OPERATION_STATUS (
+ SERVICE_ID varchar(255) not null,
+ OPERATION_ID varchar(255) not null,
+ SERVICE_NAME varchar(255),
+ OPERATION_TYPE varchar(255),
+ USER_ID varchar(255),
+ RESULT varchar(255),
+ OPERATION_CONTENT varchar(255),
+ PROGRESS varchar(255),
+ REASON varchar(255),
+ OPERATE_AT datetime,
+ FINISHED_AT datetime,
+ primary key (SERVICE_ID,OPERATION_ID)
+ );
+
+
+INSERT INTO PUBLIC.OPERATION_STATUS(SERVICE_ID, OPERATION_ID, OPERATION_TYPE, USER_ID, RESULT, OPERATION_CONTENT, PROGRESS, REASON, OPERATE_AT, FINISHED_AT) VALUES
+('serviceId', 'operationId', 'operationType', 'userId', 'result', 'operationContent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10');
+
+ create table RESOURCE_OPERATION_STATUS (
+ SERVICE_ID varchar(255) not null,
+ OPERATION_ID varchar(255) not null,
+ RESOURCE_TEMPLATE_UUID varchar(255) not null,
+ OPER_TYPE varchar(255),
+ RESOURCE_INSTANCE_ID varchar(255),
+ JOB_ID varchar(255),
+ STATUS varchar(255),
+ PROGRESS varchar(255),
+ ERROR_CODE varchar(255) ,
+ STATUS_DESCRIPOTION varchar(255) ,
+ primary key (SERVICE_ID,OPERATION_ID,RESOURCE_TEMPLATE_UUID)
+ );
+
+CREATE CACHED TABLE PUBLIC.INFRA_ACTIVE_REQUESTS(
+ REQUEST_ID VARCHAR NOT NULL SELECTIVITY 100,
+ CLIENT_REQUEST_ID VARCHAR SELECTIVITY 6,
+ ACTION VARCHAR SELECTIVITY 1,
+ REQUEST_STATUS VARCHAR SELECTIVITY 1,
+ STATUS_MESSAGE longtext SELECTIVITY 36,
+ PROGRESS VARCHAR SELECTIVITY 1,
+ START_TIME VARCHAR,
+ END_TIME VARCHAR,
+ SOURCE VARCHAR SELECTIVITY 2,
+ VNF_ID VARCHAR SELECTIVITY 15,
+ VNF_NAME VARCHAR SELECTIVITY 11,
+ VNF_TYPE VARCHAR SELECTIVITY 5,
+ SERVICE_TYPE VARCHAR SELECTIVITY 1,
+ AIC_NODE_CLLI VARCHAR SELECTIVITY 1,
+ TENANT_ID VARCHAR SELECTIVITY 2,
+ PROV_STATUS VARCHAR SELECTIVITY 1,
+ VNF_PARAMS VARCHAR SELECTIVITY 1,
+ VNF_OUTPUTS VARCHAR SELECTIVITY 3,
+ REQUEST_BODY VARCHAR SELECTIVITY 79,
+ RESPONSE_BODY VARCHAR SELECTIVITY 7,
+ LAST_MODIFIED_BY VARCHAR SELECTIVITY 2,
+ MODIFY_TIME VARCHAR,
+ REQUEST_TYPE VARCHAR SELECTIVITY 1,
+ VOLUME_GROUP_ID VARCHAR SELECTIVITY 2,
+ VOLUME_GROUP_NAME VARCHAR SELECTIVITY 3,
+ VF_MODULE_ID VARCHAR SELECTIVITY 5,
+ VF_MODULE_NAME VARCHAR SELECTIVITY 8,
+ VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
+ AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
+ AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CALLBACK_URL VARCHAR SELECTIVITY 1,
+ CORRELATOR VARCHAR SELECTIVITY 1,
+ NETWORK_ID VARCHAR SELECTIVITY 2,
+ NETWORK_NAME VARCHAR SELECTIVITY 4,
+ NETWORK_TYPE VARCHAR SELECTIVITY 1,
+ REQUEST_SCOPE VARCHAR SELECTIVITY 1,
+ REQUEST_ACTION VARCHAR SELECTIVITY 1,
+ SERVICE_INSTANCE_ID VARCHAR SELECTIVITY 34,
+ SERVICE_INSTANCE_NAME VARCHAR SELECTIVITY 25,
+ REQUESTOR_ID VARCHAR SELECTIVITY 2,
+ CONFIGURATION_ID VARCHAR SELECTIVITY 1,
+ CONFIGURATION_NAME VARCHAR SELECTIVITY 2,
+ OPERATIONAL_ENV_ID VARCHAR SELECTIVITY 1,
+ OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1
+);
+
+INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES
+('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null),
+('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null),
+('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, STRINGDECODE('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n'), 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null);
+INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES
+('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'md5621', null, null, null, null),
+('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null),
+('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null);
+
+CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
+ REQUEST_ID VARCHAR NOT NULL SELECTIVITY 100,
+ CLIENT_REQUEST_ID VARCHAR SELECTIVITY 6,
+ ACTION VARCHAR SELECTIVITY 1,
+ REQUEST_STATUS VARCHAR SELECTIVITY 1,
+ STATUS_MESSAGE longtext SELECTIVITY 36,
+ PROGRESS VARCHAR SELECTIVITY 1,
+ START_TIME VARCHAR,
+ END_TIME VARCHAR,
+ SOURCE VARCHAR SELECTIVITY 2,
+ VNF_ID VARCHAR SELECTIVITY 15,
+ VNF_NAME VARCHAR SELECTIVITY 11,
+ VNF_TYPE VARCHAR SELECTIVITY 5,
+ SERVICE_TYPE VARCHAR SELECTIVITY 1,
+ AIC_NODE_CLLI VARCHAR SELECTIVITY 1,
+ TENANT_ID VARCHAR SELECTIVITY 2,
+ PROV_STATUS VARCHAR SELECTIVITY 1,
+ VNF_PARAMS VARCHAR SELECTIVITY 1,
+ VNF_OUTPUTS VARCHAR SELECTIVITY 3,
+ REQUEST_BODY VARCHAR SELECTIVITY 79,
+ RESPONSE_BODY VARCHAR SELECTIVITY 7,
+ LAST_MODIFIED_BY VARCHAR SELECTIVITY 2,
+ MODIFY_TIME VARCHAR,
+ REQUEST_TYPE VARCHAR SELECTIVITY 1,
+ VOLUME_GROUP_ID VARCHAR SELECTIVITY 2,
+ VOLUME_GROUP_NAME VARCHAR SELECTIVITY 3,
+ VF_MODULE_ID VARCHAR SELECTIVITY 5,
+ VF_MODULE_NAME VARCHAR SELECTIVITY 8,
+ VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
+ AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
+ AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CALLBACK_URL VARCHAR SELECTIVITY 1,
+ CORRELATOR VARCHAR SELECTIVITY 1,
+ NETWORK_ID VARCHAR SELECTIVITY 2,
+ NETWORK_NAME VARCHAR SELECTIVITY 4,
+ NETWORK_TYPE VARCHAR SELECTIVITY 1,
+ REQUEST_SCOPE VARCHAR SELECTIVITY 1,
+ REQUEST_ACTION VARCHAR SELECTIVITY 1,
+ SERVICE_INSTANCE_ID VARCHAR SELECTIVITY 34,
+ SERVICE_INSTANCE_NAME VARCHAR SELECTIVITY 25,
+ REQUESTOR_ID VARCHAR SELECTIVITY 2,
+ CONFIGURATION_ID VARCHAR SELECTIVITY 1,
+ CONFIGURATION_NAME VARCHAR SELECTIVITY 2,
+ OPERATIONAL_ENV_ID VARCHAR SELECTIVITY 1,
+ OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1
+);
+
+CREATE CACHED TABLE PUBLIC.SITE_STATUS(
+ SITE_NAME VARCHAR NOT NULL,
+ STATUS VARCHAR,
+ CREATION_TIMESTAMP VARCHAR
+);
+
+INSERT INTO PUBLIC.SITE_STATUS(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES
+('testSite', '0', '2017-11-30 15:48:09'),
+('test name', null, null),
+('test name2', '1', null),
+('test name3', '1', null),
+('test name4', '1', '2017-11-30 15:48:09'),
+('test name update', '0', null);
+
+CREATE CACHED TABLE PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(
+ DISTRIBUTION_ID VARCHAR NOT NULL,
+ DISTRIBUTION_ID_STATUS VARCHAR,
+ CREATE_TIME VARCHAR,
+ MODIFY_TIME VARCHAR
+);
+
+
+INSERT INTO PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, CREATE_TIME, MODIFY_TIME) VALUES
+('1533c4bd-a3e3-493f-a16d-28c20614415e', '', '2017-11-30 15:48:09', '2017-11-30 15:48:09'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', '', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', '', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+CREATE CACHED TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS(
+ DISTRIBUTION_ID VARCHAR NOT NULL,
+ COMPONENT_NAME VARCHAR NOT NULL,
+ COMPONENT_DISTRIBUTION_STATUS VARCHAR,
+ CREATE_TIME VARCHAR,
+ MODIFY_TIME VARCHAR
+);
+
+
+INSERT INTO PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS(DISTRIBUTION_ID, COMPONENT_NAME, COMPONENT_DISTRIBUTION_STATUS, CREATE_TIME, MODIFY_TIME) VALUES
+('1533c4bd-a3e3-493f-a16d-28c20614415e', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:48:09', '2017-11-30 15:48:09'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', 'MSO', 'COMPONENT_DONE_ERROR', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+CREATE CACHED TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP(
+ DISTRIBUTION_ID VARCHAR NOT NULL,
+ SERVICE_MODEL_VERSION_ID VARCHAR NOT NULL,
+ CREATE_TIME VARCHAR,
+ MODIFY_TIME VARCHAR
+);
+
+
+INSERT INTO PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, CREATE_TIME, MODIFY_TIME) VALUES
+('1533c4bd-a3e3-493f-a16d-28c20614415e', '7e813ab5-88d3-4fcb-86c0-498c5d7eef9a', '2017-11-30 15:48:08', '2017-11-30 15:48:08'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', 'cc031e75-4442-4d1a-b774-8a2b434e0a50', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'eade1e9d-c1ec-4ef3-bc31-60570fba1573', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+ALTER TABLE PUBLIC.INFRA_ACTIVE_REQUESTS ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(REQUEST_ID);
+ALTER TABLE PUBLIC.SITE_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_C PRIMARY KEY(SITE_NAME);
+ALTER TABLE PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(DISTRIBUTION_ID);
+ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_D PRIMARY KEY(DISTRIBUTION_ID, COMPONENT_NAME);
+ALTER TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP ADD CONSTRAINT PUBLIC.CONSTRAINT_6 PRIMARY KEY(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID);
+ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK;
+
+