use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultPluginEnvironmentNGTest method testExecuteReadPluginNowThrowsInterruptedException.
@Test(expectedExceptions = InterruptedException.class)
public void testExecuteReadPluginNowThrowsInterruptedException() throws Exception {
System.out.println("executeReadPluginNow");
GraphReadMethods graph = mock(GraphReadMethods.class);
Plugin plugin = mock(Plugin.class);
PluginParameters parameters = mock(PluginParameters.class);
InterruptedException interruptedException = mock(InterruptedException.class);
boolean interactive = false;
DefaultPluginEnvironment instance = new DefaultPluginEnvironment();
doThrow(interruptedException).when(plugin).run(any(GraphReadMethods.class), any(PluginInteraction.class), any(PluginParameters.class));
Object expResult = null;
Object result = instance.executeReadPluginNow(graph, plugin, parameters, interactive);
assertEquals(result, expResult);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultPluginEnvironmentNGTest method testExecutePluginNow.
/**
* Test of executePluginNow method, of class DefaultPluginEnvironment.
*/
@Test
public void testExecutePluginNow() throws Exception {
System.out.println("executePluginNow");
Graph graph = mock(Graph.class);
Plugin plugin = mock(Plugin.class);
PluginParameters parameters = mock(PluginParameters.class);
boolean interactive = false;
DefaultPluginEnvironment instance = new DefaultPluginEnvironment();
Object expResult = null;
Object result = instance.executePluginNow(graph, plugin, parameters, interactive);
assertEquals(result, expResult);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultPluginEnvironmentNGTest method testExecuteEditPluginNowThrowsRuntimeException.
@Test(expectedExceptions = RuntimeException.class)
public void testExecuteEditPluginNowThrowsRuntimeException() throws Exception {
System.out.println("executeEditPluginNow");
GraphWriteMethods graph = mock(GraphWriteMethods.class);
Plugin plugin = mock(Plugin.class);
RuntimeException runtimeException = mock(RuntimeException.class);
PluginParameters parameters = mock(PluginParameters.class);
boolean interactive = false;
doThrow(runtimeException).when(plugin).run(any(GraphWriteMethods.class), any(PluginInteraction.class), any(PluginParameters.class));
DefaultPluginEnvironment instance = new DefaultPluginEnvironment();
instance.executeEditPluginNow(graph, plugin, parameters, interactive);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultPluginEnvironmentNGTest method testExecutePluginLaterThrowsRuntimeException.
@Test
public void testExecutePluginLaterThrowsRuntimeException() throws ExecutionException, InterruptedException, PluginException {
System.out.println("executePluginLater");
Graph graph = mock(Graph.class);
Plugin plugin = mock(Plugin.class);
PluginParameters parameters = mock(PluginParameters.class);
boolean interactive = false;
PluginSynchronizer synchronizer = mock(PluginSynchronizer.class);
List<Future<?>> async = null;
RuntimeException runtimeException = mock(RuntimeException.class);
final ExecutorService executorService = mock(ExecutorService.class);
doThrow(runtimeException).when(plugin).run(any(PluginGraphs.class), any(PluginInteraction.class), any(PluginParameters.class));
DefaultPluginEnvironment instance = spy(new DefaultPluginEnvironment());
doReturn(executorService).when(instance).getPluginExecutor();
when(executorService.submit(any(Callable.class))).thenAnswer(iom -> {
final Callable callable = iom.getArgument(0);
callable.call();
return CompletableFuture.completedFuture(null);
});
Object expResult = null;
Future future = instance.executePluginLater(graph, plugin, parameters, interactive, async, synchronizer);
Object result = future.get();
assertEquals(result, expResult);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultPluginEnvironmentNGTest method testExecuteEditPluginNow.
/**
* Test of executeEditPluginNow method, of class DefaultPluginEnvironment.
*/
@Test
public void testExecuteEditPluginNow() throws Exception {
System.out.println("executeEditPluginNow");
GraphWriteMethods graph = mock(GraphWriteMethods.class);
Plugin plugin = mock(Plugin.class);
PluginParameters parameters = mock(PluginParameters.class);
boolean interactive = false;
DefaultPluginEnvironment instance = new DefaultPluginEnvironment();
Object expResult = null;
Object result = instance.executeEditPluginNow(graph, plugin, parameters, interactive);
assertEquals(result, expResult);
}
Aggregations