You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2011/08/08 13:26:32 UTC
svn commit: r1154921 - in
/sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/base/impl/bootstrapcommands:
BootstrapCommandFileTest.java UninstallBundleCommandTest.java
Author: cziegeler
Date: Mon Aug 8 11:26:32 2011
New Revision: 1154921
URL: http://svn.apache.org/viewvc?rev=1154921&view=rev
Log:
Commit missing changes in test cases
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=1154921&r1=1154920&r2=1154921&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 Mon Aug 8 11:26:32 2011
@@ -18,7 +18,10 @@
*/
package org.apache.sling.launchpad.base.impl.bootstrapcommands;
-import static org.junit.Assert.*;
+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 java.io.ByteArrayInputStream;
import java.io.File;
@@ -59,11 +62,11 @@ public class BootstrapCommandFileTest {
mockery.checking(new Expectations() {{
allowing(b1).getSymbolicName();
will(returnValue("somebundle"));
+ allowing(b1).getHeaders();
+ will(returnValue(new Hashtable<String, String>()));
allowing(b1).getVersion();
will(returnValue(new Version("1.0.0")));
allowing(b1).uninstall();
- allowing(b1).getHeaders();
- will(returnValue(new Hashtable()));
}});
final Bundle [] bundles = { b1 };
@@ -74,6 +77,8 @@ public class BootstrapCommandFileTest {
will(returnValue(dataFile));
allowing(bundleContext).getBundles();
will(returnValue(bundles));
+ allowing(bundleContext).getServiceReference(with(any(String.class)));
+ will(returnValue(null));
}});
cmdFile = File.createTempFile(getClass().getSimpleName(), "cmd");
@@ -104,7 +109,7 @@ public class BootstrapCommandFileTest {
final BootstrapCommandFile bcf = new BootstrapCommandFile(logger, cmdFile);
assertTrue("Expecting anythingToExecute true for existing file",
bcf.anythingToExecute(bundleContext));
- assertEquals("Expecting no need to restart", false, bcf.execute(bundleContext));
+ assertEquals("Expecting two commands to be executed", false, bcf.execute(bundleContext));
assertFalse("Expecting anythingToExecute false after execution",
bcf.anythingToExecute(bundleContext));
}
@@ -140,14 +145,14 @@ public class BootstrapCommandFileTest {
+ "uninstall symbolicname1 1.0\n"
+ "\n"
+ "# another comment\n"
- + "uninstall symbolicname1 1.0 fail\n"
+ + "uninstall three args 1.0\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("fail"));
+ ioe.getMessage().contains("three args"));
}
}
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=1154921&r1=1154920&r2=1154921&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 Mon Aug 8 11:26:32 2011
@@ -52,31 +52,31 @@ public class UninstallBundleCommandTest
mockery.checking(new Expectations() {{
allowing(b[0]).getSymbolicName();
will(returnValue("testbundle"));
+ allowing(b[0]).getHeaders();
+ will(returnValue(new Hashtable<String, String>()));
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
mockery.checking(new Expectations() {{
allowing(b[1]).getSymbolicName();
will(returnValue("testbundle"));
+ allowing(b[1]).getHeaders();
+ will(returnValue(new Hashtable<String, String>()));
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
mockery.checking(new Expectations() {{
allowing(b[2]).getSymbolicName();
will(returnValue("otherbundle"));
+ allowing(b[2]).getHeaders();
+ will(returnValue(new Hashtable<String, String>()));
allowing(b[2]).getVersion();
will(returnValue(new Version("1.0.0")));
- allowing(b[2]).getHeaders();
- will(returnValue(new Hashtable()));
}});
bundleContext = mockery.mock(BundleContext.class);