Search in sources :

Example 1 with LoadNetworkFileTask

use of org.cytoscape.task.internal.export.network.LoadNetworkFileTask in project cytoscape-impl by cytoscape.

the class LoadNetworkFileTaskTest method testRun.

@Test
public void testRun() throws Exception {
    TaskFactory factory = new LoadNetworkFileTaskFactoryImpl(serviceRegistrar);
    TaskIterator ti = factory.createTaskIterator();
    TaskMonitor tm = mock(TaskMonitor.class);
    boolean first = true;
    while (ti.hasNext()) {
        Task t = ti.next();
        if (first) {
            ((LoadNetworkFileTask) t).file = file;
            first = false;
        }
        t.run(tm);
    }
    verify(netManager).addNetwork(net, false);
    // verify(networkViewManager).addNetworkView(view);
    verify(tm, atLeast(1)).setProgress(1.0);
}
Also used : Task(org.cytoscape.work.Task) LoadNetworkFileTask(org.cytoscape.task.internal.export.network.LoadNetworkFileTask) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) LoadNetworkFileTaskFactoryImpl(org.cytoscape.task.internal.export.network.LoadNetworkFileTaskFactoryImpl) TaskFactory(org.cytoscape.work.TaskFactory) Test(org.junit.Test)

Example 2 with LoadNetworkFileTask

use of org.cytoscape.task.internal.export.network.LoadNetworkFileTask in project cytoscape-impl by cytoscape.

the class LoadNetworkFileTaskTest method testNullFile.

@Test(expected = NullPointerException.class)
public void testNullFile() throws Exception {
    TaskFactory factory = new LoadNetworkFileTaskFactoryImpl(serviceRegistrar);
    TaskIterator ti = factory.createTaskIterator();
    TaskMonitor tm = mock(TaskMonitor.class);
    boolean first = true;
    while (ti.hasNext()) {
        Task t = ti.next();
        if (first) {
            ((LoadNetworkFileTask) t).file = null;
            first = false;
        }
        t.run(tm);
    }
}
Also used : Task(org.cytoscape.work.Task) LoadNetworkFileTask(org.cytoscape.task.internal.export.network.LoadNetworkFileTask) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) LoadNetworkFileTaskFactoryImpl(org.cytoscape.task.internal.export.network.LoadNetworkFileTaskFactoryImpl) TaskFactory(org.cytoscape.work.TaskFactory) Test(org.junit.Test)

Aggregations

LoadNetworkFileTask (org.cytoscape.task.internal.export.network.LoadNetworkFileTask)2 LoadNetworkFileTaskFactoryImpl (org.cytoscape.task.internal.export.network.LoadNetworkFileTaskFactoryImpl)2 Task (org.cytoscape.work.Task)2 TaskFactory (org.cytoscape.work.TaskFactory)2 TaskIterator (org.cytoscape.work.TaskIterator)2 TaskMonitor (org.cytoscape.work.TaskMonitor)2 Test (org.junit.Test)2