Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2015-06-02 08:50:47 -0400
committerFlorian Waibel2015-06-02 17:07:11 -0400
commitc88bf1cf41c70d3a42449d340125a2c776161546 (patch)
tree5f4b4413ed795bf7330b0f8ee1bec46ede104f43 /org.eclipse.virgo.shell.command
parent8b8f30fd6e32ae62a3bccdadac9ea35badae25a6 (diff)
downloadorg.eclipse.virgo.kernel-c88bf1cf41c70d3a42449d340125a2c776161546.tar.gz
org.eclipse.virgo.kernel-c88bf1cf41c70d3a42449d340125a2c776161546.tar.xz
org.eclipse.virgo.kernel-c88bf1cf41c70d3a42449d340125a2c776161546.zip
Replaces code using default encoding with code using explicitly UTF-8
Diffstat (limited to 'org.eclipse.virgo.shell.command')
-rwxr-xr-xorg.eclipse.virgo.shell.command/src/test/java/org/eclipse/virgo/shell/osgicommand/internal/GogoClassLoadingCommandTests.java207
1 files changed, 90 insertions, 117 deletions
diff --git a/org.eclipse.virgo.shell.command/src/test/java/org/eclipse/virgo/shell/osgicommand/internal/GogoClassLoadingCommandTests.java b/org.eclipse.virgo.shell.command/src/test/java/org/eclipse/virgo/shell/osgicommand/internal/GogoClassLoadingCommandTests.java
index 23aa3006..fec7c2b6 100755
--- a/org.eclipse.virgo.shell.command/src/test/java/org/eclipse/virgo/shell/osgicommand/internal/GogoClassLoadingCommandTests.java
+++ b/org.eclipse.virgo.shell.command/src/test/java/org/eclipse/virgo/shell/osgicommand/internal/GogoClassLoadingCommandTests.java
@@ -8,13 +8,27 @@
* Contributors:
* Hristo Iliev, SAP AG - initial contribution
******************************************************************************/
+
package org.eclipse.virgo.shell.osgicommand.internal;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.util.Enumeration;
+
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.virgo.shell.osgicommand.internal.GogoClassLoadingCommand;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -23,15 +37,6 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.net.URL;
-import java.util.Enumeration;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
/**
* Unit tests for class loading commands
*/
@@ -39,32 +44,39 @@ import static org.junit.Assert.assertTrue;
public class GogoClassLoadingCommandTests {
private static final long BUNDLE_ID = 1234;
+
private static final String BUNDLE_SYMBOLIC_NAME = "test";
private static final String CLASS_NAME = GogoClassLoadingCommandTests.class.getName();
+
private static final String CLASS_PACKAGE = GogoClassLoadingCommandTests.class.getPackage().getName();
private static final String SHORT_CLASS_NAME = CLASS_NAME.substring(CLASS_NAME.lastIndexOf(".") + 1) + ".class";
+
private static final String CLASS_NAME_PATH = CLASS_NAME.replace(".", "/") + ".class";
+
private static final String CLASS_PACKAGE_PATH = CLASS_PACKAGE.replace(".", "/");
+
private ByteArrayOutputStream baos;
+
private PrintStream oldOut;
+
private PrintStream output;
-
+
@Before
- public void before() {
+ public void before() throws UnsupportedEncodingException {
this.oldOut = System.out;
this.baos = new ByteArrayOutputStream();
- this.output = new PrintStream(baos);
+ this.output = new PrintStream(baos, true, UTF_8.name());
System.setOut(this.output);
}
-
+
private String getOutput() {
this.output.flush();
- String output = new String(baos.toByteArray());
+ String output = new String(baos.toByteArray(), UTF_8);
return output;
}
-
+
@After
public void after() {
System.setOut(this.oldOut);
@@ -80,7 +92,7 @@ public class GogoClassLoadingCommandTests {
expect(bundle.findEntries("/", CLASS_NAME_PATH, true)).andReturn(null); // class not found in root
expect(bundle.getBundleId()).andReturn(BUNDLE_ID);
expect(bundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
replay(bundle, bundleContext);
@@ -88,17 +100,15 @@ public class GogoClassLoadingCommandTests {
command.clhas(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME_PATH));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME_PATH));
assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE_PATH + "]",
- output.contains("" + CLASS_PACKAGE_PATH));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ output.contains("" + CLASS_PACKAGE_PATH));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
-
+
}
@Test
@@ -108,7 +118,7 @@ public class GogoClassLoadingCommandTests {
expect(bundle.findEntries("/", SHORT_CLASS_NAME, true)).andReturn(null); // class does not exist
expect(bundle.findEntries("/", CLASS_NAME_PATH, true)).andReturn(null); // class does not exist
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
replay(bundle, bundleContext);
@@ -116,14 +126,11 @@ public class GogoClassLoadingCommandTests {
command.clhas(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME_PATH));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE_PATH));
- assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME_PATH));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE_PATH));
+ assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertFalse("Command output [" + output + "] contains bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
}
@@ -134,10 +141,10 @@ public class GogoClassLoadingCommandTests {
Bundle bundle = createMock(Bundle.class);
BundleContext bundleContext = createMock(BundleContext.class);
- expect((Class)bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
+ expect((Class) bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
expect(bundle.getBundleId()).andReturn(BUNDLE_ID);
expect(bundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
expect(bundleContext.getBundle(0)).andReturn(bundle); // system bundle is also our mockup
replay(bundle, bundleContext);
@@ -146,14 +153,11 @@ public class GogoClassLoadingCommandTests {
command.clload(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
}
@@ -164,7 +168,7 @@ public class GogoClassLoadingCommandTests {
BundleContext bundleContext = createMock(BundleContext.class);
expect(bundle.loadClass(CLASS_NAME)).andReturn(null);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
replay(bundle, bundleContext);
@@ -172,14 +176,11 @@ public class GogoClassLoadingCommandTests {
command.clload(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertFalse("Command output [" + output + "] contains bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
}
@@ -192,13 +193,13 @@ public class GogoClassLoadingCommandTests {
PackageAdmin packageAdmin = createMock(PackageAdmin.class);
ServiceReference packageAdminServiceReference = createMock(ServiceReference.class);
- expect((Class)bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
+ expect((Class) bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
expect(bundle.getBundleId()).andReturn(BUNDLE_ID);
expect(bundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME);
expect(bundleContext.getBundle(0)).andReturn(bundle); // system bundle is also our mockup
expect(bundleContext.getServiceReference(PackageAdmin.class)).andReturn(packageAdminServiceReference);
expect(bundleContext.getService(packageAdminServiceReference)).andReturn(packageAdmin);
- expect(packageAdmin.getBundles(BUNDLE_SYMBOLIC_NAME, null)).andReturn(new Bundle[]{bundle});
+ expect(packageAdmin.getBundles(BUNDLE_SYMBOLIC_NAME, null)).andReturn(new Bundle[] { bundle });
replay(bundle, bundleContext, packageAdmin, packageAdminServiceReference);
@@ -206,14 +207,11 @@ public class GogoClassLoadingCommandTests {
command.clload(CLASS_NAME, BUNDLE_SYMBOLIC_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext, packageAdmin, packageAdminServiceReference);
}
@@ -224,7 +222,7 @@ public class GogoClassLoadingCommandTests {
Bundle bundle = createMock(Bundle.class);
BundleContext bundleContext = createMock(BundleContext.class);
- expect((Class)bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
+ expect((Class) bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
expect(bundle.getBundleId()).andReturn(BUNDLE_ID);
expect(bundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME);
expect(bundleContext.getBundle(0)).andReturn(bundle); // system bundle is also our mockup
@@ -236,14 +234,11 @@ public class GogoClassLoadingCommandTests {
command.clload(CLASS_NAME, BUNDLE_ID);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
}
@@ -262,14 +257,11 @@ public class GogoClassLoadingCommandTests {
command.clload(CLASS_NAME, BUNDLE_ID);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertFalse("Command output [" + output + "] contains bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
verify(bundle, bundleContext);
}
@@ -287,29 +279,24 @@ public class GogoClassLoadingCommandTests {
expect(bundle.getBundleId()).andReturn(BUNDLE_ID);
expect(bundleContext.getServiceReference(PlatformAdmin.class)).andReturn(platformAdminServiceReference);
expect(bundleContext.getService(platformAdminServiceReference)).andReturn(platformAdmin);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
- expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[]{}); // nothing exported
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
+ expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[] {}); // nothing exported
expect(platformAdmin.getState(false)).andReturn(bundleState);
expect(bundleState.getBundle(BUNDLE_ID)).andReturn(bundleDescription);
- replay(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription);
+ replay(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription);
GogoClassLoadingCommand command = new GogoClassLoadingCommand(bundleContext);
command.clexport(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertFalse("Command output [" + output + "] contains bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertFalse("Command output [" + output + "] contains bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
- verify(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription);
+ verify(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -325,35 +312,28 @@ public class GogoClassLoadingCommandTests {
expect(bundle.getBundleId()).andReturn(BUNDLE_ID).times(2);
expect(bundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME);
- expect((Class)bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
+ expect((Class) bundle.loadClass(CLASS_NAME)).andReturn(GogoClassLoadingCommandTests.class);
expect(bundleContext.getServiceReference(PlatformAdmin.class)).andReturn(platformAdminServiceReference);
expect(bundleContext.getService(platformAdminServiceReference)).andReturn(platformAdmin);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
expect(exportPackageDescription.getName()).andReturn(CLASS_PACKAGE);
- expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[]{exportPackageDescription});
+ expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[] { exportPackageDescription });
expect(platformAdmin.getState(false)).andReturn(bundleState);
expect(bundleState.getBundle(BUNDLE_ID)).andReturn(bundleDescription);
- replay(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription,
- exportPackageDescription);
+ replay(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription, exportPackageDescription);
GogoClassLoadingCommand command = new GogoClassLoadingCommand(bundleContext);
command.clexport(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
- verify(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription,
- exportPackageDescription);
+ verify(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription, exportPackageDescription);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -372,32 +352,25 @@ public class GogoClassLoadingCommandTests {
expect(bundle.loadClass(CLASS_NAME)).andReturn(null); // class cannot be loaded
expect(bundleContext.getServiceReference(PlatformAdmin.class)).andReturn(platformAdminServiceReference);
expect(bundleContext.getService(platformAdminServiceReference)).andReturn(platformAdmin);
- expect(bundleContext.getBundles()).andReturn(new Bundle[]{bundle});
+ expect(bundleContext.getBundles()).andReturn(new Bundle[] { bundle });
expect(exportPackageDescription.getName()).andReturn(CLASS_PACKAGE);
- expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[]{exportPackageDescription});
+ expect(bundleDescription.getSelectedExports()).andReturn(new ExportPackageDescription[] { exportPackageDescription });
expect(platformAdmin.getState(false)).andReturn(bundleState);
expect(bundleState.getBundle(BUNDLE_ID)).andReturn(bundleDescription);
- replay(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription,
- exportPackageDescription);
+ replay(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription, exportPackageDescription);
GogoClassLoadingCommand command = new GogoClassLoadingCommand(bundleContext);
command.clexport(CLASS_NAME);
String output = getOutput();
- assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]",
- output.contains("" + CLASS_NAME));
- assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]",
- output.contains("" + CLASS_PACKAGE));
- assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]",
- output.contains("" + BUNDLE_ID));
+ assertTrue("Command output [" + output + "] does not contain class name [" + CLASS_NAME + "]", output.contains("" + CLASS_NAME));
+ assertTrue("Command output [" + output + "] does not contain class package [" + CLASS_PACKAGE + "]", output.contains("" + CLASS_PACKAGE));
+ assertTrue("Command output [" + output + "] does not contain bundle ID [" + BUNDLE_ID + "]", output.contains("" + BUNDLE_ID));
assertTrue("Command output [" + output + "] does not contain bundle symbolic name [" + BUNDLE_SYMBOLIC_NAME + "]",
- output.contains(BUNDLE_SYMBOLIC_NAME));
+ output.contains(BUNDLE_SYMBOLIC_NAME));
- verify(platformAdmin, platformAdminServiceReference,
- bundle, bundleContext, bundleState, bundleDescription,
- exportPackageDescription);
+ verify(platformAdmin, platformAdminServiceReference, bundle, bundleContext, bundleState, bundleDescription, exportPackageDescription);
}
}

Back to the top