Author: kono
Date: 2012-05-21 17:23:52 -0700 (Mon, 21 May 2012)
New Revision: 29306
Added:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy2SimpleSessionLodingTest.java
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3LargeSessionLodingTest.java
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/session2x/
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/session3x/
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/session3x/smallSession.cys
Removed:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/AbstractSessionTest.java
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionLoadingTest.java
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionSavingTest.java
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/smallSession.cys
Modified:
core3/impl/trunk/session-impl/integration-test/pom.xml
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/BasicIntegrationTest.java
Log:
refs #6 Integration test template is ready. We can add more tests based on
this framework.
Modified: core3/impl/trunk/session-impl/integration-test/pom.xml
===================================================================
--- core3/impl/trunk/session-impl/integration-test/pom.xml 2012-05-21
19:27:44 UTC (rev 29305)
+++ core3/impl/trunk/session-impl/integration-test/pom.xml 2012-05-22
00:23:52 UTC (rev 29306)
@@ -11,12 +11,9 @@
<properties>
<bundle.symbolicName>org.cytoscape.session-impl-integration-test</bundle.symbolicName>
<bundle.namespace>org.cytoscape.session</bundle.namespace>
-
- <!-- Karaf + Pax Exam -->
<exam.version>2.4.0</exam.version>
- <paxrunnerversion>1.7.6</paxrunnerversion>
<url.version>1.3.3</url.version>
- <felixversion>3.2.2</felixversion>
+ <felix.version>4.0.2</felix.version>
</properties>
<modelVersion>4.0.0</modelVersion>
@@ -26,13 +23,7 @@
<packaging>jar</packaging>
- <build>
- <plugins>
- </plugins>
-
- </build>
-
<!-- Build minimal application to test session mechanism. -->
<dependencies>
<dependency>
@@ -85,12 +76,12 @@
<!-- Pax Exam Dependencies -->
- <!-- Pax Exam Dependencies -->
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>2.1.3</version>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -99,6 +90,12 @@
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-rbc</artifactId>
+ <version>2.4.0</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
@@ -124,7 +121,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>4.0.2</version>
+ <version>${felix.version}</version>
<scope>test</scope>
</dependency>
@@ -142,21 +139,6 @@
<scope>test</scope>
</dependency>
-
-
-
-
-
-
- <!-- Karaf Extension -->
- <dependency>
- <groupId>org.apache.karaf.tooling</groupId>
-
<artifactId>org.apache.karaf.tooling.testing</artifactId>
- <version>2.2.7</version>
- <scope>test</scope>
- </dependency>
-
-
</dependencies>
</project>
Deleted:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/AbstractSessionTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/AbstractSessionTest.java
2012-05-21 19:27:44 UTC (rev 29305)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/AbstractSessionTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -1,147 +0,0 @@
-package org.cytoscape.session;
-
-import static org.mockito.Mockito.mock;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import org.cytoscape.equations.EquationCompiler;
-import org.cytoscape.equations.EquationParser;
-import org.cytoscape.equations.Interpreter;
-import org.cytoscape.equations.internal.EquationCompilerImpl;
-import org.cytoscape.equations.internal.EquationParserImpl;
-import org.cytoscape.equations.internal.interpreter.InterpreterImpl;
-import org.cytoscape.event.CyEventHelper;
-import org.cytoscape.event.internal.CyEventHelperImpl;
-import org.cytoscape.event.internal.CyListenerAdapter;
-import org.cytoscape.io.BasicCyFileFilter;
-import org.cytoscape.io.DataCategory;
-import org.cytoscape.io.internal.read.CyNetworkReaderManagerImpl;
-import org.cytoscape.io.internal.read.CyPropertyReaderManagerImpl;
-import org.cytoscape.io.internal.read.VizmapReaderManagerImpl;
-import org.cytoscape.io.internal.read.datatable.CSVCyReaderFactory;
-import org.cytoscape.io.internal.read.session.Cy3SessionReaderImpl;
-import org.cytoscape.io.internal.read.vizmap.VizmapXMLFileFilter;
-import org.cytoscape.io.internal.read.vizmap.VizmapXMLReaderFactory;
-import org.cytoscape.io.internal.util.ReadCache;
-import org.cytoscape.io.internal.util.StreamUtilImpl;
-import org.cytoscape.io.internal.util.vizmap.CalculatorConverterFactory;
-import org.cytoscape.io.internal.util.vizmap.VisualStyleSerializer;
-import org.cytoscape.io.read.CyNetworkReaderManager;
-import org.cytoscape.io.read.CyPropertyReaderManager;
-import org.cytoscape.io.read.CySessionReader;
-import org.cytoscape.io.read.VizmapReaderManager;
-import org.cytoscape.io.util.StreamUtil;
-import org.cytoscape.model.CyNetworkTableManager;
-import org.cytoscape.model.CyTableFactory;
-import org.cytoscape.model.internal.CyNetworkTableManagerImpl;
-import org.cytoscape.model.internal.CyRootNetworkManagerImpl;
-import org.cytoscape.model.internal.CyTableFactoryImpl;
-import org.cytoscape.model.subnetwork.CyRootNetworkManager;
-import org.cytoscape.property.CyProperty;
-import org.cytoscape.service.util.CyServiceRegistrar;
-import org.cytoscape.service.util.internal.CyServiceRegistrarImpl;
-import org.cytoscape.work.TaskMonitor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-
-/**
- * Build real application with minimal functionality.
- *
- */
-public class AbstractSessionTest {
-
- private CySessionReader sessionReader;
-
- private URL session1;
- private TaskMonitor taskMonitor = mock(TaskMonitor.class);
-
- @Before
- public void setUp() throws Exception {
- buildHeadlessApplication();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void test() throws Exception {
-
- //sessionReader.run(taskMonitor);
- }
-
- private void buildHeadlessApplication() throws Exception {
- BundleContext bc = mock(BundleContext.class);
- CyListenerAdapter normal = new CyListenerAdapter(bc);
- CyEventHelper cyEventHelper = new CyEventHelperImpl(normal);
-
- final File sessionFile1 = new
File("./src/test/resources/testData/" + "smallSession.cys");
-
- final URL sessionFileURL1 = sessionFile1.toURI().toURL();
- InputStream sourceInputStream = sessionFileURL1.openStream();
-
- final ReadCache cache = new ReadCache();
- CyProperty<Properties> prop = new CyProperty<Properties>() {
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Properties getProperties() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public org.cytoscape.property.CyProperty.SavePolicy
getSavePolicy() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Class<? extends Properties> getPropertyType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- };
- StreamUtil streamUtil = new StreamUtilImpl(prop);
- CyNetworkReaderManager networkReaderMgr = new
CyNetworkReaderManagerImpl(streamUtil);
- CyPropertyReaderManager propertyReaderMgr = new
CyPropertyReaderManagerImpl(streamUtil);
- VizmapReaderManager vizmapReaderMgr = new
VizmapReaderManagerImpl(streamUtil);
-
- CalculatorConverterFactory calculatorConverterFactory = new
CalculatorConverterFactory();
-
-// VisualStyleSerializer visualStyleSerializer = new
VisualStyleSerializer(calculatorConverterFactory,visualStyleFactoryServiceRef,visualMappingManagerServiceRef,renderingEngineManagerServiceRef,discreteMappingFactoryServiceRef,continuousMappingFactoryServiceRef,passthroughMappingFactoryServiceRef);
-// VizmapXMLFileFilter vizmapXMLFilter = new
VizmapXMLFileFilter(new String[]{"xml"}, new String[]{}, "Vizmap XML
files",DataCategory.VIZMAP, streamUtil);
-// VizmapXMLReaderFactory vizmapXMLReaderFactory = new
VizmapXMLReaderFactory(vizmapXMLFilter,visualStyleSerializer);
-
-
-
-
- Interpreter interpreter = new InterpreterImpl();
- CyServiceRegistrar serviceRegistrar = new
CyServiceRegistrarImpl(bc);
- CyTableFactory tableFactory = new
CyTableFactoryImpl(cyEventHelper, interpreter, serviceRegistrar);
- EquationParser parser = new EquationParserImpl();
- EquationCompiler compiler = new EquationCompilerImpl(parser);
-
- BasicCyFileFilter sessionTableFilter = new
BasicCyFileFilter(new String[] { "cytable" },
- new String[] { "text/plain" }, "Session table
file", DataCategory.TABLE, streamUtil);
-
- CSVCyReaderFactory sessionTableReaderFactory = new
CSVCyReaderFactory(sessionTableFilter, true, true,
- tableFactory, compiler);
-
- CyNetworkTableManager networkTableMgr = new
CyNetworkTableManagerImpl();
- CyRootNetworkManager rootNetworkMgr = new
CyRootNetworkManagerImpl();
- sessionReader = new Cy3SessionReaderImpl(sourceInputStream,
cache, networkReaderMgr, propertyReaderMgr,
- vizmapReaderMgr, sessionTableReaderFactory,
networkTableMgr, rootNetworkMgr);
- }
-}
Modified:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/BasicIntegrationTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/BasicIntegrationTest.java
2012-05-21 19:27:44 UTC (rev 29305)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/BasicIntegrationTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -15,7 +15,7 @@
*/
package org.cytoscape.session;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
@@ -24,19 +24,22 @@
import static org.ops4j.pax.exam.CoreOptions.repository;
import java.io.File;
-import java.util.Set;
import javax.inject.Inject;
-import org.cytoscape.model.CyNetwork;
+import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.model.CyNetworkFactory;
import org.cytoscape.model.CyNetworkManager;
+import org.cytoscape.model.CyNetworkTableManager;
+import org.cytoscape.model.CyTableManager;
import org.cytoscape.task.read.OpenSessionTaskFactory;
+import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.presentation.RenderingEngineManager;
+import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.work.SynchronousTaskManager;
import org.cytoscape.work.TaskIterator;
-import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -45,39 +48,66 @@
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
import org.ops4j.pax.exam.util.Filter;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
+/**
+ * Build minimum set of Cytoscape to test session loading/saving.
+ *
+ */
@RunWith(JUnit4TestRunner.class)
+// Framework will be reset for each test
@ExamReactorStrategy( AllConfinedStagedReactorFactory.class )
-public class BasicIntegrationTest {
+public abstract class BasicIntegrationTest {
- final String API_BUNDLE_VERSION = "3.0.0-beta2-SNAPSHOT";
- final String IMPL_BUNDLE_VERSION = "3.0.0-alpha9-SNAPSHOT";
+ protected static final String API_BUNDLE_VERSION =
"3.0.0-beta2-SNAPSHOT";
+ protected static final String IMPL_BUNDLE_VERSION =
"3.0.0-alpha9-SNAPSHOT";
+
+ ///////// OSGi Bundle Context ////////////
@Inject
- private BundleContext bundleContext;
+ protected BundleContext bundleContext;
+ ///////// Manager objects ////////////////
+
@Inject
- private CyNetworkManager networkManager;
+ protected CyNetworkManager networkManager;
+
@Inject
- private CyNetworkFactory networkFactory;
+ protected CyTableManager tableManager;
@Inject
- private CySessionManager sessionManager;
+ protected CyNetworkTableManager networkTableManager;
@Inject
- private RenderingEngineManager renderingEngineManager;
+ protected CyNetworkViewManager viewManager;
- @Inject @Filter("(id=ding)")
- private VisualLexicon lexicon;
+ @Inject
+ protected CyNetworkFactory networkFactory;
@Inject
- private OpenSessionTaskFactory openSessionTF;
+ protected CySessionManager sessionManager;
@Inject
- private SynchronousTaskManager tm;
+ protected VisualMappingManager vmm;
+
+ @Inject
+ protected RenderingEngineManager renderingEngineManager;
+
+ @Inject @Filter("(id=ding)") // Use DING
+ protected VisualLexicon lexicon;
+
+ @Inject
+ protected OpenSessionTaskFactory openSessionTF;
+
+ @Inject
+ protected SynchronousTaskManager<?> tm;
+
+ @Inject
+ protected CyApplicationManager applicationManager;
+
+
+ // Target file name. Assume we always have one test session file per
test class.
+ protected File sessionFile;
/**
* Build minimal set of bundles.
@@ -86,17 +116,27 @@
public Option[] config() {
return options(
junitBundles(),
- felix(),
+ felix(), // Use Felix as runtime
repository("http://code.cytoscape.org/nexus/content/repositories/snapshots/"),
-
-
// Misc. bundles required to run minimal
Cytoscape
mavenBundle().groupId("cytoscape-sun").artifactId("jhall").version("1.0"),
+
mavenBundle().groupId("com.googlecode.guava-osgi").artifactId("guava-osgi").version("9.0.0"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("parallelcolt").version("0.9.4"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("opencsv").version("2.1"),
+
mavenBundle().groupId("com.lowagie.text").artifactId("com.springsource.com.lowagie.text").version("2.0.8"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio").version("2.1.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio-svg").version("2.1.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio-ps").version("2.1.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphics2d").version("2.1.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-shared").version("7.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-fontchooser").version("7.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-sheet").version("7.3"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("org.swinglabs.swingx").version("1.6.1"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-export").version("2.1.1"),
+
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-util").version("2.0.2"),
+
// API bundles
-
-
-
mavenBundle().groupId("org.cytoscape").artifactId("event-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("model-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("group-api").version(API_BUNDLE_VERSION),
@@ -112,31 +152,14 @@
mavenBundle().groupId("org.cytoscape").artifactId("layout-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("datasource-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("vizmap-gui-api").version(API_BUNDLE_VERSION),
-
mavenBundle().groupId("org.cytoscape").artifactId("work-swing-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("swing-application-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("equations-api").version(API_BUNDLE_VERSION),
-
mavenBundle().groupId("org.cytoscape").artifactId("swing-application-api").version(API_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("service-api").version(API_BUNDLE_VERSION),
-
mavenBundle().groupId("com.googlecode.guava-osgi").artifactId("guava-osgi").version("9.0.0"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("parallelcolt").version("0.9.4"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("opencsv").version("2.1"),
-
mavenBundle().groupId("com.lowagie.text").artifactId("com.springsource.com.lowagie.text").version("2.0.8"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio").version("2.1.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio-svg").version("2.1.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphicsio-ps").version("2.1.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-graphics2d").version("2.1.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-shared").version("7.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-fontchooser").version("7.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("l2fprod-common-sheet").version("7.3"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("org.swinglabs.swingx").version("1.6.1"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-export").version("2.1.1"),
-
mavenBundle().groupId("cytoscape-temp").artifactId("freehep-util").version("2.0.2"),
-
-
+ // Implementation bundles
mavenBundle().groupId("org.cytoscape").artifactId("property-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("datasource-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("equations-impl").version(IMPL_BUNDLE_VERSION),
@@ -146,7 +169,6 @@
mavenBundle().groupId("org.cytoscape").artifactId("group-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("work-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("work-headless-impl").version(IMPL_BUNDLE_VERSION),
-
mavenBundle().groupId("org.cytoscape").artifactId("layout-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("viewmodel-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("presentation-impl").version(IMPL_BUNDLE_VERSION),
@@ -154,46 +176,31 @@
mavenBundle().groupId("org.cytoscape").artifactId("application-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("session-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("ding-presentation-impl").version(IMPL_BUNDLE_VERSION),
-
mavenBundle().groupId("org.cytoscape").artifactId("io-impl").version(IMPL_BUNDLE_VERSION),
mavenBundle().groupId("org.cytoscape").artifactId("core-task-impl").version(IMPL_BUNDLE_VERSION),
-
mavenBundle().groupId("org.cytoscape").artifactId("vizmap-gui-impl").version(IMPL_BUNDLE_VERSION)
);
}
+
+
+ /**
+ *
+ * Make Sure all required basic objects are available.
+ *
+ * @throws Exception
+ */
+ void checkBasicConfiguration() throws Exception {
+ assertNotNull(sessionFile);
- @Test
- public void test() throws Exception {
assertNotNull(bundleContext);
- Bundle[] bundles = bundleContext.getBundles();
-
- for(Bundle bundle:bundles) {
- System.out.println(bundle.getState() + ": Bundle: " +
bundle.getSymbolicName() + " Correct state=" + Bundle.ACTIVE);
- ServiceReference<?>[] services =
bundle.getRegisteredServices();
- if(services != null)
- System.out.println("# service: " +
services.length);
- }
- assertNotNull(bundles);
assertNotNull(networkManager);
+ assertNotNull(networkTableManager);
+ assertNotNull(tableManager);
assertNotNull(networkFactory);
assertNotNull(sessionManager);
assertNotNull(renderingEngineManager);
-
assertNotNull(tm);
assertNotNull(openSessionTF);
-
- final File sessionFile1 = new
File("./src/test/resources/testData/" + "smallSession.cys");
- final TaskIterator ti =
openSessionTF.createTaskIterator(sessionFile1);
- tm.execute(ti);
+ assertNotNull(applicationManager);
}
-
- @After
- public void confirm() {
- Set<CyNetwork> networks = networkManager.getNetworkSet();
- assertEquals(2, networks.size());
-// CyNetwork net1 = networks.iterator().next();
-// CyNetwork net2 = networks.iterator().next();
-// assertEquals(22, net1.getNodeCount());
- }
-
}
Added:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy2SimpleSessionLodingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy2SimpleSessionLodingTest.java
(rev 0)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy2SimpleSessionLodingTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -0,0 +1,44 @@
+package org.cytoscape.session;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.cytoscape.work.TaskIterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.ExamReactorStrategy;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
+
+@RunWith(JUnit4TestRunner.class)
+@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
+public class Cy2SimpleSessionLodingTest extends BasicIntegrationTest {
+
+ @Before
+ public void setup() throws Exception {
+// sessionFile = new
File("./src/test/resources/testData/session3x/", "smallSession.cys");
+// checkBasicConfiguration();
+ }
+
+ @Test
+ public void testLoadSession() throws Exception {
+// final TaskIterator ti =
openSessionTF.createTaskIterator(sessionFile);
+// tm.execute(ti);
+ }
+
+ @After
+ public void confirm() {
+
+ // test overall status of current session.
+ checkGlobalStatus();
+
+ }
+
+ private void checkGlobalStatus() {
+
+ }
+
+}
Added:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3LargeSessionLodingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3LargeSessionLodingTest.java
(rev 0)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3LargeSessionLodingTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -0,0 +1,42 @@
+package org.cytoscape.session;
+
+import java.io.File;
+
+import org.cytoscape.work.TaskIterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.ExamReactorStrategy;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
+
+@RunWith(JUnit4TestRunner.class)
+@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
+public class Cy3LargeSessionLodingTest extends BasicIntegrationTest {
+
+ @Before
+ public void setup() throws Exception {
+ sessionFile = new
File("./src/test/resources/testData/session3x/", "smallSession.cys");
+ checkBasicConfiguration();
+ }
+
+ @Test
+ public void testLoadSession() throws Exception {
+ final TaskIterator ti =
openSessionTF.createTaskIterator(sessionFile);
+ tm.execute(ti);
+ }
+
+ @After
+ public void confirm() {
+
+ // test overall status of current session.
+ checkGlobalStatus();
+
+ }
+
+ private void checkGlobalStatus() {
+
+ }
+
+}
Added:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
(rev 0)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/Cy3SimpleSessionLodingTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -0,0 +1,139 @@
+package org.cytoscape.session;
+
+import static org.junit.Assert.*;
+
+import java.awt.Color;
+import java.awt.Paint;
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.swing.plaf.basic.BasicViewportUI;
+
+import org.cytoscape.io.internal.util.session.model.SelectedNodes;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+import org.cytoscape.view.vizmap.VisualMappingFunction;
+import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.mappings.PassthroughMapping;
+import org.cytoscape.work.TaskIterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.ExamReactorStrategy;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+@RunWith(JUnit4TestRunner.class)
+@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
+public class Cy3SimpleSessionLodingTest extends BasicIntegrationTest {
+
+ @Before
+ public void setup() throws Exception {
+ sessionFile = new
File("./src/test/resources/testData/session3x/", "smallSession.cys");
+ checkBasicConfiguration();
+ }
+
+ @Test
+ public void testLoadSession() throws Exception {
+ final TaskIterator ti =
openSessionTF.createTaskIterator(sessionFile);
+ tm.execute(ti);
+ }
+
+ @After
+ public void confirm() {
+
+ // test overall status of current session.
+ checkGlobalStatus();
+
+ Set<CyNetwork> networks = networkManager.getNetworkSet();
+ final Iterator<CyNetwork> itr = networks.iterator();
+ CyNetwork net1 = itr.next();
+ CyNetwork net2 = itr.next();
+
+ // Pick galFiltered.sif
+
if(net1.getDefaultNetworkTable().getRow(net1.getSUID()).get(CyNetwork.NAME,
String.class).equals("galFiltered.sif")) {
+ checkNetwork(net1);
+ checkChildNetwork(net2);
+ } else {
+ checkNetwork(net2);
+ checkChildNetwork(net1);
+ }
+ }
+
+ private void checkGlobalStatus() {
+ assertEquals(2, networkManager.getNetworkSet().size());
+ assertEquals(2, viewManager.getNetworkViewSet().size());
+
+ // Since this test runs in headless mode, this should be zero.
+ assertEquals(0,
renderingEngineManager.getAllRenderingEngines().size());
+
+ assertEquals(30, tableManager.getAllTables(true).size());
+
+ // 6 tables per network
+ assertEquals(12, tableManager.getAllTables(false).size());
+ }
+
+ private void checkNetwork(final CyNetwork network) {
+ assertEquals(331, network.getNodeCount());
+ assertEquals(362, network.getEdgeCount());
+
+ // Selection state
+ Collection<CyRow> selectedNodes =
network.getDefaultNodeTable().getMatchingRows(CyNetwork.SELECTED, true);
+ Collection<CyRow> selectedEdges =
network.getDefaultEdgeTable().getMatchingRows(CyNetwork.SELECTED, true);
+ assertEquals(43, selectedNodes.size());
+ assertEquals(51, selectedEdges.size());
+
+ // View test
+ Collection<CyNetworkView> views =
viewManager.getNetworkViews(network);
+ assertEquals(1, views.size());
+
+ final CyNetworkView view = views.iterator().next();
+ assertEquals(331, view.getNodeViews().size());
+ assertEquals(362, view.getEdgeViews().size());
+
+ // Visual Style
+ assertEquals(8, vmm.getAllVisualStyles().size());
+ final VisualStyle style = vmm.getVisualStyle(view);
+ checkVisualStyle(style);
+
+ final Color backgroungColor = (Color)
view.getVisualProperty(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT);
+ assertEquals(Color.WHITE, backgroungColor);
+
+ // All nodes should have same width:
+ Double nodeWidth =
view.getNodeView(network.getNodeList().iterator().next()).getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
+ assertEquals(Double.valueOf(60.0d), nodeWidth);
+
+ // Apply the given style
+ style.apply(view);
+
+ nodeWidth =
view.getNodeView(network.getNodeList().iterator().next()).getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
+ assertEquals(Double.valueOf(70.0d), nodeWidth);
+
+
+ }
+
+ private void checkVisualStyle(final VisualStyle style) {
+ assertNotNull(style);
+ assertEquals(vmm.getDefaultVisualStyle(), style);
+
+ Collection<VisualMappingFunction<?, ?>> mappings =
style.getAllVisualMappingFunctions();
+ assertEquals(1, mappings.size());
+ VisualMappingFunction<?, ?> labelMapping =
mappings.iterator().next();
+ assertTrue(labelMapping instanceof PassthroughMapping);
+ assertEquals(BasicVisualLexicon.NODE_LABEL,
labelMapping.getVisualProperty());
+ assertEquals(CyNetwork.NAME,
labelMapping.getMappingColumnName());
+ assertEquals(String.class, labelMapping.getMappingColumnType());
+ }
+
+ private void checkChildNetwork(final CyNetwork network) {
+ assertEquals(43, network.getNodeCount());
+ assertEquals(34, network.getEdgeCount());
+ }
+}
Deleted:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionLoadingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionLoadingTest.java
2012-05-21 19:27:44 UTC (rev 29305)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionLoadingTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -1,23 +0,0 @@
-package org.cytoscape.session;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SessionLoadingTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void test() {
- }
-
-}
Deleted:
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionSavingTest.java
===================================================================
---
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionSavingTest.java
2012-05-21 19:27:44 UTC (rev 29305)
+++
core3/impl/trunk/session-impl/integration-test/src/test/java/org/cytoscape/session/SessionSavingTest.java
2012-05-22 00:23:52 UTC (rev 29306)
@@ -1,23 +0,0 @@
-package org.cytoscape.session;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SessionSavingTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void test() {
- }
-
-}
Copied:
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/session3x/smallSession.cys
(from rev 29301,
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/smallSession.cys)
===================================================================
(Binary files differ)
Deleted:
core3/impl/trunk/session-impl/integration-test/src/test/resources/testData/smallSession.cys
===================================================================
(Binary files differ)
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.