aboutsummaryrefslogtreecommitdiffstats
path: root/so-etsi-nfvo/so-etsi-nfvo-ns-lcm
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2020-10-21 17:28:51 +0100
committerwaqas.ikram <waqas.ikram@est.tech>2020-10-22 13:13:59 +0100
commitb38cdcc65fad5909a42b7a67a63cd66ad2dbe7d4 (patch)
tree78d034914fe0d26d4bae061903c71fc6c3aad1fb /so-etsi-nfvo/so-etsi-nfvo-ns-lcm
parent506cd385cb845fa334856c0e236a79b058c8eb35 (diff)
Changing save to saveAndFlush to flush the data to
DB immediately and Updating Camunda configuration to use separate transaction manager than other datasources Change-Id: Id621827a9de61dec08c4bae92741fbd7296824a7 Issue-ID: SO-2868 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm')
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java27
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java30
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java41
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java8
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java2
12 files changed, 72 insertions, 58 deletions
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java
index c803808df1..770e91c1cb 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java
@@ -22,13 +22,17 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows;
import static org.slf4j.LoggerFactory.getLogger;
import javax.sql.DataSource;
+import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
+import org.camunda.bpm.spring.boot.starter.util.SpringBootProcessEnginePlugin;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
@@ -39,9 +43,10 @@ import com.zaxxer.hikari.HikariDataSource;
*/
@Configuration
@EnableTransactionManagement
-@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager")
public class CamundaDatabaseConfiguration {
+ private static final String CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME = "camundaTransactionManager";
+
private static final String CAMUNDA_DATA_SOURCE_BEAN_NAME = "camundaBpmDataSource";
private static final Logger logger = getLogger(CamundaDatabaseConfiguration.class);
@@ -66,4 +71,22 @@ public class CamundaDatabaseConfiguration {
return new HikariDataSource(hikariConfig);
}
+ @Bean(name = CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME)
+ public PlatformTransactionManager camundaTransactionManager(
+ @Qualifier(CAMUNDA_DATA_SOURCE_BEAN_NAME) final DataSource dataSource) {
+ return new DataSourceTransactionManager(dataSource);
+ }
+
+ @Bean
+ public SpringBootProcessEnginePlugin transactionManagerProcessEnginePlugin(
+ @Qualifier(CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME) final PlatformTransactionManager camundaTransactionManager) {
+ return new SpringBootProcessEnginePlugin() {
+ @Override
+ public void preInit(final SpringProcessEngineConfiguration processEngineConfiguration) {
+ logger.info("Setting Camunda TransactionManager ...");
+ processEngineConfiguration.setTransactionManager(camundaTransactionManager);
+
+ }
+ };
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
index 49118494cf..14d4fa2f07 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
@@ -302,7 +302,7 @@ public class JobExecutorService {
}
private boolean isNotImmediateTerminateRequest(final TerminateNsRequest terminateNsRequest) {
- return terminateNsRequest.getTerminationTime() != null;
+ return terminateNsRequest != null && terminateNsRequest.getTerminationTime() != null;
}
private boolean isNotInstantiated(final NfvoNsInst nfvoNsInst) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
index b6fd9e407a..1a89f75a70 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
@@ -67,7 +67,7 @@ public abstract class BaseTest {
protected static final Logger logger = getLogger(BaseTest.class);
- private static final long TIME_OUT_IN_SECONDS = 60;
+ private static final long TIME_OUT_IN_SECONDS = 120;
private static final int SLEEP_TIME_IN_SECONDS = 5;
@Autowired
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java
index adb8a9e69b..017bdf6b70 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java
@@ -19,7 +19,17 @@
*/
package org.onap.so.etsi.nfvo.ns.workflow.engine.tasks;
-import com.google.gson.Gson;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.time.LocalDateTime;
+import java.util.Optional;
+import java.util.UUID;
import org.camunda.bpm.engine.history.HistoricProcessInstance;
import org.junit.After;
import org.junit.Before;
@@ -27,24 +37,12 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.BaseTest;
-import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.GsonProvider;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.exceptions.NsRequestProcessingException;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.service.JobExecutorService;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
import org.springframework.beans.factory.annotation.Autowired;
-import java.time.LocalDateTime;
-import java.util.Optional;
-import java.util.UUID;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.ok;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
/**
* @author Andrew Lamb (andrew.a.lamb@est.tech)
@@ -55,18 +53,12 @@ public class DeleteNsTaskTest extends BaseTest {
@Autowired
private JobExecutorService objUnderTest;
- @Autowired
- private GsonProvider gsonProvider;
-
@Rule
public ExpectedException expectedException = ExpectedException.none();
- private Gson gson;
-
@Before
public void before() {
wireMockServer.resetAll();
- gson = gsonProvider.getGson();
}
@After
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
index b821c85edd..51460ec4c8 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
@@ -19,7 +19,25 @@
*/
package org.onap.so.etsi.nfvo.ns.workflow.engine.tasks;
-import com.google.gson.Gson;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN;
+import static org.springframework.test.web.client.ExpectedCount.times;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
import org.camunda.bpm.engine.history.HistoricProcessInstance;
import org.hamcrest.text.MatchesPattern;
import org.junit.After;
@@ -47,26 +65,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
-import java.io.IOException;
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.ok;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN;
-import static org.springframework.test.web.client.ExpectedCount.times;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import com.google.gson.Gson;
/**
* @author Andrew Lamb (andrew.a.lamb@est.tech)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml
index 1fabfbaac9..101e17a791 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml
@@ -42,7 +42,7 @@ etsi-catalog-manager:
endpoint: http://modeling-etsicatalog.onap:8806/api
so-etsi-ns-lcm-workflow-engine:
requesttimeout:
- timeoutInSeconds: 60
+ timeoutInSeconds: 120
logging:
level:
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java
index d52dcd6192..d7f2f4cefa 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java
@@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository;
import java.util.Optional;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
* @author mukeshsharma(mukeshsharma@est.tech)
*/
-public interface NSLcmOpOccRepository extends CrudRepository<NsLcmOpOcc, String> {
+public interface NSLcmOpOccRepository extends JpaRepository<NsLcmOpOcc, String> {
Optional<NsLcmOpOcc> findById(final String id);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java
index 2d6d033689..220902c631 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java
@@ -21,13 +21,13 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository;
import java.util.Optional;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
-import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-public interface NfvoJobRepository extends CrudRepository<NfvoJob, String>, RefreshableRepository<NfvoJob> {
+public interface NfvoJobRepository extends JpaRepository<NfvoJob, String>, RefreshableRepository<NfvoJob> {
Optional<NfvoJob> findByResourceId(final String resourceId);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java
index 5560ea7af3..f91a85f2e6 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java
@@ -23,16 +23,16 @@ import java.util.List;
import java.util.Optional;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
* @author mukeshsharma(mukeshsharma@est.tech)
*/
-public interface NfvoNfInstRepository extends CrudRepository<NfvoNfInst, String> {
+public interface NfvoNfInstRepository extends JpaRepository<NfvoNfInst, String> {
Optional<NfvoNfInst> findByNfInstId(final String nfInstId);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java
index 2a6abda558..a64cf9bdd5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java
@@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository;
import java.util.Optional;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-public interface NfvoNsInstRepository extends CrudRepository<NfvoNsInst, String> {
+public interface NfvoNsInstRepository extends JpaRepository<NfvoNsInst, String> {
Optional<NfvoNsInst> findByName(final String name);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
index 58ca76eec9..ec8777d0fa 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
@@ -68,7 +68,7 @@ public class DatabaseServiceProvider {
public boolean addJob(final NfvoJob job) {
logger.info("Adding NfvoJob: {} to database", job);
- return nfvoJobRepository.save(job) != null;
+ return nfvoJobRepository.saveAndFlush(job) != null;
}
public Optional<NfvoJob> getJob(final String jobId) {
@@ -104,7 +104,7 @@ public class DatabaseServiceProvider {
public boolean saveNfvoNsInst(final NfvoNsInst nfvoNsInst) {
logger.info("Saving NfvoNsInst: {} to database", nfvoNsInst);
- return nfvoNsInstRepository.save(nfvoNsInst) != null;
+ return nfvoNsInstRepository.saveAndFlush(nfvoNsInst) != null;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
@@ -125,7 +125,7 @@ public class DatabaseServiceProvider {
public boolean saveNfvoNfInst(final NfvoNfInst nfvoNfInst) {
logger.info("Saving NfvoNfInst: {} to database", nfvoNfInst);
- return nfvoNfInstRepository.save(nfvoNfInst) != null;
+ return nfvoNfInstRepository.saveAndFlush(nfvoNfInst) != null;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
@@ -162,7 +162,7 @@ public class DatabaseServiceProvider {
public boolean addNSLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) {
logger.info("Adding NSLcmOpOcc: {} to database", nsLcmOpOcc);
- return nsLcmOpOccRepository.save(nsLcmOpOcc) != null;
+ return nsLcmOpOccRepository.saveAndFlush(nsLcmOpOcc) != null;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
index 2390cef564..4d6f92c373 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
@@ -145,7 +145,7 @@ public class NsLifecycleManagementController {
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public ResponseEntity<Void> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
- @RequestBody final TerminateNsRequest terminateNsRequest) {
+ @RequestBody(required = false) final TerminateNsRequest terminateNsRequest) {
logger.debug("Received terminate NS request: {}\n with nsInstanceId: {}", terminateNsRequest, nsInstanceId);
final URI resourceUri = nsLifeCycleManager.terminateNs(nsInstanceId, terminateNsRequest);
logger.info("{} Ns Terminate started successfully. Resource Operation Occurrence uri: {}", nsInstanceId,