Search in sources :

Example 1 with CyRootNetworkImpl

use of org.cytoscape.model.internal.CyRootNetworkImpl 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)

Example 2 with CyRootNetworkImpl

use of org.cytoscape.model.internal.CyRootNetworkImpl in project cytoscape-impl by cytoscape.

the class TestCyNetworkFactory method getPublicRootInstance.

public static CyRootNetwork getPublicRootInstance(DummyCyEventHelper deh, SavePolicy policy) {
    CyServiceRegistrar serviceRegistrar = mockCyServiceRegistrar(deh);
    final CyNetworkTableManagerImpl ntm = new CyNetworkTableManagerImpl();
    final CyTableManagerImpl tm = new CyTableManagerImpl(ntm, new CyNetworkManagerImpl(serviceRegistrar), serviceRegistrar);
    final CyTableFactoryImpl tableFactory = new CyTableFactoryImpl(deh, serviceRegistrar);
    return new CyRootNetworkImpl(deh, tm, ntm, tableFactory, serviceRegistrar, true, policy);
}
Also used : CyTableFactoryImpl(org.cytoscape.model.internal.CyTableFactoryImpl) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) CyRootNetworkImpl(org.cytoscape.model.internal.CyRootNetworkImpl) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar)

Example 3 with CyRootNetworkImpl

use of org.cytoscape.model.internal.CyRootNetworkImpl in project cytoscape-impl by cytoscape.

the class TestCyNetworkFactory method getPrivateRootInstance.

public static CyRootNetwork getPrivateRootInstance(SavePolicy policy) {
    DummyCyEventHelper deh = new DummyCyEventHelper();
    CyServiceRegistrar serviceRegistrar = mockCyServiceRegistrar(deh);
    CyNetworkTableManagerImpl ntm = new CyNetworkTableManagerImpl();
    CyTableManagerImpl tm = new CyTableManagerImpl(ntm, new CyNetworkManagerImpl(serviceRegistrar), serviceRegistrar);
    CyRootNetworkImpl ar = new CyRootNetworkImpl(deh, tm, ntm, new CyTableFactoryImpl(deh, serviceRegistrar), serviceRegistrar, false, policy);
    return ar;
}
Also used : CyTableFactoryImpl(org.cytoscape.model.internal.CyTableFactoryImpl) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) CyRootNetworkImpl(org.cytoscape.model.internal.CyRootNetworkImpl) DummyCyEventHelper(org.cytoscape.event.DummyCyEventHelper) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar)

Example 4 with CyRootNetworkImpl

use of org.cytoscape.model.internal.CyRootNetworkImpl in project cytoscape-impl by cytoscape.

the class CyTableManagerTest method setUp.

@Before
public void setUp() {
    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);
    networkTableMgr = new CyNetworkTableManagerImpl();
    networkManager = new CyNetworkManagerImpl(serviceRegistrar);
    mgr = new CyTableManagerImpl(networkTableMgr, networkManager, serviceRegistrar);
    assertNotNull(mgr);
    assertEquals(0, mgr.getAllTables(true).size());
    final CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
    final CyTableFactoryImpl tableFactory = new CyTableFactoryImpl(eventHelper, serviceRegistrar);
    goodNetwork = new CyRootNetworkImpl(eventHelper, (CyTableManagerImpl) mgr, networkTableMgr, tableFactory, serviceRegistrar, true, SavePolicy.DO_NOT_SAVE).getBaseNetwork();
    networkManager.addNetwork(goodNetwork);
    globalTable = tableFactory.createTable("test table", CyIdentifiable.SUID, Long.class, true, true);
    assertNotNull(globalTable);
    assertNotNull(goodNetwork);
    assertEquals(1, networkManager.getNetworkSet().size());
}
Also used : CyTableFactoryImpl(org.cytoscape.model.internal.CyTableFactoryImpl) Interpreter(org.cytoscape.equations.Interpreter) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) CyRootNetworkImpl(org.cytoscape.model.internal.CyRootNetworkImpl) InterpreterImpl(org.cytoscape.equations.internal.interpreter.InterpreterImpl) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) Before(org.junit.Before)

Aggregations

CyNetworkManagerImpl (org.cytoscape.model.internal.CyNetworkManagerImpl)4 CyNetworkTableManagerImpl (org.cytoscape.model.internal.CyNetworkTableManagerImpl)4 CyRootNetworkImpl (org.cytoscape.model.internal.CyRootNetworkImpl)4 CyTableFactoryImpl (org.cytoscape.model.internal.CyTableFactoryImpl)4 CyTableManagerImpl (org.cytoscape.model.internal.CyTableManagerImpl)4 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)4 Interpreter (org.cytoscape.equations.Interpreter)2 InterpreterImpl (org.cytoscape.equations.internal.interpreter.InterpreterImpl)2 DummyCyEventHelper (org.cytoscape.event.DummyCyEventHelper)2 Before (org.junit.Before)2 EquationCompiler (org.cytoscape.equations.EquationCompiler)1 EquationCompilerImpl (org.cytoscape.equations.internal.EquationCompilerImpl)1 EquationParserImpl (org.cytoscape.equations.internal.EquationParserImpl)1 CyEventHelper (org.cytoscape.event.CyEventHelper)1 CyNetworkNaming (org.cytoscape.session.CyNetworkNaming)1