Skip to content

Commit

Permalink
Format java files in o.e.osgi.tests
Browse files Browse the repository at this point in the history
This was achieved by running:
eclipse -consolelog -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter \
  -config .settings/org.eclipse.jdt.core.prefs . -data `mktemp -d`

Signed-off-by: Torbjörn SVENSSON <[email protected]>
  • Loading branch information
Torbjorn-Svensson committed Oct 1, 2023
1 parent 32d4ed7 commit 2c84aca
Show file tree
Hide file tree
Showing 156 changed files with 5,043 additions and 3,143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

import chain.test.b.BChain;

public class AChain extends BChain{
public class AChain extends BChain {

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*******************************************************************************/
package chain.test.a;


public interface AMultiChain2 {
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*******************************************************************************/
package chain.test.b;


public interface BMultiChain1 {
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
import chain.test.c.CMultipleChain2;
import chain.test.d.DMultipleChain1;

public interface BMultiChain2 extends CMultipleChain2, DMultipleChain1{
public interface BMultiChain2 extends CMultipleChain2, DMultipleChain1 {
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ public void addHooks(HookRegistry hookRegistry) {
hookRegistry.addClassLoaderHook(new ClassLoaderHook() {

@Override
public boolean rejectTransformation(String name, byte[] transformedBytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) {
public boolean rejectTransformation(String name, byte[] transformedBytes, ClasspathEntry classpathEntry,
BundleEntry entry, ClasspathManager manager) {
return Boolean.getBoolean(REJECT_PROP);
}

@Override
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) {
public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry,
ClasspathManager manager) {
if (Boolean.getBoolean(BAD_TRANSFORM_PROP)) {
return new byte[] {'b', 'a', 'd', 'b', 'y', 't', 'e', 's'};
return new byte[] { 'b', 'a', 'd', 'b', 'y', 't', 'e', 's' };
}
if (Boolean.getBoolean(RECURSION_LOAD)) {
if (isProcessClassRecursionSupported() && doingRecursionLoad.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package exporter.importer;

import exporter.importer.test.Test3;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class Activator implements BundleActivator {

public void start(BundleContext context) throws Exception {
AbstractBundleTests.simpleResults.addEvent(new ExtClasspathExtTest().toString());
AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/extclasspath/a/extresource.txt"))); //$NON-NLS-1$
AbstractBundleTests.simpleResults
.addEvent(getURLContent(this.getClass().getResource("/ext/extclasspath/a/extresource.txt"))); //$NON-NLS-1$
}

private String getURLContent(URL resource) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class Activator implements BundleActivator {

public void start(BundleContext context) throws Exception {
AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$
AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$
AbstractBundleTests.simpleResults
.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$
ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class Activator implements BundleActivator {

public void start(BundleContext context) throws Exception {
AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$
AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$
AbstractBundleTests.simpleResults
.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$
ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private TestCondition(String id, boolean mutable, boolean postponed, boolean sat

static public Condition getCondition(final Bundle bundle, ConditionInfo info) {
if (!TestCondition.class.getName().equals(info.getType()))
throw new IllegalArgumentException("ConditionInfo must be of type \"" + TestCondition.class.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
throw new IllegalArgumentException(
"ConditionInfo must be of type \"" + TestCondition.class.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
String[] args = info.getArgs();
if (args.length != 4)
throw new IllegalArgumentException("Illegal number of args: " + args.length); //$NON-NLS-1$
Expand Down Expand Up @@ -109,7 +110,9 @@ public boolean equals(Object o) {
if (!(o instanceof TestCondition))
return false;
TestCondition otherCondition = (TestCondition) o;
return id.equals(otherCondition.id) && postponed == otherCondition.postponed && satisfied == otherCondition.satisfied && mutable == otherCondition.mutable && bundle == otherCondition.bundle;
return id.equals(otherCondition.id) && postponed == otherCondition.postponed
&& satisfied == otherCondition.satisfied && mutable == otherCondition.mutable
&& bundle == otherCondition.bundle;
}

public void setMutable(boolean mutable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import org.eclipse.osgi.tests.bundles.ITestRunner;

public class TestPackageAccess implements ITestRunner{
public class TestPackageAccess implements ITestRunner {

@Override
public Object testIt() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*******************************************************************************/
package fragment.test.attach.frag.b;


public class Test {

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void start(BundleContext context) throws Exception {
try {
new URL(url.getProtocol(), url.getHost(), url.getFile());
} catch (MalformedURLException e2) {
// unexpected; the handler does not get involved and we have a multiplexor cached
// unexpected; the handler does not get involved and we have a multiplexor
// cached
throw new RuntimeException("Could not create URL from parts: " + url);
}
url.toExternalForm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.eclipse.osgi.tests.bundles.ITestRunner;
import legacy.lazystart.c.CTest;

public class FalseExceptionLegacy2 implements ITestRunner {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.osgi.tests.bundles.ITestRunner;
import legacy.lazystart.b.excluded.a.BAExcluded;
import legacy.lazystart.b.excluded.b.BBExcluded;

public class TrueExceptionLegacy1 implements ITestRunner {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile1.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile1.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile2.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile2.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception {
Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary",
String.class);
findLibrary.setAccessible(true);
AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"}));
AbstractBundleTests.simpleResults
.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" }));
}

public void stop(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.osgi.tests.bundles.ITestRunner;
import osgi.lazystart.b.excluded.a.BAExcluded;
import osgi.lazystart.b.excluded.b.BBExcluded;

public class LazyExclude1 implements ITestRunner {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.eclipse.osgi.tests.bundles.ITestRunner;
import osgi.lazystart.c.CTest;

public class LazyInclude2 implements ITestRunner {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void start(BundleContext context) throws Exception {
}

public void stop(BundleContext context) throws Exception {
//nothing
// nothing
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class Activator implements BundleActivator {

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
this.bc = context;
Expand All @@ -33,7 +35,9 @@ public void start(BundleContext context) throws Exception {

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
import org.osgi.framework.namespace.IdentityNamespace;

public class TestHookConfigurator implements HookConfigurator {
private static class TestStorageHookFactory extends StorageHookFactory<Object, Object, TestStorageHookFactory.TestStorageHook> {
private static class TestStorageHookFactory
extends StorageHookFactory<Object, Object, TestStorageHookFactory.TestStorageHook> {
private static class TestStorageHook extends StorageHookFactory.StorageHook<Object, Object> {
private static AtomicInteger adaptCount = new AtomicInteger(1);

Expand Down Expand Up @@ -83,24 +84,28 @@ public void deletingGeneration() {
}

@Override
public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) {
public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin,
ModuleRevisionBuilder builder) {
if (TestHookConfigurator.replaceModuleBuilder) {
ModuleRevisionBuilder replace = new ModuleRevisionBuilder();
// try setting the ID to something which is checked during the test
replace.setId(5678);
replace.setSymbolicName("replace");
replace.setVersion(Version.parseVersion("1.1.1"));
replace.addCapability("replace", Collections.emptyMap(), Collections.emptyMap());
replace.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, Collections.emptyMap(), Collections.singletonMap(IdentityNamespace.IDENTITY_NAMESPACE, "replace"));
replace.addCapability(BundleNamespace.BUNDLE_NAMESPACE, Collections.emptyMap(), Collections.singletonMap(BundleNamespace.BUNDLE_NAMESPACE, "replace"));
replace.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, Collections.emptyMap(),
Collections.singletonMap(IdentityNamespace.IDENTITY_NAMESPACE, "replace"));
replace.addCapability(BundleNamespace.BUNDLE_NAMESPACE, Collections.emptyMap(),
Collections.singletonMap(BundleNamespace.BUNDLE_NAMESPACE, "replace"));
return replace;
}
if (TestHookConfigurator.adaptManifest) {
// try setting the ID to something which is checked during the test
builder.setId(5678);
Map<String, String> dirs = Collections.emptyMap();
Map<String, Object> attrs = new HashMap<>();
attrs.put("test.file.path", getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement());
attrs.put("test.file.path",
getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement());
attrs.put("test.operation", operation.toString());
attrs.put("test.origin", origin.getLocation());
builder.addCapability("test.file.path", dirs, attrs);
Expand Down Expand Up @@ -136,7 +141,8 @@ protected TestStorageHook createStorageHook(Generation generation) {
}

@Override
public URLConnection handleContentConnection(Module module, String location, InputStream in) throws IOException {
public URLConnection handleContentConnection(Module module, String location, InputStream in)
throws IOException {
if (handleContentConnection) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
Manifest manifest = new Manifest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ public class Activator implements BundleActivator {

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
new X1();
}

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ public class Activator implements BundleActivator {

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
}

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public void start(BundleContext context) throws Exception {

public void stop(BundleContext context) throws Exception {

new Service3() {/* nothing*/};
new Service3() {
/* nothing */};
AbstractBundleTests.simpleResults.addEvent(new BundleEvent(BundleEvent.STOPPED, context.getBundle()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void start(BundleContext context) throws Exception {
}

public void stop(BundleContext context) throws Exception {
//nothing
// nothing
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void start(BundleContext context) throws Exception {
}

public void stop(BundleContext context) throws Exception {
//nothing
// nothing
}

}
Loading

0 comments on commit 2c84aca

Please sign in to comment.