summaryrefslogtreecommitdiffstats
path: root/catalog-fe
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-fe')
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java24
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java2
-rw-r--r--catalog-fe/src/main/resources/config/designers-configuration.yaml28
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java41
4 files changed, 48 insertions, 47 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java
index cadaf19e96..eb43df6c95 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java
@@ -1,8 +1,8 @@
package org.openecomp.sdc.fe.impl;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpHead;
@@ -32,31 +32,31 @@ public class DesignerStatusBL {
}
- public String checkDesinerListAvailability() {
+ public String checkDesignerListAvailability() {
String result = null;
- DesignersConfiguration designersConfiguarion = ConfigurationManager.getConfigurationManager()
+ DesignersConfiguration designersConfiguration = ConfigurationManager.getConfigurationManager()
.getDesignersConfiguration();
- if (designersConfiguarion == null || designersConfiguarion.getDesignersList() == null) {
+ if (designersConfiguration == null || designersConfiguration.getDesignersList() == null) {
log.warn("Configuration of type {} was not found", DesignersConfiguration.class);
} else {
- log.debug("The value returned from getConfig is {}", designersConfiguarion);
+ log.debug("The value returned from getConfig is {}", designersConfiguration);
- Map<String, Designer> avaiableDesignersMap = new HashMap<String, Designer>();
+ List<Designer> availableDesignersList = new ArrayList<>();
- designersConfiguarion.getDesignersList().forEach((key, value) -> {
- if (CheckDesignerAvailabilty(value)) {
- avaiableDesignersMap.put(key, value);
+ designersConfiguration.getDesignersList().forEach(value -> {
+ if (checkDesignerAvailability(value)) {
+ availableDesignersList.add(value);
}
});
- result = gson.toJson(avaiableDesignersMap);
+ result = gson.toJson(availableDesignersList);
}
return result;
}
- private boolean CheckDesignerAvailabilty(Designer designer) {
+ private boolean checkDesignerAvailability(Designer designer) {
StringBuilder requestString = new StringBuilder();
boolean result = false;
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
index bcaf504497..ba37e94d10 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
@@ -124,7 +124,7 @@ public class ConfigServlet extends BasicServlet {
DesignerStatusBL designerStatusBL = (DesignerStatusBL) context.getAttribute(Constants.DESIGNER_BL_COMPONENT);
- result = designerStatusBL.checkDesinerListAvailability();
+ result = designerStatusBL.checkDesignerListAvailability();
return Response.status(Status.OK).entity(result).build();
diff --git a/catalog-fe/src/main/resources/config/designers-configuration.yaml b/catalog-fe/src/main/resources/config/designers-configuration.yaml
index c8c041b975..7064619878 100644
--- a/catalog-fe/src/main/resources/config/designers-configuration.yaml
+++ b/catalog-fe/src/main/resources/config/designers-configuration.yaml
@@ -1,13 +1,17 @@
designersList:
- DCAE:
- displayName: DCAE
- designerHost: 192.168.50.5
- designerPort: 8080
- designerPath: "/dcae"
- designerProtocol: http
- WORKFLOW:
- displayName: WORKFLOW
- designerHost: 192.168.50.5
- designerPort: 9527
- designerPath: ""
- designerProtocol: http \ No newline at end of file
+ - displayName: DCAE
+ designerHost: 192.168.50.5
+ designerPort: 8080
+ designerPath: "/dcae"
+ designerStateUrl: "dcae"
+ designerProtocol: http
+ buttonLocation: ["top", "tab"]
+ tabPresentation: ["VF", "SERVICE"]
+ - displayName: WORKFLOW
+ designerHost: 192.168.50.5
+ designerPort: 9527
+ designerPath: "/"
+ designerStateUrl: "workflowDesigner"
+ designerProtocol: http
+ buttonLocation: ["top"]
+ tabPresentation: [] \ No newline at end of file
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java
index 0ad233fd6d..00c2d206d5 100644
--- a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java
@@ -4,8 +4,8 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
@@ -30,12 +30,12 @@ public class DesignerStatusBLTest {
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class);
- final static DesignersConfiguration designersConfiguraiton = Mockito.mock(DesignersConfiguration.class);
+ final static DesignersConfiguration designersConfiguration = Mockito.mock(DesignersConfiguration.class);
final static Designer offlineDesigner = new Designer();
- final static Designer onlineDesinger = new Designer();
+ final static Designer onlineDesigner = new Designer();
final static CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class);
final static StatusLine statusLine = Mockito.mock(StatusLine.class);
- final static Map<String, Designer> testDesignersList = new HashMap<String, Designer>();
+ final static List<Designer> testDesignersList = new ArrayList<>();
final static String offlineDesignerDisplayName = "offlineDesigner";
final static String offlineDesignerHost = "192.168.10.1";
@@ -48,14 +48,11 @@ public class DesignerStatusBLTest {
final static int onlineDesignerPort = 2000;
final static String onlineDesignerPath = "/online";
final static String onlineDesignerProtocol = "http";
-
- StringBuilder offlineRequestString = new StringBuilder();
- StringBuilder onlineRequestString = new StringBuilder();
@BeforeClass
public static void beforeClass() {
ConfigurationManager.setTestInstance(configurationManager);
- when(configurationManager.getDesignersConfiguration()).thenReturn(designersConfiguraiton);
+ when(configurationManager.getDesignersConfiguration()).thenReturn(designersConfiguration);
offlineDesigner.setDisplayName(offlineDesignerDisplayName);
offlineDesigner.setDesignerHost(offlineDesignerHost);
@@ -67,11 +64,11 @@ public class DesignerStatusBLTest {
offlineRequestString.append(offlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":")
.append(offlineDesignerPort).append(offlineDesignerPath);
- onlineDesinger.setDisplayName(onlineDesignerDisplayName);
- onlineDesinger.setDesignerHost(onlineDesignerHost);
- onlineDesinger.setDesignerPort(onlineDesignerPort);
- onlineDesinger.setDesignerPath(onlineDesignerPath);
- onlineDesinger.setDesignerProtocol(onlineDesignerProtocol);
+ onlineDesigner.setDisplayName(onlineDesignerDisplayName);
+ onlineDesigner.setDesignerHost(onlineDesignerHost);
+ onlineDesigner.setDesignerPort(onlineDesignerPort);
+ onlineDesigner.setDesignerPath(onlineDesignerPath);
+ onlineDesigner.setDesignerProtocol(onlineDesignerProtocol);
StringBuilder onlineRequestString = new StringBuilder();
onlineRequestString.append(onlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":")
@@ -80,22 +77,22 @@ public class DesignerStatusBLTest {
}
@Test
- public void TestOfflineDesignerNotBeingReturnedWhenCallingCheckDesinerListAvailability() throws ClientProtocolException, IOException {
- testDesignersList.put("offlineDesigner", offlineDesigner);
- when(designersConfiguraiton.getDesignersList()).thenReturn(testDesignersList);
+ public void TestOfflineDesignerNotBeingReturnedWhenCallingCheckDesignerListAvailability() throws ClientProtocolException, IOException {
+ testDesignersList.add(offlineDesigner);
+ when(designersConfiguration.getDesignersList()).thenReturn(testDesignersList);
when(statusLine.getStatusCode()).thenReturn(404);
when(httpResponse.getStatusLine()).thenReturn(statusLine);
when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse);
- assertTrue(designerStatusBL.checkDesinerListAvailability().equals("{}"));
+ assertTrue(designerStatusBL.checkDesignerListAvailability().equals("[]"));
}
@Test
- public void TestOnlineDesignerNotBeingReturnedWhenCallingCheckDesinerListAvailability() throws ClientProtocolException, IOException {
- testDesignersList.put("onlineDesigner", onlineDesinger);
- when(designersConfiguraiton.getDesignersList()).thenReturn(testDesignersList);
+ public void TestOnlineDesignerNotBeingReturnedWhenCallingCheckDesignerListAvailability() throws ClientProtocolException, IOException {
+ testDesignersList.add(onlineDesigner);
+ when(designersConfiguration.getDesignersList()).thenReturn(testDesignersList);
when(statusLine.getStatusCode()).thenReturn(200);
when(httpResponse.getStatusLine()).thenReturn(statusLine);
@@ -103,7 +100,7 @@ public class DesignerStatusBLTest {
String result = gson.toJson(testDesignersList);
- assertTrue(designerStatusBL.checkDesinerListAvailability().equals(result));
+ assertTrue(designerStatusBL.checkDesignerListAvailability().contains(result));
}