aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java39
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java13
-rw-r--r--vid-ext-services-simulator/src/main/resources/META-INF/persistence.xml2
3 files changed, 32 insertions, 22 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
index 4fede294d..aae494f84 100644
--- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
+++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
@@ -1,8 +1,26 @@
package vid.automation.test.services;
+import static org.testng.Assert.assertEquals;
+import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString;
+import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString;
+
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.net.URI;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider;
@@ -14,25 +32,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import vid.automation.test.utils.ReadFile;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.net.URI;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.function.UnaryOperator;
-import java.util.stream.Collectors;
-
-import static org.testng.Assert.assertEquals;
-import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString;
-import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString;
-
public class SimulatorApi {
public enum RegistrationStrategy {
@@ -63,7 +62,7 @@ public class SimulatorApi {
ImmutableList.of(dropTestApiFieldFromString(), dropFieldCloudOwnerFromString());
static {
- String host = System.getProperty("VID_HOST", "127.0.0.1" );
+ String host = System.getProperty("SIM_HOST", System.getProperty("VID_HOST", "127.0.0.1"));
Integer port = Integer.valueOf(System.getProperty("SIM_PORT", System.getProperty("VID_PORT", "8080"))); //port for registration
uri = new JerseyUriBuilder().host(host).port(port).scheme("http").path("vidSimulator").build();
client = ClientBuilder.newClient();
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..aec437806 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;
@@ -107,11 +109,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"/>