diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /jdisc_core_test |
Publish
Diffstat (limited to 'jdisc_core_test')
125 files changed, 3848 insertions, 0 deletions
diff --git a/jdisc_core_test/.gitignore b/jdisc_core_test/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/OWNERS b/jdisc_core_test/OWNERS new file mode 100644 index 00000000000..90fdb511ae3 --- /dev/null +++ b/jdisc_core_test/OWNERS @@ -0,0 +1 @@ +bakksjo diff --git a/jdisc_core_test/integration_test/.gitignore b/jdisc_core_test/integration_test/.gitignore new file mode 100644 index 00000000000..579f9d16789 --- /dev/null +++ b/jdisc_core_test/integration_test/.gitignore @@ -0,0 +1,3 @@ +/pom.xml.build +/target +/tmp diff --git a/jdisc_core_test/integration_test/pom.xml b/jdisc_core_test/integration_test/pom.xml new file mode 100644 index 00000000000..30263277c96 --- /dev/null +++ b/jdisc_core_test/integration_test/pom.xml @@ -0,0 +1,291 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>parent</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>integration_test</artifactId> + <version>6-SNAPSHOT</version> + <packaging>jar</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>jdisc_core</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-a</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-b-priv</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-ca</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-dj</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-ej-priv</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-f-more</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-g-act</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>app-h-log</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-b</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ca</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-dc</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-eab</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-fac</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-gg</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-hi</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ih</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-j-priv</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-k-pkgs</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-l1</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-l2</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ml</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-nac</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-oa-path</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-p-jar</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-q-frag</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-rq</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-s-act</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-tp</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-us</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>my-bundle-activator</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>my-guice-module</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>my-server-provider</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>compile</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <excludeTransitive>true</excludeTransitive> + <stripVersion>true</stripVersion> + </configuration> + </execution> + <execution> + <!-- we need an explicit copy of cert-a for the pre-install in cert-oa-path's manifest --> + <id>cert-a</id> + <phase>compile</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <includeGroupIds>com.yahoo.vespa.jdisc_core</includeGroupIds> + <includeArtifactIds>cert-a</includeArtifactIds> + <stripVersion>true</stripVersion> + <outputDirectory>${basedir}/target</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <redirectTestOutputToFile>${test.hide}</redirectTestOutputToFile> + <systemPropertyVariables> + <java.util.logging.config.file> + src/test/resources/logger.properties + </java.util.logging.config.file> + <jdisc.bundle.path>${project.build.directory}/dependency</jdisc.bundle.path> + <jdisc.cache.path>${project.build.directory}/bundlecache</jdisc.cache.path> + <jdisc.config.file>src/test/resources/config.properties</jdisc.config.file> + <jdisc.logger.level>ALL</jdisc.logger.level> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <test.hide>false</test.hide> + </properties> +</project> diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java new file mode 100644 index 00000000000..a9d33270c20 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java @@ -0,0 +1,46 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.application; + +import com.google.inject.Inject; +import com.yahoo.jdisc.service.CurrentContainer; +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class AbstractApplicationTestCase { + + @Test + public void requireThatBundleInstallerCanBeAccessed() throws BundleException { + TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class); + MyApplication app = (MyApplication)driver.application(); + List<Bundle> lst = app.installAndStartBundle("cert-a.jar"); + assertEquals(1, lst.size()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-a", lst.get(0).getSymbolicName()); + app.stopAndUninstallBundle(lst.get(0)); + assertTrue(driver.close()); + } + + private static class MyApplication extends AbstractApplication { + + @Inject + public MyApplication(BundleInstaller bundleInstaller, ContainerActivator activator, + CurrentContainer container) { + super(bundleInstaller, activator, container); + } + + @Override + public void start() { + + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java new file mode 100644 index 00000000000..7fe517fdd80 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java @@ -0,0 +1,50 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.application; + +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class BundleActivatorIntegrationTest { + + @Test + public void requireThatBundleActivatorHasAccessToCurrentContainer() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + OsgiFramework osgi = driver.osgiFramework(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-bundle-activator.jar").get(0); + Class serviceClass = bundle.loadClass("com.yahoo.jdisc.bundle.MyService"); + assertNotNull(serviceClass); + BundleContext ctx = osgi.bundleContext(); + ServiceReference serviceRef = ctx.getServiceReference(serviceClass.getName()); + assertNotNull(serviceRef); + Object service = ctx.getService(serviceRef); + assertNotNull(service); + assertTrue(serviceClass.isInstance(service)); + assertTrue(driver.close()); + } + + @Test + public void requireThatApplicationBundleActivatorHasAccessToCurrentContainer() throws Exception { + TestDriver driver = TestDriver.newApplicationBundleInstance("app-g-act.jar", false); + OsgiFramework osgi = driver.osgiFramework(); + Class serviceClass = osgi.bundles().get(1).loadClass("com.yahoo.jdisc.bundle.MyService"); + assertNotNull(serviceClass); + BundleContext ctx = osgi.bundleContext(); + ServiceReference serviceRef = ctx.getServiceReference(serviceClass.getName()); + assertNotNull(serviceRef); + Object service = ctx.getService(serviceRef); + assertNotNull(service); + assertTrue(serviceClass.isInstance(service)); + assertTrue(driver.close()); + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleInstallerIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleInstallerIntegrationTest.java new file mode 100644 index 00000000000..3ed84446369 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleInstallerIntegrationTest.java @@ -0,0 +1,192 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.application; + +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; + +import java.util.LinkedList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class BundleInstallerIntegrationTest { + + @Test + public void requireThatInstallWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + List<Bundle> prev = new LinkedList<>(driver.osgiFramework().bundles()); + + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("cert-a.jar").get(0); + assertNotNull(bundle); + assertEquals("com.yahoo.vespa.jdisc_core.cert-a", bundle.getSymbolicName()); + + boolean found = false; + for (Bundle entry : driver.osgiFramework().bundles()) { + assertNotNull(entry); + if (prev.remove(entry)) { + continue; + } + assertFalse(found); + assertSame(bundle, entry); + found = true; + } + assertTrue(prev.isEmpty()); + assertTrue(found); + driver.close(); + } + + @Test + public void requireThatInstallAllWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + List<Bundle> bundles = installer.installAndStart( + "cert-a.jar", + "cert-b.jar"); + assertNotNull(bundles); + assertEquals(2, bundles.size()); + driver.close(); + } + + @Test + public void requireThatUninstallWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + List<Bundle> prev = new LinkedList<>(driver.osgiFramework().bundles()); + + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("cert-a.jar").get(0); + assertNotNull(bundle); + installer.stopAndUninstall(bundle); + + for (Bundle entry : driver.osgiFramework().bundles()) { + assertTrue(prev.remove(entry)); + } + assertTrue(prev.isEmpty()); + driver.close(); + } + + @Test + public void requireThatUninstallAllWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + List<Bundle> prev = new LinkedList<>(driver.osgiFramework().bundles()); + + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + List<Bundle> bundles = installer.installAndStart( + "cert-a.jar", + "cert-b.jar"); + assertNotNull(bundles); + installer.stopAndUninstall(bundles); + + List<Bundle> next = new LinkedList<>(driver.osgiFramework().bundles()); + next.removeAll(prev); + assertTrue(next.isEmpty()); + driver.close(); + } + + @Test + public void requireThatUninstallUninstalledThrowsException() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("cert-a.jar").get(0); + assertNotNull(bundle); + installer.stopAndUninstall(bundle); + try { + installer.stopAndUninstall(bundle); + fail(); + } catch (BundleException e) { + assertEquals("OSGi bundle com.yahoo.vespa.jdisc_core.cert-a not started.", + e.getMessage()); + } + driver.close(); + } + + @Test + public void requireThatInstallInstalledThrowsException() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("cert-a.jar").get(0); + assertNotNull(bundle); + try { + installer.installAndStart("cert-a.jar"); + fail(); + } catch (BundleException e) { + assertEquals("OSGi bundle com.yahoo.vespa.jdisc_core.cert-a already started.", + e.getMessage()); + } + driver.close(); + } + + @Test + public void requireThatApplicationInstructionThrowsException() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + try { + installer.installAndStart("app-a.jar"); + fail(); + } catch (BundleException e) { + assertEquals("OSGi header 'X-JDisc-Application' not allowed for non-application bundle " + + "com.yahoo.vespa.jdisc_core.app-a.", e.getMessage()); + } + driver.close(); + } + + @Test + public void requireThatPrivilegedActivatorInstructionButNoRootPrivilegesKindOfWorksOnABestEffortBasis() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + installer.installAndStart("cert-j-priv.jar"); + driver.close(); + } + + @Test + public void requireThatInstallExceptionContainsInstalledBundles() throws BundleException { + OsgiFramework osgi = TestDriver.newOsgiFramework(); + osgi.start(); + BundleInstaller installer = new BundleInstaller(osgi); + assertEquals(1, osgi.bundles().size()); + try { + installer.installAndStart("cert-a.jar", "cert-tp.jar"); + fail(); + } catch (BundleException e) { + assertTrue(e instanceof BundleInstallationException); + List<Bundle> bundles = ((BundleInstallationException)e).installedBundles(); + assertEquals(2, bundles.size()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-a", bundles.get(0).getSymbolicName()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-tp", bundles.get(1).getSymbolicName()); + } + assertEquals(3, osgi.bundles().size()); // did not clean up the installed bundles inside the catch-block + osgi.stop(); + } + + @Test + public void requireThatStartExceptionContainsInstalledBundles() throws BundleException { + OsgiFramework osgi = TestDriver.newOsgiFramework(); + osgi.start(); + osgi.bundleContext().registerService(RuntimeException.class, new RuntimeException(), null); + BundleInstaller installer = new BundleInstaller(osgi); + assertEquals(1, osgi.bundles().size()); + try { + installer.installAndStart("cert-a.jar", "cert-us.jar"); + fail(); + } catch (BundleException e) { + assertTrue(e instanceof BundleInstallationException); + List<Bundle> bundles = ((BundleInstallationException)e).installedBundles(); + assertEquals(3, bundles.size()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-a", bundles.get(0).getSymbolicName()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-us", bundles.get(1).getSymbolicName()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-s-act", bundles.get(2).getSymbolicName()); + } + assertEquals(4, osgi.bundles().size()); // did not clean up the installed bundles inside the catch-block + osgi.stop(); + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryIntegrationTest.java new file mode 100644 index 00000000000..ba237318f20 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryIntegrationTest.java @@ -0,0 +1,95 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.application; + +import com.google.inject.AbstractModule; +import com.google.inject.Injector; +import com.google.inject.Module; +import com.google.inject.name.Names; +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class GuiceRepositoryIntegrationTest { + + @Test + public void requireThatInstallFromBundleWorks() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newSimpleApplicationInstance(module); + ContainerBuilder builder = driver.newContainerBuilder(); + List<Module> prev = new LinkedList<>(builder.guiceModules().collection()); + + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-guice-module.jar").get(0); + builder.guiceModules().install(bundle, "com.yahoo.jdisc.bundle.MyGuiceModule"); + List<Module> next = new LinkedList<>(builder.guiceModules().collection()); + next.removeAll(prev); + + assertEquals(1, next.size()); + assertTrue(module.initLatch.await(60, TimeUnit.SECONDS)); + assertNotNull(builder.guiceModules().getInstance(Injector.class)); + assertTrue(module.configLatch.await(60, TimeUnit.SECONDS)); + + driver.close(); + } + + @Test + public void requireThatInstallAllFromBundleWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(new MyModule()); + ContainerBuilder builder = driver.newContainerBuilder(); + List<Module> prev = new LinkedList<>(builder.guiceModules().collection()); + + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-guice-module.jar").get(0); + builder.guiceModules().installAll(bundle, Arrays.asList("com.yahoo.jdisc.bundle.MyGuiceModule", + "com.yahoo.jdisc.bundle.MyGuiceModule")); + List<Module> next = new LinkedList<>(builder.guiceModules().collection()); + next.removeAll(prev); + + assertEquals(2, next.size()); + driver.close(); + } + + @Test + public void requireThatInstallUnknowClassThrows() throws BundleException, ClassNotFoundException { + TestDriver driver = TestDriver.newSimpleApplicationInstance(new MyModule()); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-guice-module.jar").get(0); + + ContainerBuilder builder = driver.newContainerBuilder(); + try { + builder.guiceModules().install(bundle, "class.not.Found"); + fail(); + } catch (ClassNotFoundException e) { + + } + driver.close(); + } + + private static class MyModule extends AbstractModule { + + final CountDownLatch initLatch = new CountDownLatch(1); + final CountDownLatch configLatch = new CountDownLatch(1); + + @Override + protected void configure() { + bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(initLatch); + bind(CountDownLatch.class).annotatedWith(Names.named("Config")).toInstance(configLatch); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/ServerRepositoryIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/ServerRepositoryIntegrationTest.java new file mode 100644 index 00000000000..250a05f6ed9 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/ServerRepositoryIntegrationTest.java @@ -0,0 +1,99 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.application; + +import com.google.inject.AbstractModule; +import com.google.inject.name.Names; +import com.yahoo.jdisc.service.ServerProvider; +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ServerRepositoryIntegrationTest { + + @Test + public void requireThatInstallFromBundleWorks() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newSimpleApplicationInstance(module); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-server-provider.jar").get(0); + ContainerBuilder builder = driver.newContainerBuilder(); + builder.serverProviders().install(bundle, "com.yahoo.jdisc.bundle.MyServerProvider"); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + + Iterator<ServerProvider> it = builder.serverProviders().iterator(); + assertTrue(it.hasNext()); + ServerProvider server = it.next(); + assertNotNull(server); + server.start(); + assertTrue(module.start.await(60, TimeUnit.SECONDS)); + server.close(); + assertTrue(module.close.await(60, TimeUnit.SECONDS)); + server.release(); + assertTrue(module.destroy.await(60, TimeUnit.SECONDS)); + assertFalse(it.hasNext()); + driver.close(); + } + + @Test + public void requireThatInstallAllFromBundleWorks() throws Exception { + TestDriver driver = TestDriver.newSimpleApplicationInstance(new MyModule()); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-server-provider.jar").get(0); + ContainerBuilder builder = driver.newContainerBuilder(); + builder.serverProviders().installAll(bundle, Arrays.asList("com.yahoo.jdisc.bundle.MyServerProvider", + "com.yahoo.jdisc.bundle.MyServerProvider")); + Iterator<ServerProvider> it = builder.serverProviders().iterator(); + assertTrue(it.hasNext()); + assertNotNull(it.next()); + assertTrue(it.hasNext()); + assertNotNull(it.next()); + assertFalse(it.hasNext()); + driver.close(); + } + + @Test + public void requireThatInstallUnknownClassThrows() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newSimpleApplicationInstance(module); + BundleInstaller installer = new BundleInstaller(driver.osgiFramework()); + Bundle bundle = installer.installAndStart("my-server-provider.jar").get(0); + ContainerBuilder builder = driver.newContainerBuilder(); + try { + builder.serverProviders().install(bundle, "class.not.Found"); + fail(); + } catch (ClassNotFoundException e) { + + } + driver.close(); + } + + private static class MyModule extends AbstractModule { + + final CountDownLatch init = new CountDownLatch(1); + final CountDownLatch start = new CountDownLatch(1); + final CountDownLatch close = new CountDownLatch(1); + final CountDownLatch destroy = new CountDownLatch(1); + + @Override + protected void configure() { + bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(init); + bind(CountDownLatch.class).annotatedWith(Names.named("Start")).toInstance(start); + bind(CountDownLatch.class).annotatedWith(Names.named("Close")).toInstance(close); + bind(CountDownLatch.class).annotatedWith(Names.named("Destroy")).toInstance(destroy); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/client/ClientDriverIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/client/ClientDriverIntegrationTest.java new file mode 100644 index 00000000000..bcb4a0b4fd7 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/client/ClientDriverIntegrationTest.java @@ -0,0 +1,89 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.client; + +import com.google.inject.AbstractModule; +import com.google.inject.Inject; +import com.yahoo.jdisc.application.BundleInstaller; +import com.yahoo.jdisc.application.ContainerActivator; +import com.yahoo.jdisc.application.OsgiFramework; +import org.junit.Test; +import org.osgi.framework.Bundle; + +import java.util.List; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ClientDriverIntegrationTest { + + @Test + public void requireThatApplicationClassInjectionWorks() throws Exception { + MyModule module = new MyModule(); + ClientDriver.runApplicationWithOsgi("target/bundlecache_client", MyApplication.class, module); + assertEquals(5, module.state); + } + + private static class MyApplication implements ClientApplication { + + final Logger log = Logger.getLogger(MyApplication.class.getName()); + final ContainerActivator activator; + final BundleInstaller installer; + final MyModule module; + + @Inject + MyApplication(ContainerActivator activator, OsgiFramework osgi, MyModule module) { + this.activator = activator; + this.installer = new BundleInstaller(osgi); + this.module = module; + module.state = 1; + } + + @Override + public void start() { + if (++module.state != 2) { + throw new IllegalStateException(); + } + } + + @Override + public void run() { + if (++module.state != 3) { + throw new IllegalStateException(); + } + try { + List<Bundle> bundles = installer.installAndStart("cert-a.jar"); + Class classObj = bundles.get(0).loadClass("com.yahoo.jdisc.bundle.a.CertificateA"); + log.info("Loaded '" + classObj.getName() + "'."); + } catch (Exception e) { + throw new AssertionError(e); + } + } + + @Override + public void stop() { + if (++module.state != 4) { + throw new IllegalStateException(); + } + } + + @Override + public void destroy() { + if (++module.state != 5) { + throw new IllegalStateException(); + } + } + } + + private static class MyModule extends AbstractModule { + + int state = 0; + + @Override + protected void configure() { + bind(MyModule.class).toInstance(this); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderIntegrationTest.java new file mode 100644 index 00000000000..99ed055fd36 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderIntegrationTest.java @@ -0,0 +1,155 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import com.google.inject.AbstractModule; +import com.google.inject.name.Names; +import com.yahoo.jdisc.test.TestDriver; +import org.apache.felix.framework.util.FelixConstants; +import org.junit.Test; +import org.osgi.framework.Bundle; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationLoaderIntegrationTest { + + @Test + public void requireThatLifecycleWorks() throws Exception { + MyModule module = new MyModule(); + ApplicationLoader loader = new ApplicationLoader(TestDriver.newOsgiFramework(), + Arrays.asList(module)); + loader.init("app-a.jar", false); + + assertFalse(module.init.await(100, TimeUnit.MILLISECONDS)); + assertFalse(module.start.await(100, TimeUnit.MILLISECONDS)); + loader.start(); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + assertTrue(module.start.await(60, TimeUnit.SECONDS)); + + Iterator<Bundle> it = loader.osgiFramework().bundles().iterator(); + assertTrue(it.hasNext()); + Bundle bundle = it.next(); + assertNotNull(bundle); + assertEquals(FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME, + bundle.getSymbolicName()); + assertTrue(it.hasNext()); + assertNotNull(bundle = it.next()); + assertEquals("com.yahoo.vespa.jdisc_core.app-a", + bundle.getSymbolicName()); + assertFalse(it.hasNext()); + + assertFalse(module.stop.await(100, TimeUnit.MILLISECONDS)); + assertFalse(module.destroy.await(100, TimeUnit.MILLISECONDS)); + loader.stop(); + assertTrue(module.stop.await(60, TimeUnit.SECONDS)); + assertTrue(module.destroy.await(60, TimeUnit.SECONDS)); + + loader.destroy(); + } + + @Test + public void requireThatNoApplicationInstructionThrowsException() throws Exception { + try { + TestDriver.newApplicationBundleInstance("cert-a.jar", false); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void requireThatMultipleApplicationInstructionsThrowException() throws Exception { + try { + TestDriver.newApplicationBundleInstance("app-f-more.jar", false); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void requireThatUnprivilegedBundleCanBeLoadedUnprivileged() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newApplicationBundleInstance("app-a.jar", false, module); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + assertEquals("com.yahoo.jdisc.bundle.ApplicationA", driver.application().getClass().getName()); + driver.close(); + } + + @Test + public void requireThatUnprivilegedBundleCanBeLoadedPrivileged() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newApplicationBundleInstance("app-a.jar", true, module); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + assertEquals("com.yahoo.jdisc.bundle.ApplicationA", driver.application().getClass().getName()); + driver.close(); + } + + @Test + public void requireThatPrivilegedBundleCanBeLoadedUnprivilegedOnABestEffortBasis() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newApplicationBundleInstance("app-b-priv.jar", + false, module); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + assertEquals("com.yahoo.jdisc.bundle.ApplicationB", driver.application().getClass().getName()); + driver.close(); + } + + @Test + public void requireThatPrivilegedBundleCanBeLoadedPrivileged() throws Exception { + MyModule module = new MyModule(); + TestDriver driver = TestDriver.newApplicationBundleInstance("app-b-priv.jar", + true, module); + assertTrue(module.init.await(60, TimeUnit.SECONDS)); + assertEquals("com.yahoo.jdisc.bundle.ApplicationB", driver.application().getClass().getName()); + driver.close(); + } + + @Test + public void requireThatInstallBundleInstructionWorks() throws Exception { + TestDriver driver = TestDriver.newApplicationBundleInstance("app-ca.jar", true); + assertEquals("com.yahoo.jdisc.bundle.ApplicationC", driver.application().getClass().getName()); + driver.close(); + } + + @Test + public void requireThatInstallBundleInstructionDoesNotIgnorePrivilegedActivatorOfDependencies() throws Exception { + TestDriver driver = TestDriver.newApplicationBundleInstance("app-dj.jar", true); + driver.close(); + } + + @Test + public void requireThatInstallBundleInstructionPropagatesPrivileges() throws Exception { + TestDriver driver = TestDriver.newApplicationBundleInstance("app-ej-priv.jar", true); + assertEquals("com.yahoo.jdisc.bundle.ApplicationE", driver.application().getClass().getName()); + driver.close(); + } + + private static class MyModule extends AbstractModule { + + final CountDownLatch init = new CountDownLatch(1); + final CountDownLatch start = new CountDownLatch(1); + final CountDownLatch stop = new CountDownLatch(1); + final CountDownLatch destroy = new CountDownLatch(1); + + @Override + protected void configure() { + bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(init); + bind(CountDownLatch.class).annotatedWith(Names.named("Start")).toInstance(start); + bind(CountDownLatch.class).annotatedWith(Names.named("Stop")).toInstance(stop); + bind(CountDownLatch.class).annotatedWith(Names.named("Destroy")).toInstance(destroy); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/BootstrapDaemonIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/BootstrapDaemonIntegrationTest.java new file mode 100644 index 00000000000..384ba0aa89d --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/BootstrapDaemonIntegrationTest.java @@ -0,0 +1,58 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import com.yahoo.jdisc.application.Application; +import org.apache.commons.daemon.DaemonContext; +import org.junit.Test; +import org.mockito.Mockito; + +import static org.junit.Assert.assertEquals; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class BootstrapDaemonIntegrationTest { + + @Test + public void requireThatConfigFileIsInjected() throws Exception { + BootstrapDaemon daemon = new BootstrapDaemon(); + + DaemonContext ctx = Mockito.mock(DaemonContext.class); + Mockito.doReturn(new String[] { MyApplication.class.getName() }).when(ctx).getArguments(); + daemon.init(ctx); + daemon.start(); + + assertEquals("bar", ((MyApplication)((ApplicationLoader)daemon.loader()).application()).foo); + + daemon.stop(); + daemon.destroy(); + } + + public static class MyApplication implements Application { + + final String foo; + + @Inject + public MyApplication(@Named("foo") String foo) { + this.foo = foo; + } + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java new file mode 100644 index 00000000000..04fa085db17 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java @@ -0,0 +1,36 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class ExportPackagesIntegrationTest { + + @Test + public void requireThatManifestContainsExportPackage() throws BundleException { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + List<Bundle> bundles = felix.installBundle("jdisc_core.jar"); + assertEquals(1, bundles.size()); + Object obj = bundles.get(0).getHeaders().get("Export-Package"); + assertTrue(obj instanceof String); + String str = (String)obj; + assertTrue(str.contains(ExportPackages.getSystemPackages())); + assertTrue(str.contains("com.yahoo.jdisc")); + assertTrue(str.contains("com.yahoo.jdisc.application")); + assertTrue(str.contains("com.yahoo.jdisc.handler")); + assertTrue(str.contains("com.yahoo.jdisc.service")); + felix.stop(); + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/FelixFrameworkIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/FelixFrameworkIntegrationTest.java new file mode 100644 index 00000000000..d6a77a88625 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/FelixFrameworkIntegrationTest.java @@ -0,0 +1,223 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import com.yahoo.jdisc.application.BundleInstallationException; +import com.yahoo.jdisc.test.TestDriver; +import org.apache.felix.framework.util.FelixConstants; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class FelixFrameworkIntegrationTest { + + @Test + public void requireThatBundlesCanBeInstalled() throws BundleException { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + + Bundle bundle = felix.installBundle("cert-a.jar").get(0); + assertNotNull(bundle); + + Iterator<Bundle> it = felix.bundles().iterator(); + assertNotNull(it); + assertTrue(it.hasNext()); + assertEquals(FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME, it.next().getSymbolicName()); + assertTrue(it.hasNext()); + assertSame(bundle, it.next()); + assertFalse(it.hasNext()); + + felix.stop(); + } + + @Test + public void requireThatInstallBundleInstructionWorks() throws Exception { + assertBundle("cert-ca.jar", "com.yahoo.jdisc.bundle.c.CertificateC", + "com.yahoo.vespa.jdisc_core.cert-ca", + "com.yahoo.vespa.jdisc_core.cert-a"); + } + + @Test + public void requireThatInstallBundleInstructionResolvesTransitiveDepedencies() throws Exception { + assertBundle("cert-dc.jar", "com.yahoo.jdisc.bundle.d.CertificateD", + "com.yahoo.vespa.jdisc_core.cert-dc", + "com.yahoo.vespa.jdisc_core.cert-ca", + "com.yahoo.vespa.jdisc_core.cert-a"); + } + + @Test + public void requireThatInstallBundleInstructionResolvesAllTransitiveDepedencies() throws Exception { + assertBundle("cert-eab.jar", "com.yahoo.jdisc.bundle.e.CertificateE", + "com.yahoo.vespa.jdisc_core.cert-eab", + "com.yahoo.vespa.jdisc_core.cert-a", + "com.yahoo.vespa.jdisc_core.cert-b"); + } + + @Test + public void requireThatInstallBundleInstructionInstallsEachBundleOnlyOnce() throws Exception { + assertBundle("cert-fac.jar", "com.yahoo.jdisc.bundle.f.CertificateF", + "com.yahoo.vespa.jdisc_core.cert-fac", + "com.yahoo.vespa.jdisc_core.cert-a", + "com.yahoo.vespa.jdisc_core.cert-ca"); + } + + @Test + public void requireThatInstallBundleInstructionTracksLocationInCanonicalForm() throws Exception { + assertBundle("cert-nac.jar", "com.yahoo.jdisc.bundle.n.CertificateN", + "com.yahoo.vespa.jdisc_core.cert-nac", + "com.yahoo.vespa.jdisc_core.cert-a", + "com.yahoo.vespa.jdisc_core.cert-ca"); + } + + @Test + public void requireThatInstallBundleInstructionDetectsAutoDependency() throws Exception { + assertBundle("cert-gg.jar", "com.yahoo.jdisc.bundle.g.CertificateG", + "com.yahoo.vespa.jdisc_core.cert-gg"); + } + + @Test + public void requireThatInstallBundleInstructionDetectsCycles() throws Exception { + assertBundle("cert-hi.jar", "com.yahoo.jdisc.bundle.h.CertificateH", + "com.yahoo.vespa.jdisc_core.cert-hi", + "com.yahoo.vespa.jdisc_core.cert-ih"); + } + + @Test + public void requireThatSystemPackagesAreExported() throws Exception { + assertBundle("cert-k-pkgs.jar", "com.yahoo.jdisc.bundle.k.CertificateK", + "com.yahoo.vespa.jdisc_core.cert-k-pkgs"); + } + + @Test + public void requireThatBundlesCanBeRefreshed() throws Exception { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + Bundle bundleL = startBundle(felix, "cert-l1.jar"); + Bundle bundleM = startBundle(felix, "cert-ml.jar"); + assertEquals(1, callClass(bundleM, "com.yahoo.jdisc.bundle.m.CertificateM")); + bundleL.uninstall(); + startBundle(felix, "cert-l2.jar"); + felix.refreshPackages(); + assertEquals(2, callClass(bundleM, "com.yahoo.jdisc.bundle.m.CertificateM")); + felix.stop(); + } + + @Test + public void requireThatBundlesCanBeRefreshedWithDisjunctRemovalClosure() throws Exception { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + Bundle bundleA = startBundle(felix, "cert-a.jar"); + Bundle bundleL = startBundle(felix, "cert-l1.jar"); + Bundle bundleM = startBundle(felix, "cert-ml.jar"); + assertEquals(1, callClass(bundleM, "com.yahoo.jdisc.bundle.m.CertificateM")); + bundleA.uninstall(); + bundleL.uninstall(); + startBundle(felix, "cert-l2.jar"); + felix.refreshPackages(); + assertEquals(2, callClass(bundleM, "com.yahoo.jdisc.bundle.m.CertificateM")); + felix.stop(); + } + + @Test + public void requireThatJdiscBundlePathIsConfigurable() throws Exception { + assertBundle("cert-oa-path.jar", "com.yahoo.jdisc.bundle.o.CertificateO", + "com.yahoo.vespa.jdisc_core.cert-oa-path", + "com.yahoo.vespa.jdisc_core.cert-a"); + } + + @Test + public void requireThatBundleSymbolicNameIsRequired() throws Exception { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + try { + felix.installBundle("cert-p-jar.jar"); + fail(); + } catch (BundleException e) { + assertTrue(e.getMessage().contains("it might not be an OSGi bundle")); + } + felix.stop(); + } + + @Test + public void requireThatBundleInstallationExceptionContainsInstalledBundles() throws Exception { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + assertEquals(1, felix.bundles().size()); + try { + felix.installBundle("cert-tp.jar"); + fail(); + } catch (BundleException e) { + assertTrue(e instanceof BundleInstallationException); + List<Bundle> bundles = ((BundleInstallationException)e).installedBundles(); + assertEquals(1, bundles.size()); + assertEquals("com.yahoo.vespa.jdisc_core.cert-tp", bundles.get(0).getSymbolicName()); + } + assertEquals(2, felix.bundles().size()); // did not clean up the installed bundle inside the catch-block + felix.stop(); + } + + @Test + public void requireThatFragmentBundlesCanBeInstalled() throws Exception { + assertBundle("cert-q-frag.jar", null, + "com.yahoo.vespa.jdisc_core.cert-q-frag"); + } + + @Test + public void requireThatFragmentBundlesCanBePreinstalled() throws Exception { + assertBundle("cert-rq.jar", null, + "com.yahoo.vespa.jdisc_core.cert-rq", + "com.yahoo.vespa.jdisc_core.cert-q-frag"); + } + + private static Bundle startBundle(FelixFramework felix, String bundleLocation) throws BundleException { + List<Bundle> lst = felix.installBundle(bundleLocation); + assertEquals(1, lst.size()); + felix.startBundles(lst, false); + return lst.get(0); + } + + @SuppressWarnings({ "unchecked" }) + private static int callClass(Bundle bundle, String className) throws Exception { + Class certClass = bundle.loadClass(className); + assertNotNull(certClass); + Callable<Integer> cert = (Callable<Integer>)certClass.newInstance(); + assertNotNull(cert); + return cert.call(); + } + + private static void assertBundle(String bundleLocation, String className, String... expectedBundles) + throws Exception { + FelixFramework felix = TestDriver.newOsgiFramework(); + felix.start(); + try { + List<Bundle> bundles = felix.installBundle(bundleLocation); + List<String> actual = new LinkedList<>(); + for (Bundle bundle : bundles) { + actual.add(bundle.getSymbolicName()); + } + assertEquals(Arrays.asList(expectedBundles), actual); + felix.startBundles(bundles, false); + if (className != null) { + assertNotNull(bundles.get(0).loadClass(className).newInstance()); + } + } finally { + felix.stop(); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerIntegrationTest.java new file mode 100644 index 00000000000..f6f717df7fa --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerIntegrationTest.java @@ -0,0 +1,30 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import org.junit.Test; +import org.mockito.Mockito; +import org.osgi.framework.BundleContext; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class OsgiLogManagerIntegrationTest { + + @Test + public void requireThatRootLoggerLevelIsNotModifiedIfLoggerConfigIsGiven() { + Logger logger = Logger.getLogger(""); + logger.setLevel(Level.WARNING); + + OsgiLogManager.newInstance().install(Mockito.mock(BundleContext.class)); + + assertNotNull(System.getProperty("java.util.logging.config.file")); + assertEquals(Level.WARNING, logger.getLevel()); + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java new file mode 100644 index 00000000000..89420464f6f --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java @@ -0,0 +1,62 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.core; + +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogEntry; +import org.osgi.service.log.LogReaderService; + +import java.util.Enumeration; +import java.util.logging.Level; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class OsgiLogServiceIntegrationTest { + + @Test + @SuppressWarnings("unchecked") + public void requireThatAllSupportedLogFrameworksAreConfigured() throws Exception { + // need to explicitly set log level of root logger since integration suite now provides a logger config file, + // which disables that setLevel() call of the OsgiLogManager. + Logger.getLogger("").setLevel(Level.INFO); + + long now = System.currentTimeMillis(); + TestDriver driver = TestDriver.newApplicationBundleInstance("app-h-log.jar", false); + BundleContext ctx = driver.osgiFramework().bundleContext(); + ServiceReference ref = ctx.getServiceReference(LogReaderService.class.getName()); + LogReaderService reader = (LogReaderService)ctx.getService(ref); + Enumeration<LogEntry> log = (Enumeration<LogEntry>)reader.getLog(); + + assertEntry(Level.INFO, "[jdk14] hello world", null, now, log); + assertEntry(Level.INFO, "[slf4j] hello world", null, now, log); + assertEntry(Level.INFO, "[log4j] hello world", null, now, log); + assertEntry(Level.INFO, "[jcl] hello world", null, now, log); + + assertTrue(driver.close()); + } + + private static void assertEntry(Level expectedLevel, String expectedMessage, Throwable expectedException, + long expectedTimeGE, Enumeration<LogEntry> log) + { + assertTrue(log.hasMoreElements()); + LogEntry entry = log.nextElement(); + assertNotNull(entry); + System.err.println("log entry: "+entry.getMessage()+" bundle="+entry.getBundle()); + assertNull(entry.getBundle()); + assertNotNull(entry.getServiceReference()); + assertEquals(OsgiLogHandler.toServiceLevel(expectedLevel), entry.getLevel()); + assertEquals(expectedMessage, entry.getMessage()); + assertEquals(expectedException, entry.getException()); + assertTrue(expectedTimeGE <= entry.getTime()); + } +} diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/test/TestDriverIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/test/TestDriverIntegrationTest.java new file mode 100644 index 00000000000..75eed83f56b --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/test/TestDriverIntegrationTest.java @@ -0,0 +1,33 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.test; + +import com.google.inject.AbstractModule; +import com.google.inject.name.Names; +import org.junit.Test; + +import java.util.concurrent.CountDownLatch; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class TestDriverIntegrationTest { + + @Test + public void requireThatFactoryMethodsWork() { + TestDriver.newApplicationBundleInstance("app-a.jar", false, new MyModule()).close(); + TestDriver.newInstance(TestDriver.newOsgiFramework(), "app-a.jar", false, new MyModule()).close(); + } + + private static class MyModule extends AbstractModule { + + final CountDownLatch latch = new CountDownLatch(1); + + @Override + protected void configure() { + bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(latch); + bind(CountDownLatch.class).annotatedWith(Names.named("Start")).toInstance(latch); + bind(CountDownLatch.class).annotatedWith(Names.named("Stop")).toInstance(latch); + bind(CountDownLatch.class).annotatedWith(Names.named("Destroy")).toInstance(latch); + } + } +} diff --git a/jdisc_core_test/integration_test/src/test/resources/config.properties b/jdisc_core_test/integration_test/src/test/resources/config.properties new file mode 100644 index 00000000000..74d0a43fccf --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/resources/config.properties @@ -0,0 +1 @@ +foo=bar diff --git a/jdisc_core_test/integration_test/src/test/resources/logger.properties b/jdisc_core_test/integration_test/src/test/resources/logger.properties new file mode 100644 index 00000000000..cf5b037c599 --- /dev/null +++ b/jdisc_core_test/integration_test/src/test/resources/logger.properties @@ -0,0 +1 @@ +unknown.Logger.level = INFO diff --git a/jdisc_core_test/pom.xml b/jdisc_core_test/pom.xml new file mode 100644 index 00000000000..85b4d7c1c37 --- /dev/null +++ b/jdisc_core_test/pom.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa</groupId> + <artifactId>parent</artifactId> + <version>6-SNAPSHOT</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>parent</artifactId> + <version>6-SNAPSHOT</version> + <packaging>pom</packaging> + <name>${project.artifactId}</name> + <modules> + <module>integration_test</module> + <module>test_bundles</module> + </modules> +</project> diff --git a/jdisc_core_test/test_bundles/.gitignore b/jdisc_core_test/test_bundles/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-a/.gitignore b/jdisc_core_test/test_bundles/app-a/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-a/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-a/pom.xml b/jdisc_core_test/test_bundles/app-a/pom.xml new file mode 100644 index 00000000000..e8671307b72 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-a/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-a</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationA + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-a/src/main/java/com/yahoo/jdisc/bundle/ApplicationA.java b/jdisc_core_test/test_bundles/app-a/src/main/java/com/yahoo/jdisc/bundle/ApplicationA.java new file mode 100644 index 00000000000..d2a63c1b0e2 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-a/src/main/java/com/yahoo/jdisc/bundle/ApplicationA.java @@ -0,0 +1,45 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import com.yahoo.jdisc.application.Application; + +import java.util.concurrent.CountDownLatch; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationA implements Application { + + private final CountDownLatch startLatch; + private final CountDownLatch stopLatch; + private final CountDownLatch destroyLatch; + + @Inject + public ApplicationA(@Named("Init") CountDownLatch initLatch, + @Named("Start") CountDownLatch startLatch, + @Named("Stop") CountDownLatch stopLatch, + @Named("Destroy") CountDownLatch destroyLatch) + { + this.startLatch = startLatch; + this.stopLatch = stopLatch; + this.destroyLatch = destroyLatch; + initLatch.countDown(); + } + + @Override + public void start() { + startLatch.countDown(); + } + + @Override + public void stop() { + stopLatch.countDown(); + } + + @Override + public void destroy() { + destroyLatch.countDown(); + } +} diff --git a/jdisc_core_test/test_bundles/app-b-priv/.gitignore b/jdisc_core_test/test_bundles/app-b-priv/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-b-priv/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-b-priv/pom.xml b/jdisc_core_test/test_bundles/app-b-priv/pom.xml new file mode 100644 index 00000000000..efaf189d2c4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-b-priv/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-b-priv</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Privileged-Activator> + true + </X-JDisc-Privileged-Activator> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationB + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-b-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationB.java b/jdisc_core_test/test_bundles/app-b-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationB.java new file mode 100644 index 00000000000..777556e0934 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-b-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationB.java @@ -0,0 +1,45 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import com.yahoo.jdisc.application.Application; + +import java.util.concurrent.CountDownLatch; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationB implements Application { + + private final CountDownLatch startLatch; + private final CountDownLatch stopLatch; + private final CountDownLatch destroyLatch; + + @Inject + public ApplicationB(@Named("Init") CountDownLatch initLatch, + @Named("Start") CountDownLatch startLatch, + @Named("Stop") CountDownLatch stopLatch, + @Named("Destroy") CountDownLatch destroyLatch) + { + this.startLatch = startLatch; + this.stopLatch = stopLatch; + this.destroyLatch = destroyLatch; + initLatch.countDown(); + } + + @Override + public void start() { + startLatch.countDown(); + } + + @Override + public void stop() { + stopLatch.countDown(); + } + + @Override + public void destroy() { + destroyLatch.countDown(); + } +} diff --git a/jdisc_core_test/test_bundles/app-ca/.gitignore b/jdisc_core_test/test_bundles/app-ca/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ca/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-ca/pom.xml b/jdisc_core_test/test_bundles/app-ca/pom.xml new file mode 100644 index 00000000000..487dc99f928 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ca/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-ca</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-a.jar + </X-JDisc-Preinstall-Bundle> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationC + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-ca/src/main/java/com/yahoo/jdisc/bundle/ApplicationC.java b/jdisc_core_test/test_bundles/app-ca/src/main/java/com/yahoo/jdisc/bundle/ApplicationC.java new file mode 100644 index 00000000000..769baf3a1e2 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ca/src/main/java/com/yahoo/jdisc/bundle/ApplicationC.java @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.application.Application; +import com.yahoo.jdisc.bundle.a.CertificateA; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationC implements Application { + + private final CertificateA certificateA = new CertificateA(); + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-dj/.gitignore b/jdisc_core_test/test_bundles/app-dj/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-dj/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-dj/pom.xml b/jdisc_core_test/test_bundles/app-dj/pom.xml new file mode 100644 index 00000000000..5b244cd8ae4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-dj/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-dj</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-j-priv</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-j-priv.jar + </X-JDisc-Preinstall-Bundle> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationD + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-dj/src/main/java/com/yahoo/jdisc/bundle/ApplicationD.java b/jdisc_core_test/test_bundles/app-dj/src/main/java/com/yahoo/jdisc/bundle/ApplicationD.java new file mode 100644 index 00000000000..f9976d006e7 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-dj/src/main/java/com/yahoo/jdisc/bundle/ApplicationD.java @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.application.Application; +import com.yahoo.jdisc.bundle.j.CertificateJ; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationD implements Application { + + private final CertificateJ certificateJ = new CertificateJ(); + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-ej-priv/.gitignore b/jdisc_core_test/test_bundles/app-ej-priv/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ej-priv/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-ej-priv/pom.xml b/jdisc_core_test/test_bundles/app-ej-priv/pom.xml new file mode 100644 index 00000000000..ffc856506b4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ej-priv/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-ej-priv</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-j-priv</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Privileged-Activator> + true + </X-JDisc-Privileged-Activator> + <X-JDisc-Preinstall-Bundle> + cert-j-priv.jar + </X-JDisc-Preinstall-Bundle> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationE + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-ej-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationE.java b/jdisc_core_test/test_bundles/app-ej-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationE.java new file mode 100644 index 00000000000..288ca0aac8a --- /dev/null +++ b/jdisc_core_test/test_bundles/app-ej-priv/src/main/java/com/yahoo/jdisc/bundle/ApplicationE.java @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.application.Application; +import com.yahoo.jdisc.bundle.j.CertificateJ; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationE implements Application { + + private final CertificateJ certificateJ = new CertificateJ(); + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-f-more/.gitignore b/jdisc_core_test/test_bundles/app-f-more/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-f-more/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-f-more/pom.xml b/jdisc_core_test/test_bundles/app-f-more/pom.xml new file mode 100644 index 00000000000..e55f15b85d4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-f-more/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-f-more</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationF, + com.yahoo.jdisc.bundle.ApplicationF + </X-JDisc-Application> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-f-more/src/main/java/com/yahoo/jdisc/bundle/ApplicationF.java b/jdisc_core_test/test_bundles/app-f-more/src/main/java/com/yahoo/jdisc/bundle/ApplicationF.java new file mode 100644 index 00000000000..48d86e5ab89 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-f-more/src/main/java/com/yahoo/jdisc/bundle/ApplicationF.java @@ -0,0 +1,25 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.application.Application; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationF implements Application { + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-g-act/.gitignore b/jdisc_core_test/test_bundles/app-g-act/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-g-act/pom.xml b/jdisc_core_test/test_bundles/app-g-act/pom.xml new file mode 100644 index 00000000000..7b5b1d513e0 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-g-act</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationG + </X-JDisc-Application> + <Bundle-Activator> + com.yahoo.jdisc.bundle.MyBundleActivator + </Bundle-Activator> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/ApplicationG.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/ApplicationG.java new file mode 100644 index 00000000000..92bda7c6c2e --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/ApplicationG.java @@ -0,0 +1,25 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.application.Application; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class ApplicationG implements Application { + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public void destroy() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java new file mode 100644 index 00000000000..29ce713f606 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java @@ -0,0 +1,34 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.service.CurrentContainer; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class MyBundleActivator implements BundleActivator { + + private MyService service; + private ServiceRegistration registration; + + @Override + public void start(BundleContext ctx) throws Exception { + ServiceReference containerRef = ctx.getServiceReference(CurrentContainer.class.getName()); + service = new MyService((CurrentContainer)ctx.getService(containerRef)); + registration = ctx.registerService(MyService.class.getName(), service, null); + } + + @Override + public void stop(BundleContext ctx) throws Exception { + if (registration != null) { + registration.unregister(); + } + if (service != null) { + service.release(); + } + } +} diff --git a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyService.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyService.java new file mode 100644 index 00000000000..07bb4018e01 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyService.java @@ -0,0 +1,25 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.service.AbstractServerProvider; +import com.yahoo.jdisc.service.CurrentContainer; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class MyService extends AbstractServerProvider { + + public MyService(CurrentContainer container) { + super(container); + } + + @Override + public void start() { + + } + + @Override + public void close() { + + } +} diff --git a/jdisc_core_test/test_bundles/app-h-log/.gitignore b/jdisc_core_test/test_bundles/app-h-log/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-h-log/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/app-h-log/pom.xml b/jdisc_core_test/test_bundles/app-h-log/pom.xml new file mode 100644 index 00000000000..6288c9c790c --- /dev/null +++ b/jdisc_core_test/test_bundles/app-h-log/pom.xml @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>app-h-log</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Application> + com.yahoo.jdisc.bundle.ApplicationH + </X-JDisc-Application> + <Import-Package> + com.google.inject, + com.google.inject.name, + com.yahoo.jdisc.application, + com.yahoo.jdisc.service, + org.slf4j, + org.apache.commons.logging, + org.apache.log4j, + </Import-Package> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/app-h-log/src/main/java/com/yahoo/jdisc/bundle/ApplicationH.java b/jdisc_core_test/test_bundles/app-h-log/src/main/java/com/yahoo/jdisc/bundle/ApplicationH.java new file mode 100644 index 00000000000..32a52bc5e95 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-h-log/src/main/java/com/yahoo/jdisc/bundle/ApplicationH.java @@ -0,0 +1,27 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.google.inject.Inject; +import com.yahoo.jdisc.application.AbstractApplication; +import com.yahoo.jdisc.application.BundleInstaller; +import com.yahoo.jdisc.application.ContainerActivator; +import com.yahoo.jdisc.service.CurrentContainer; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class ApplicationH extends AbstractApplication { + + @Inject + public ApplicationH(BundleInstaller bundleInstaller, ContainerActivator activator, CurrentContainer container) { + super(bundleInstaller, activator, container); + } + + @Override + public void start() { + org.apache.commons.logging.LogFactory.getLog("jcl").info("[jcl] hello world"); + org.apache.log4j.Logger.getLogger("log4j").info("[log4j] hello world"); + org.slf4j.LoggerFactory.getLogger("slf4j").info("[slf4j] hello world"); + java.util.logging.Logger.getLogger("jdk14").info("[jdk14] hello world"); + } +} diff --git a/jdisc_core_test/test_bundles/cert-a/.gitignore b/jdisc_core_test/test_bundles/cert-a/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-a/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-a/pom.xml b/jdisc_core_test/test_bundles/cert-a/pom.xml new file mode 100644 index 00000000000..18a7b765a56 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-a/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-a</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle.a + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-a/src/main/java/com/yahoo/jdisc/bundle/a/CertificateA.java b/jdisc_core_test/test_bundles/cert-a/src/main/java/com/yahoo/jdisc/bundle/a/CertificateA.java new file mode 100644 index 00000000000..500273a215a --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-a/src/main/java/com/yahoo/jdisc/bundle/a/CertificateA.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.a; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateA { + +} diff --git a/jdisc_core_test/test_bundles/cert-b/.gitignore b/jdisc_core_test/test_bundles/cert-b/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-b/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-b/pom.xml b/jdisc_core_test/test_bundles/cert-b/pom.xml new file mode 100644 index 00000000000..c9f965d7ae1 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-b/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-b</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle.b + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-b/src/main/java/com/yahoo/jdisc/bundle/b/CertificateB.java b/jdisc_core_test/test_bundles/cert-b/src/main/java/com/yahoo/jdisc/bundle/b/CertificateB.java new file mode 100644 index 00000000000..bf55855f09f --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-b/src/main/java/com/yahoo/jdisc/bundle/b/CertificateB.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.b; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateB { + +} diff --git a/jdisc_core_test/test_bundles/cert-ca/.gitignore b/jdisc_core_test/test_bundles/cert-ca/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ca/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-ca/pom.xml b/jdisc_core_test/test_bundles/cert-ca/pom.xml new file mode 100644 index 00000000000..f94022b2ce9 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ca/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-ca</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-a.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.c + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-ca/src/main/java/com/yahoo/jdisc/bundle/c/CertificateC.java b/jdisc_core_test/test_bundles/cert-ca/src/main/java/com/yahoo/jdisc/bundle/c/CertificateC.java new file mode 100644 index 00000000000..f1ca5591787 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ca/src/main/java/com/yahoo/jdisc/bundle/c/CertificateC.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.c; + +import com.yahoo.jdisc.bundle.a.CertificateA; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateC { + + private final CertificateA certificateA = new CertificateA(); +} diff --git a/jdisc_core_test/test_bundles/cert-dc/.gitignore b/jdisc_core_test/test_bundles/cert-dc/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-dc/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-dc/pom.xml b/jdisc_core_test/test_bundles/cert-dc/pom.xml new file mode 100644 index 00000000000..f26c2a6a783 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-dc/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-dc</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ca</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-ca.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.d + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-dc/src/main/java/com/yahoo/jdisc/bundle/d/CertificateD.java b/jdisc_core_test/test_bundles/cert-dc/src/main/java/com/yahoo/jdisc/bundle/d/CertificateD.java new file mode 100644 index 00000000000..8cc473a278b --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-dc/src/main/java/com/yahoo/jdisc/bundle/d/CertificateD.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.d; + +import com.yahoo.jdisc.bundle.c.CertificateC; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateD { + + private final CertificateC certificateC = new CertificateC(); +} diff --git a/jdisc_core_test/test_bundles/cert-eab/.gitignore b/jdisc_core_test/test_bundles/cert-eab/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-eab/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-eab/pom.xml b/jdisc_core_test/test_bundles/cert-eab/pom.xml new file mode 100644 index 00000000000..0f21559410b --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-eab/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-eab</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-b</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-a.jar, + cert-b.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.e + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-eab/src/main/java/com/yahoo/jdisc/bundle/e/CertificateE.java b/jdisc_core_test/test_bundles/cert-eab/src/main/java/com/yahoo/jdisc/bundle/e/CertificateE.java new file mode 100644 index 00000000000..a8e2d7d1d07 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-eab/src/main/java/com/yahoo/jdisc/bundle/e/CertificateE.java @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.e; + +import com.yahoo.jdisc.bundle.a.CertificateA; +import com.yahoo.jdisc.bundle.b.CertificateB; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateE { + + private final CertificateA certificateA = new CertificateA(); + private final CertificateB certificateB = new CertificateB(); +} diff --git a/jdisc_core_test/test_bundles/cert-fac/.gitignore b/jdisc_core_test/test_bundles/cert-fac/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-fac/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-fac/pom.xml b/jdisc_core_test/test_bundles/cert-fac/pom.xml new file mode 100644 index 00000000000..77ce09a727f --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-fac/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-fac</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ca</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-a.jar, + cert-ca.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.f + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-fac/src/main/java/com/yahoo/jdisc/bundle/f/CertificateF.java b/jdisc_core_test/test_bundles/cert-fac/src/main/java/com/yahoo/jdisc/bundle/f/CertificateF.java new file mode 100644 index 00000000000..c989932887a --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-fac/src/main/java/com/yahoo/jdisc/bundle/f/CertificateF.java @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.f; + +import com.yahoo.jdisc.bundle.a.CertificateA; +import com.yahoo.jdisc.bundle.c.CertificateC; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateF { + + private final CertificateA certificateA = new CertificateA(); + private final CertificateC certificateC = new CertificateC(); +} diff --git a/jdisc_core_test/test_bundles/cert-gg/.gitignore b/jdisc_core_test/test_bundles/cert-gg/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-gg/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-gg/pom.xml b/jdisc_core_test/test_bundles/cert-gg/pom.xml new file mode 100644 index 00000000000..263b77b2c25 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-gg/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-gg</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-gg.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.g + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-gg/src/main/java/com/yahoo/jdisc/bundle/g/CertificateG.java b/jdisc_core_test/test_bundles/cert-gg/src/main/java/com/yahoo/jdisc/bundle/g/CertificateG.java new file mode 100644 index 00000000000..aeddce96fc2 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-gg/src/main/java/com/yahoo/jdisc/bundle/g/CertificateG.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.g; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateG { + +} diff --git a/jdisc_core_test/test_bundles/cert-hi/.gitignore b/jdisc_core_test/test_bundles/cert-hi/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-hi/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-hi/pom.xml b/jdisc_core_test/test_bundles/cert-hi/pom.xml new file mode 100644 index 00000000000..d9e396e42bb --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-hi/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-hi</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-ih.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.h + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-hi/src/main/java/com/yahoo/jdisc/bundle/h/CertificateH.java b/jdisc_core_test/test_bundles/cert-hi/src/main/java/com/yahoo/jdisc/bundle/h/CertificateH.java new file mode 100644 index 00000000000..b38f4215472 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-hi/src/main/java/com/yahoo/jdisc/bundle/h/CertificateH.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.h; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateH { + +} diff --git a/jdisc_core_test/test_bundles/cert-ih/.gitignore b/jdisc_core_test/test_bundles/cert-ih/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ih/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-ih/pom.xml b/jdisc_core_test/test_bundles/cert-ih/pom.xml new file mode 100644 index 00000000000..af06801759f --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ih/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-ih</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-hi.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.i + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-ih/src/main/java/com/yahoo/jdisc/bundle/i/CertificateI.java b/jdisc_core_test/test_bundles/cert-ih/src/main/java/com/yahoo/jdisc/bundle/i/CertificateI.java new file mode 100644 index 00000000000..9414086de7a --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ih/src/main/java/com/yahoo/jdisc/bundle/i/CertificateI.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.i; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateI { + +} diff --git a/jdisc_core_test/test_bundles/cert-j-priv/.gitignore b/jdisc_core_test/test_bundles/cert-j-priv/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-j-priv/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-j-priv/pom.xml b/jdisc_core_test/test_bundles/cert-j-priv/pom.xml new file mode 100644 index 00000000000..d1f288d353c --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-j-priv/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-j-priv</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Privileged-Activator> + true + </X-JDisc-Privileged-Activator> + <Export-Package> + com.yahoo.jdisc.bundle.j + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-j-priv/src/main/java/com/yahoo/jdisc/bundle/j/CertificateJ.java b/jdisc_core_test/test_bundles/cert-j-priv/src/main/java/com/yahoo/jdisc/bundle/j/CertificateJ.java new file mode 100644 index 00000000000..d92c3728cc9 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-j-priv/src/main/java/com/yahoo/jdisc/bundle/j/CertificateJ.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.j; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateJ { + +} diff --git a/jdisc_core_test/test_bundles/cert-k-pkgs/.gitignore b/jdisc_core_test/test_bundles/cert-k-pkgs/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-k-pkgs/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-k-pkgs/pom.xml b/jdisc_core_test/test_bundles/cert-k-pkgs/pom.xml new file mode 100644 index 00000000000..d77981e879d --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-k-pkgs/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-k-pkgs</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle.k + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java b/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java new file mode 100644 index 00000000000..547f2a2d312 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java @@ -0,0 +1,222 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.k; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +@SuppressWarnings({ "UnusedDeclaration", "deprecation" }) +public class CertificateK { + + private final com.google.common.annotations.Beta beta = null; + private final com.google.common.base.Ascii ascii = null; + private final com.google.common.cache.CacheStats stats = null; + private final com.google.common.collect.BoundType boundType = null; + private final com.google.common.eventbus.DeadEvent deadEvent = null; + private final com.google.common.hash.Funnels funnels = null; + private final com.google.common.io.ByteArrayDataInput dataInput = null; + private final com.google.common.math.BigIntegerMath math = null; + private final com.google.common.net.HostAndPort hostAndPort = null; + private final com.google.common.primitives.Booleans booleans = null; + private final com.google.common.reflect.Reflection reflection = null; + private final com.google.common.util.concurrent.AbstractIdleService idleService = null; + private final com.google.inject.AbstractModule module = null; + private final com.google.inject.assistedinject.Assisted assisted = null; + private final com.google.inject.binder.AnnotatedConstantBindingBuilder builder = null; + private final com.google.inject.matcher.Matchers matchers = null; + private final com.google.inject.multibindings.MapBinder<String, String> mapBinder = null; + private final com.google.inject.name.Named named = null; + private final com.google.inject.spi.Elements elements = null; + private final com.google.inject.util.Modules modules = null; + private final com.yahoo.config.BooleanNode node = null; + private final com.yahoo.jdisc.AbstractResource resource = null; + private final com.yahoo.jdisc.application.AbstractApplication application = null; + private final com.yahoo.jdisc.handler.AbstractRequestHandler handler = null; + private final com.yahoo.jdisc.service.AbstractClientProvider client = null; + private final com.yahoo.yolean.chain.Chain chain = null; + private final com.yahoo.yolean.concurrent.ThreadRobustList robustList = null; + private final com.yahoo.yolean.trace.TraceNode traceNode = null; + private final com.sun.security.auth.LdapPrincipal principal = null; + private final com.sun.security.auth.module.JndiLoginModule jndiLoginModule = null; + private final javax.accessibility.Accessible accessible = null; + private final javax.activation.CommandInfo commandInfo = null; + private final javax.activity.ActivityCompletedException activityCompletedException = null; + private final javax.annotation.PostConstruct postConstruct = null; + private final javax.annotation.processing.FilerException filerException = null; + private final javax.crypto.BadPaddingException badPaddingException = null; + private final javax.crypto.interfaces.DHKey dhKey = null; + private final javax.crypto.spec.DHParameterSpec dhParameterSpec = null; + private final javax.imageio.IIOException iioException = null; + private final javax.imageio.event.IIOReadProgressListener iioReadProgressListener = null; + private final javax.imageio.metadata.IIOInvalidTreeException iioInvalidTreeException = null; + private final javax.imageio.plugins.bmp.BMPImageWriteParam bmpImageWriteParam = null; + private final javax.imageio.plugins.jpeg.JPEGHuffmanTable jpegHuffmanTable = null; + private final javax.imageio.spi.IIORegistry iioRegistry = null; + private final javax.imageio.stream.FileCacheImageInputStream fileCacheImageInputStream = null; + private final javax.jws.HandlerChain handlerChain = null; + private final javax.jws.soap.SOAPBinding soapBinding = null; + private final javax.lang.model.SourceVersion sourceVersion = null; + private final javax.lang.model.element.AnnotationMirror annotationMirror = null; + private final javax.lang.model.type.ArrayType arrayType = null; + private final javax.lang.model.util.AbstractAnnotationValueVisitor6 abstractAnnotationValueVisitor6 = null; + private final javax.management.Attribute attribute = null; + private final javax.management.loading.ClassLoaderRepository classLoaderRepository = null; + private final javax.management.modelmbean.DescriptorSupport descriptorSupport = null; + private final javax.management.monitor.CounterMonitor counterMonitor = null; + private final javax.management.openmbean.CompositeData compositeData = null; + private final javax.management.relation.InvalidRelationIdException invalidRelationIdException = null; + private final javax.management.remote.JMXAddressable jmxAddressable = null; + private final javax.management.remote.rmi.RMIConnection rmiConnection = null; + private final javax.management.timer.Timer timer = null; + private final javax.naming.AuthenticationException authenticationException = null; + private final javax.naming.directory.AttributeInUseException attributeInUseException = null; + private final javax.naming.event.EventContext eventContext = null; + private final javax.naming.ldap.BasicControl basicControl = null; + private final javax.naming.spi.DirectoryManager directoryManager = null; + private final javax.net.ServerSocketFactory serverSocketFactory = null; + private final javax.net.ssl.CertPathTrustManagerParameters certPathTrustManagerParameters = null; + private final javax.print.AttributeException attributeException = null; + private final javax.print.attribute.AttributeSet attributeSet = null; + private final javax.print.attribute.standard.Chromaticity chromaticity = null; + private final javax.print.event.PrintEvent printEvent = null; + private final javax.rmi.PortableRemoteObject portableRemoteObject = null; + private final javax.rmi.CORBA.ClassDesc classDesc = null; + private final javax.rmi.ssl.SslRMIClientSocketFactory sslRMIClientSocketFactory = null; + private final javax.script.AbstractScriptEngine abstractScriptEngine = null; + private final javax.security.auth.AuthPermission authPermission = null; + private final javax.security.auth.callback.ChoiceCallback choiceCallback = null; + private final javax.security.auth.kerberos.DelegationPermission delegationPermission = null; + private final javax.security.auth.login.AccountException accountException = null; + private final javax.security.auth.spi.LoginModule loginModule = null; + private final javax.security.auth.x500.X500Principal x500Principal = null; + private final javax.security.cert.Certificate certificate = null; + private final javax.security.sasl.AuthorizeCallback authorizeCallback = null; + private final javax.sound.midi.ControllerEventListener controllerEventListener = null; + private final javax.sound.midi.spi.MidiDeviceProvider midiDeviceProvider = null; + private final javax.sound.sampled.AudioFileFormat audioFileFormat = null; + private final javax.sound.sampled.spi.AudioFileReader audioFileReader = null; + private final javax.sql.CommonDataSource commonDataSource = null; + private final javax.sql.rowset.BaseRowSet baseRowSet = null; + private final javax.sql.rowset.serial.SerialArray serialArray = null; + private final javax.sql.rowset.spi.SyncFactory syncFactory = null; + private final javax.swing.AbstractAction abstractAction = null; + private final javax.swing.border.AbstractBorder abstractBorder = null; + private final javax.swing.colorchooser.AbstractColorChooserPanel abstractColorChooserPanel = null; + private final javax.swing.event.AncestorEvent ancestorEvent = null; + private final javax.swing.filechooser.FileFilter fileFilter = null; + private final javax.swing.plaf.ActionMapUIResource actionMapUIResource = null; + private final javax.swing.plaf.basic.BasicArrowButton basicArrowButton = null; + private final javax.swing.plaf.metal.DefaultMetalTheme defaultMetalTheme = null; + private final javax.swing.plaf.multi.MultiButtonUI multiButtonUI = null; + private final javax.swing.plaf.synth.ColorType colorType = null; + private final javax.swing.table.AbstractTableModel abstractTableModel = null; + private final javax.swing.text.AbstractDocument abstractDocument = null; + private final javax.swing.text.html.BlockView blockView = null; + private final javax.swing.text.html.parser.AttributeList attributeList = null; + private final javax.swing.text.rtf.RTFEditorKit rtfEditorKit = null; + private final javax.swing.tree.AbstractLayoutCache abstractLayoutCache = null; + private final javax.swing.undo.AbstractUndoableEdit abstractUndoableEdit = null; + private final javax.tools.FileObject fileObject = null; + private final javax.transaction.InvalidTransactionException invalidTransactionException = null; + private final javax.transaction.xa.XAException xaException = null; + private final javax.xml.XMLConstants xmlConstants = null; + private final javax.xml.bind.DataBindingException dataBindingException = null; + private final javax.xml.bind.annotation.DomHandler domHandler = null; + private final javax.xml.bind.annotation.adapters.CollapsedStringAdapter collapsedStringAdapter = null; + private final javax.xml.bind.attachment.AttachmentMarshaller attachmentMarshaller = null; + private final javax.xml.bind.helpers.AbstractMarshallerImpl abstractMarshaller = null; + private final javax.xml.bind.util.JAXBResult jaxbResult = null; + private final javax.xml.crypto.AlgorithmMethod algorithmMethod = null; + private final javax.xml.crypto.dom.DOMCryptoContext domCryptoContext = null; + private final javax.xml.crypto.dsig.CanonicalizationMethod canonicalizationMethod = null; + private final javax.xml.crypto.dsig.dom.DOMSignContext domSignContext = null; + private final javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo = null; + private final javax.xml.crypto.dsig.spec.C14NMethodParameterSpec c14NMethodParameterSpec = null; + private final javax.xml.datatype.DatatypeConfigurationException datatypeConfigurationException = null; + private final javax.xml.namespace.NamespaceContext namespaceContext = null; + private final javax.xml.parsers.DocumentBuilder documentBuilder = null; + private final javax.xml.soap.AttachmentPart attachmentPartt = null; + private final javax.xml.stream.EventFilter eventFilter = null; + private final javax.xml.stream.events.Characters characters = null; + private final javax.xml.stream.util.EventReaderDelegate eventReaderDelegate = null; + private final javax.xml.transform.ErrorListener errorListener = null; + private final javax.xml.transform.dom.DOMLocator domLocator = null; + private final javax.xml.transform.sax.SAXResult saxResult = null; + private final javax.xml.transform.stax.StAXResult stAXResult = null; + private final javax.xml.transform.stream.StreamResult streamResult = null; + private final javax.xml.validation.Schema schema = null; + private final javax.xml.ws.Action action = null; + private final javax.xml.ws.handler.HandlerResolver handlerResolver = null; + private final javax.xml.ws.handler.soap.SOAPMessageContext soapMessageContext = null; + private final javax.xml.ws.http.HTTPBinding httpBinding = null; + private final javax.xml.ws.soap.AddressingFeature addressingFeature = null; + private final javax.xml.ws.spi.Provider provider = null; + private final javax.xml.ws.wsaddressing.W3CEndpointReference w3CEndpointReference = null; + private final javax.xml.xpath.XPath xPath = null; + private final org.aopalliance.intercept.Joinpoint jointpoint = null; + private final org.aopalliance.aop.Advice advice = null; + private final org.apache.commons.daemon.Daemon daemon = null; + private final org.apache.commons.daemon.support.DaemonLoader daemonLoader = null; + private final org.apache.commons.logging.LogFactory logFactory = null; + private final org.apache.commons.logging.impl.SimpleLog simpleLog = null; + private final org.apache.log4j.Appender appender = null; + private final org.apache.log4j.helpers.LogLog logLog = null; + private final org.apache.log4j.spi.ErrorHandler errorHandler = null; + private final org.apache.log4j.xml.DOMConfigurator configurator = null; + private final org.ietf.jgss.ChannelBinding channelBinding = null; + private final org.omg.CORBA.Any any = null; + private final org.omg.CORBA_2_3.ORB orb = null; + private final org.omg.CORBA_2_3.portable.InputStream inputStream = null; + private final org.omg.CORBA.DynAnyPackage.Invalid invalid = null; + private final org.omg.CORBA.ORBPackage.InvalidName invalidName = null; + private final org.omg.CORBA.portable.ApplicationException applicationException = null; + private final org.omg.CORBA.TypeCodePackage.BadKind badKind = null; + private final org.omg.CosNaming.Binding binding = null; + private final org.omg.CosNaming.NamingContextExtPackage.AddressHelper addressHelper = null; + private final org.omg.CosNaming.NamingContextPackage.AlreadyBound alreadyBound = null; + private final org.omg.Dynamic.Parameter parameter = null; + private final org.omg.DynamicAny.AnySeqHelper anySeqHelper = null; + private final org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode inconsistentTypeCode = null; + private final org.omg.DynamicAny.DynAnyPackage.InvalidValue invalidValue = null; + private final org.omg.IOP.Codec codex = null; + private final org.omg.IOP.CodecFactoryPackage.UnknownEncoding unknownEncoding = null; + private final org.omg.IOP.CodecPackage.FormatMismatch formatMismatch = null; + private final org.omg.Messaging.SyncScopeHelper syncScopeHelper = null; + private final org.omg.PortableInterceptor.AdapterManagerIdHelper adapterManagerIdHelper = null; + private final org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName duplicateName = null; + private final org.omg.PortableServer.AdapterActivator adapterActivator = null; + private final org.omg.PortableServer.CurrentPackage.NoContext noContext = null; + private final org.omg.PortableServer.POAManagerPackage.AdapterInactive adapterInactive = null; + private final org.omg.PortableServer.POAPackage.AdapterAlreadyExists adapterAlreadyExists = null; + private final org.omg.PortableServer.portable.Delegate delegate = null; + private final org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookieHolder = null; + private final org.omg.SendingContext.RunTime runTime = null; + private final org.omg.stub.java.rmi._Remote_Stub remote_stub = null; + private final org.osgi.framework.AdminPermission permission = null; + private final org.osgi.framework.hooks.service.FindHook hook = null; + private final org.osgi.framework.launch.Framework framework = null; + private final org.osgi.service.log.LogEntry entry = null; + private final org.osgi.service.packageadmin.ExportedPackage pkg = null; + private final org.osgi.service.startlevel.StartLevel level = null; + private final org.osgi.service.url.URLConstants constants = null; + private final org.osgi.util.tracker.BundleTracker tracker = null; + private final org.slf4j.ILoggerFactory loggerFactory = null; + private final org.slf4j.spi.LocationAwareLogger locationAwareLogger = null; + private final org.slf4j.helpers.BasicMarker basicMarker = null; + private final org.slf4j.impl.StaticLoggerBinder staticLoggerBinder = null; + private final org.w3c.dom.Attr attr = null; + private final org.w3c.dom.bootstrap.DOMImplementationRegistry domImplementationRegistry = null; + private final org.w3c.dom.css.Counter counter = null; + private final org.w3c.dom.events.EventException eventException = null; + private final org.w3c.dom.html.HTMLAnchorElement htmlAnchorElement = null; + private final org.w3c.dom.ls.DOMImplementationLS domImplementationLS = null; + private final org.w3c.dom.ranges.DocumentRange documentRange = null; + private final org.w3c.dom.stylesheets.DocumentStyle documentStyle = null; + private final org.w3c.dom.traversal.DocumentTraversal documentTraversal = null; + private final org.w3c.dom.views.DocumentView documentView = null; + private final org.xml.sax.ContentHandler contentHandler = null; + private final org.xml.sax.ext.Attributes2Impl attributes2 = null; + private final org.xml.sax.helpers.AttributesImpl attributes = null; + private final sun.misc.ASCIICaseInsensitiveComparator comparator = null; + private final sun.net.util.IPAddressUtil ipaddressutil = null; + private final sun.security.krb5.Checksum checksum = null; +} diff --git a/jdisc_core_test/test_bundles/cert-l1/.gitignore b/jdisc_core_test/test_bundles/cert-l1/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l1/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-l1/pom.xml b/jdisc_core_test/test_bundles/cert-l1/pom.xml new file mode 100644 index 00000000000..b281a5c03da --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l1/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-l1</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle.l + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-l1/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java b/jdisc_core_test/test_bundles/cert-l1/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java new file mode 100644 index 00000000000..ac6fc234f6d --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l1/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.l; + +import java.util.concurrent.Callable; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateL implements Callable<Integer> { + + @Override + public Integer call() throws Exception { + return 1; + } +} diff --git a/jdisc_core_test/test_bundles/cert-l2/.gitignore b/jdisc_core_test/test_bundles/cert-l2/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l2/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-l2/pom.xml b/jdisc_core_test/test_bundles/cert-l2/pom.xml new file mode 100644 index 00000000000..9f0740bb68f --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l2/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-l2</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle.l + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-l2/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java b/jdisc_core_test/test_bundles/cert-l2/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java new file mode 100644 index 00000000000..768ef61a1bc --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-l2/src/main/java/com/yahoo/jdisc/bundle/l/CertificateL.java @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.l; + +import java.util.concurrent.Callable; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateL implements Callable<Integer> { + + @Override + public Integer call() throws Exception { + return 2; + } +} diff --git a/jdisc_core_test/test_bundles/cert-ml/.gitignore b/jdisc_core_test/test_bundles/cert-ml/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ml/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-ml/pom.xml b/jdisc_core_test/test_bundles/cert-ml/pom.xml new file mode 100644 index 00000000000..b32402730dc --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ml/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-ml</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package> + com.yahoo.jdisc.bundle.l + </Import-Package> + <Export-Package> + com.yahoo.jdisc.bundle.m + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-ml/src/main/java/com/yahoo/jdisc/bundle/m/CertificateM.java b/jdisc_core_test/test_bundles/cert-ml/src/main/java/com/yahoo/jdisc/bundle/m/CertificateM.java new file mode 100644 index 00000000000..a921059c47a --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-ml/src/main/java/com/yahoo/jdisc/bundle/m/CertificateM.java @@ -0,0 +1,18 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.m; + +import java.util.concurrent.Callable; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateM implements Callable<Integer> { + + @Override + @SuppressWarnings({ "unchecked" }) + public Integer call() throws Exception { + Class certClass = Class.forName("com.yahoo.jdisc.bundle.l.CertificateL"); + Callable<Integer> cert = (Callable<Integer>)certClass.newInstance(); + return cert.call(); + } +} diff --git a/jdisc_core_test/test_bundles/cert-nac/.gitignore b/jdisc_core_test/test_bundles/cert-nac/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-nac/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-nac/pom.xml b/jdisc_core_test/test_bundles/cert-nac/pom.xml new file mode 100644 index 00000000000..f111a8ef585 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-nac/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-nac</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-ca</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + file:./target/../target/./dependency/../dependency/cert-a.jar, + cert-ca.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.n + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-nac/src/main/java/com/yahoo/jdisc/bundle/n/CertificateN.java b/jdisc_core_test/test_bundles/cert-nac/src/main/java/com/yahoo/jdisc/bundle/n/CertificateN.java new file mode 100644 index 00000000000..53a39b96f84 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-nac/src/main/java/com/yahoo/jdisc/bundle/n/CertificateN.java @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.n; + +import com.yahoo.jdisc.bundle.a.CertificateA; +import com.yahoo.jdisc.bundle.c.CertificateC; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateN { + + private final CertificateA certificateA = new CertificateA(); + private final CertificateC certificateC = new CertificateC(); +} diff --git a/jdisc_core_test/test_bundles/cert-oa-path/.gitignore b/jdisc_core_test/test_bundles/cert-oa-path/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-oa-path/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-oa-path/pom.xml b/jdisc_core_test/test_bundles/cert-oa-path/pom.xml new file mode 100644 index 00000000000..7c26b6b71e6 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-oa-path/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-oa-path</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-a</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + file:target/cert-a.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.o + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-oa-path/src/main/java/com/yahoo/jdisc/bundle/o/CertificateO.java b/jdisc_core_test/test_bundles/cert-oa-path/src/main/java/com/yahoo/jdisc/bundle/o/CertificateO.java new file mode 100644 index 00000000000..50c69fe84f3 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-oa-path/src/main/java/com/yahoo/jdisc/bundle/o/CertificateO.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.o; + +import com.yahoo.jdisc.bundle.a.CertificateA; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateO { + + private final CertificateA certificateA = new CertificateA(); +} diff --git a/jdisc_core_test/test_bundles/cert-p-jar/.gitignore b/jdisc_core_test/test_bundles/cert-p-jar/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-p-jar/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-p-jar/pom.xml b/jdisc_core_test/test_bundles/cert-p-jar/pom.xml new file mode 100644 index 00000000000..70e8e770e2b --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-p-jar/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-p-jar</artifactId> + <version>6-SNAPSHOT</version> + <packaging>jar</packaging> + <name>${project.artifactId}</name> +</project> diff --git a/jdisc_core_test/test_bundles/cert-p-jar/src/main/java/com/yahoo/jdisc/bundle/p/CertificateP.java b/jdisc_core_test/test_bundles/cert-p-jar/src/main/java/com/yahoo/jdisc/bundle/p/CertificateP.java new file mode 100644 index 00000000000..2e3aeaa82a4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-p-jar/src/main/java/com/yahoo/jdisc/bundle/p/CertificateP.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.p; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateP { + +} diff --git a/jdisc_core_test/test_bundles/cert-q-frag/.gitignore b/jdisc_core_test/test_bundles/cert-q-frag/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-q-frag/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-q-frag/pom.xml b/jdisc_core_test/test_bundles/cert-q-frag/pom.xml new file mode 100644 index 00000000000..b93d6b50902 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-q-frag/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-q-frag</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Fragment-Host> + system.bundle; extension:=framework + </Fragment-Host> + <Export-Package> + com.yahoo.jdisc.bundle.q + </Export-Package> + <Import-Package> + !com.yahoo.jdisc.bundle.q + </Import-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-q-frag/src/main/java/com/yahoo/jdisc/bundle/q/CertificateQ.java b/jdisc_core_test/test_bundles/cert-q-frag/src/main/java/com/yahoo/jdisc/bundle/q/CertificateQ.java new file mode 100644 index 00000000000..463e6be3e23 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-q-frag/src/main/java/com/yahoo/jdisc/bundle/q/CertificateQ.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.q; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateQ { + +} diff --git a/jdisc_core_test/test_bundles/cert-rq/.gitignore b/jdisc_core_test/test_bundles/cert-rq/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-rq/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-rq/pom.xml b/jdisc_core_test/test_bundles/cert-rq/pom.xml new file mode 100644 index 00000000000..7f85ac69ea1 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-rq/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-rq</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-q-frag</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-q-frag.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.r + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-rq/src/main/java/com/yahoo/jdisc/bundle/r/CertificateR.java b/jdisc_core_test/test_bundles/cert-rq/src/main/java/com/yahoo/jdisc/bundle/r/CertificateR.java new file mode 100644 index 00000000000..00a39a78d46 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-rq/src/main/java/com/yahoo/jdisc/bundle/r/CertificateR.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.r; + +import com.yahoo.jdisc.bundle.q.CertificateQ; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateR { + + private final CertificateQ certificateQ = new CertificateQ(); +} diff --git a/jdisc_core_test/test_bundles/cert-s-act/.gitignore b/jdisc_core_test/test_bundles/cert-s-act/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-s-act/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-s-act/pom.xml b/jdisc_core_test/test_bundles/cert-s-act/pom.xml new file mode 100644 index 00000000000..7dd018010a6 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-s-act/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-s-act</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator> + com.yahoo.jdisc.bundle.s.MyBundleActivator + </Bundle-Activator> + <Export-Package> + com.yahoo.jdisc.bundle.s + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/CertificateS.java b/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/CertificateS.java new file mode 100644 index 00000000000..5eb034b6f43 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/CertificateS.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.s; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateS { + +} diff --git a/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/MyBundleActivator.java b/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/MyBundleActivator.java new file mode 100644 index 00000000000..f12381acf24 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-s-act/src/main/java/com/yahoo/jdisc/bundle/s/MyBundleActivator.java @@ -0,0 +1,28 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.s; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class MyBundleActivator implements BundleActivator { + + @Override + public void start(BundleContext ctx) throws Exception { + ServiceReference ref = ctx.getServiceReference(RuntimeException.class); + if (ref != null) { + throw (RuntimeException)ctx.getService(ref); + } + } + + @Override + public void stop(BundleContext ctx) throws Exception { + ServiceReference ref = ctx.getServiceReference(RuntimeException.class); + if (ref != null) { + throw (RuntimeException)ctx.getService(ref); + } + } +} diff --git a/jdisc_core_test/test_bundles/cert-tp/.gitignore b/jdisc_core_test/test_bundles/cert-tp/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-tp/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-tp/pom.xml b/jdisc_core_test/test_bundles/cert-tp/pom.xml new file mode 100644 index 00000000000..0ecb54a5c3f --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-tp/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-tp</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-p-jar</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-p-jar.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.t + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-tp/src/main/java/com/yahoo/jdisc/bundle/t/CertificateT.java b/jdisc_core_test/test_bundles/cert-tp/src/main/java/com/yahoo/jdisc/bundle/t/CertificateT.java new file mode 100644 index 00000000000..94e871bfa23 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-tp/src/main/java/com/yahoo/jdisc/bundle/t/CertificateT.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.t; + +import com.yahoo.jdisc.bundle.p.CertificateP; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateT { + + private final CertificateP certificateP = new CertificateP(); +} diff --git a/jdisc_core_test/test_bundles/cert-us/.gitignore b/jdisc_core_test/test_bundles/cert-us/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-us/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/cert-us/pom.xml b/jdisc_core_test/test_bundles/cert-us/pom.xml new file mode 100644 index 00000000000..6491248734b --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-us/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>cert-us</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>cert-s-act</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <X-JDisc-Preinstall-Bundle> + cert-s-act.jar + </X-JDisc-Preinstall-Bundle> + <Export-Package> + com.yahoo.jdisc.bundle.u + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/cert-us/src/main/java/com/yahoo/jdisc/bundle/u/CertificateU.java b/jdisc_core_test/test_bundles/cert-us/src/main/java/com/yahoo/jdisc/bundle/u/CertificateU.java new file mode 100644 index 00000000000..52efc00edee --- /dev/null +++ b/jdisc_core_test/test_bundles/cert-us/src/main/java/com/yahoo/jdisc/bundle/u/CertificateU.java @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.u; + +import com.yahoo.jdisc.bundle.s.CertificateS; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class CertificateU { + + private final CertificateS certificateS = new CertificateS(); +} diff --git a/jdisc_core_test/test_bundles/my-bundle-activator/.gitignore b/jdisc_core_test/test_bundles/my-bundle-activator/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml b/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml new file mode 100644 index 00000000000..e9c3ea85b40 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>my-bundle-activator</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-Activator> + com.yahoo.jdisc.bundle.MyBundleActivator + </Bundle-Activator> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java new file mode 100644 index 00000000000..a7e4984a367 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java @@ -0,0 +1,39 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.yahoo.jdisc.service.CurrentContainer; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class MyBundleActivator implements BundleActivator { + + private ServiceRegistration registration; + + @Override + public void start(BundleContext ctx) throws Exception { + ServiceReference seviceRef = ctx.getServiceReference(CurrentContainer.class.getName()); + if (seviceRef == null) { + throw new IllegalStateException("Service reference '" + CurrentContainer.class.getName() + "' not found."); + } + Object service = ctx.getService(seviceRef); + if (service == null) { + throw new IllegalStateException("Service '" + CurrentContainer.class.getName() + "' not found."); + } + if (!(service instanceof CurrentContainer)) { + throw new IllegalStateException("Expected " + CurrentContainer.class + ", got " + service.getClass() + "."); + } + registration = ctx.registerService(MyService.class.getName(), new MyService(), null); + } + + @Override + public void stop(BundleContext ctx) throws Exception { + if (registration != null) { + registration.unregister(); + } + } +} diff --git a/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyService.java b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyService.java new file mode 100644 index 00000000000..b6fc6877a02 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyService.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a> + */ +public class MyService { + +} diff --git a/jdisc_core_test/test_bundles/my-guice-module/.gitignore b/jdisc_core_test/test_bundles/my-guice-module/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-guice-module/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/my-guice-module/pom.xml b/jdisc_core_test/test_bundles/my-guice-module/pom.xml new file mode 100644 index 00000000000..cf7f689b07b --- /dev/null +++ b/jdisc_core_test/test_bundles/my-guice-module/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>my-guice-module</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/my-guice-module/src/main/java/com/yahoo/jdisc/bundle/MyGuiceModule.java b/jdisc_core_test/test_bundles/my-guice-module/src/main/java/com/yahoo/jdisc/bundle/MyGuiceModule.java new file mode 100644 index 00000000000..62f98f74b00 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-guice-module/src/main/java/com/yahoo/jdisc/bundle/MyGuiceModule.java @@ -0,0 +1,29 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.google.inject.AbstractModule; +import com.google.inject.Inject; +import com.google.inject.name.Named; + +import java.util.concurrent.CountDownLatch; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class MyGuiceModule extends AbstractModule { + + private final CountDownLatch configLatch; + + @Inject + public MyGuiceModule(@Named("Init") CountDownLatch initLatch, + @Named("Config") CountDownLatch configLatch) + { + this.configLatch = configLatch; + initLatch.countDown(); + } + + @Override + protected void configure() { + configLatch.countDown(); + } +} diff --git a/jdisc_core_test/test_bundles/my-server-provider/.gitignore b/jdisc_core_test/test_bundles/my-server-provider/.gitignore new file mode 100644 index 00000000000..3cc25b51fc4 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-server-provider/.gitignore @@ -0,0 +1,2 @@ +/pom.xml.build +/target diff --git a/jdisc_core_test/test_bundles/my-server-provider/pom.xml b/jdisc_core_test/test_bundles/my-server-provider/pom.xml new file mode 100644 index 00000000000..97d9a4258f1 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-server-provider/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>my-server-provider</artifactId> + <version>6-SNAPSHOT</version> + <packaging>bundle</packaging> + <name>${project.artifactId}</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + com.yahoo.jdisc.bundle + </Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java b/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java new file mode 100644 index 00000000000..0e332b5d715 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java @@ -0,0 +1,46 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import com.yahoo.jdisc.AbstractResource; +import com.yahoo.jdisc.service.ServerProvider; + +import java.util.concurrent.CountDownLatch; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class MyServerProvider extends AbstractResource implements ServerProvider { + + private final CountDownLatch startLatch; + private final CountDownLatch closeLatch; + private final CountDownLatch destroyLatch; + + @Inject + public MyServerProvider(@Named("Init") CountDownLatch initLatch, + @Named("Start") CountDownLatch startLatch, + @Named("Close") CountDownLatch closeLatch, + @Named("Destroy") CountDownLatch destroyLatch) + { + this.startLatch = startLatch; + this.closeLatch = closeLatch; + this.destroyLatch = destroyLatch; + initLatch.countDown(); + } + + @Override + public void start() { + startLatch.countDown(); + } + + @Override + public void close() { + closeLatch.countDown(); + } + + @Override + protected void destroy() { + destroyLatch.countDown(); + } +} diff --git a/jdisc_core_test/test_bundles/pom.xml b/jdisc_core_test/test_bundles/pom.xml new file mode 100644 index 00000000000..546d2e441fe --- /dev/null +++ b/jdisc_core_test/test_bundles/pom.xml @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa.jdisc_core</groupId> + <artifactId>parent</artifactId> + <version>6-SNAPSHOT</version> + </parent> + <artifactId>test_bundles</artifactId> + <version>6-SNAPSHOT</version> + <packaging>pom</packaging> + <name>${project.artifactId}</name> + <dependencies> + <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>jdisc_core</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + </plugins> + </build> + <modules> + <module>app-a</module> + <module>app-b-priv</module> + <module>app-ca</module> + <module>app-dj</module> + <module>app-ej-priv</module> + <module>app-f-more</module> + <module>app-g-act</module> + <module>app-h-log</module> + <module>cert-a</module> + <module>cert-b</module> + <module>cert-ca</module> + <module>cert-dc</module> + <module>cert-eab</module> + <module>cert-fac</module> + <module>cert-gg</module> + <module>cert-hi</module> + <module>cert-ih</module> + <module>cert-j-priv</module> + <module>cert-k-pkgs</module> + <module>cert-l1</module> + <module>cert-l2</module> + <module>cert-ml</module> + <module>cert-nac</module> + <module>cert-oa-path</module> + <module>cert-p-jar</module> + <module>cert-q-frag</module> + <module>cert-rq</module> + <module>cert-s-act</module> + <module>cert-tp</module> + <module>cert-us</module> + <module>my-bundle-activator</module> + <module>my-guice-module</module> + <module>my-server-provider</module> + </modules> +</project> |