Author: mes
Date: 2011-09-01 12:22:15 -0700 (Thu, 01 Sep 2011)
New Revision: 26678
Removed:
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleAnalyzerImplTest.java
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleTaskTest.java
Modified:
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/META-INF/maven/archetype.xml
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/pom.xml
core3/support/trunk/archetypes/cyaction-plugin/src/main/resources/archetype-resources/pom.xml
core3/support/trunk/archetypes/task-plugin/src/main/resources/META-INF/maven/archetype.xml
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/pom.xml
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTask.java
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTaskFactory.java
Log:
updated for latest release
Modified:
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/META-INF/maven/archetype.xml
===================================================================
---
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/META-INF/maven/archetype.xml
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/META-INF/maven/archetype.xml
2011-09-01 19:22:15 UTC (rev 26678)
@@ -4,9 +4,6 @@
<source>src/main/java/internal/SampleAnalyzerImpl.java</source>
<source>src/main/java/SampleAnalyzer.java</source>
</sources>
- <testSources>
- <source>src/test/java/internal/SampleAnalyzerImplTest.java</source>
- </testSources>
<resources>
<resource>src/main/resources/META-INF/spring/bundle-context-osgi.xml</resource>
<resource>src/main/resources/META-INF/spring/bundle-context.xml</resource>
Modified:
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/pom.xml
===================================================================
---
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 19:22:15 UTC (rev 26678)
@@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
- <version>${project.version}</version>
+ <version>${version}</version>
#set( $dollar = "$" )
#if( $symbolicName.equals($package) )
@@ -35,6 +35,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -51,6 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
@@ -108,7 +110,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>model-api</artifactId>
- <version>3.0.0-alpha4</version>
+ <version>[3.0.0-alpha6,4.0)</version>
</dependency>
<!-- Logging -->
@@ -119,19 +121,6 @@
<scope>provided</scope>
</dependency>
- <!-- dependencies specifically for unit testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.cytoscape</groupId>
- <artifactId>test-support</artifactId>
- <version>3.0.0-alpha2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
Deleted:
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleAnalyzerImplTest.java
===================================================================
---
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleAnalyzerImplTest.java
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/api-provider-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleAnalyzerImplTest.java
2011-09-01 19:22:15 UTC (rev 26678)
@@ -1,91 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-package ${package}.internal;
-
-import org.junit.Test;
-import org.junit.Before;
-import static org.junit.Assert.*;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyNode;
-
-import org.cytoscape.test.support.NetworkTestSupport;
-
-import ${package}.SampleAnalyzer;
-
-import java.util.Collection;
-
-/**
- * Unit test for SampleAnalyzerImpl.
- * <br/>
- * This unit test tests the implemention of the API directly
- * and we do this for simplicity here. However, if you have
- * an API that you expect others to implement, then you should
- * consider creating an abstract test class for the interface
- * that others can inherit from and use to test their implementation.
- * To do this, create an abstract test class where the constructor
- * takes an implemenation of the interface being tested as an
- * argument or in an abstract set method. Then create unit tests
- * assuming that the implementation has been provided. This
- * forces you to think critically about your API and whether it
- * provide all necessary functionality. Anyone implementing
- * your API will be able to inherit your test cases and be able
- * verify that their code meets YOUR expectations. See the
- * org.cytoscape.model-api bundle for an example of this approach.
- */
-public class SampleAnalyzerImplTest {
-
- CyNetwork network;
- NetworkTestSupport support;
- SampleAnalyzer analyzer;
-
- public SampleAnalyzerImplTest() {
- support = new NetworkTestSupport();
- }
-
-
- @Before
- public void setUp() {
- network = support.getNetwork();
- analyzer = new SampleAnalyzerImpl();
- }
-
- @Test
- public void testLowerBound() {
- Collection<CyNode> res = analyzer.analyzeNodes(network);
- assertNotNull( res );
- assertEquals("list size",0,res.size());
- }
-
- @Test
- public void testEven() {
- network.addNode();
- network.addNode();
- network.addNode();
- network.addNode();
-
- Collection<CyNode> res = analyzer.analyzeNodes(network);
- assertNotNull( res );
- assertEquals("list size",2,res.size());
- }
-
- @Test
- public void testOdd() {
- network.addNode();
- network.addNode();
- network.addNode();
- network.addNode();
- network.addNode();
-
- Collection<CyNode> res = analyzer.analyzeNodes(network);
- assertNotNull( res );
- assertEquals("list size",2,res.size());
- }
-
- @Test(expected=NullPointerException.class)
- public void testNull() {
- Collection<CyNode> res = analyzer.analyzeNodes(null);
- }
-
-}
Modified:
core3/support/trunk/archetypes/cyaction-plugin/src/main/resources/archetype-resources/pom.xml
===================================================================
---
core3/support/trunk/archetypes/cyaction-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/cyaction-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 19:22:15 UTC (rev 26678)
@@ -12,7 +12,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
- <version>${project.version}</version>
+ <version>${version}</version>
#set( $dollar = "$" )
#if( $symbolicName.equals($package) )
@@ -34,6 +34,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -49,6 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
@@ -106,12 +108,12 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>swing-application-api</artifactId>
- <version>3.0.0-alpha2</version>
+ <version>[3.0.0-alpha6,4.0)</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>session-api</artifactId>
- <version>3.0.0-alpha3</version>
+ <version>[3.0.0-alpha6,4.0)</version>
</dependency>
<!-- Logging -->
@@ -122,19 +124,6 @@
<scope>provided</scope>
</dependency>
- <!-- dependencies specifically for unit testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.cytoscape</groupId>
- <artifactId>test-support</artifactId>
- <version>3.0.0-alpha2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
Modified:
core3/support/trunk/archetypes/task-plugin/src/main/resources/META-INF/maven/archetype.xml
===================================================================
---
core3/support/trunk/archetypes/task-plugin/src/main/resources/META-INF/maven/archetype.xml
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/task-plugin/src/main/resources/META-INF/maven/archetype.xml
2011-09-01 19:22:15 UTC (rev 26678)
@@ -4,9 +4,6 @@
<source>src/main/java/internal/SampleTask.java</source>
<source>src/main/java/internal/SampleTaskFactory.java</source>
</sources>
- <testSources>
- <source>src/test/java/internal/SampleTaskTest.java</source>
- </testSources>
<resources>
<resource>osgi.bnd</resource>
<resource>src/main/resources/META-INF/spring/bundle-context.xml
Modified:
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/pom.xml
===================================================================
---
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/pom.xml
2011-09-01 19:22:15 UTC (rev 26678)
@@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
- <version>${project.version}</version>
+ <version>${version}</version>
#set( $dollar = "$" )
#if( $symbolicName.equals($package) )
@@ -36,6 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -52,6 +53,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
@@ -111,27 +113,14 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>model-api</artifactId>
- <version>3.0.0-alpha4</version>
+ <version>[3.0.0-alpha6,4.0)</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>core-task-api</artifactId>
- <version>3.0.0-alpha3</version>
+ <version>[3.0.0-alpha6,4.0)</version>
</dependency>
- <!-- dependencies specifically for unit testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.cytoscape</groupId>
- <artifactId>test-support</artifactId>
- <version>3.0.0-alpha2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
Modified:
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTask.java
===================================================================
---
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTask.java
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTask.java
2011-09-01 19:22:15 UTC (rev 26678)
@@ -68,10 +68,10 @@
if ( numNodesToSelect < 0 )
throw new IllegalArgumentException("The number of nodes
to select is less than 0");
- if ( numNodesToSelect > net.getNodeCount() )
+ if ( numNodesToSelect > network.getNodeCount() )
throw new IllegalArgumentException("The number of nodes
to select " +
"is greater than the
number of available nodes (" +
-
net.getNodeCount() + ")");
+
network.getNodeCount() + ")");
// Give the task a title.
taskMonitor.setTitle("Selecting " + numNodesToSelect + "
nodes.");
@@ -79,13 +79,13 @@
int alreadySelected = 0;
// Loop over all nodes in the network.
- for ( CyNode node : net.getNodeList() ) {
+ for ( CyNode node : network.getNodeList() ) {
- // cancelTask is inherited from AbstractTask and is
+ // cancelled is inherited from AbstractTask and is
// set when the cancel() method is called.
// Also consider calling a cleanup method to
// undo anyting already accomplished!
- if ( cancelTask )
+ if ( cancelled )
break;
// Pay attention to how many nodes we've already
@@ -96,7 +96,7 @@
// DO THE ACTUAL WORK!!!
// Set the selected attribute to true for the given
node.
- node.attrs().set("selected",true);
+ node.getCyRow().set("selected",true);
// Update the progress bar with the percent complete
Modified:
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTaskFactory.java
===================================================================
---
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTaskFactory.java
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/main/java/internal/SampleTaskFactory.java
2011-09-01 19:22:15 UTC (rev 26678)
@@ -3,7 +3,7 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.task.AbstractNetworkTaskFactory;
-import org.cytoscape.work.Task;
+import org.cytoscape.work.TaskIterator;
/**
* The TaskFactory is a Singleton object whose sole purpose is to
@@ -27,8 +27,8 @@
* method is <i>assumed</i> to have already called the setNetwork()
* method which will set the "net" variable.
*/
- public Task getTask() {
- return new SampleTask( net );
+ public TaskIterator getTaskIterator() {
+ return new TaskIterator( new SampleTask( network ) );
}
}
Deleted:
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleTaskTest.java
===================================================================
---
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleTaskTest.java
2011-09-01 18:36:18 UTC (rev 26677)
+++
core3/support/trunk/archetypes/task-plugin/src/main/resources/archetype-resources/src/test/java/internal/SampleTaskTest.java
2011-09-01 19:22:15 UTC (rev 26678)
@@ -1,91 +0,0 @@
-package ${package}.internal;
-
-import org.junit.Test;
-import org.junit.Before;
-import static org.junit.Assert.*;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyTableUtil;
-import org.cytoscape.work.TaskMonitor;
-
-import org.cytoscape.test.support.NetworkTestSupport;
-
-/**
- * Unit test for SampleTask
- */
-public class SampleTaskTest {
-
- SampleTask sampleTask;
- TaskMonitor taskMonitor;
- CyNetwork network;
- NetworkTestSupport support;
-
- public SampleTaskTest() {
- support = new NetworkTestSupport();
- }
-
-
- @Before
- public void setUp() {
- network = support.getNetwork();
-
- // normal setup
- network.addNode();
- network.addNode();
- network.addNode();
- network.addNode();
- network.addNode();
- sampleTask = new SampleTask(network);
- sampleTask.sleepTime = 10; // to speed things along!
- taskMonitor = new DummyTaskMonitor();
- }
-
- @Test
- public void testLowerBound() {
- checkSelectedNodes(0);
- }
-
- @Test
- public void testMiddle() {
- checkSelectedNodes(3);
- }
-
- @Test
- public void testUpperBound() {
- checkSelectedNodes(5);
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testLessThanZero() {
- checkSelectedNodes(-1);
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testGreaterThanNumNodes() {
- checkSelectedNodes(100);
- }
-
- private void checkSelectedNodes(final int x) {
- sampleTask.numNodesToSelect = x;
- sampleTask.run( taskMonitor );
- assertEquals("num selected nodes",x,
-
CyTableUtil.getNodesInState(network,"selected",true).size());
- }
-
- // Instead of writing your own dummy object, you could use a
- // mocking framework like JMock, EasyMock, or Mockito.
- private class DummyTaskMonitor implements TaskMonitor {
- public void setTitle(String title) {
- assertNotNull(title);
- assertTrue(title.length()>0);
- }
- public void setProgress(double progress) {
- assertTrue(progress >= 0.0d);
- assertTrue(progress <= 1.0d);
- }
- public void setStatusMessage(String statusMessage) {
- assertNotNull(statusMessage);
- assertTrue(statusMessage.length()>0);
- }
- }
-}
--
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.