Search in sources :

Example 1 with GroupTestSupport

use of org.cytoscape.group.GroupTestSupport in project cytoscape-impl by cytoscape.

the class AbstractNetworkReaderTest method setUp.

@Before
public void setUp() throws Exception {
    taskMonitor = mock(TaskMonitor.class);
    CyLayoutAlgorithm def = mock(CyLayoutAlgorithm.class);
    Object context = new Object();
    when(def.createLayoutContext()).thenReturn(context);
    when(def.getDefaultLayoutContext()).thenReturn(context);
    when(def.createTaskIterator(Mockito.any(CyNetworkView.class), Mockito.any(Object.class), Mockito.anySet(), Mockito.any(String.class))).thenReturn(new TaskIterator(new SimpleTask()));
    layouts = mock(CyLayoutAlgorithmManager.class);
    when(layouts.getDefaultLayout()).thenReturn(def);
    NetworkTestSupport nts = new NetworkTestSupport();
    netFactory = nts.getNetworkFactory();
    netManager = nts.getNetworkManager();
    rootNetManager = nts.getRootNetworkFactory();
    netTableManager = nts.getNetworkTableManager();
    TableTestSupport tblTestSupport = new TableTestSupport();
    tableFactory = tblTestSupport.getTableFactory();
    tableManager = mock(CyTableManager.class);
    GroupTestSupport groupTestSupport = new GroupTestSupport();
    groupManager = groupTestSupport.getGroupManager();
    groupFactory = groupTestSupport.getGroupFactory();
    properties = new Properties();
    CyProperty<Properties> cyProperties = new SimpleCyProperty<>("Test", properties, Properties.class, SavePolicy.DO_NOT_SAVE);
    NetworkViewTestSupport nvts = new NetworkViewTestSupport();
    setViewThreshold(DEF_THRESHOLD);
    viewFactory = nvts.getNetworkViewFactory();
    readUtil = new ReadUtils(new StreamUtilImpl(serviceRegistrar));
    defRenderer = mock(NetworkViewRenderer.class);
    when(defRenderer.getNetworkViewFactory()).thenReturn(viewFactory);
    lexicon = new BasicVisualLexicon(new NullVisualProperty("MINIMAL_ROOT", "Minimal Root Visual Property"));
    renderingEngineManager = mock(RenderingEngineManager.class);
    when(renderingEngineManager.getDefaultVisualLexicon()).thenReturn(lexicon);
    applicationManager = mock(CyApplicationManager.class);
    when(applicationManager.getDefaultNetworkViewRenderer()).thenReturn(defRenderer);
    serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)")).thenReturn(cyProperties);
    when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
    when(serviceRegistrar.getService(CyNetworkFactory.class)).thenReturn(netFactory);
    when(serviceRegistrar.getService(CyNetworkViewFactory.class)).thenReturn(viewFactory);
    when(serviceRegistrar.getService(CyNetworkManager.class)).thenReturn(netManager);
    when(serviceRegistrar.getService(CyNetworkTableManager.class)).thenReturn(netTableManager);
    when(serviceRegistrar.getService(CyRootNetworkManager.class)).thenReturn(rootNetManager);
    when(serviceRegistrar.getService(CyLayoutAlgorithmManager.class)).thenReturn(layouts);
    when(serviceRegistrar.getService(CyTableManager.class)).thenReturn(tableManager);
    when(serviceRegistrar.getService(CyTableFactory.class)).thenReturn(tableFactory);
    when(serviceRegistrar.getService(CyGroupManager.class)).thenReturn(groupManager);
    when(serviceRegistrar.getService(CyGroupFactory.class)).thenReturn(groupFactory);
    when(serviceRegistrar.getService(RenderingEngineManager.class)).thenReturn(renderingEngineManager);
}
Also used : NullVisualProperty(org.cytoscape.view.presentation.property.NullVisualProperty) RenderingEngineManager(org.cytoscape.view.presentation.RenderingEngineManager) NetworkTestSupport(org.cytoscape.model.NetworkTestSupport) Properties(java.util.Properties) NetworkViewTestSupport(org.cytoscape.ding.NetworkViewTestSupport) SimpleCyProperty(org.cytoscape.property.SimpleCyProperty) StreamUtilImpl(org.cytoscape.io.internal.util.StreamUtilImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) CyApplicationManager(org.cytoscape.application.CyApplicationManager) TaskIterator(org.cytoscape.work.TaskIterator) CyLayoutAlgorithmManager(org.cytoscape.view.layout.CyLayoutAlgorithmManager) CyTableManager(org.cytoscape.model.CyTableManager) TaskMonitor(org.cytoscape.work.TaskMonitor) TableTestSupport(org.cytoscape.model.TableTestSupport) CyLayoutAlgorithm(org.cytoscape.view.layout.CyLayoutAlgorithm) BasicVisualLexicon(org.cytoscape.view.presentation.property.BasicVisualLexicon) GroupTestSupport(org.cytoscape.group.GroupTestSupport) ReadUtils(org.cytoscape.io.internal.util.ReadUtils) CyNetworkView(org.cytoscape.view.model.CyNetworkView) NetworkViewRenderer(org.cytoscape.application.NetworkViewRenderer) Before(org.junit.Before)

Aggregations

Properties (java.util.Properties)1 CyApplicationManager (org.cytoscape.application.CyApplicationManager)1 NetworkViewRenderer (org.cytoscape.application.NetworkViewRenderer)1 NetworkViewTestSupport (org.cytoscape.ding.NetworkViewTestSupport)1 GroupTestSupport (org.cytoscape.group.GroupTestSupport)1 ReadUtils (org.cytoscape.io.internal.util.ReadUtils)1 StreamUtilImpl (org.cytoscape.io.internal.util.StreamUtilImpl)1 CyTableManager (org.cytoscape.model.CyTableManager)1 NetworkTestSupport (org.cytoscape.model.NetworkTestSupport)1 TableTestSupport (org.cytoscape.model.TableTestSupport)1 SimpleCyProperty (org.cytoscape.property.SimpleCyProperty)1 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)1 CyLayoutAlgorithm (org.cytoscape.view.layout.CyLayoutAlgorithm)1 CyLayoutAlgorithmManager (org.cytoscape.view.layout.CyLayoutAlgorithmManager)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1 RenderingEngineManager (org.cytoscape.view.presentation.RenderingEngineManager)1 BasicVisualLexicon (org.cytoscape.view.presentation.property.BasicVisualLexicon)1 NullVisualProperty (org.cytoscape.view.presentation.property.NullVisualProperty)1 TaskIterator (org.cytoscape.work.TaskIterator)1 TaskMonitor (org.cytoscape.work.TaskMonitor)1