diff --git a/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedFrameworkFactoryTest.java b/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedFrameworkFactoryTest.java index 5e363d5fa..7bc90b569 100644 --- a/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedFrameworkFactoryTest.java +++ b/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedFrameworkFactoryTest.java @@ -39,13 +39,15 @@ import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.TestContainerException; import org.ops4j.pax.swissbox.framework.RemoteFramework; -import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.ops4j.pax.tinybundles.TinyBundles; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; import org.osgi.framework.launch.FrameworkFactory; +import static org.ops4j.pax.tinybundles.TinyBundles.rawBuilder; + public class ForkedFrameworkFactoryTest { private File storage; @@ -150,11 +152,11 @@ Collections. emptyMap(), frameworkProperties, null, } private File generateBundle() throws IOException { - InputStream stream = TinyBundles.bundle().add(ClasspathTestActivator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "boot.classpath.test.generated") - .set(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.kohsuke.metainf_services") - .set(Constants.BUNDLE_ACTIVATOR, ClasspathTestActivator.class.getName()) - .build(); + InputStream stream = TinyBundles.bundle().addClass(ClasspathTestActivator.class) + .setHeader(Constants.BUNDLE_SYMBOLICNAME, "boot.classpath.test.generated") + .setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.kohsuke.metainf_services") + .setHeader(Constants.BUNDLE_ACTIVATOR, ClasspathTestActivator.class.getName()) + .build(rawBuilder()); File bundle = new File("target/bundles/boot-classpath-generated.jar"); FileUtils.copyInputStreamToFile(stream, bundle); diff --git a/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedTestContainerFactoryTest.java b/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedTestContainerFactoryTest.java index 31d9c3a4a..e8e3d6cd5 100644 --- a/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedTestContainerFactoryTest.java +++ b/containers/pax-exam-container-forked/src/test/java/org/ops4j/pax/exam/forked/ForkedTestContainerFactoryTest.java @@ -37,12 +37,14 @@ import org.ops4j.pax.exam.options.MavenArtifactUrlReference; import org.ops4j.pax.exam.options.UrlReference; import org.ops4j.pax.exam.spi.PaxExamRuntime; -import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.ops4j.pax.tinybundles.TinyBundles; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; +import static org.ops4j.pax.tinybundles.TinyBundles.rawBuilder; + public class ForkedTestContainerFactoryTest { @Test @@ -75,6 +77,8 @@ public void failWithoutBootClasspath() throws BundleException, IOException, Assert.assertEquals(ClassNotFoundException.class.getName(), cause.getClass().getName()); + cause.printStackTrace(); + Assert.assertEquals("org.kohsuke.metainf_services.AnnotationProcessorImpl", cause.getMessage()); } @@ -128,12 +132,12 @@ public void startWithBootClasspath(UrlReference url) throws BundleException, } private File generateBundle() throws IOException { - InputStream stream = TinyBundles.bundle().add(ClasspathTestActivator.class) - .set(Constants.BUNDLE_MANIFESTVERSION, "2") - .set(Constants.BUNDLE_SYMBOLICNAME, "boot.classpath.test.generated") - .set(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.kohsuke.metainf_services") - .set(Constants.BUNDLE_ACTIVATOR, ClasspathTestActivator.class.getName()) - .build(); + InputStream stream = TinyBundles.bundle().addClass(ClasspathTestActivator.class) + .setHeader(Constants.BUNDLE_MANIFESTVERSION, "2") + .setHeader(Constants.BUNDLE_SYMBOLICNAME, "boot.classpath.test.generated") + .setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.kohsuke.metainf_services") + .setHeader(Constants.BUNDLE_ACTIVATOR, ClasspathTestActivator.class.getName()) + .build(rawBuilder()); File bundle = new File("target/bundles/boot-classpath-generated.jar"); FileUtils.copyInputStreamToFile(stream, bundle); diff --git a/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationProvisionOption.java b/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationProvisionOption.java index a14e243c1..7cd579ab1 100644 --- a/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationProvisionOption.java +++ b/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationProvisionOption.java @@ -31,8 +31,8 @@ import org.ops4j.pax.exam.cm.internal.ConfigurationOptionActivator; import org.ops4j.pax.exam.cm.internal.ConfigurationOptionConfigurationListener; import org.ops4j.pax.exam.options.ProvisionOption; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.ops4j.pax.tinybundles.TinyBundle; +import org.ops4j.pax.tinybundles.TinyBundles; import org.osgi.framework.Constants; /** @@ -201,14 +201,14 @@ private static ProvisionOption createProvisionOption(ConfigurationOption conf } ByteArrayInputStream stream = new ByteArrayInputStream(outputStream.toByteArray()); TinyBundle bundle = TinyBundles.bundle(); - bundle.add(ConfigurationOptionConfigurationListener.class); - bundle.add(ConfigurationOptionActivator.class).add("override.obj", stream); + bundle.addClass(ConfigurationOptionConfigurationListener.class); + bundle.addClass(ConfigurationOptionActivator.class).addResource("override.obj", stream); bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "PAXExamConfigurationOption-" + UUID.randomUUID()); - bundle.set(Constants.IMPORT_PACKAGE, + .setHeader(Constants.BUNDLE_SYMBOLICNAME, "PAXExamConfigurationOption-" + UUID.randomUUID()); + bundle.setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework,org.osgi.service.cm,org.osgi.util.tracker,org.slf4j"); - bundle.set(Constants.BUNDLE_ACTIVATOR, ConfigurationOptionActivator.class.getName()); - bundle.set(Constants.BUNDLE_MANIFESTVERSION, "2"); + bundle.setHeader(Constants.BUNDLE_ACTIVATOR, ConfigurationOptionActivator.class.getName()); + bundle.setHeader(Constants.BUNDLE_MANIFESTVERSION, "2"); return CoreOptions.streamBundle(bundle.build()).startLevel(1).start(true).update(false); } diff --git a/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/intern/TestProbeBuilderImpl.java b/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/intern/TestProbeBuilderImpl.java index 1e732fa96..63116f923 100644 --- a/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/intern/TestProbeBuilderImpl.java +++ b/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/intern/TestProbeBuilderImpl.java @@ -18,8 +18,8 @@ package org.ops4j.pax.exam.spi.intern; import static org.ops4j.pax.exam.Constants.PROBE_EXECUTABLE; -import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withClassicBuilder; +import static org.ops4j.pax.tinybundles.TinyBundles.bundle; +import static org.ops4j.pax.tinybundles.TinyBundles.rawBuilder; import java.io.File; import java.io.IOException; @@ -42,7 +42,7 @@ import org.ops4j.pax.exam.TestProbeBuilder; import org.ops4j.pax.exam.TestProbeProvider; import org.ops4j.pax.exam.spi.ContentCollector; -import org.ops4j.pax.tinybundles.core.TinyBundle; +import org.ops4j.pax.tinybundles.TinyBundle; import org.ops4j.store.Store; import org.osgi.framework.Constants; @@ -120,7 +120,7 @@ public TestProbeProvider build() { try { TinyBundle bundle = prepareProbeBundle(createExtraIgnores()); return new DefaultTestProbeProvider(getTests(), store, store.store(bundle - .build(withClassicBuilder()))); + .build(rawBuilder()))); } catch (IOException e) { @@ -129,20 +129,20 @@ public TestProbeProvider build() { } private TinyBundle prepareProbeBundle(Properties p) throws IOException { - TinyBundle bundle = bundle(store).set(Constants.DYNAMICIMPORT_PACKAGE, "*"); + TinyBundle bundle = bundle(store).setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*"); - bundle.set(Constants.BUNDLE_SYMBOLICNAME, ""); - bundle.set(Constants.BUNDLE_MANIFESTVERSION, "2"); + bundle.setHeader(Constants.BUNDLE_SYMBOLICNAME, ""); + bundle.setHeader(Constants.BUNDLE_MANIFESTVERSION, "2"); for (Object key : extraProperties.keySet()) { - bundle.set((String) key, (String) extraProperties.get(key)); + bundle.setHeader((String) key, (String) extraProperties.get(key)); } for (Object key : p.keySet()) { - bundle.set((String) key, (String) p.get(key)); + bundle.setHeader((String) key, (String) p.get(key)); } Map map = collectResources(); for (String item : map.keySet()) { - bundle.add(item, map.get(item)); + bundle.addResource(item, map.get(item)); } return bundle; } diff --git a/itest/karaf/src/it/regression-karaf/src/test/java/org/ops4j/pax/exam/regression/karaf/ServletTest.java b/itest/karaf/src/it/regression-karaf/src/test/java/org/ops4j/pax/exam/regression/karaf/ServletTest.java index 4262b226d..1c72b9afe 100644 --- a/itest/karaf/src/it/regression-karaf/src/test/java/org/ops4j/pax/exam/regression/karaf/ServletTest.java +++ b/itest/karaf/src/it/regression-karaf/src/test/java/org/ops4j/pax/exam/regression/karaf/ServletTest.java @@ -23,8 +23,8 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; import static org.ops4j.pax.exam.regression.karaf.RegressionConfiguration.featureRepoStandard; import static org.ops4j.pax.exam.regression.karaf.RegressionConfiguration.regressionDefaults; -import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; +import static org.ops4j.pax.tinybundles.TinyBundles.bundle; +import static org.ops4j.pax.tinybundles.TinyBundles.withBnd; import java.io.BufferedReader; import java.io.IOException; @@ -128,9 +128,9 @@ private String readResponse(URLConnection conn) throws IOException { private InputStream createTestBundle() { return bundle() - .add(EchoServlet.class) - .add(ServletActivator.class) - .set(Constants.BUNDLE_ACTIVATOR, ServletActivator.class.getName()) - .build(withBnd()); + .addClass(EchoServlet.class) + .addClass(ServletActivator.class) + .setHeader(Constants.BUNDLE_ACTIVATOR, ServletActivator.class.getName()) + .build(bndBuilder()); } } diff --git a/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentAsStreamTest.java b/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentAsStreamTest.java index bab63f300..fe74fb266 100644 --- a/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentAsStreamTest.java +++ b/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentAsStreamTest.java @@ -40,8 +40,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerMethod; import org.ops4j.pax.swissbox.tracker.ServiceLookup; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.ops4j.pax.tinybundles.TinyBundle; +import org.ops4j.pax.tinybundles.TinyBundles; import org.ops4j.store.StoreFactory; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -64,10 +64,10 @@ public Option[] config() { private InputStream createFragmentBundle() { try { TinyBundle bundle = TinyBundles.bundle(StoreFactory.anonymousStore()) - .set(Constants.FRAGMENT_HOST, "org.ops4j.pax.exam.sample9.pde") - .set(Constants.BUNDLE_MANIFESTVERSION, "2") - .set(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment") - .add("messages.properties", getClass().getResource("/messages.properties")); + .setHeader(Constants.FRAGMENT_HOST, "org.ops4j.pax.exam.sample9.pde") + .setHeader(Constants.BUNDLE_MANIFESTVERSION, "2") + .setHeader(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment") + .addResource("messages.properties", getClass().getResource("/messages.properties")); return bundle.build(); } catch (IOException e) { diff --git a/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentTest.java b/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentTest.java index 0036750df..33e3d5bc3 100644 --- a/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentTest.java +++ b/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/fragment/FragmentTest.java @@ -39,8 +39,8 @@ import org.ops4j.pax.exam.TestContainerException; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.swissbox.tracker.ServiceLookup; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.ops4j.pax.tinybundles.TinyBundle; +import org.ops4j.pax.tinybundles.TinyBundles; import org.ops4j.store.Handle; import org.ops4j.store.Store; import org.ops4j.store.StoreFactory; @@ -63,10 +63,10 @@ public Option[] config() { private URL createFragmentBundle() { TinyBundle bundle = TinyBundles.bundle() - .set(Constants.FRAGMENT_HOST, "org.ops4j.pax.exam.sample9.pde") - .set(Constants.BUNDLE_MANIFESTVERSION, "2") - .set(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment") - .add("messages.properties", getClass().getResource("/messages.properties")); + .setHeader(Constants.FRAGMENT_HOST, "org.ops4j.pax.exam.sample9.pde") + .setHeader(Constants.BUNDLE_MANIFESTVERSION, "2") + .setHeader(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment") + .addResource("messages.properties", getClass().getResource("/messages.properties")); try { Store store = StoreFactory.anonymousStore(); diff --git a/pom/pom.xml b/pom/pom.xml index 587d98883..eb575564f 100644 --- a/pom/pom.xml +++ b/pom/pom.xml @@ -20,7 +20,7 @@ 2.6.8 1.10.3 1.8.3 - 2.1.1 + 4.0.0 1.5.1 1.7.25 4.13.2