Update to felix-parent 1.2.0 and use EasyMock instead of JMock

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@785170 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/gshell/gshell-admin/pom.xml b/karaf/gshell/gshell-admin/pom.xml
index 644ea1e..a4cb533 100644
--- a/karaf/gshell/gshell-admin/pom.xml
+++ b/karaf/gshell/gshell-admin/pom.xml
@@ -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>
diff --git a/karaf/pom.xml b/karaf/pom.xml
index 2785962..c872ffa 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -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>
diff --git a/karaf/tooling/features-maven-plugin/pom.xml b/karaf/tooling/features-maven-plugin/pom.xml
index b78e43e..9e500b3 100644
--- a/karaf/tooling/features-maven-plugin/pom.xml
+++ b/karaf/tooling/features-maven-plugin/pom.xml
@@ -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>
diff --git a/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java b/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java
index 5b0517a..4f8c499 100644
--- a/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java
+++ b/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesFileMojoTest.java
@@ -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
diff --git a/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java b/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java
index cd96711..dff00cf 100644
--- a/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java
+++ b/karaf/tooling/features-maven-plugin/src/test/java/org/apache/felix/karaf/tooling/features/GenerateFeaturesXmlMojoTest.java
@@ -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));
     }
 
 }