diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9f997047da..9e17491aa5 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -61,9 +61,6 @@ updates: - dependency-name: "org.mockito:mockito*" versions: - ">=5.0.0" # does not support java 8 - - dependency-name: "org.eclipse:osgi" # should be upgraded to org.eclipse.platform:org.eclipse.osgi - versions: - - ">=3.9.1" # higher version removed CompositeBundle used by some artifacts - dependency-name: "org.ops4j.pax.cdi:pax-cdi*" versions: - ">=1.0.0" # pax-cdi is only used in blueprint maven plugin as an optional annotation provider and it's changed in version 1.x in incompatible way - blueprint-maven-plugin-annotation should be used instead since provides annotations more focused on blueprint elements diff --git a/.github/workflows/subsystem.yml b/.github/workflows/subsystem.yml index d087695da2..1bcf8288be 100644 --- a/.github/workflows/subsystem.yml +++ b/.github/workflows/subsystem.yml @@ -17,9 +17,11 @@ on: paths: - parent/** - testsupport/** + - proxy/** - versioning/** - util/** - - application/** + - quiesce/** + - blueprint/** - subsystem/** - .github/workflows/subsystem.yml push: @@ -53,12 +55,21 @@ jobs: - name: Build testsupport shell: bash run: mvn -U -e -B -ntp -Dmaven.test.skip=true clean install -f testsupport + - name: Build proxy + shell: bash + run: mvn -U -e -B -ntp -Dmaven.test.skip=true clean install -f proxy - name: Build versioning shell: bash run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f versioning - name: Build util shell: bash run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f util + - name: Build quiesce + shell: bash + run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f quiesce + - name: Build blueprint + shell: bash + run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f blueprint - name: Build subsystem shell: bash run: mvn -U -e -B -ntp clean install -f subsystem diff --git a/blueprint/blueprint-core/pom.xml b/blueprint/blueprint-core/pom.xml index e1211789b0..1cdda2df68 100644 --- a/blueprint/blueprint-core/pom.xml +++ b/blueprint/blueprint-core/pom.xml @@ -108,7 +108,7 @@ 1.1.1 1.1.9 1.0.0 - 1.1.3 + 2.0.0-SNAPSHOT 2.0.17 diff --git a/blueprint/blueprint-parent/pom.xml b/blueprint/blueprint-parent/pom.xml index f855ea3f80..660fcbfaec 100644 --- a/blueprint/blueprint-parent/pom.xml +++ b/blueprint/blueprint-parent/pom.xml @@ -55,7 +55,7 @@ 1.3.3-SNAPSHOT 1.10.4-SNAPSHOT 1.1.1-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 1.6.2-SNAPSHOT 1.0.1-SNAPSHOT 1.0.1-SNAPSHOT diff --git a/blueprint/blueprint-repository/pom.xml b/blueprint/blueprint-repository/pom.xml index 97f342971b..763046f628 100644 --- a/blueprint/blueprint-repository/pom.xml +++ b/blueprint/blueprint-repository/pom.xml @@ -42,7 +42,7 @@ 6.4.0 1.0.1 1.0.6 - 1.1.3 + 2.0.0-SNAPSHOT diff --git a/blueprint/blueprint-web/pom.xml b/blueprint/blueprint-web/pom.xml index 54f42e8735..c455641fbc 100644 --- a/blueprint/blueprint-web/pom.xml +++ b/blueprint/blueprint-web/pom.xml @@ -48,7 +48,7 @@ 1.1.1 1.1.0 - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 1.5.0 1.2 2.0.17 diff --git a/jndi/parent/pom.xml b/jndi/parent/pom.xml index 5f593ca8b9..24d75d40a1 100644 --- a/jndi/parent/pom.xml +++ b/jndi/parent/pom.xml @@ -52,7 +52,7 @@ 1.0.1-SNAPSHOT 1.0.1-SNAPSHOT 1.0.1-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 1.1.1 1.1.14 1.0.1 diff --git a/quiesce/quiesce-manager-itest/pom.xml b/quiesce/quiesce-manager-itest/pom.xml index 0af5d788cf..b701ff239d 100644 --- a/quiesce/quiesce-manager-itest/pom.xml +++ b/quiesce/quiesce-manager-itest/pom.xml @@ -45,7 +45,7 @@ 1.0.1-SNAPSHOT 1.0.1-SNAPSHOT 2.0.0-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 3.23.0 4.13.5 2.6.16 @@ -128,8 +128,8 @@ org.apache.aries org.apache.aries.util - test ${org.apache.aries.util.version} + test diff --git a/quiesce/quiesce-manager/pom.xml b/quiesce/quiesce-manager/pom.xml index 7e624fada4..20d5a662ee 100644 --- a/quiesce/quiesce-manager/pom.xml +++ b/quiesce/quiesce-manager/pom.xml @@ -58,7 +58,7 @@ 1.0.0 1.0.1-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT diff --git a/samples/ariestrader/assemblies/equinox-test-harness/pom.xml b/samples/ariestrader/assemblies/equinox-test-harness/pom.xml index 892be99528..4bcd0375dc 100644 --- a/samples/ariestrader/assemblies/equinox-test-harness/pom.xml +++ b/samples/ariestrader/assemblies/equinox-test-harness/pom.xml @@ -30,7 +30,7 @@ pom - 3.5.0.v20090520 + 3.23.0 @@ -39,9 +39,9 @@ External Dependencies --> - org.eclipse - osgi - ${osgi.version} + org.eclipse.platform + org.eclipse.osgi + ${org.eclipse.osgi.version} org.eclipse.equinox diff --git a/samples/blueprint/helloworld/helloworld-assembly/pom.xml b/samples/blueprint/helloworld/helloworld-assembly/pom.xml index 9d3edbf594..00d3f795d6 100644 --- a/samples/blueprint/helloworld/helloworld-assembly/pom.xml +++ b/samples/blueprint/helloworld/helloworld-assembly/pom.xml @@ -29,17 +29,16 @@ pom - 3.5.0.v20090520 + 3.23.0 3.2.0-v20070116 3.1.200-v20070605 - - org.eclipse - osgi - ${osgi.version} + org.eclipse.platform + org.eclipse.osgi + ${org.eclipse.osgi.version} diff --git a/subsystem/subsystem-api/pom.xml b/subsystem/subsystem-api/pom.xml index 0b1a068502..73e3e31167 100644 --- a/subsystem/subsystem-api/pom.xml +++ b/subsystem/subsystem-api/pom.xml @@ -54,7 +54,7 @@ * - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 8.1.0 6.0.0 5.0.0 diff --git a/subsystem/subsystem-bundle/pom.xml b/subsystem/subsystem-bundle/pom.xml index 6a503d82b1..000c11a06b 100644 --- a/subsystem/subsystem-bundle/pom.xml +++ b/subsystem/subsystem-bundle/pom.xml @@ -66,7 +66,7 @@ 1.1.0 2.0.10 2.0.10 - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 2.0.4 1.1.0.v20120522-1841 1.2.101.v20150831-1342 diff --git a/subsystem/subsystem-core/pom.xml b/subsystem/subsystem-core/pom.xml index a5b64961af..b410f3211e 100644 --- a/subsystem/subsystem-core/pom.xml +++ b/subsystem/subsystem-core/pom.xml @@ -68,7 +68,7 @@ 2.0.10 - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 1.0.0-SNAPSHOT 6.0.0 5.0.0 diff --git a/subsystem/subsystem-itests/pom.xml b/subsystem/subsystem-itests/pom.xml index 353837dd8f..886dfad89f 100644 --- a/subsystem/subsystem-itests/pom.xml +++ b/subsystem/subsystem-itests/pom.xml @@ -46,14 +46,14 @@ 3.4.2 3.5.3 1.0.0-SNAPSHOT - 1.2.0 - 1.1.0 + 1.10.4-SNAPSHOT + 1.1.9 2.0.11-SNAPSHOT 2.0.11-SNAPSHOT 1.0.0-SNAPSHOT 1.0.5-SNAPSHOT 2.0.0-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 2.0.10 1.9.26 1.2.200.v20120522-2049 diff --git a/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java b/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java index d70f15d73e..ff6ead266a 100644 --- a/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java +++ b/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java @@ -118,7 +118,7 @@ public Option baseOptions() { return composite( junitBundles(), addPaxLoggingBundles(), - setPaxExamLogLevel("INFO"), + setPaxExamLogLevel("DEBUG"), configurePaxUrlLocalMavenRepoIfNeeded(), setupRemoteDebugging() ); diff --git a/subsystem/subsystem-modeller/pom.xml b/subsystem/subsystem-modeller/pom.xml index 05f7e442d7..16ee827021 100644 --- a/subsystem/subsystem-modeller/pom.xml +++ b/subsystem/subsystem-modeller/pom.xml @@ -57,10 +57,10 @@ 0.3.2-SNAPSHOT - 1.2.0 + 1.10.4-SNAPSHOT 1.0.0 2.0.0-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 4.3.1 4.3.1 @@ -85,6 +85,11 @@ org.apache.aries.blueprint.core ${org.apache.aries.blueprint.core.version} + + org.apache.aries + org.apache.aries.util + ${org.apache.aries.util.version} + org.osgi @@ -111,8 +116,8 @@ org.apache.aries.testsupport org.apache.aries.testsupport.unit - test ${org.apache.aries.testsupport.unit.version} + test diff --git a/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java b/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java index 4cc48d544c..be9a89f68a 100644 --- a/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java +++ b/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java @@ -102,7 +102,7 @@ private Filter generateAttributeFilter (Map attrsToPopulate) thr reducedBlueprintFilter = _blueprintFilter; } - attrsToPopulate.put(ManifestHeaderProcessor.NESTED_FILTER_ATTRIBUTE, reducedBlueprintFilter); + attrsToPopulate.put(ManifestHeaderProcessor.NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING, reducedBlueprintFilter); } if (_componentName != null) { attrsToPopulate.put ("osgi.service.blueprint.compname", _componentName); diff --git a/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java b/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java index ad20ef3905..a0898b6bbe 100644 --- a/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java +++ b/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java @@ -69,7 +69,7 @@ public static ParserProxy getMockParserServiceProxy() { BundleContext mockCtx = Skeleton.newMock(new BundleContextMock(), BundleContext.class); NamespaceHandlerRegistry nhri = new NamespaceHandlerRegistryImpl (mockCtx); - ParserService parserService = new ParserServiceImpl(nhri); + ParserService parserService = new ParserServiceImpl(nhri, true); mockCtx.registerService(ParserService.class.getName(), parserService, new Hashtable()); ParserProxyImpl parserProxyService = new ParserProxyImpl(); diff --git a/util/pom.xml b/util/pom.xml index dbab0ca775..52d641e0a6 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -30,7 +30,7 @@ org.apache.aries.util bundle - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT Apache Aries Util This bundle contains the OSGi common util for Apache Aries @@ -52,9 +52,7 @@ org.osgi.framework.launch;resolution:=optional, org.osgi.framework.wiring.*;resolution:=optional, org.osgi.service.framework;resolution:=optional, - org.eclipse.osgi.internal.loader;resolution:=optional, org.eclipse.osgi.framework.internal.core;resolution:=optional, - org.eclipse.osgi.framework.adaptor;resolution:=optional, org.osgi.service.log;resolution:=optional, * @@ -68,7 +66,7 @@ 3.11.2 1.0.0 - 3.9.1-v20140110-1610 + 3.23.0 @@ -83,9 +81,9 @@ provided - org.eclipse - osgi - ${osgi.version} + org.eclipse.platform + org.eclipse.osgi + ${org.eclipse.osgi.version} provided diff --git a/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java b/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java index f648ff0849..1bac5808b5 100644 --- a/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java +++ b/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java @@ -36,11 +36,6 @@ public class ManifestHeaderProcessor { - /** - * @deprecated use {@link #NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING} - */ - @Deprecated - public static final String NESTED_FILTER_ATTRIBUTE = "org.apache.aries.application.filter.attribute"; public static final String NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING = "org.apache.aries.manifestheaderprocessor.filter.attribute"; private static final Pattern FILTER_ATTR = Pattern.compile("(\\(!)?\\((.*?)([<>]?=)(.*?)\\)\\)?"); private static final String LESS_EQ_OP = "<="; @@ -569,7 +564,7 @@ public static String generateFilter(Map attribs) { } filter.append(")"); - } else if (NESTED_FILTER_ATTRIBUTE.equals(attribName) || NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING.equals(attribName)) { + } else if (NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING.equals(attribName)) { // Filters go in whole, no formatting needed realAttrib = true; filter.append(attrib.getValue()); diff --git a/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java b/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java deleted file mode 100644 index 4d29cb41f8..0000000000 --- a/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.aries.util.tracker; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.service.framework.CompositeBundle; -import org.osgi.util.tracker.BundleTracker; -import org.osgi.util.tracker.BundleTrackerCustomizer; - -/** - * A BundleTracker which will track bundles in the given context, and also - * bundles in any child contexts. This should be used instead of the - * normal non-recursive BundleTracker when registering bundle tracker - * customizers. - */ -@SuppressWarnings({"rawtypes", "unchecked"}) -public class InternalRecursiveBundleTracker extends BundleTracker -{ - private final int mask; - - private final ConcurrentMap alreadyRecursedContexts = new ConcurrentHashMap(); - - private final BundleTrackerCustomizer customizer; - - private final boolean nested; - - public InternalRecursiveBundleTracker(BundleContext context, int stateMask, - BundleTrackerCustomizer customizer, boolean nested) - { - super(context, stateMask, null); - mask = stateMask; - this.customizer = customizer; - this.nested = nested; - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#addingBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent) - */ - @Override - public Object addingBundle(Bundle b, BundleEvent event) - { - Object o = null; - - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, false); - o = b; - } else if (nested) { - // Delegate to our customizer for normal bundles - if (customizer != null) { - o = customizer.addingBundle(b, event); - } - } - - return o; - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#modifiedBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent, java.lang.Object) - */ - @Override - public void modifiedBundle(Bundle b, BundleEvent event, Object object) - { - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, false); - } else { - // Delegate to our customizer for normal bundles - if (customizer != null) { - customizer.modifiedBundle(b, event, object); - } - } - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#removedBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent, java.lang.Object) - */ - @Override - public void removedBundle(Bundle b, BundleEvent event, Object object) - { - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, true); - } else { - if (customizer != null) { - customizer.removedBundle(b, event, object); - } - } - } - - protected void customizedProcessBundle(BundleTrackerCustomizer btc, Bundle b, BundleEvent event, boolean removing) - { - if (b instanceof CompositeBundle) { - CompositeBundle cb = (CompositeBundle) b; - // check if the compositeBundle is already tracked in the - // BundleTrackerFactory - String bundleScope = cb.getSymbolicName() + "_" + cb.getVersion().toString(); - List btList = BundleTrackerFactory.getBundleTrackerList(bundleScope); - - // bundle is already active and there is no event associated - // this can happen when bundle is first time added to the tracker - // or when the tracker is being closed. - if (event == null && !removing) { - if (cb.getState() == Bundle.INSTALLED || cb.getState() == Bundle.RESOLVED || cb.getState() == Bundle.STARTING || cb.getState() == Bundle.ACTIVE) { - openTracker(btc, cb, bundleScope, mask); - } - } else { - // if we are removing, or the event is of the right type then we need to shutdown. - if (removing || event.getType() == BundleEvent.STOPPED || event.getType() == BundleEvent.UNRESOLVED || event.getType() == BundleEvent.UNINSTALLED) { - // if CompositeBundle is being stopped, let's remove the bundle - // tracker(s) associated with the composite bundle - String bundleId = b.getSymbolicName()+"/"+b.getVersion(); - alreadyRecursedContexts.remove(bundleId); - - if (btList != null) { - // unregister the bundlescope off the factory and close - // bundle trackers - BundleTrackerFactory.unregisterAndCloseBundleTracker(bundleScope); - } - } else if (event.getType() == BundleEvent.INSTALLED || event.getType() == BundleEvent.RESOLVED || event.getType() == BundleEvent.STARTING) { - openTracker(btc, cb, bundleScope, mask); - } - } - } - } - - private synchronized void openTracker(BundleTrackerCustomizer btc, CompositeBundle cb, - String bundleScope, int stateMask) - { - // let's process each of the bundle in the CompositeBundle - BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext(); - - String bundleId = cb.getSymbolicName()+"/"+cb.getVersion(); - if (alreadyRecursedContexts.putIfAbsent(bundleId, bundleId) == null) { - - // let's track each of the bundle in the CompositeBundle - BundleTracker bt = new InternalRecursiveBundleTracker(compositeBundleContext, stateMask, - customizer, true); - bt.open(); - BundleTrackerFactory.registerBundleTracker(bundleScope, bt); - } - } -} diff --git a/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java b/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java index ff28570eaa..ff009858bb 100644 --- a/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java +++ b/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java @@ -66,37 +66,14 @@ public RecursiveBundleTracker(BundleContext context, int stateMask, BundleTracke tracker = new BundleHookBundleTracker(context, stateMask, customizer); } catch (Throwable e) { } - if (areMultipleFrameworksAvailable(context)) { - compositeTracker = new InternalRecursiveBundleTracker(context, stateMask, customizer, tracker == null); - } else { - compositeTracker = null; - } - if (tracker == null && compositeTracker == null) { + compositeTracker = null; + if (tracker == null) { //R42 tracker = new BundleTracker(context, stateMask, customizer); } this.tracker = tracker; } - /* - * Checks whether or not the framework supports composite bundles. The only - * known supporting framework is Equinox. When the Equinox specific - * framework property osgi.resolverMode is set to "strict", the - * CompositeBundleFactory service is registered, but the x-internal - * org.osgi.service.framework package is not exported, thus the need for - * the additional Class.forName check. - */ - private static boolean areMultipleFrameworksAvailable(BundleContext context) { - String compositeBundleFactory = "org.osgi.service.framework.CompositeBundleFactory"; - try { - Class.forName(compositeBundleFactory); - } catch (ClassNotFoundException e) { - return false; - } - ServiceReference sr = context.getServiceReference(compositeBundleFactory); - return sr != null; - } - /** * Start tracking bundles that match the bit mask provided at creation time. * diff --git a/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java b/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java index b4e132d0c7..4d881fb760 100644 --- a/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java +++ b/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java @@ -18,77 +18,18 @@ */ package org.apache.aries.util; -import org.apache.aries.unittest.mocks.MethodCall; -import org.apache.aries.unittest.mocks.Skeleton; import org.apache.aries.util.tracker.BundleTrackerFactory; -import org.apache.aries.util.tracker.InternalRecursiveBundleTracker; import org.apache.aries.util.tracker.RecursiveBundleTracker; import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.Version; -import org.osgi.service.framework.CompositeBundle; -import org.osgi.util.tracker.BundleTrackerCustomizer; - -import static org.junit.Assert.*; public class RecursiveBundleTrackerTest { - BundleContext context; - InternalRecursiveBundleTracker sut; - - @Before - public void setup() { - context = Skeleton.newMock(BundleContext.class); - Skeleton.getSkeleton(context).setReturnValue( - new MethodCall(BundleContext.class, "getServiceReference", "org.osgi.service.framework.CompositeBundleFactory"), - Skeleton.newMock(ServiceReference.class)); - } - @After public void closeTrackes() { BundleTrackerFactory.unregisterAndCloseBundleTracker("test"); } - @Test - public void testCompositeLifeCycle() { - makeSUT(); - CompositeBundle cb = composite("test.composite", "1.0.0"); - assertNoTrackers(); - - // full lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.RESOLVED, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STARTING, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STARTED, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STOPPING, cb), cb); - sut.removedBundle(cb, new BundleEvent(BundleEvent.STOPPED, cb), cb); - assertNoTrackers(); - - // short lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.RESOLVED, cb), cb); - sut.removedBundle(cb, new BundleEvent(BundleEvent.UNRESOLVED, cb), cb); - assertNoTrackers(); - - // shortest lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.removedBundle(cb, new BundleEvent(BundleEvent.UNINSTALLED, cb), cb); - assertNoTrackers(); - } - @Test(expected=IllegalArgumentException.class) public void testMissingStopping() { @@ -104,31 +45,4 @@ public void testMissingStarting() { public void testMissingInstalled() { new RecursiveBundleTracker(null, Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING, null); } - - private void assertNoTrackers() { - assertTrue(BundleTrackerFactory.getAllBundleTracker().isEmpty()); - } - - private void assertTracker(CompositeBundle cb) { - assertEquals(1, BundleTrackerFactory.getAllBundleTracker().size()); - assertEquals(1, BundleTrackerFactory.getBundleTrackerList(cb.getSymbolicName()+"_"+cb.getVersion()).size()); - } - - @SuppressWarnings("rawtypes") - private void makeSUT() { - BundleTrackerCustomizer customizer = Skeleton.newMock(BundleTrackerCustomizer.class); - - sut = new InternalRecursiveBundleTracker(context, - Bundle.INSTALLED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING, customizer, true); - - sut.open(); - } - - private CompositeBundle composite(String symbolicName, String version) { - CompositeBundle cb = Skeleton.newMock(CompositeBundle.class); - Skeleton cbSkel = Skeleton.getSkeleton(cb); - cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getSymbolicName"), symbolicName); - cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getVersion"), new Version(version)); - return cb; - } } diff --git a/web/web-itests/pom.xml b/web/web-itests/pom.xml index 2ee843d397..c7e139613a 100644 --- a/web/web-itests/pom.xml +++ b/web/web-itests/pom.xml @@ -46,7 +46,7 @@ 9.8 1.5.0 2.0.0-SNAPSHOT - 1.2.0-SNAPSHOT + 2.0.0-SNAPSHOT 1.0.1-SNAPSHOT 1.9.26 3.23.0