aboutsummaryrefslogtreecommitdiffstats
path: root/vid-ext-services-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'vid-ext-services-simulator')
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java14
-rw-r--r--vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml2
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/deactivate_service_instance.json4
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/dissociate_pnf_from_service_instance.json4
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/post_mso_create_service_instance.json4
5 files changed, 20 insertions, 8 deletions
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
index 3845c7419..b6cc6759f 100644
--- a/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
@@ -1,11 +1,13 @@
package org.onap.simulator.controller;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;
import static org.mockserver.matchers.Times.exactly;
import static org.mockserver.model.JsonBody.json;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
@@ -21,6 +23,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
@@ -107,11 +110,20 @@ public class SimulatorController {
private void initJPA() {
if (enableJPA) {
- entityManagerFactory = Persistence.createEntityManagerFactory("vid");
+ entityManagerFactory = Persistence.createEntityManagerFactory("vid", overrideConnectionUrl());
entityManager = entityManagerFactory.createEntityManager();
}
}
+ private Map<Object, Object> overrideConnectionUrl() {
+ final String connectionUrlEnvProperty = "hibernate.connection.url";
+ if (isEmpty(System.getProperty(connectionUrlEnvProperty))) {
+ return Collections.emptyMap();
+ } else {
+ return ImmutableMap.of(connectionUrlEnvProperty, System.getProperty(connectionUrlEnvProperty));
+ }
+ }
+
@PreDestroy
public void tearDown(){
logger.info("Stopping VID Simulator....");
diff --git a/vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml b/vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml
index 9e4453feb..448b5b380 100644
--- a/vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml
+++ b/vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml
@@ -12,7 +12,7 @@
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MariaDB103Dialect" />
- <property name="hibernate.hbm2ddl.auto" value="validate" />
+ <property name="hibernate.hbm2ddl.auto" value="none" />
<property name="hibernate.connection.driver_class" value="org.mariadb.jdbc.Driver"/>
<property name="hibernate.connection.username" value="euser"/>
<property name="hibernate.connection.password" value="euser"/>
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/deactivate_service_instance.json b/vid-ext-services-simulator/src/main/resources/preset_registration/deactivate_service_instance.json
index dc7344a4d..47b9ba953 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/deactivate_service_instance.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/deactivate_service_instance.json
@@ -1,10 +1,10 @@
{
"simulatorRequest": {
"method": "POST",
- "path": "/mso/serviceInstances/v./f36f5734-e9df-4fbf-9f35-61be13f028a1/deactivate"
+ "path": "/mso/serviceInstantiation/v./serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1/deactivate"
} ,
"simulatorResponse": {
"responseCode": 202,
"body": "{\"requestReferences\": {\"instanceId\": \"f36f5734-e9df-4fbf-9f35-61be13f028a1\", \"requestId\": \"b6dc9806-b094-42f7-9386-a48de8218ce8\"}}"
}
-} \ No newline at end of file
+}
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/dissociate_pnf_from_service_instance.json b/vid-ext-services-simulator/src/main/resources/preset_registration/dissociate_pnf_from_service_instance.json
index ef551184d..ea1dfd252 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/dissociate_pnf_from_service_instance.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/dissociate_pnf_from_service_instance.json
@@ -1,10 +1,10 @@
{
"simulatorRequest": {
"method": "POST",
- "path": "/mso/serviceInstances/v./f36f5734-e9df-4fbf-9f35-61be13f028a1/removeRelationships"
+ "path": "/mso/serviceInstantiation/v./serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1/removeRelationships"
} ,
"simulatorResponse": {
"responseCode": 202,
"body": "{\"requestReferences\": {\"instanceId\": \"f36f5734-e9df-4fbf-9f35-61be13f028a1\", \"requestId\": \"b6dc9806-b094-42f7-9386-a48de8218ce8\"}}"
}
-} \ No newline at end of file
+}
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/post_mso_create_service_instance.json b/vid-ext-services-simulator/src/main/resources/preset_registration/post_mso_create_service_instance.json
index e9f90f0ef..13638efac 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/post_mso_create_service_instance.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/post_mso_create_service_instance.json
@@ -2,7 +2,7 @@
{
"simulatorRequest": {
"method": "POST",
- "path": "/mso/serviceInstances/v."
+ "path": "/mso/serviceInstantiation/v./serviceInstances"
},
"simulatorResponse": {
"responseCode": 202,
@@ -19,4 +19,4 @@
"body": {"request":{"requestId":"c0011670-0e1a-4b74-945d-8bf5aede1d9c","startTime":"Mon, 11 Dec 2017 07:27:49 GMT","requestScope":"service","requestType":"createInstance","instanceReferences":{"serviceInstanceId":"f8791436-8d55-4fde-b4d5-72dd2cf13cfb","serviceInstanceName":"asdfasdf234234asdf","requestorId":"il883e"},"requestStatus":{"requestState":"COMPLETE","statusMessage":"Service Instance was created successfully.","percentProgress":100,"finishTime":"Mon, 11 Dec 2017 07:27:53 GMT"}}}
}
}
-] \ No newline at end of file
+]