incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1154346 - in /sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands: BootstrapCommandFileTest.java UninstallBundleCommandTest.java
Date Fri, 05 Aug 2011 18:42:57 GMT
Author: justin
Date: Fri Aug  5 18:42:57 2011
New Revision: 1154346

URL: http://svn.apache.org/viewvc?rev=1154346&view=rev
Log:
SLING-2168 - fixing unit tests broken by r1153861

Modified:
    sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/BootstrapCommandFileTest.java
    sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/UninstallBundleCommandTest.java

Modified: sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/BootstrapCommandFileTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/BootstrapCommandFileTest.java?rev=1154346&r1=1154345&r2=1154346&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/BootstrapCommandFileTest.java
(original)
+++ sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/BootstrapCommandFileTest.java
Fri Aug  5 18:42:57 2011
@@ -18,16 +18,14 @@
  */
 package org.apache.sling.launchpad.base.impl.bootstrapcommands;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Hashtable;
 import java.util.List;
 
 import org.apache.felix.framework.Logger;
@@ -64,6 +62,8 @@ public class BootstrapCommandFileTest {
             allowing(b1).getVersion();
             will(returnValue(new Version("1.0.0")));
             allowing(b1).uninstall();
+            allowing(b1).getHeaders();
+            will(returnValue(new Hashtable()));
         }});
         final Bundle [] bundles = { b1 };
 
@@ -104,7 +104,7 @@ public class BootstrapCommandFileTest {
         final BootstrapCommandFile bcf = new BootstrapCommandFile(logger, cmdFile);
         assertTrue("Expecting anythingToExecute true for existing file",
                 bcf.anythingToExecute(bundleContext));
-        assertEquals("Expecting two commands to be executed", 2, bcf.execute(bundleContext));
+        assertEquals("Expecting no need to restart", false, bcf.execute(bundleContext));
         assertFalse("Expecting anythingToExecute false after execution",
                 bcf.anythingToExecute(bundleContext));
     }
@@ -138,13 +138,16 @@ public class BootstrapCommandFileTest {
             + "\n"
             + "# another comment\n"
             + "uninstall symbolicname1 1.0\n"
+            + "\n"
+            + "# another comment\n"
+            + "uninstall symbolicname1 1.0 fail\n"
             ;
         try {
             bcf.parse(new ByteArrayInputStream(cmdString.getBytes()));
             fail("Expecting IOException for syntax error");
         } catch(IOException ioe) {
             assertTrue("Exception message (" + ioe.getMessage() + ") should contain command
line",
-                    ioe.getMessage().contains("only_one_field"));
+                    ioe.getMessage().contains("fail"));
         }
     }
 

Modified: sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/UninstallBundleCommandTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/UninstallBundleCommandTest.java?rev=1154346&r1=1154345&r2=1154346&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/UninstallBundleCommandTest.java
(original)
+++ sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands/UninstallBundleCommandTest.java
Fri Aug  5 18:42:57 2011
@@ -20,6 +20,8 @@ package org.apache.sling.launchpad.base.
 
 import static org.junit.Assert.assertNotNull;
 
+import java.util.Hashtable;
+
 import org.apache.felix.framework.Logger;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
@@ -53,6 +55,8 @@ public class UninstallBundleCommandTest 
             allowing(b[0]).getVersion();
             will(returnValue(new Version("1.0.0")));
             exactly(1).of(b[0]).uninstall();
+            allowing(b[0]).getHeaders();
+            will(returnValue(new Hashtable()));
         }});
 
         // b1 is not in version range, not uninstalled
@@ -61,6 +65,8 @@ public class UninstallBundleCommandTest 
             will(returnValue("testbundle"));
             allowing(b[1]).getVersion();
             will(returnValue(new Version("2.0.0")));
+            allowing(b[1]).getHeaders();
+            will(returnValue(new Hashtable()));
         }});
 
         // b2 has different symbolic name, not uninstalled
@@ -69,6 +75,8 @@ public class UninstallBundleCommandTest 
             will(returnValue("otherbundle"));
             allowing(b[2]).getVersion();
             will(returnValue(new Version("1.0.0")));
+            allowing(b[2]).getHeaders();
+            will(returnValue(new Hashtable()));
         }});
 
         bundleContext = mockery.mock(BundleContext.class);



Mime
View raw message