summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-07-20 08:31:57 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-07-20 11:51:24 -0400
commitb58317907044b0cd72f1cdd8582800dc2c764b40 (patch)
tree3e6f7db75ceeadd7571403b46e2d22ac8ac01014
parentc67680ada04c96a1753c037d67080c65628d32ca (diff)
Add portal property; correct docker build script.
New Portal property services.widget.protocol controls whether http or https protocol is used to access the widget microservice endpoints. Adjust build script to use new name "sdk" when building Docker with Portal apps (formerly named ecompsdkos). Change-Id: I25b7f39d40351da04c7a9dc3cc1c75ddad2750ea Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
-rw-r--r--.gitignore6
-rw-r--r--deliveries/.gitignore1
-rw-r--r--deliveries/dbstop.sh2
-rwxr-xr-xdeliveries/os_build_febe.sh3
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java5
-rw-r--r--ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java3
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java7
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java10
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java33
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java5
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java3
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java1
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java14
-rw-r--r--ecomp-portal-BE-os/README.md3
14 files changed, 59 insertions, 37 deletions
diff --git a/.gitignore b/.gitignore
index eb3edf4f..08f69cfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
-.idea/workspace.xml \ No newline at end of file
+/.idea/workspace.xml
+/.project
+/.settings
+/dmaapbc
+/sdk
diff --git a/deliveries/.gitignore b/deliveries/.gitignore
new file mode 100644
index 00000000..f12ac3a0
--- /dev/null
+++ b/deliveries/.gitignore
@@ -0,0 +1 @@
+/PROJECT
diff --git a/deliveries/dbstop.sh b/deliveries/dbstop.sh
index 6fb7dc3f..319b28ba 100644
--- a/deliveries/dbstop.sh
+++ b/deliveries/dbstop.sh
@@ -1,2 +1,2 @@
docker stop ecompdb_portal
-docker rm ecompdb_portal \ No newline at end of file
+docker rm ecompdb_portal
diff --git a/deliveries/os_build_febe.sh b/deliveries/os_build_febe.sh
index c9110892..d9a59bf1 100755
--- a/deliveries/os_build_febe.sh
+++ b/deliveries/os_build_febe.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+# Builds docker with three webapps: portal app, portal-sdk app, dbc app
# Stop on error; show output
set -e -x
@@ -36,7 +37,7 @@ cp -r ecomp-portal-BE-common $PROJECTDIR/ecomp-portal-BE-common
cp -r ecomp-portal-BE-os $PROJECTDIR/ecomp-portal-BE-os
cp -r ecomp-portal-DB-common $PROJECTDIR/ecomp-portal-DB-common
cp -r ecomp-portal-DB-os $PROJECTDIR/ecomp-portal-DB-os
-cp -r ecompsdkos/ecomp-sdk $PROJECTDIR/ecomp-sdk
+cp -r sdk/ecomp-sdk $PROJECTDIR/ecomp-sdk
cd $PROJECTDIR/ecomp-portal-BE-common
${MVN} install
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java
index 4c14d8a0..567446ee 100644
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java
+++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java
@@ -165,7 +165,7 @@ public class MicroserviceControllerTest extends MockitoTestSuite{
PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
expectedportalRestResponse.setMessage("FAILURE");
expectedportalRestResponse.setResponse(
- "I/O error on GET request for \"https://null/widget/microservices/widgetCatalog/service/1\":null; nested exception is java.net.UnknownHostException: null");
+ "I/O error on GET request for \"" + EcompPortalUtils.widgetMsProtocol() + "://null/widget/microservices/widgetCatalog/service/1\":null; nested exception is java.net.UnknownHostException: null");
PortalRestStatusEnum portalRestStatusEnum = null;
expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR);
PowerMockito.mockStatic(WidgetServiceHeaders.class);
@@ -209,7 +209,6 @@ public class MicroserviceControllerTest extends MockitoTestSuite{
@SuppressWarnings("unchecked")
@Test
public void deleteMicroserviceWhenNoWidgetsAssociatedTest() throws Exception {
- String HTTPS = "https://";
PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>();
expectedportalRestResponse.setMessage("SUCCESS");
expectedportalRestResponse.setResponse("");
@@ -223,7 +222,7 @@ public class MicroserviceControllerTest extends MockitoTestSuite{
ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() {
};
Mockito.when(template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/service/" + 1,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans);
PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest,
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java
index 1ba4c784..60a9b7a1 100644
--- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java
+++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java
@@ -19,6 +19,7 @@ import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalapp.test.framework.MockitoTestSuite;
import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -62,7 +63,7 @@ public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite {
{
String whatService = "widgets-service";
PowerMockito.mockStatic(WidgetServiceHeaders.class);
- Mockito.when(template.getForObject("https://" + consulHealthService.getServiceLocation(whatService, null) + "/widget/microservices/markup/" + 1, String.class,
+ Mockito.when(template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, null) + "/widget/microservices/markup/" + 1, String.class,
WidgetServiceHeaders.getInstance())).thenReturn("Success");
String response = widgetsCatalogMarkupController.getWidgetMarkup(mockedRequest, mockedResponse, 1);
assertTrue(response.equals("Success"));
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
index bc21dd98..42a62b5f 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
@@ -33,6 +33,7 @@ import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
import org.openecomp.portalapp.portal.service.ConsulHealthService;
import org.openecomp.portalapp.portal.service.MicroserviceService;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -54,8 +55,6 @@ import org.springframework.web.client.RestTemplate;
@EPAuditLog
public class MicroserviceController extends EPRestrictedBaseController {
- private static final String HTTPS = "https://";
-
String whatService = "widgets-service";
RestTemplate template = new RestTemplate();
@@ -64,7 +63,7 @@ public class MicroserviceController extends EPRestrictedBaseController {
@Autowired
private MicroserviceService microserviceService;
-
+
@RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.POST)
public PortalRestResponse<String> createMicroservice(HttpServletRequest request, HttpServletResponse response,
@RequestBody MicroserviceData newServiceData) throws Exception {
@@ -114,7 +113,7 @@ public class MicroserviceController extends EPRestrictedBaseController {
};
// If this service is assoicated with widgets, cannnot be deleted
ResponseEntity<List<WidgetCatalog>> ans = (ResponseEntity<List<WidgetCatalog>>) template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/service/" + serviceId,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef);
List<WidgetCatalog> widgets = ans.getBody();
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
index b5761617..662de30a 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
@@ -77,8 +77,10 @@ public class WebAnalyticsExtAppController extends EPRestrictedRESTfulBaseControl
private static final String MACHINE_LEARNING_SERVICE_CTX = "/ml_api";
private static final String REGISTER_ACTION = MACHINE_LEARNING_SERVICE_CTX + "/" + "registerAction";
private static final String CONSUL_ML_SERVICE_ID = "machine-learning";
- private static final String SERVICE_PROTOCOL = "http";
private static final String APP_KEY = "uebkey";
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WebAnalyticsExtAppController.class);
+ private AsyncRestTemplate restTemplate = new AsyncRestTemplate();
+
@Autowired
AuditService auditService;
@@ -86,10 +88,6 @@ public class WebAnalyticsExtAppController extends EPRestrictedRESTfulBaseControl
@Autowired
AppsCacheService appCacheService;
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WebAnalyticsExtAppController.class);
-
- private AsyncRestTemplate restTemplate = new AsyncRestTemplate();
-
SuccessCallback<ResponseEntity<String>> successCallback = new SuccessCallback<ResponseEntity<String>>() {
@Override
public void onSuccess(ResponseEntity<String> arg) {
@@ -230,7 +228,7 @@ public class WebAnalyticsExtAppController extends EPRestrictedRESTfulBaseControl
// send it!
ListenableFuture<ResponseEntity<String>> out = restTemplate.exchange(
- SERVICE_PROTOCOL + "://"
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(CONSUL_ML_SERVICE_ID,
SystemProperties.getProperty("microservices.m-learn.local.port"))
+ REGISTER_ACTION,
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
index 9ac81e9a..84150b54 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
@@ -44,6 +44,8 @@ import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
import org.openecomp.portalapp.portal.service.ConsulHealthService;
import org.openecomp.portalapp.portal.service.MicroserviceService;
import org.openecomp.portalapp.portal.service.WidgetParameterService;
+import org.openecomp.portalapp.portal.utils.CustomLoggingFilter;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalapp.util.EPUserUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.util.SystemProperties;
@@ -76,8 +78,6 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@EPAuditLog
public class WidgetsCatalogController extends EPRestrictedBaseController {
- private static final String HTTPS = "https://";
-
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
RestTemplate template = new RestTemplate();
String whatService = "widgets-service";
@@ -106,16 +106,16 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
return false;
}
- });
+ });
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET)
public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
@PathVariable("loginName") String loginName) throws RestClientException, Exception {
List<WidgetCatalog> widgets = new ArrayList<>();
- try {
+ try {CustomLoggingFilter d;
ResponseEntity<ArrayList> ans = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + loginName,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
@@ -133,9 +133,11 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
public List<WidgetCatalog> getWidgetCatalog(HttpServletRequest request, HttpServletResponse response)
throws RestClientException, Exception {
List<WidgetCatalog> widgets = new ArrayList<>();
+
+ String p = EcompPortalUtils.widgetMsProtocol();
try {
ResponseEntity<ArrayList> ans = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog",
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
@@ -155,7 +157,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId)
throws RestClientException, Exception {
template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
HttpMethod.PUT, new HttpEntity(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class);
@@ -165,7 +167,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
HttpMethod.DELETE, new HttpEntity(WidgetServiceHeaders.getInstance()), String.class);
@@ -192,7 +194,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName));
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
@@ -233,7 +235,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog",
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
@@ -255,7 +257,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
@RequestMapping(value = "/portalApi/microservices/{widgetId}/framework.js", method = RequestMethod.GET)
public String getWidgetFramework(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/framework.js", String.class,
@@ -265,7 +267,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
@RequestMapping(value = "/portalApi/microservices/{widgetId}/controller.js", method = RequestMethod.GET)
public String getWidgetController(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/controller.js", String.class,
@@ -275,7 +277,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
@RequestMapping(value = "/portalApi/microservices/{widgetId}/style.css", method = RequestMethod.GET)
public String getWidgetCSS(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/styles.css", String.class,
@@ -289,7 +291,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
List<WidgetParameterResult> list = new ArrayList<>();
Long serviceId = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/parameters/" + widgetId,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), Long.class).getBody();
@@ -336,7 +338,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
ServletContext context = request.getServletContext();
byte[] byteFile = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/download/" + widgetId,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), byte[].class).getBody();
@@ -388,5 +390,4 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "SUCCESS", "");
}
-
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
index b0bc9fc4..e8bd9622 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
@@ -26,6 +26,7 @@ import org.openecomp.portalapp.controller.EPUnRestrictedBaseController;
import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders;
import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
import org.openecomp.portalapp.portal.service.ConsulHealthService;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,9 +47,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
public class WidgetsCatalogMarkupController extends EPUnRestrictedBaseController {
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogMarkupController.class);
-
private RestTemplate template = new RestTemplate();
-
private final String whatService = "widgets-service";
@Autowired
@@ -77,7 +76,7 @@ public class WidgetsCatalogMarkupController extends EPUnRestrictedBaseController
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
return template
.getForObject(
- "https://"
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/markup/" + widgetId,
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java
index df835a92..6b9a4416 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java
@@ -30,6 +30,7 @@ import org.openecomp.portalapp.portal.domain.MicroserviceParameter;
import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter;
import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders;
import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
import org.openecomp.portalsdk.core.util.SystemProperties;
@@ -137,7 +138,7 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService {
@SuppressWarnings({ "rawtypes", "unchecked" })
ResponseEntity<Long> ans = (ResponseEntity<Long>) template.exchange(
- "https://"
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/parameters/" + widgetId,
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java
index 8ef4593f..23bb3567 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java
@@ -61,5 +61,6 @@ public class EPCommonSystemProperties extends SystemProperties {
public static final String AUTH_USER_SERVER = "auth_user_server";
public static final String EXTERNAL_ACCESS_ENABLE = "external_access_enable";
+ public static final String WIDGET_MS_PROTOCOL = "microservices.widget.protocol";
} \ No newline at end of file
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java
index 48c2dbe8..2b39da0a 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java
@@ -340,5 +340,19 @@ public class EcompPortalUtils {
}
}
}
+
+ public static String widgetMsProtocol(){
+ final String protocol;
+ try{
+ protocol = SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_PROTOCOL);
+ return (protocol == null || protocol.trim().equals("")) ? "https" : protocol ;
+ }
+ catch(IllegalStateException ese){
+ //looks like SystemProperties.getProperty throws IllegalStateException if it cannot find a property you are looking for
+ //In order to not break the code if a non-required property is missing from system.properties, returning https as default
+ //when this exception is caught.
+ return "https";
+ }
+ }
}
diff --git a/ecomp-portal-BE-os/README.md b/ecomp-portal-BE-os/README.md
index ee765c72..47f1cfb9 100644
--- a/ecomp-portal-BE-os/README.md
+++ b/ecomp-portal-BE-os/README.md
@@ -14,6 +14,9 @@ https://www.eclipse.org/m2e-wtp/
## Release Notes
+Version 1.1.?, July 2017
+- [Portal-30] Failed to communicate with the widget microservice: Fixed
+
Version 1.1.0, July 2017
- [Portal-7] Improvements added as part of the rebasing process
- [Portal-6] Updates to License and Trademark in the PORTAL Source Code