summaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/test/java
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-10-09 18:45:52 +0300
committerMichael Lando <michael.lando@intl.att.com>2018-10-10 14:16:02 +0000
commit3504f84909d1ee1963931e63bed694a533a84cd3 (patch)
tree76c0d4a298aac90efee26a8a9b4a96137aec187f /catalog-fe/src/test/java
parent1eda33de6c88b9c1d6259e74b50c55ab1bb9357a (diff)
Plugin load by the UI
Changed the original plugin API to only return the plugins list Changed the plugin Iframe to check if the plugin is online on every init Change-Id: I7916668de17c49a2639047ef243939889a933067 Issue-ID: SDC-1400 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-fe/src/test/java')
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java40
1 files changed, 23 insertions, 17 deletions
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
index e1d93b702d..731516e65b 100644
--- 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
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@@ -63,24 +64,33 @@ public class PluginStatusBLTest {
}
@Test
- public void TestOfflinePluginBeingReturnedWithIsOnlineValueFalse() throws ClientProtocolException, IOException {
+ public void TestPluginsConfigurationListReturnsWithWantedPlugins() {
testPluginsList.add(offlinePlugin);
+ testPluginsList.add(onlinePlugin);
when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList);
-
- when(statusLine.getStatusCode()).thenReturn(404);
- when(httpResponse.getStatusLine()).thenReturn(statusLine);
- when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse);
- offlinePlugin.setOnline(false);
assertPluginList.add(offlinePlugin);
+ assertPluginList.add(onlinePlugin);
String result = gson.toJson(assertPluginList);
- String actualResult = pluginStatusBL.checkPluginsListAvailability();
+ String actualResult = pluginStatusBL.getPluginsList();
- System.out.println(result);
- System.out.println(actualResult);
+ assertEquals(actualResult, result);
+ }
+
+ @Test
+ public void TestGetPluginAvailabilityShouldReturnFalseWhenPluginIsOffline() throws ClientProtocolException, IOException {
+ testPluginsList.add(offlinePlugin);
+ when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList);
- assertTrue(pluginStatusBL.checkPluginsListAvailability().equals(result));
+ when(statusLine.getStatusCode()).thenReturn(404);
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse);
+
+ String result = gson.toJson(false);
+ String actualResult = pluginStatusBL.getPluginAvailability(offlinePlugin.getPluginId());
+
+ assertEquals(actualResult, result);
}
@Test
@@ -92,13 +102,9 @@ public class PluginStatusBLTest {
when(httpResponse.getStatusLine()).thenReturn(statusLine);
when(httpClient.execute(Mockito.any())).thenReturn(httpResponse);
- onlinePlugin.setOnline(true);
- assertPluginList.add(onlinePlugin);
+ String result = gson.toJson(true);
+ String actualResult = pluginStatusBL.getPluginAvailability(onlinePlugin.getPluginId());
- String result = gson.toJson(assertPluginList);
-
- assertTrue(pluginStatusBL.checkPluginsListAvailability().equals(result));
-
+ assertEquals(actualResult, result);
}
-
}