Search in sources :

Example 1 with DummyCyEventHelper

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

the class InDegreeTest 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.INCOMING)).thenReturn(edgeList);
    when(network.getNode(101L)).thenReturn(node);
    Collection<CyNode> nodes = new ArrayList<CyNode>(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 2 with DummyCyEventHelper

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

the class SourceIDTest 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.getSource()).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 3 with DummyCyEventHelper

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

the class InterpreterTest method init.

@Before
public void init() {
    eventHelper = new DummyCyEventHelper();
    serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
    parser = new EquationParserImpl(serviceRegistrar);
    compiler = new EquationCompilerImpl(parser);
    interpreter = new InterpreterImpl();
}
Also used : EquationParserImpl(org.cytoscape.equations.internal.EquationParserImpl) EquationCompilerImpl(org.cytoscape.equations.internal.EquationCompilerImpl) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) Before(org.junit.Before)

Example 4 with DummyCyEventHelper

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

the class AttribParserTest method init.

@Before
public void init() {
    eventHelper = new DummyCyEventHelper();
    serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
    parser = new EquationParserImpl(serviceRegistrar);
}
Also used : DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) Before(org.junit.Before)

Example 5 with DummyCyEventHelper

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

the class CySubNetworkCyTableManagerTest method setUp.

@Before
public void setUp() {
    final CyEventHelper eh = new DummyCyEventHelper();
    final CyNetworkNaming namingUtil = mock(CyNetworkNaming.class);
    final CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
    final EquationCompiler compiler = new EquationCompilerImpl(new EquationParserImpl(serviceRegistrar));
    final Interpreter interpreter = new InterpreterImpl();
    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);
    networkTableMgr = new CyNetworkTableManagerImpl();
    networkManager = new CyNetworkManagerImpl(serviceRegistrar);
    mgr = new CyTableManagerImpl(networkTableMgr, networkManager, serviceRegistrar);
    CyTableFactoryImpl tableFactory = new CyTableFactoryImpl(eh, serviceRegistrar);
    CyRootNetworkImpl baseNet = new CyRootNetworkImpl(eh, (CyTableManagerImpl) mgr, networkTableMgr, tableFactory, serviceRegistrar, true, SavePolicy.DO_NOT_SAVE);
    // This is a different subnetwork and not "baseNetwork" in ArrayGraph.
    goodNetwork = baseNet.addSubNetwork();
    globalTable = tableFactory.createTable("test table", CyIdentifiable.SUID, Long.class, true, true);
    networkManager.addNetwork(goodNetwork);
    assertNotNull(globalTable);
    assertNotNull(goodNetwork);
    assertEquals(1, networkManager.getNetworkSet().size());
}
Also used : DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyEventHelper(org.cytoscape.event.CyEventHelper) EquationCompilerImpl(org.cytoscape.equations.internal.EquationCompilerImpl) Interpreter(org.cytoscape.equations.Interpreter) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) InterpreterImpl(org.cytoscape.equations.internal.interpreter.InterpreterImpl) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) EquationParserImpl(org.cytoscape.equations.internal.EquationParserImpl) CyTableFactoryImpl(org.cytoscape.model.internal.CyTableFactoryImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) CyRootNetworkImpl(org.cytoscape.model.internal.CyRootNetworkImpl) CyNetworkNaming(org.cytoscape.session.CyNetworkNaming) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) EquationCompiler(org.cytoscape.equations.EquationCompiler) 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