use of org.cytoscape.work.undo.UndoSupport in project cytoscape-impl by cytoscape.
the class UnHideAllNodesTaskFactoryTest method testRun.
@Test
public void testRun() throws Exception {
UndoSupport undoSupport = mock(UndoSupport.class);
CyEventHelper eventHelper = mock(CyEventHelper.class);
VisualMappingManager vmMgr = mock(VisualMappingManager.class);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(UndoSupport.class)).thenReturn(undoSupport);
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(VisualMappingManager.class)).thenReturn(vmMgr);
UnHideAllNodesTaskFactoryImpl factory = new UnHideAllNodesTaskFactoryImpl(serviceRegistrar);
CyNetworkView view = mock(CyNetworkView.class);
TaskIterator ti = factory.createTaskIterator(view);
assertNotNull(ti);
assertTrue(ti.hasNext());
Task t = ti.next();
assertNotNull(t);
}
use of org.cytoscape.work.undo.UndoSupport in project cytoscape-impl by cytoscape.
the class HideSelectedEdgesTaskFactoryTest method testRun.
@Test
public void testRun() throws Exception {
UndoSupport undoSupport = mock(UndoSupport.class);
CyEventHelper eventHelper = mock(CyEventHelper.class);
VisualMappingManager vmMgr = mock(VisualMappingManager.class);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(UndoSupport.class)).thenReturn(undoSupport);
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(VisualMappingManager.class)).thenReturn(vmMgr);
HideSelectedEdgesTaskFactoryImpl factory = new HideSelectedEdgesTaskFactoryImpl(serviceRegistrar);
CyNetworkView view = mock(CyNetworkView.class);
TaskIterator ti = factory.createTaskIterator(view);
assertNotNull(ti);
assertTrue(ti.hasNext());
Task t = ti.next();
assertNotNull(t);
}
use of org.cytoscape.work.undo.UndoSupport in project cytoscape-impl by cytoscape.
the class HideSelectedTaskFactoryTest method testRun.
@Test
public void testRun() throws Exception {
UndoSupport undoSupport = mock(UndoSupport.class);
CyEventHelper eventHelper = mock(CyEventHelper.class);
VisualMappingManager vmMgr = mock(VisualMappingManager.class);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(UndoSupport.class)).thenReturn(undoSupport);
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(VisualMappingManager.class)).thenReturn(vmMgr);
HideSelectedTaskFactoryImpl factory = new HideSelectedTaskFactoryImpl(serviceRegistrar);
CyNetworkView view = mock(CyNetworkView.class);
TaskIterator ti = factory.createTaskIterator(view);
assertNotNull(ti);
assertTrue(ti.hasNext());
Task t = ti.next();
assertNotNull(t);
}
use of org.cytoscape.work.undo.UndoSupport in project cytoscape-impl by cytoscape.
the class UnHideAllTaskFactoryTest method testRun.
@Test
public void testRun() throws Exception {
UndoSupport undoSupport = mock(UndoSupport.class);
CyEventHelper eventHelper = mock(CyEventHelper.class);
VisualMappingManager vmMgr = mock(VisualMappingManager.class);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(UndoSupport.class)).thenReturn(undoSupport);
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(VisualMappingManager.class)).thenReturn(vmMgr);
UnHideAllTaskFactoryImpl factory = new UnHideAllTaskFactoryImpl(serviceRegistrar);
CyNetworkView view = mock(CyNetworkView.class);
TaskIterator ti = factory.createTaskIterator(view);
assertNotNull(ti);
assertTrue(ti.hasNext());
Task t = ti.next();
assertNotNull(t);
}
use of org.cytoscape.work.undo.UndoSupport in project cytoscape-impl by cytoscape.
the class NewNetworkSelectedNodesEdgesTaskTest method testNewNetworkSelectedNodesEdgesTask.
@Test
public void testNewNetworkSelectedNodesEdgesTask() throws Exception {
final UndoSupport undoSupport = mock(UndoSupport.class);
netmgr.addNetwork(net);
final CyNode node1 = net.addNode();
final CyNode node2 = net.addNode();
final CyNode node3 = net.addNode();
final CyEdge edge1 = net.addEdge(node1, node2, true);
final CyEdge edge2 = net.addEdge(node2, node3, true);
net.getRow(node1).set(CyNetwork.SELECTED, true);
// net.getRow(node2).set(CyNetwork.SELECTED, true);
net.getRow(edge1).set(CyNetwork.SELECTED, true);
int numberOfNetsBeforeTask = netmgr.getNetworkSet().size();
List<CyNetwork> netListbeforeTask = new ArrayList<CyNetwork>(netmgr.getNetworkSet());
final NewNetworkSelectedNodesEdgesTask task = new NewNetworkSelectedNodesEdgesTask(undoSupport, net, cyroot, cnvf, netmgr, networkViewManager, cyNetworkNaming, vmm, appManager, eventHelper, groupMgr, renderingEngineManager, serviceRegistrar);
assertNotNull("task is null!", task);
task.setTaskIterator(new TaskIterator(task));
task.run(mock(TaskMonitor.class));
int numberOfNetsAfterTask = netmgr.getNetworkSet().size();
assertEquals(1, numberOfNetsAfterTask - numberOfNetsBeforeTask);
List<CyNetwork> networkList = new ArrayList<CyNetwork>(netmgr.getNetworkSet());
networkList.removeAll(netListbeforeTask);
assertEquals(2, networkList.get(0).getNodeList().size());
assertEquals(1, networkList.get(0).getEdgeList().size());
}
Aggregations