use of org.codice.ddf.admin.application.plugin.ApplicationPlugin in project ddf by codice.
the class ApplicationServiceBeanTest method testGetSetApplicationPlugins.
/**
* Tests the {@link ApplicationServiceBean#getApplicationPlugins()} method and the {@link
* ApplicationServiceBean#setApplicationPlugins(List)} method
*
* @throws Exception
*/
@Test
public void testGetSetApplicationPlugins() throws Exception {
ApplicationServiceBean serviceBean = newApplicationServiceBean();
ApplicationPlugin testPlugin1 = mock(ApplicationPlugin.class);
ApplicationPlugin testPlugin2 = mock(ApplicationPlugin.class);
List<ApplicationPlugin> pluginList = new ArrayList<>();
pluginList.add(testPlugin1);
pluginList.add(testPlugin2);
serviceBean.setApplicationPlugins(pluginList);
assertEquals(pluginList, serviceBean.getApplicationPlugins());
}
use of org.codice.ddf.admin.application.plugin.ApplicationPlugin in project ddf by codice.
the class ApplicationServiceBeanTest method testGetPluginsForApplication.
/**
* Tests the {@link ApplicationServiceBean#getPluginsForApplication(String)} method
*
* @throws Exception
*/
@Test
public void testGetPluginsForApplication() throws Exception {
ApplicationServiceBean serviceBean = newApplicationServiceBean();
ApplicationPlugin testPlugin1 = mock(ApplicationPlugin.class);
ApplicationPlugin testPlugin2 = mock(ApplicationPlugin.class);
List<ApplicationPlugin> pluginList = new ArrayList<>();
pluginList.add(testPlugin1);
pluginList.add(testPlugin2);
Map<String, Object> plugin1JSON = new HashMap<>();
plugin1JSON.put("TestAppJSON", "Plugin1");
Map<String, Object> plugin2JSON = new HashMap<>();
plugin2JSON.put("TestAppJSON", "Plugin2");
when(testPlugin1.matchesAssocationName(TEST_APP_NAME)).thenReturn(true);
when(testPlugin2.matchesAssocationName(TEST_APP_NAME)).thenReturn(true);
when(testPlugin1.toJSON()).thenReturn(plugin1JSON);
when(testPlugin2.toJSON()).thenReturn(plugin2JSON);
serviceBean.setApplicationPlugins(pluginList);
assertThat("Should return the list of plugins given to it.", serviceBean.getPluginsForApplication(TEST_APP_NAME).get(0), is(plugin1JSON));
}
Aggregations