You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ge...@apache.org on 2009/06/16 13:58:10 UTC

svn commit: r785170 - in /felix/trunk/karaf: ./ gshell/gshell-admin/ tooling/features-maven-plugin/ tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/

Author: gertv
Date: Tue Jun 16 11:58:10 2009
New Revision: 785170

URL: http://svn.apache.org/viewvc?rev=785170&view=rev
Log:
Update to felix-parent 1.2.0 and use EasyMock instead of JMock

Modified:
    felix/trunk/karaf/gshell/gshell-admin/pom.xml
    felix/trunk/karaf/pom.xml
    felix/trunk/karaf/tooling/features-maven-plugin/pom.xml
    felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java
    felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java

Modified: felix/trunk/karaf/gshell/gshell-admin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-admin/pom.xml?rev=785170&r1=785169&r2=785170&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-admin/pom.xml (original)
+++ felix/trunk/karaf/gshell/gshell-admin/pom.xml Tue Jun 16 11:58:10 2009
@@ -173,6 +173,16 @@
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                  <excludes>
+                    <!-- this is not a unit test but an application used for testing -->
+                    <exclude>**/MainTest.java</exclude>
+                  </excludes>
+                </configuration>
+           </plugin>
         </plugins>
     </build>
 </project>

Modified: felix/trunk/karaf/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/pom.xml?rev=785170&r1=785169&r2=785170&view=diff
==============================================================================
--- felix/trunk/karaf/pom.xml (original)
+++ felix/trunk/karaf/pom.xml Tue Jun 16 11:58:10 2009
@@ -23,8 +23,8 @@
 
     <parent>
         <groupId>org.apache.felix</groupId>
-        <artifactId>felix</artifactId>
-        <version>1.0.4</version>
+        <artifactId>felix-parent</artifactId>
+        <version>1.2.0</version>
     </parent>
 
     <groupId>org.apache.felix.karaf</groupId>

Modified: felix/trunk/karaf/tooling/features-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/features-maven-plugin/pom.xml?rev=785170&r1=785169&r2=785170&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/features-maven-plugin/pom.xml (original)
+++ felix/trunk/karaf/tooling/features-maven-plugin/pom.xml Tue Jun 16 11:58:10 2009
@@ -48,9 +48,8 @@
         <artifactId>maven-bundle-plugin</artifactId>
       </dependency>
       <dependency>
-        <groupId>org.jmock</groupId>
-        <artifactId>jmock</artifactId>
-        <version>2.5.0</version>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymock</artifactId>
         <scope>test</scope>
       </dependency>
     </dependencies>

Modified: felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java?rev=785170&r1=785169&r2=785170&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java (original)
+++ felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java Tue Jun 16 11:58:10 2009
@@ -17,6 +17,9 @@
  */
 package org.apache.felix.karaf.tooling.features;
 
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -26,57 +29,50 @@
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
+import org.easymock.EasyMock;
 
 /**
  * Test cases for {@link GenerateFeaturesFileMojo} 
  */
 public class GenerateFeaturesFileMojoTest extends TestCase {
     
-    private Mockery mockery;
     private GenerateFeaturesFileMojo mojo;
     
     @Override
     protected void setUp() throws Exception {
         super.setUp();
         mojo = new GenerateFeaturesFileMojo();
-        mockery = new Mockery();
     }
     
     public void testGetBestVersionForArtifactWithOneVersion() throws Exception {       
-        final Artifact artifact = mockery.mock(Artifact.class);
-        mockery.checking(new Expectations() {{
-            allowing(artifact).getVersion(); will(returnValue("2.1.6"));
-        }});
+        final Artifact artifact = EasyMock.createMock(Artifact.class);
+        expect(artifact.getVersion()).andReturn("2.1.6");
+        replay(artifact);
 
         assertEquals("2.1.6_1-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("2.1.6_1-SNAPSHOT")));
     }
     
     public void testGetBestVersionForArtifactWithTwoVersions() throws Exception {       
-        final Artifact artifact = mockery.mock(Artifact.class);
-        mockery.checking(new Expectations() {{
-            allowing(artifact).getVersion(); will(returnValue("2.1.6"));
-        }});
+        final Artifact artifact = EasyMock.createMock(Artifact.class);
+        expect(artifact.getVersion()).andReturn("2.1.6");
+        replay(artifact);
 
         assertEquals("2.1.6_2-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("2.1.6_1-SNAPSHOT", "2.1.6_2-SNAPSHOT")));
     }
     
     public void testGetBestVersionForArtifactWithSameMajorMinor() throws Exception {       
-        final Artifact artifact = mockery.mock(Artifact.class);
-        mockery.checking(new Expectations() {{
-            allowing(artifact).getVersion(); will(returnValue("3.8.2"));
-        }});
+        final Artifact artifact = EasyMock.createMock(Artifact.class);
+        expect(artifact.getVersion()).andReturn("3.8.2").anyTimes();
+        replay(artifact);        
 
         assertEquals("3.8.1_1-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("3.8.1_1-SNAPSHOT")));
     }
 
     
     public void testGetBestVersionForArtifactWithOneNonMatchingVersion() throws Exception {
-        final Artifact artifact = mockery.mock(Artifact.class);
-        mockery.checking(new Expectations() {{
-            allowing(artifact).getVersion(); will(returnValue("9.1.0.1"));
-        }});
+        final Artifact artifact = EasyMock.createMock(Artifact.class);
+        expect(artifact.getVersion()).andReturn("9.1.0.1").anyTimes();
+        replay(artifact);        
         
         try {
             mojo.getBestVersionForArtifact(artifact, createVersionList("9.0_1-SNAPSHOT"));
@@ -88,7 +84,7 @@
     
     public void testGetBestVersionForArtifactWithNoVersions() throws Exception {
         try {
-            mojo.getBestVersionForArtifact(mockery.mock(Artifact.class), createVersionList());
+            mojo.getBestVersionForArtifact(EasyMock.createMock(Artifact.class), createVersionList());
             fail("ArtifactMetadataRetrievalException should have been thrown if no matching version was found");
         } catch (ArtifactMetadataRetrievalException e) {
             // this is expected

Modified: felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java?rev=785170&r1=785169&r2=785170&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java (original)
+++ felix/trunk/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java Tue Jun 16 11:58:10 2009
@@ -17,8 +17,9 @@
 package org.apache.felix.karaf.tooling.features;
 
 import org.apache.maven.artifact.Artifact;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
+import org.easymock.EasyMock;
+
+import static org.easymock.EasyMock.*;
 
 import junit.framework.TestCase;
 
@@ -27,22 +28,16 @@
  */
 public class GenerateFeaturesXmlMojoTest extends TestCase {
     
-    private Mockery mockery;
-    
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mockery = new Mockery();
-    }
-    
     public void testToString() throws Exception {
-        final Artifact artifact = mockery.mock(Artifact.class);
-        mockery.checking(new Expectations() {{
-            allowing(artifact).getGroupId(); will(returnValue("org.apache.servicemix.test"));
-            allowing(artifact).getArtifactId(); will(returnValue("test-artifact"));
-            allowing(artifact).getVersion(); will(returnValue("1.2.3"));
-        }});
-        assertEquals("org.apache.servicemix.test/test-artifact/1.2.3", GenerateFeaturesXmlMojo.toString(artifact));
+        Artifact artifact = EasyMock.createMock(Artifact.class);
+
+        expect(artifact.getGroupId()).andReturn("org.apache.felix.karaf.test");
+        expect(artifact.getArtifactId()).andReturn("test-artifact");
+        expect(artifact.getVersion()).andReturn("1.2.3");
+        
+        replay(artifact);
+        
+        assertEquals("org.apache.felix.karaf.test/test-artifact/1.2.3", GenerateFeaturesXmlMojo.toString(artifact));
     }
 
 }