diff options
Diffstat (limited to 'catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java')
-rw-r--r-- | catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java | 40 |
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); } - } |