From 66f479c351c593e63f36039c4d85c7f02a8f5b03 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Tue, 25 Sep 2018 11:53:40 +0200 Subject: Create separate packages for activator test bundles. - When running tests in IntelliJ, classes from the two bundles are confused. --- jdisc_core_test/test_bundles/app-g-act/pom.xml | 6 ++-- .../java/com/yahoo/jdisc/bundle/ApplicationG.java | 25 -------------- .../com/yahoo/jdisc/bundle/MyBundleActivator.java | 34 ------------------- .../java/com/yahoo/jdisc/bundle/MyService.java | 25 -------------- .../com/yahoo/jdisc/bundle/g_act/ApplicationG.java | 25 ++++++++++++++ .../jdisc/bundle/g_act/MyBundleActivator.java | 34 +++++++++++++++++++ .../com/yahoo/jdisc/bundle/g_act/MyService.java | 25 ++++++++++++++ .../test_bundles/my-bundle-activator/pom.xml | 4 +-- .../com/yahoo/jdisc/bundle/MyBundleActivator.java | 39 ---------------------- .../java/com/yahoo/jdisc/bundle/MyService.java | 9 ----- .../jdisc/bundle/my_act/MyBundleActivator.java | 39 ++++++++++++++++++++++ .../com/yahoo/jdisc/bundle/my_act/MyService.java | 9 +++++ 12 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/ApplicationG.java delete mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java delete mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyService.java create mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/ApplicationG.java create mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyBundleActivator.java create mode 100644 jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyService.java delete mode 100644 jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java delete mode 100644 jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyService.java create mode 100644 jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyBundleActivator.java create mode 100644 jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyService.java (limited to 'jdisc_core_test/test_bundles') diff --git a/jdisc_core_test/test_bundles/app-g-act/pom.xml b/jdisc_core_test/test_bundles/app-g-act/pom.xml index b91b95f9fdd..aaa740efade 100644 --- a/jdisc_core_test/test_bundles/app-g-act/pom.xml +++ b/jdisc_core_test/test_bundles/app-g-act/pom.xml @@ -23,13 +23,13 @@ - com.yahoo.jdisc.bundle.ApplicationG + com.yahoo.jdisc.bundle.g_act.ApplicationG - com.yahoo.jdisc.bundle.MyBundleActivator + com.yahoo.jdisc.bundle.g_act.MyBundleActivator - com.yahoo.jdisc.bundle + com.yahoo.jdisc.bundle.g_act 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 deleted file mode 100644 index 9b4d7501ac0..00000000000 --- a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/ApplicationG.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. 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 Simon Thoresen Hult - */ -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 deleted file mode 100644 index 51a95b8e3a9..00000000000 --- a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 Yahoo Holdings. 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 Simon Thoresen Hult - */ -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 deleted file mode 100644 index a5cb9be9a47..00000000000 --- a/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/MyService.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. 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 Simon Thoresen Hult - */ -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-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/ApplicationG.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/ApplicationG.java new file mode 100644 index 00000000000..02a9cd5a542 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/ApplicationG.java @@ -0,0 +1,25 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.g_act; + +import com.yahoo.jdisc.application.Application; + +/** + * @author Simon Thoresen Hult + */ +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/g_act/MyBundleActivator.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyBundleActivator.java new file mode 100644 index 00000000000..c60f4939409 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyBundleActivator.java @@ -0,0 +1,34 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.g_act; + +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 Simon Thoresen Hult + */ +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/g_act/MyService.java b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyService.java new file mode 100644 index 00000000000..518f7304100 --- /dev/null +++ b/jdisc_core_test/test_bundles/app-g-act/src/main/java/com/yahoo/jdisc/bundle/g_act/MyService.java @@ -0,0 +1,25 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.g_act; + +import com.yahoo.jdisc.service.AbstractServerProvider; +import com.yahoo.jdisc.service.CurrentContainer; + +/** + * @author Simon Thoresen Hult + */ +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/my-bundle-activator/pom.xml b/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml index 531af08b915..8931c26a73e 100644 --- a/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml +++ b/jdisc_core_test/test_bundles/my-bundle-activator/pom.xml @@ -23,10 +23,10 @@ - com.yahoo.jdisc.bundle.MyBundleActivator + com.yahoo.jdisc.bundle.my_act.MyBundleActivator - com.yahoo.jdisc.bundle + com.yahoo.jdisc.bundle.my_act 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 deleted file mode 100644 index b4af03bdf60..00000000000 --- a/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyBundleActivator.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 Yahoo Holdings. 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 Simon Thoresen Hult - */ -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 deleted file mode 100644 index 8eb1543776d..00000000000 --- a/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/MyService.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.jdisc.bundle; - -/** - * @author Simon Thoresen Hult - */ -public class MyService { - -} diff --git a/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyBundleActivator.java b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyBundleActivator.java new file mode 100644 index 00000000000..4212fc2fd09 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyBundleActivator.java @@ -0,0 +1,39 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.my_act; + +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 Simon Thoresen Hult + */ +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/my_act/MyService.java b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyService.java new file mode 100644 index 00000000000..b24ee137f59 --- /dev/null +++ b/jdisc_core_test/test_bundles/my-bundle-activator/src/main/java/com/yahoo/jdisc/bundle/my_act/MyService.java @@ -0,0 +1,9 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.bundle.my_act; + +/** + * @author Simon Thoresen Hult + */ +public class MyService { + +} -- cgit v1.2.3