aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/test/java/org
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-01-31 13:27:33 +0200
committerMichael Lando <ml636r@att.com>2018-01-31 14:35:13 +0000
commiteedaaf983d731d0179916b3f3a8e4d3a0d80981b (patch)
tree066eb388f47ac15ef35c98aa74618b751da47ae6 /catalog-fe/src/test/java/org
parent3b09e29e1e1cab9baf3b1380718a3c45126930bd (diff)
Change designer to plugin in code
Changed all the use of the designer configuration in the code to be plugin Change-Id: Id9792cbd4fb9385446780c28fb7fb5418772acf6 Issue-ID: SDC-974 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-fe/src/test/java/org')
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java107
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java107
2 files changed, 107 insertions, 107 deletions
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
deleted file mode 100644
index db0fd736ec..0000000000
--- a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.openecomp.sdc.fe.servlets;
-
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.http.StatusLine;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.sdc.fe.config.ConfigurationManager;
-import org.openecomp.sdc.fe.config.DesignersConfiguration;
-import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer;
-import org.openecomp.sdc.fe.impl.DesignerStatusBL;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-public class DesignerStatusBLTest {
-
- final static CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
- DesignerStatusBL designerStatusBL = new DesignerStatusBL(httpClient);
- private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
- final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class);
- final static DesignersConfiguration designersConfiguration = Mockito.mock(DesignersConfiguration.class);
- final static Designer offlineDesigner = 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 List<Designer> testDesignersList = new ArrayList<>();
-
- final static String offlineDesignerDisplayName = "offlineDesigner";
- final static String offlineDesignerHost = "192.168.10.1";
- final static String offlineDesignerPort = "1000";
- final static String offlineDesignerPath = "/offline";
- final static String offlineDesignerProtocol = "http";
-
- final static String onlineDesignerDisplayName = "onlineDesigner";
- final static String onlineDesignerHost = "192.168.20.2";
- final static String onlineDesignerPort = "2000";
- final static String onlineDesignerPath = "/online";
- final static String onlineDesignerProtocol = "http";
-
- @BeforeClass
- public static void beforeClass() {
- ConfigurationManager.setTestInstance(configurationManager);
- when(configurationManager.getDesignersConfiguration()).thenReturn(designersConfiguration);
-
- offlineDesigner.setDesignerId(offlineDesignerDisplayName);
- offlineDesigner.setDesignerHost(offlineDesignerHost);
- offlineDesigner.setDesignerPort(offlineDesignerPort);
- offlineDesigner.setDesignerPath(offlineDesignerPath);
- offlineDesigner.setDesignerProtocol(offlineDesignerProtocol);
-
- StringBuilder offlineRequestString = new StringBuilder();
- offlineRequestString.append(offlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":")
- .append(offlineDesignerPort).append(offlineDesignerPath);
-
- onlineDesigner.setDesignerId(onlineDesignerDisplayName);
- onlineDesigner.setDesignerHost(onlineDesignerHost);
- onlineDesigner.setDesignerPort(onlineDesignerPort);
- onlineDesigner.setDesignerPath(onlineDesignerPath);
- onlineDesigner.setDesignerProtocol(onlineDesignerProtocol);
-
- StringBuilder onlineRequestString = new StringBuilder();
- onlineRequestString.append(onlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":")
- .append(offlineDesignerPort).append(offlineDesignerPath);
-
- }
-
- @Test
- 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.checkDesignerListAvailability().equals("[]"));
-
- }
-
- @Test
- public void TestOnlineDesignerNotBeingReturnedWhenCallingCheckDesignerListAvailability() throws ClientProtocolException, IOException {
- testDesignersList.add(onlineDesigner);
- when(designersConfiguration.getDesignersList()).thenReturn(testDesignersList);
-
- when(statusLine.getStatusCode()).thenReturn(200);
- when(httpResponse.getStatusLine()).thenReturn(statusLine);
- when(httpClient.execute(Mockito.any())).thenReturn(httpResponse);
-
- String result = gson.toJson(testDesignersList);
-
- assertTrue(designerStatusBL.checkDesignerListAvailability().contains(result));
-
- }
-
-}
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java
new file mode 100644
index 0000000000..8a796a4993
--- /dev/null
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java
@@ -0,0 +1,107 @@
+package org.openecomp.sdc.fe.servlets;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.config.PluginsConfiguration;
+import org.openecomp.sdc.fe.config.PluginsConfiguration.Plugin;
+import org.openecomp.sdc.fe.impl.PluginStatusBL;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public class PluginStatusBLTest {
+
+ final static CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
+ PluginStatusBL pluginStatusBL = new PluginStatusBL(httpClient);
+ private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
+ final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class);
+ final static PluginsConfiguration pluginsConfiguration = Mockito.mock(PluginsConfiguration.class);
+ final static Plugin offlinePlugin = new Plugin();
+ final static Plugin onlinePlugin = new Plugin();
+ final static CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class);
+ final static StatusLine statusLine = Mockito.mock(StatusLine.class);
+ final static List<Plugin> testPluginsList = new ArrayList<>();
+
+ final static String offlinePluginsDisplayName = "offlinePlugin";
+ final static String offlinePluginHost = "192.168.10.1";
+ final static String offlinePluginPort = "1000";
+ final static String offlinePluginPath = "/offline";
+ final static String offlinePluginProtocol = "http";
+
+ final static String onlinePluginDisplayName = "onlinePlugin";
+ final static String onlinePluginHost = "192.168.20.2";
+ final static String onlinePluginPort = "2000";
+ final static String onlinePluginPath = "/online";
+ final static String onlinePluginProtocol = "http";
+
+ @BeforeClass
+ public static void beforeClass() {
+ ConfigurationManager.setTestInstance(configurationManager);
+ when(configurationManager.getPluginsConfiguration()).thenReturn(pluginsConfiguration);
+
+ offlinePlugin.setPluginId(offlinePluginsDisplayName);
+ offlinePlugin.setPluginHost(offlinePluginHost);
+ offlinePlugin.setPluginPort(offlinePluginPort);
+ offlinePlugin.setPluginPath(offlinePluginPath);
+ offlinePlugin.setPluginProtocol(offlinePluginProtocol);
+
+ StringBuilder offlineRequestString = new StringBuilder();
+ offlineRequestString.append(offlinePluginProtocol).append("://").append(onlinePluginHost).append(":")
+ .append(offlinePluginPort).append(offlinePluginPath);
+
+ onlinePlugin.setPluginId(onlinePluginDisplayName);
+ onlinePlugin.setPluginHost(onlinePluginHost);
+ onlinePlugin.setPluginPort(onlinePluginPort);
+ onlinePlugin.setPluginPath(onlinePluginPath);
+ onlinePlugin.setPluginProtocol(onlinePluginProtocol);
+
+ StringBuilder onlineRequestString = new StringBuilder();
+ onlineRequestString.append(onlinePluginProtocol).append("://").append(onlinePluginHost).append(":")
+ .append(offlinePluginPort).append(offlinePluginPath);
+
+ }
+
+ @Test
+ public void TestOfflinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException {
+ testPluginsList.add(offlinePlugin);
+ when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList);
+
+ when(statusLine.getStatusCode()).thenReturn(404);
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse);
+
+ assertTrue(pluginStatusBL.checkPluginsListAvailability().equals("[]"));
+
+ }
+
+ @Test
+ public void TestOnlinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException {
+ testPluginsList.add(onlinePlugin);
+ when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList);
+
+ when(statusLine.getStatusCode()).thenReturn(200);
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(httpClient.execute(Mockito.any())).thenReturn(httpResponse);
+
+ String result = gson.toJson(testPluginsList);
+
+ assertTrue(pluginStatusBL.checkPluginsListAvailability().contains(result));
+
+ }
+
+}