From aff68cfa08f0a0e154b303bf228c929fcf5d9549 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 7 Aug 2019 18:39:22 +0300 Subject: Change out-of-the-box config to work on dev's environment 1) Fill-up system.properties's missing fields, and same for system_template.properties. This modifies some SO endpoints, most significantly -- mso.restapi.vnf.instance is now /serviceInstantiation/v7/serviceInstances//vnfs instead of /serviceInstances/v6//vnfs 2) Configure endpoint's to a local simulator's location: * ecomp_rest_url in portal.properties * mso.server.url, aai.server.url in system.properties * asdc.client.rest.host in asdc.properties 3) Added always-on getSessionSlotCheckInterval in simulator. Issue-ID: VID-564 Change-Id: Icc7bdc83ed65df3415a4b0f36f98291775909f49 Signed-off-by: Ittay Stern --- .../simulator/controller/SimulatorController.java | 75 ++++++++++++++-------- 1 file changed, 50 insertions(+), 25 deletions(-) (limited to 'vid-ext-services-simulator') 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 06c72cbd4..3845c7419 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,8 +1,41 @@ 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.net.URLEncoder; +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; @@ -20,36 +53,22 @@ 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.*; +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.View; -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 java.io.*; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockserver.integration.ClientAndServer.startClientAndServer; -import static org.mockserver.matchers.Times.exactly; -import static org.mockserver.model.JsonBody.json; - @RestController @Component public class SimulatorController { @@ -245,8 +264,14 @@ public class SimulatorController { return new ResponseEntity<>(jsonString, HttpStatus.OK); } + //*******portal role access simulator end + @RequestMapping(value = {"/ecompportal_att/auxapi//{ver}/getSessionSlotCheckInterval", "/ONAPPORTAL/auxapi//{ver}/getSessionSlotCheckInterval"}, method = RequestMethod.GET) + @ResponseBody + public String getSessionSlotCheckInterval() { + return "300000"; + } @RequestMapping(value = {"/**"}) public ResponseEntity redirectToMockServer(HttpServletRequest request, HttpServletResponse response) throws IOException { -- cgit 1.2.3-korg