use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImplTest method testSetSelectedViews.
@Test
public void testSetSelectedViews() {
final List<CyNetwork> nets = Collections.singletonList(newNetwork());
appMgr.setSelectedNetworks(nets);
final CyNetworkView v1 = newNetworkView();
final CyNetworkView v2 = newNetworkView();
final List<CyNetworkView> views = Arrays.asList(new CyNetworkView[] { v1, v2 });
appMgr.setSelectedNetworkViews(views);
final List<CyNetworkView> selectedViews = appMgr.getSelectedNetworkViews();
final List<CyNetwork> selectedNets = appMgr.getSelectedNetworks();
assertEquals(2, selectedViews.size());
assertTrue(selectedViews.containsAll(views));
// Selected networks didn't change
assertEquals(1, selectedNets.size());
assertTrue(selectedNets.containsAll(nets));
// Shouldn't change the current network
assertNull(appMgr.getCurrentNetwork());
// Shouldn't change the current network view
assertNull(appMgr.getCurrentNetworkView());
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImplTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
nvtSupport = new NetworkViewTestSupport();
final Set<CyNetwork> networks = new HashSet<>();
when(netMgr.getNetworkSet()).thenReturn(networks);
when(netMgr.networkExists(anyLong())).thenReturn(false);
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(evtHelper);
when(serviceRegistrar.getService(CyNetworkManager.class)).thenReturn(netMgr);
when(serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)")).thenReturn(cyProperty);
appMgr = new CyApplicationManagerImpl(serviceRegistrar);
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImplTest method testSetCurrentNetwork.
@Test
public void testSetCurrentNetwork() {
CyNetworkView view = newNetworkView();
CyNetwork net = view.getModel();
appMgr.setCurrentNetwork(net);
assertEquals(net, appMgr.getCurrentNetwork());
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImplTest method testSetUnselectedCurrentNetworkChangesNetworkSelection.
@Test
public void testSetUnselectedCurrentNetworkChangesNetworkSelection() {
// Setting a current view that is not selected changes the network view selection
CyNetworkView v1 = newNetworkView();
CyNetworkView v2 = newNetworkView();
CyNetworkView v3 = newNetworkView();
appMgr.setSelectedNetworks(Arrays.asList(new CyNetwork[] { v1.getModel(), v2.getModel() }));
appMgr.setCurrentNetwork(v3.getModel());
assertEquals(v3.getModel(), appMgr.getCurrentNetwork());
assertEquals(1, appMgr.getSelectedNetworks().size());
assertTrue(appMgr.getSelectedNetworks().contains(v3.getModel()));
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImplTest method testSetSelectedCurrentNetworkDoesNotChangeNetworkSelection.
@Test
public void testSetSelectedCurrentNetworkDoesNotChangeNetworkSelection() {
// Setting a current network that is already selected does NOT change the network selection state
CyNetwork n1 = newNetwork();
CyNetwork n2 = newNetwork();
CyNetwork n3 = newNetwork();
appMgr.setSelectedNetworks(Arrays.asList(new CyNetwork[] { n1, n2, n3 }));
appMgr.setCurrentNetwork(n3);
assertEquals(n3, appMgr.getCurrentNetwork());
assertEquals(3, appMgr.getSelectedNetworks().size());
}
Aggregations