summaryrefslogtreecommitdiffstats
path: root/vid-ext-services-simulator/src/main/java/org/onap
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-03-11 15:50:07 +0200
committerIttay Stern <ittay.stern@att.com>2019-03-11 16:05:19 +0200
commitcb8baa2054a427becd39e4031798375efcc9027c (patch)
treeaad2b6cc0a6afcc2627a84868d74ffb736210e24 /vid-ext-services-simulator/src/main/java/org/onap
parente2617e9d5b82f2605e1660750a0dae96a077d83f (diff)
Merge simulator from ECOMP's repository
Reference commit in ECOMP: 8e92a8c6 Issue-ID: VID-378 Change-Id: Ifd87e07db55a760fc94c582758a7413103b5fdd8 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-ext-services-simulator/src/main/java/org/onap')
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java215
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/App.java204
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Function.java56
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Role.java57
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/RoleFunction.java33
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/User.java221
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/UserApp.java49
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorRequest.java20
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorResponse.java1
9 files changed, 798 insertions, 58 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 3c193cdb9..bfed60395 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,13 +1,48 @@
package org.onap.simulator.controller;
+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.gson.Gson;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Scanner;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.TypedQuery;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.mockserver.integration.ClientAndServer;
+import org.mockserver.matchers.MatchType;
import org.mockserver.matchers.Times;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
-
import org.mockserver.model.JsonBody;
+import org.onap.simulator.db.entities.Function;
+import org.onap.simulator.db.entities.User;
import org.onap.simulator.errorHandling.VidSimulatorException;
import org.onap.simulator.model.SimulatorRequestResponseExpectation;
import org.slf4j.Logger;
@@ -17,27 +52,23 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.View;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static org.mockserver.integration.ClientAndServer.startClientAndServer;
-import static org.mockserver.matchers.Times.exactly;
-
@RestController
@Component
public class SimulatorController {
@@ -48,9 +79,14 @@ public class SimulatorController {
private String mockServerHost;
private Integer mockServerPort;
private Boolean enablePresetRegistration;
+ private Boolean enableJPA;
private volatile boolean isInitialized = false;
- Logger logger = LoggerFactory.getLogger(SimulatorController.class);
+ private EntityManager entityManager;
+ private EntityManagerFactory entityManagerFactory;
+
+
+ private static final Logger logger = LoggerFactory.getLogger(SimulatorController.class);
@PostConstruct
public void init(){
@@ -58,15 +94,31 @@ public class SimulatorController {
setProperties();
mockServer = startClientAndServer(mockServerPort);
presetRegister();
+ try {
+ initJPA();
+ } catch (RuntimeException e) {
+ isInitialized = false;
+ logger.error("Error during the JPA initialization:", e);
+ return;
+ }
isInitialized = true;
logger.info("VID Simulator started successfully");
}
+ private void initJPA() {
+ if (enableJPA) {
+ entityManagerFactory = Persistence.createEntityManagerFactory("vid");
+ entityManager = entityManagerFactory.createEntityManager();
+ }
+ }
+
@PreDestroy
public void tearDown(){
logger.info("Stopping VID Simulator....");
+ entityManager.close();
+ entityManagerFactory.close();
isInitialized = false;
- mockServer.stop();
+ mockServer.stop(false);
}
@@ -82,9 +134,11 @@ public class SimulatorController {
try {
File presetDir = resolver.getResource("/preset_registration/").getFile();
if (presetDir.exists() && presetDir.isDirectory()) {
- resources = Files.walk(Paths.get(presetDir.getPath()))
- .filter(p -> p.toString().endsWith(".json"))
- .collect(Collectors.toList());
+ try (Stream<Path> files = Files.walk(Paths.get(presetDir.getPath()))) {
+ resources = files
+ .filter(p -> p.toString().endsWith(".json"))
+ .collect(Collectors.toList());
+ }
} else {
logger.error("preset_registration directory is not exists");
}
@@ -95,8 +149,8 @@ public class SimulatorController {
logger.info("Starting preset registrations, number of requests: {}", resources.size());
for (Path resource: resources){
String content;
- try {
- content = new Scanner(resource).useDelimiter("\\Z").next();
+ try (Scanner scanner = new Scanner(resource).useDelimiter("\\Z")){
+ content = scanner.next();
} catch (IOException e){
logger.error("Error reading preset registration file {}, skipping to next one. Error: ", resource.getFileName(), e);
continue;
@@ -126,6 +180,7 @@ public class SimulatorController {
mockServerHost = (String)props.get("simulator.mockserver.host");
mockServerPort = Integer.parseInt((String)props.get("simulator.mockserver.port"));
enablePresetRegistration = Boolean.parseBoolean((String)props.get("simulator.enablePresetRegistration"));
+ enableJPA = Boolean.parseBoolean((String)props.get("simulator.enableCentralizedRoleAccess"));
}
@RequestMapping(value = {"/registerToVidSimulator"}, method = RequestMethod.POST)
@@ -144,13 +199,10 @@ public class SimulatorController {
return isInitialized ? new ResponseEntity<>("",HttpStatus.OK) : new ResponseEntity<>("",HttpStatus.SERVICE_UNAVAILABLE);
}
-// @RequestMapping(value = {"/registerToVidSimulator"}, method = RequestMethod.GET)
-// public ResponseEntity<String> getAllRegisteredRequests() throws JsonProcessingException {
-// final Expectation[] expectations = mockServer.retrieveExistingExpectations(null);
-// return new ResponseEntity<>(new ObjectMapper()
-// .configure(SerializationFeature.INDENT_OUTPUT, true)
-// .writeValueAsString(expectations), HttpStatus.OK);
-// }
+ @RequestMapping(value = {"/retrieveRecordedRequests"}, method = RequestMethod.GET)
+ public List<HttpRequest> retrieveRecordedRequests() {
+ return Arrays.asList(mockServer.retrieveRecordedRequests(null));
+ }
@RequestMapping(value = {"/registerToVidSimulator"}, method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
@@ -176,10 +228,47 @@ public class SimulatorController {
}
}
- @RequestMapping(value = {"/**"})
- public String redirectToMockServer(HttpServletRequest request, HttpServletResponse response) {
- //Currently, the easiest logic is redirecting
+ //*******portal role access simulator (added by ag137v)
+
+ @RequestMapping(value = {"/ONAPPORTAL/auxapi//v3/user/*"}, method = RequestMethod.GET)
+ public @ResponseBody
+ ResponseEntity auxapiGetUser(HttpServletRequest request) {
+ if (!enableJPA) {
+ return new ResponseEntity<>("Centralized Role Access is disabled", HttpStatus.SERVICE_UNAVAILABLE);
+ }
+ entityManager.clear();
+ String reqUri = request.getRequestURI();
+ String userName = reqUri.substring(reqUri.lastIndexOf('/') + 1);
+ TypedQuery<User> userQuery = entityManager.createQuery("select u from fn_user u where u.loginId = :userName", User.class);
+ userQuery.setParameter("userName", userName);
+ User user = userQuery.getSingleResult();
+
+ Gson g = new Gson();
+ String jsonString = g.toJson(user);
+
+ return new ResponseEntity<>(jsonString, HttpStatus.OK);
+
+ }
+
+ @RequestMapping(value = {"/ONAPPORTAL/auxapi//v3/functions"}, method = RequestMethod.GET)
+ public @ResponseBody
+ ResponseEntity auxapiGetFunctions(HttpServletRequest request) {
+ if (!enableJPA) {
+ return new ResponseEntity<>("Centralized Role Access is disabled", HttpStatus.SERVICE_UNAVAILABLE);
+ }
+ TypedQuery<Function> userQuery = entityManager.createQuery("select f from fn_function f", Function.class);
+ List<Function> functions = userQuery.getResultList();
+ Gson g = new Gson();
+ String jsonString = g.toJson(functions);
+
+ return new ResponseEntity<>(jsonString, HttpStatus.OK);
+
+ }
+ //*******portal role access simulator end
+
+ @RequestMapping(value = {"/**"})
+ public ResponseEntity redirectToMockServer(HttpServletRequest request, HttpServletResponse response) throws IOException {
//This is needed to allow POST redirect - see http://www.baeldung.com/spring-redirect-and-forward
request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, HttpStatus.TEMPORARY_REDIRECT);
@@ -196,21 +285,15 @@ public class SimulatorController {
}*/
StringBuilder sb = new StringBuilder();
- sb.append(mockServerProtocol+"://"+mockServerHost+":"+mockServerPort+"/"+restOfTheUrl);
+ sb.append(mockServerProtocol).append("://").append(mockServerHost).append(":").append(mockServerPort).append(restOfTheUrl);
String queryString = request.getQueryString();
if (queryString != null){
sb.append("?").append(queryString);
}
String redirectUrl = sb.toString();
logger.info("Redirecting the request to : {}", redirectUrl);
- return ("redirect:"+redirectUrl);
- //This was a try to setup a proxy instead of redirect
- //Abandoned this direction when trying to return the original HTTP error code which was registered to mock server, instead of wrapped up HTTP 500.
-
- /* String restOfTheUrl = "/"+(String) request.getAttribute(
- HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
- URI uri = null;
+ URI uri;
try {
uri = new URI("http", null, "localhost", 1080, restOfTheUrl, request.getQueryString(), null);
} catch (URISyntaxException e) {
@@ -225,11 +308,24 @@ public class SimulatorController {
String headerToSet = headerNames.nextElement();
headers.set(headerToSet, request.getHeader(headerToSet));
}
+ HttpEntity<String> proxyRequest;
+ if ("POST".equalsIgnoreCase(request.getMethod()))
+ {
+ String body = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
+ proxyRequest = new HttpEntity<>(body, headers);
+ } else {
+ proxyRequest = new HttpEntity<>(headers);
+ }
+
+ ResponseEntity<String> responseEntity;
+ try {
+ responseEntity =
+ restTemplate.exchange(uri, HttpMethod.resolve(request.getMethod()), proxyRequest, String.class);
+ } catch (HttpClientErrorException exception) {
+ responseEntity = new ResponseEntity<>(exception.getResponseBodyAsString(), exception.getStatusCode());
+ }
- ResponseEntity<String> responseEntity =
- restTemplate.exchange(uri, HttpMethod.resolve(request.getMethod()), new HttpEntity<String>(body, headers), String.class);
-
- return responseEntity;*/
+ return responseEntity;
}
private void register(SimulatorRequestResponseExpectation expectationModel) throws VidSimulatorException{
@@ -239,6 +335,12 @@ public class SimulatorController {
if (id != null) {
request.withHeader("x-simulator-id", id);
}
+
+ if (expectationModel.getSimulatorRequest().getHeaders()!=null) {
+ expectationModel.getSimulatorRequest().getHeaders().forEach(
+ request::withHeader);
+ }
+
String method = expectationModel.getSimulatorRequest().getMethod();
if (method != null) {
request.withMethod(method);
@@ -249,16 +351,18 @@ public class SimulatorController {
}
String body = expectationModel.getSimulatorRequest().getBody();
if (body != null) {
- request.withBody(new JsonBody(body));
+ if (expectationModel.getSimulatorRequest().getStrict()) {
+ request.withBody(json(body, MatchType.STRICT));
+ } else {
+ request.withBody(new JsonBody(body));
+ }
}
//Queryparams
final Map<String, List<String>> queryParams = expectationModel.getSimulatorRequest().getQueryParams();
if (queryParams != null){
String[] arr = new String[0];
- queryParams.entrySet().stream().forEach(x -> {
- request.withQueryStringParameter(x.getKey(), x.getValue().toArray(arr));
- });
+ queryParams.forEach((key, value) -> request.withQueryStringParameter(key, value.toArray(arr)));
}
//Setting response according to what is passed
@@ -300,14 +404,13 @@ public class SimulatorController {
private byte[] loadFileString(String filePath) {
byte[] bytes = null;
+ File file = null;
try {
- File file = new ClassPathResource("download_files/" + filePath).getFile();
- bytes = new byte[(int)file.length()];
- DataInputStream dataInputStream = null;
-
- dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file.getPath())));
- dataInputStream.readFully(bytes);
- dataInputStream.close();
+ file = new ClassPathResource("download_files/" + filePath).getFile();
+ try(DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file.getPath())))) {
+ bytes = new byte[(int)file.length()];
+ dataInputStream.readFully(bytes);
+ }
} catch (FileNotFoundException e) {
logger.error("File not found for file:" + filePath);
e.printStackTrace();
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/App.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/App.java
new file mode 100644
index 000000000..222e753c4
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/App.java
@@ -0,0 +1,204 @@
+package org.onap.simulator.db.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import org.hibernate.annotations.Type;
+
+@Entity(name = "fn_app")
+public class App {
+ @Id
+ @Column(name = "app_id")
+ protected Integer id;
+ @Column(name = "app_name")
+ private String name; // app_name
+ @Column(name = "app_image_url")
+ private String imageUrl; // app_image_url
+ @Column(name = "app_description")
+ private String description; // app_description
+ @Column(name = "app_notes")
+ private String notes; // app_notes
+ @Column(name = "app_url")
+ private String url; // app_url
+ @Column(name = "app_alternate_url")
+ private String alternateUrl; // app_alternate_url
+ @Column(name = "app_rest_endpoint")
+ private String restEndpoint; // app_rest_endpoint
+ @Column(name = "ml_app_name")
+ private String mlAppName; // ml_app_name
+ @Column(name = "ml_app_admin_id")
+ private String mlAppAdminId; // ml_app_admin_id
+ @Column(name = "mots_id")
+ private Integer motsId; // mots_id
+ @Column(name = "app_password")
+ private String appPassword; // app_password
+ @Column(columnDefinition = "varchar")
+ @Type(type="yes_no")
+ private Boolean open;
+ @Column(columnDefinition = "varchar")
+ @Type(type="yes_no")
+ private Boolean enabled;
+ @Column(columnDefinition="mediumblob")
+ private byte[] thumbnail;
+ @Column(name = "app_username")
+ private String username; // app_username
+ @Column(name = "ueb_key")
+ private String uebKey; // ueb_key
+ @Column(name = "ueb_secret")
+ private String uebSecret; // ueb_secret
+ @Column(name = "ueb_topic_name")
+ private String uebTopicName; // ueb_topic_name
+
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getImageUrl() {
+ return imageUrl;
+ }
+
+ public void setImageUrl(String imageUrl) {
+ this.imageUrl = imageUrl;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getAlternateUrl() {
+ return alternateUrl;
+ }
+
+ public void setAlternateUrl(String alternateUrl) {
+ this.alternateUrl = alternateUrl;
+ }
+
+ public String getRestEndpoint() {
+ return restEndpoint;
+ }
+
+ public void setRestEndpoint(String restEndpoint) {
+ this.restEndpoint = restEndpoint;
+ }
+
+ public String getMlAppName() {
+ return mlAppName;
+ }
+
+ public void setMlAppName(String mlAppName) {
+ this.mlAppName = mlAppName;
+ }
+
+ public String getMlAppAdminId() {
+ return mlAppAdminId;
+ }
+
+ public void setMlAppAdminId(String mlAppAdminId) {
+ this.mlAppAdminId = mlAppAdminId;
+ }
+
+ public Integer getMotsId() {
+ return motsId;
+ }
+
+ public void setMotsId(Integer motsId) {
+ this.motsId = motsId;
+ }
+
+ public String getAppPassword() {
+ return appPassword;
+ }
+
+ public void setAppPassword(String appPassword) {
+ this.appPassword = appPassword;
+ }
+
+ public Boolean getOpen() {
+ return open;
+ }
+
+ public void setOpen(Boolean open) {
+ this.open = open;
+ }
+
+ public Boolean getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public byte[] getThumbnail() {
+ return thumbnail;
+ }
+
+ public void setThumbnail(byte[] thumbnail) {
+ this.thumbnail = thumbnail;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getUebKey() {
+ return uebKey;
+ }
+
+ public void setUebKey(String uebKey) {
+ this.uebKey = uebKey;
+ }
+
+ public String getUebSecret() {
+ return uebSecret;
+ }
+
+ public void setUebSecret(String uebSecret) {
+ this.uebSecret = uebSecret;
+ }
+
+ public String getUebTopicName() {
+ return uebTopicName;
+ }
+
+ public void setUebTopicName(String uebTopicName) {
+ this.uebTopicName = uebTopicName;
+ }
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Function.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Function.java
new file mode 100644
index 000000000..0f37ec9e2
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Function.java
@@ -0,0 +1,56 @@
+package org.onap.simulator.db.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name = "fn_function")
+public class Function {
+
+ @Id
+ @Column(name = "function_cd")
+ private String code;
+ @Column(name = "function_name")
+ private String name;
+ private String type;
+ private String action;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String toString() {
+ return "RoleFunction [code=" + code + ", name=" + name + ", type=" + type + ", action=" + action + "]";
+ }
+
+
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Role.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Role.java
new file mode 100644
index 000000000..8b09d1f57
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/Role.java
@@ -0,0 +1,57 @@
+package org.onap.simulator.db.entities;
+
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import org.hibernate.annotations.Type;
+
+@Entity(name = "fn_role")
+public class Role {
+ @Id
+ @Column(name = "role_id")
+ private Integer id;
+ @Column(name = "role_name")
+ private String name;
+ @Column(name = "active_yn", columnDefinition = "varchar")
+ @Type(type="yes_no")
+ private boolean active;
+
+ @OneToMany(cascade = CascadeType.ALL, targetEntity=RoleFunction.class, mappedBy="id")
+ private Set<RoleFunction> roleFunctions;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+
+ public Set<RoleFunction> getRoleFunctions() {
+ return roleFunctions;
+ }
+
+ public void setRoleFunctions(Set<RoleFunction> roleFunctions) {
+ this.roleFunctions = roleFunctions;
+ }
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/RoleFunction.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/RoleFunction.java
new file mode 100644
index 000000000..addda5363
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/RoleFunction.java
@@ -0,0 +1,33 @@
+package org.onap.simulator.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name = "fn_role_function")
+public class RoleFunction implements Serializable {
+
+ @Id
+ @Column(name = "role_id")
+ private Integer id;
+ @Id
+ @Column(name = "function_cd")
+ private String code;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/User.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/User.java
new file mode 100644
index 000000000..349845f36
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/User.java
@@ -0,0 +1,221 @@
+package org.onap.simulator.db.entities;
+
+import java.math.BigDecimal;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import org.hibernate.annotations.Type;
+
+@Entity(name = "fn_user")
+public class User {
+
+ @Id @Column(name = "user_id")
+ private Integer id;
+ @Column(name = "created_id")
+ private Integer createdId;
+ @Column(name = "modified_id")
+ private Integer modifiedId;
+ @Column(name = "org_id")
+ private Integer orgId;
+ @Column(name = "org_manager_userid")
+ private String managerId;
+ @Column(name = "first_name")
+ private String firstName;
+ @Column(name = "middle_name")
+ private String middleInitial;
+ @Column(name = "last_name")
+ private String lastName;
+
+ @Column(name = "address_id")
+ private BigDecimal addressId;
+ @Column(name = "alert_method_cd")
+ private String alertMethodCd;
+ private String hrid;
+ @Column(name = "org_user_id")
+ private String orgUserId;
+ @Column(name = "ADDRESS_LINE_1")
+ private String address1;
+ @Column(name = "ADDRESS_LINE_2")
+ private String address2;
+ @Column(name = "login_id")
+ private String loginId;
+ @Column(name = "login_pwd")
+ private String loginPwd;
+ @Column(name = "active_yn", columnDefinition = "varchar")
+ @Type(type="yes_no")
+ private Boolean active;
+ @Column(name = "is_internal_yn", columnDefinition = "varchar")
+ @Type(type="yes_no")
+ private Boolean internal;
+ @Column(name = "timezone")
+ private Integer timeZoneId;
+
+ @OneToMany(cascade = CascadeType.ALL, targetEntity=UserApp.class, mappedBy="userId")
+ private Set<UserApp> userApps;
+
+ public User() {
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getCreatedId() {
+ return createdId;
+ }
+
+ public void setCreatedId(Integer createdId) {
+ this.createdId = createdId;
+ }
+
+ public Integer getModifiedId() {
+ return modifiedId;
+ }
+
+ public void setModifiedId(Integer modifiedId) {
+ this.modifiedId = modifiedId;
+ }
+
+ public Integer getOrgId() {
+ return orgId;
+ }
+
+ public void setOrgId(Integer orgId) {
+ this.orgId = orgId;
+ }
+
+ public String getManagerId() {
+ return managerId;
+ }
+
+ public void setManagerId(String managerId) {
+ this.managerId = managerId;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getMiddleInitial() {
+ return middleInitial;
+ }
+
+ public void setMiddleInitial(String middleInitial) {
+ this.middleInitial = middleInitial;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public BigDecimal getAddressId() {
+ return addressId;
+ }
+
+ public void setAddressId(BigDecimal addressId) {
+ this.addressId = addressId;
+ }
+
+ public String getAlertMethodCd() {
+ return alertMethodCd;
+ }
+
+ public void setAlertMethodCd(String alertMethodCd) {
+ this.alertMethodCd = alertMethodCd;
+ }
+
+ public String getHrid() {
+ return hrid;
+ }
+
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+ public String getAddress1() {
+ return address1;
+ }
+
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ public String getAddress2() {
+ return address2;
+ }
+
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public String getLoginPwd() {
+ return loginPwd;
+ }
+
+ public void setLoginPwd(String loginPwd) {
+ this.loginPwd = loginPwd;
+ }
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+
+ public Boolean getInternal() {
+ return internal;
+ }
+
+ public void setInternal(Boolean internal) {
+ this.internal = internal;
+ }
+
+ public Integer getTimeZoneId() {
+ return timeZoneId;
+ }
+
+ public void setTimeZoneId(Integer timeZoneId) {
+ this.timeZoneId = timeZoneId;
+ }
+
+ public Set<UserApp> getUserApps() {
+ return userApps;
+ }
+
+ public void setUserApps(Set<UserApp> userApps) {
+ this.userApps = userApps;
+ }
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/UserApp.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/UserApp.java
new file mode 100644
index 000000000..e4eba7940
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/db/entities/UserApp.java
@@ -0,0 +1,49 @@
+package org.onap.simulator.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+@Entity(name = "fn_user_role")
+public class UserApp implements Serializable {
+
+ @Id
+ @Column(name = "user_id")
+ private Integer userId;
+ @Id
+ @ManyToOne
+ @JoinColumn(name = "app_id")
+ private App app;
+ @Id
+ @ManyToOne
+ @JoinColumn(name = "role_id")
+ private Role role;
+
+ public Integer getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ public App getApp() {
+ return app;
+ }
+
+ public void setApp(App app) {
+ this.app = app;
+ }
+
+ public Role getRole() {
+ return role;
+ }
+
+ public void setRole(Role role) {
+ this.role = role;
+ }
+
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorRequest.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorRequest.java
index 9e298b916..713c318a2 100644
--- a/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorRequest.java
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorRequest.java
@@ -2,7 +2,6 @@ package org.onap.simulator.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
-
import java.util.List;
import java.util.Map;
@@ -12,6 +11,9 @@ public class SimulatorRequest {
private String method;
private String path;
private String body;
+ private boolean strict;
+ private Map<String,String> headers;
+
private Map<String, List<String>> queryParams;
public Map<String, List<String>> getQueryParams() {
@@ -54,6 +56,22 @@ public class SimulatorRequest {
this.body = body.isTextual() ? body.textValue() : body.toString();
}
+ public boolean getStrict() {
+ return strict;
+ }
+
+ public void setStrict(boolean strict) {
+ this.strict = strict;
+ }
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
@Override
public String toString() {
return "SimulatorRequest{" +
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorResponse.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorResponse.java
index 4836185f9..1ee185fdd 100644
--- a/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorResponse.java
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/model/SimulatorResponse.java
@@ -2,7 +2,6 @@ package org.onap.simulator.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
-
import java.util.Map;
public class SimulatorResponse {