Search in sources :

Example 6 with DummyCyEventHelper

use of org.cytoscape.event.DummyCyEventHelper in project cytoscape-impl by cytoscape.

the class CyTableTest method setUp.

@Before
public void setUp() {
    eventHelper = new DummyCyEventHelper();
    compiler = new EquationCompilerImpl(new EquationParserImpl(serviceRegistrar));
    final Interpreter interpreter = new InterpreterImpl();
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
    when(serviceRegistrar.getService(CyNetworkNaming.class)).thenReturn(namingUtil);
    when(serviceRegistrar.getService(EquationCompiler.class)).thenReturn(compiler);
    when(serviceRegistrar.getService(Interpreter.class)).thenReturn(interpreter);
    table = new CyTableImpl("homer", CyIdentifiable.SUID, Long.class, false, true, SavePolicy.SESSION_FILE, eventHelper, ColumnDataFactory.createDefaultFactory(), interpreter, 1000);
    attrs = table.getRow(1L);
    table2 = new CyTableImpl("marge", CyIdentifiable.SUID, Long.class, false, true, SavePolicy.SESSION_FILE, eventHelper, ColumnDataFactory.createDefaultFactory(), interpreter, 1000);
    CyTableManagerImpl tblMgr = new CyTableManagerImpl(new CyNetworkTableManagerImpl(), new CyNetworkManagerImpl(serviceRegistrar), serviceRegistrar);
    tblMgr.addTable(table);
    ((CyTableImpl) table).handleEvent(new TableAddedEvent(tblMgr, table));
    tblMgr.addTable(table2);
    ((CyTableImpl) table2).handleEvent(new TableAddedEvent(tblMgr, table2));
}
Also used : EquationParserImpl(org.cytoscape.equations.internal.EquationParserImpl) EquationCompilerImpl(org.cytoscape.equations.internal.EquationCompilerImpl) Interpreter(org.cytoscape.equations.Interpreter) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) TableAddedEvent(org.cytoscape.model.events.TableAddedEvent) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) InterpreterImpl(org.cytoscape.equations.internal.interpreter.InterpreterImpl) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyTableImpl(org.cytoscape.model.internal.CyTableImpl) Before(org.junit.Before)

Example 7 with DummyCyEventHelper

use of org.cytoscape.event.DummyCyEventHelper in project cytoscape-impl by cytoscape.

the class CySubNetworkTest method setUp.

@Before
public void setUp() {
    deh = new DummyCyEventHelper(true);
    deh2 = new DummyCyEventHelper(false);
    root = TestCyNetworkFactory.getPublicRootInstance(deh);
    root2 = TestCyNetworkFactory.getPublicRootInstance(deh2);
}
Also used : DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) Before(org.junit.Before)

Example 8 with DummyCyEventHelper

use of org.cytoscape.event.DummyCyEventHelper in project cytoscape-impl by cytoscape.

the class DegreeTest method init.

@Before
public void init() {
    final CyNode node = mock(CyNode.class);
    when(node.getSUID()).thenReturn(101L);
    final List<CyEdge> edgeList = mock(List.class);
    when(edgeList.size()).thenReturn(3);
    final CyNetwork network = mock(CyNetwork.class);
    when(network.getAdjacentEdgeList(node, CyEdge.Type.ANY)).thenReturn(edgeList);
    when(network.getNode(101L)).thenReturn(node);
    Collection<CyNode> nodes = new ArrayList<>(1);
    nodes.add(node);
    applicationManager = mock(CyApplicationManager.class);
    when(applicationManager.getCurrentNetwork()).thenReturn(network);
    eventHelper = new DummyCyEventHelper();
    serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyEdge(org.cytoscape.model.CyEdge) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) Before(org.junit.Before)

Example 9 with DummyCyEventHelper

use of org.cytoscape.event.DummyCyEventHelper in project cytoscape-impl by cytoscape.

the class TargetIDTest method init.

@Before
public void init() {
    final CyNode node = mock(CyNode.class);
    when(node.getSUID()).thenReturn(101L);
    final List<CyEdge> edgeList = mock(List.class);
    when(edgeList.size()).thenReturn(3);
    final CyNetwork network = mock(CyNetwork.class);
    final CyEdge edge = mock(CyEdge.class);
    when(edge.getSUID()).thenReturn(11L);
    when(edge.getTarget()).thenReturn(node);
    Collection<CyEdge> edges = new ArrayList<CyEdge>(1);
    edges.add(edge);
    when(network.getEdge(11L)).thenReturn(edge);
    applicationManager = mock(CyApplicationManager.class);
    when(applicationManager.getCurrentNetwork()).thenReturn(network);
    eventHelper = new DummyCyEventHelper();
    serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyEdge(org.cytoscape.model.CyEdge) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) Before(org.junit.Before)

Example 10 with DummyCyEventHelper

use of org.cytoscape.event.DummyCyEventHelper in project cytoscape-impl by cytoscape.

the class TestCyNetworkFactory method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    eh = new DummyCyEventHelper(false);
    Interpreter interpreter = new InterpreterImpl();
    EquationCompiler compiler = new EquationCompilerImpl(new EquationParserImpl(serviceRegistrar));
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eh);
    when(serviceRegistrar.getService(CyNetworkNaming.class)).thenReturn(namingUtil);
    when(serviceRegistrar.getService(EquationCompiler.class)).thenReturn(compiler);
    when(serviceRegistrar.getService(Interpreter.class)).thenReturn(interpreter);
    netTblMgr = new CyNetworkTableManagerImpl();
    netMgr = new CyNetworkManagerImpl(serviceRegistrar);
    tblMgr = new CyTableManagerImpl(netTblMgr, netMgr, serviceRegistrar);
    tblFactory = new CyTableFactoryImpl(eh, serviceRegistrar);
    netFactory = new CyNetworkFactoryImpl(eh, tblMgr, netTblMgr, tblFactory, serviceRegistrar);
}
Also used : EquationParserImpl(org.cytoscape.equations.internal.EquationParserImpl) CyTableFactoryImpl(org.cytoscape.model.internal.CyTableFactoryImpl) Interpreter(org.cytoscape.equations.Interpreter) EquationCompilerImpl(org.cytoscape.equations.internal.EquationCompilerImpl) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) InterpreterImpl(org.cytoscape.equations.internal.interpreter.InterpreterImpl) CyNetworkFactoryImpl(org.cytoscape.model.internal.CyNetworkFactoryImpl) EquationCompiler(org.cytoscape.equations.EquationCompiler) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) Before(org.junit.Before)

Aggregations

DummyCyEventHelper (org.cytoscape.event.DummyCyEventHelper)14 Before (org.junit.Before)12 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)11 ArrayList (java.util.ArrayList)5 CyApplicationManager (org.cytoscape.application.CyApplicationManager)5 EquationParserImpl (org.cytoscape.equations.internal.EquationParserImpl)5 CyEdge (org.cytoscape.model.CyEdge)5 CyNetwork (org.cytoscape.model.CyNetwork)5 CyNode (org.cytoscape.model.CyNode)5 EquationCompilerImpl (org.cytoscape.equations.internal.EquationCompilerImpl)4 CyNetworkManagerImpl (org.cytoscape.model.internal.CyNetworkManagerImpl)4 CyNetworkTableManagerImpl (org.cytoscape.model.internal.CyNetworkTableManagerImpl)4 CyTableManagerImpl (org.cytoscape.model.internal.CyTableManagerImpl)4 Interpreter (org.cytoscape.equations.Interpreter)3 InterpreterImpl (org.cytoscape.equations.internal.interpreter.InterpreterImpl)3 CyTableFactoryImpl (org.cytoscape.model.internal.CyTableFactoryImpl)3 EquationCompiler (org.cytoscape.equations.EquationCompiler)2 CyRootNetworkImpl (org.cytoscape.model.internal.CyRootNetworkImpl)2 CyEventHelper (org.cytoscape.event.CyEventHelper)1 CyGroupFactoryImpl (org.cytoscape.group.internal.CyGroupFactoryImpl)1