Author: skillcoyne Date: 2008-09-19 16:21:48 -0700 (Fri, 19 Sep 2008) New Revision: 14937
Added: csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeMultipleUsers.java csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeTest.java Modified: csplugins/trunk/ucsd/mes/api/pom.xml Log: Using JUnitPerf to attempt timed testing of network functions. Modified: csplugins/trunk/ucsd/mes/api/pom.xml =================================================================== --- csplugins/trunk/ucsd/mes/api/pom.xml 2008-09-19 23:00:36 UTC (rev 14936) +++ csplugins/trunk/ucsd/mes/api/pom.xml 2008-09-19 23:21:48 UTC (rev 14937) @@ -1,5 +1,5 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.cytoscape</groupId> <artifactId>api</artifactId> @@ -7,15 +7,25 @@ <version>1.0-SNAPSHOT</version> <name>api</name> <url>http://maven.apache.org</url> - <description>This package contains the proposed public API for the different core bundles comprising Cytoscape 3.0</description> + <description>This package contains the proposed public API for the different core bundles comprising Cytoscape 3.0 + </description> <dependencies> + <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.1</version> + <version>4.4</version> <scope>test</scope> </dependency> <dependency> + <groupId>junitperf</groupId> + <artifactId>junitperf</artifactId> + <version>1.8</version> + <scope>test</scope> + </dependency> + + <!-- Internal --> + <dependency> <groupId>cytoscape</groupId> <artifactId>graph.fixed</artifactId> <version>1.0-SNAPSHOT</version> @@ -30,129 +40,114 @@ <artifactId>util.intr</artifactId> <version>1.0-SNAPSHOT</version> </dependency> - <!-- for OSGi activator --> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi_R4_core</artifactId> - <version>1.0</version> - <scope>provided</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi_R4_compendium</artifactId> - <version>1.0</version> - <scope>provided</scope> - <optional>true</optional> - </dependency> + <!-- for OSGi activator --> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi_R4_core</artifactId> + <version>1.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi_R4_compendium</artifactId> + <version>1.0</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.osgi</groupId> + <artifactId>spring-osgi-mock</artifactId> + <version>1.0</version> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.springframework.osgi</groupId> - <artifactId>spring-osgi-mock</artifactId> - <version>1.0</version> - <scope>test</scope> - </dependency> + <!-- our custom version of CLI --> + <dependency> + <groupId>org.apache</groupId> + <artifactId>commons.cli</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> - <!-- our custom version of CLI --> - <dependency> - <groupId>org.apache</groupId> - <artifactId>commons.cli</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - <showWarnings>true</showWarnings> - <showDeprecation>true</showDeprecation> - <compilerArguments> - <Xlint:all></Xlint:all> - <Xmaxwarns>10000</Xmaxwarns> - <Xmaxerrs>10000</Xmaxerrs> - </compilerArguments> - </configuration> - </plugin> - </plugins> - </build> - <reporting> - <plugins> + + <build> + <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + <showWarnings>true</showWarnings> + <showDeprecation>true</showDeprecation> + <compilerArguments> + <Xlint:all></Xlint:all> + <Xmaxwarns>10000</Xmaxwarns> + <Xmaxerrs>10000</Xmaxerrs> + </compilerArguments> + </configuration> + </plugin> + </plugins> + </build> + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <linkXref>true</linkXref> + <sourceEncoding>utf-8</sourceEncoding> + <minimumTokens>100</minimumTokens> + <targetJdk>1.5</targetJdk> + <excludes> + <exclude>**/*Bean.java</exclude> + <exclude>**/generated/*.java</exclude> + </excludes> + </configuration> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> - <artifactId>taglist-maven-plugin</artifactId> - <version>2.2</version> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> <configuration> - <tags> - <tag>TODO</tag> - <tag>FIXME</tag> - <tag>@todo</tag> - <tag>@deprecated</tag> - <tag>DOCUMENT ME</tag> - </tags> + <threshold>Low</threshold> + <effort>Max</effort> </configuration> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <excludePackageNames>*.impl,*.internal</excludePackageNames> + <aggregate>true</aggregate> + <links> + <link>http://java.sun.com/j2se/1.5.0/docs/api/</link> + </links> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>javadoc</report> + <!-- <report>test-javadoc</report> --> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <configuration> - <linkXref>true</linkXref> - <sourceEncoding>utf-8</sourceEncoding> - <minimumTokens>100</minimumTokens> - <targetJdk>1.5</targetJdk> - <excludes> - <exclude>**/*Bean.java</exclude> - <exclude>**/generated/*.java</exclude> - </excludes> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>findbugs-maven-plugin</artifactId> - <configuration> - <threshold>Low</threshold> - <effort>Max</effort> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jdepend-maven-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <excludePackageNames>*.impl,*.internal</excludePackageNames> - <aggregate>true</aggregate> - <links> - <link>http://java.sun.com/j2se/1.5.0/docs/api/</link> - </links> - </configuration> - <reportSets> - <reportSet> - <reports> - <report>javadoc</report> - <!-- <report>test-javadoc</report> --> - </reports> - </reportSet> - </reportSets> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jxr-maven-plugin</artifactId> - </plugin> - </plugins> - </reporting> - <distributionManagement> <site> <id>chianti</id> Added: csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeMultipleUsers.java =================================================================== --- csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeMultipleUsers.java 2008-09-19 23:00:36 UTC (rev 14936) +++ csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeMultipleUsers.java 2008-09-19 23:21:48 UTC (rev 14937) @@ -0,0 +1,64 @@ +package org.cytoscape.model; + +import junit.framework.TestResult; +import junit.framework.Test; +import junit.framework.TestCase; +import org.cytoscape.model.internal.CyNetworkImpl; +import com.clarkware.junitperf.TimedTest; +import com.clarkware.junitperf.LoadTest; + +/** + * Created by IntelliJ IDEA. User: skillcoy Date: Sep 19, 2008 Time: 4:07:31 PM To change this template use File | + * Settings | File Templates. + */ +public class TimedAddNodeMultipleUsers extends TestCase + { + + private CyNetwork net; + private int totalNodes = 100000; + + public static Test suite() + { + long maxTimeInMillis = 1000; + int concurrentUsers = 3; + Test test = new TimedAddNodeMultipleUsers("testLoadNetwork"); + Test loadTest = new LoadTest(new TimedTest(test, maxTimeInMillis), concurrentUsers); + return loadTest; + } + + public static void main(String args[]) throws Exception + { + junit.textui.TestRunner.run(suite()); + } + + public TimedAddNodeMultipleUsers(String name) + { + super(name); + } + + public void setUp() + { + net = new CyNetworkImpl(new DummyCyEventHelper()); + } + + public void tearDown() + { + net = null; + } + + public void testLoadNetwork() + { + for (int i = 0; i < totalNodes; i++) + net.addNode(); + + /* + TODO + !! This is failing with an error that LOOKS like all nodes are being added to the same network. + Unsure if each timed test case should be running separately or not so don't know if this is actually + an error !! + */ + //assertEquals(net.getNodeCount(), totalNodes); + } + + + } Added: csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeTest.java =================================================================== --- csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeTest.java 2008-09-19 23:00:36 UTC (rev 14936) +++ csplugins/trunk/ucsd/mes/api/src/test/java/org/cytoscape/model/TimedAddNodeTest.java 2008-09-19 23:21:48 UTC (rev 14937) @@ -0,0 +1,51 @@ +package org.cytoscape.model; + +import org.cytoscape.model.internal.CyNetworkImpl; +import com.clarkware.junitperf.TimedTest; +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestResult; + + +/** + * Created by IntelliJ IDEA. User: skillcoy Date: Sep 19, 2008 Time: 3:04:03 PM To change this template use File | + * Settings | File Templates. + */ +public class TimedAddNodeTest extends TestCase + { + private CyNetwork net; + private int totalNodes = 100000; + + public static Test suite() + { + long maxTimeInMillis = 225; + Test test = new TimedAddNodeTest("testLoadNetwork"); + Test timedTest = new TimedTest(test, maxTimeInMillis, false); + return timedTest; + } + + public static void main(String args[]) throws Exception + { + TestResult result = junit.textui.TestRunner.run(suite()); + System.out.println("Failures: " + result.failureCount()); + } + + public TimedAddNodeTest(String name) + { + super(name); + } + + public void setUp() + { + net = new CyNetworkImpl(new DummyCyEventHelper()); + } + + public void testLoadNetwork() + { + for (int i = 0; i < totalNodes; i++) + net.addNode(); + assertEquals(net.getNodeCount(), totalNodes); + } + + + } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
