aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /mso-api-handlers/mso-requests-db/src/test
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/test')
-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
24 files changed, 711 insertions, 2141 deletions
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;
+
+