This is an automated email from the ASF dual-hosted git repository. alien11689 pushed a commit to branch remove-unnecessary-dependencies-from-quiesce in repository https://gitbox.apache.org/repos/asf/aries.git
commit e701da44b93e613d0468e525617696690cff9101 Author: Dominik Przybysz <[email protected]> AuthorDate: Mon Feb 3 06:56:44 2025 +0100 [MAINTENANCE] Remove unnecessary dependencies from quiesce --- quiesce/quiesce-manager-itest/pom.xml | 51 +---------- .../quiesce/manager/itest/QuiesceManagerTest.java | 101 ++++++++++----------- 2 files changed, 49 insertions(+), 103 deletions(-) diff --git a/quiesce/quiesce-manager-itest/pom.xml b/quiesce/quiesce-manager-itest/pom.xml index 0113f2327..0b7a8d04d 100644 --- a/quiesce/quiesce-manager-itest/pom.xml +++ b/quiesce/quiesce-manager-itest/pom.xml @@ -40,19 +40,14 @@ </scm> <properties> - <commons-collections.version>3.2.2</commons-collections.version> - <commons-lang.version>2.6</commons-lang.version> - <commons-pool.version>1.6</commons-pool.version> <depends-maven-plugin.version>1.5.0</depends-maven-plugin.version> <org.apache.aries.quiesce.api.version>1.0.1-SNAPSHOT</org.apache.aries.quiesce.api.version> <org.apache.aries.quiesce.manager.version>1.0.1-SNAPSHOT</org.apache.aries.quiesce.manager.version> <org.apache.aries.testsupport.unit.version>2.0.0-SNAPSHOT</org.apache.aries.testsupport.unit.version> <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> - <org.apache.felix.configadmin.version>1.2.4</org.apache.felix.configadmin.version> - <org.apache.servicemix.bundles.serp.version>1.13.1_2</org.apache.servicemix.bundles.serp.version> <org.eclipse.osgi.version>3.22.0</org.eclipse.osgi.version> <pax-exam.version>4.13.5</pax-exam.version> - <pax-url-aether.version>2.5.3</pax-url-aether.version> + <pax-url-aether.version>2.6.16</pax-url-aether.version> </properties> <dependencies> @@ -79,13 +74,6 @@ <version>${org.apache.aries.testsupport.unit.version}</version> <scope>test</scope> </dependency> - <!-- - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <scope>provided</scope> - </dependency> - --> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.compendium</artifactId> @@ -142,43 +130,6 @@ <scope>test</scope> <version>${org.apache.aries.util.version}</version> </dependency> - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.configadmin</artifactId> - <version>${org.apache.felix.configadmin.version}</version> - <exclusions> - <exclusion> - <groupId>org.apache.felix</groupId> - <artifactId>org.osgi.compendium</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.felix</groupId> - <artifactId>org.osgi.core</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>${commons-lang.version}</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <scope>test</scope> - <version>${commons-collections.version}</version> - </dependency> - <dependency> - <groupId>commons-pool</groupId> - <artifactId>commons-pool</artifactId> - <scope>test</scope> - <version>${commons-pool.version}</version> - </dependency> - <dependency> - <groupId>org.apache.servicemix.bundles</groupId> - <artifactId>org.apache.servicemix.bundles.serp</artifactId> - <version>${org.apache.servicemix.bundles.serp.version}</version> - </dependency> </dependencies> <build> diff --git a/quiesce/quiesce-manager-itest/src/test/java/org/apache/aries/quiesce/manager/itest/QuiesceManagerTest.java b/quiesce/quiesce-manager-itest/src/test/java/org/apache/aries/quiesce/manager/itest/QuiesceManagerTest.java index 60a05b377..d8612394b 100644 --- a/quiesce/quiesce-manager-itest/src/test/java/org/apache/aries/quiesce/manager/itest/QuiesceManagerTest.java +++ b/quiesce/quiesce-manager-itest/src/test/java/org/apache/aries/quiesce/manager/itest/QuiesceManagerTest.java @@ -15,13 +15,6 @@ */ package org.apache.aries.quiesce.manager.itest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - import org.apache.aries.itest.AbstractIntegrationTest; import org.apache.aries.quiesce.manager.QuiesceManager; import org.apache.aries.quiesce.participant.QuiesceParticipant; @@ -33,10 +26,16 @@ import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; import org.ops4j.pax.exam.spi.reactors.PerMethod; import org.osgi.framework.Bundle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -83,19 +82,19 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { @Test public void testNullSafe() throws Exception { //Check we're null safe - manager.quiesce(null); + manager.quiesce(null); } @Test public void testNoParticipants() throws Exception { bundleList = new ArrayList<Bundle>(); bundleList.add(b1); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); //Try quiescing one bundle with no participants manager.quiesceWithFuture(2000, bundleList).get(5000, TimeUnit.MILLISECONDS); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); } @Test @@ -105,12 +104,12 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { //Register a mock participant which will report back quiesced immediately bundleContext.registerService(QuiesceParticipant.class.getName(), participant1, null); //Try quiescing the bundle with immediate return - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - - manager.quiesceWithFuture(1000,bundleList).get(5000, TimeUnit.MILLISECONDS); - + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + + manager.quiesceWithFuture(1000, bundleList).get(5000, TimeUnit.MILLISECONDS); + assertEquals("Participant should have finished once", 1, participant1.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); } @Test @@ -122,16 +121,16 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { bundleList.add(b1); //Try quiescing the bundle with no return - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - manager.quiesce(1000,bundleList); - timeoutTime = System.currentTimeMillis()+5000; - while (System.currentTimeMillis() < timeoutTime && b1.getState() == Bundle.ACTIVE){ + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + manager.quiesce(1000, bundleList); + timeoutTime = System.currentTimeMillis() + 5000; + while (System.currentTimeMillis() < timeoutTime && b1.getState() == Bundle.ACTIVE) { Thread.sleep(500); } - + assertEquals("Participant should have started once", 1, participant2.getStartedCount()); assertEquals("Participant should not have finished", 0, participant2.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); } @Test @@ -142,14 +141,14 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { bundleList = new ArrayList<Bundle>(); bundleList.add(b1); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + // we should be finishing in about 5000 millis not 10000 - manager.quiesceWithFuture(10000,bundleList).get(7000, TimeUnit.MILLISECONDS); + manager.quiesceWithFuture(10000, bundleList).get(7000, TimeUnit.MILLISECONDS); assertEquals("Participant should have started once", 1, participant3.getStartedCount()); assertEquals("Participant should finished once", 1, participant3.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); } @Test @@ -161,17 +160,17 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { //recreate the list as it may have been emptied bundleList = new ArrayList<Bundle>(); bundleList.add(b1); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - - manager.quiesceWithFuture(10000,bundleList).get(15000, TimeUnit.MILLISECONDS); - + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + + manager.quiesceWithFuture(10000, bundleList).get(15000, TimeUnit.MILLISECONDS); + assertEquals("Participant 1 should have started once", 1, participant1.getStartedCount()); assertEquals("Participant 1 should finished once", 1, participant1.getFinishedCount()); assertEquals("Participant 2 should have started once", 1, participant2.getStartedCount()); assertEquals("Participant 2 should not have finished", 0, participant2.getFinishedCount()); assertEquals("Participant 3 should have started once", 1, participant3.getStartedCount()); assertEquals("Participant 3 should finished once", 1, participant3.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); } @Test @@ -180,7 +179,7 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { bundleContext.registerService(QuiesceParticipant.class.getName(), participant3, null); bundleList = new ArrayList<Bundle>(); bundleList.add(b1); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); Future<?> future = manager.quiesceWithFuture(2000, Arrays.asList(b1)); @@ -192,14 +191,14 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { assertEquals("Participant 3 has started", 1, participant3.getStartedCount()); assertEquals("Participant 3 has finished", 1, participant3.getFinishedCount()); } - + @Test public void testFutureWithWait() throws Exception { bundleContext.registerService(QuiesceParticipant.class.getName(), participant2, null); bundleContext.registerService(QuiesceParticipant.class.getName(), participant3, null); bundleList = new ArrayList<Bundle>(); bundleList.add(b1); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); Future<?> future = manager.quiesceWithFuture(2000, Arrays.asList(b1)); @@ -215,7 +214,7 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { assertEquals("Participant 2 has finished", 0, participant2.getFinishedCount()); assertEquals("Participant 3 has started", 1, participant3.getStartedCount()); assertEquals("Participant 3 has finished", 0, participant3.getFinishedCount()); - assertEquals("Bundle "+b1.getSymbolicName()+" should still be active, because we did not wait long enough", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b1.getSymbolicName() + " should still be active, because we did not wait long enough", Bundle.ACTIVE, b1.getState()); } @Test @@ -228,10 +227,10 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { bundleList = new ArrayList<Bundle>(); bundleList.add(b1); bundleList.add(b2); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - assertEquals("Bundle "+b2.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b2.getState()); + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b2.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b2.getState()); - manager.quiesceWithFuture(10000,bundleList).get(15000, TimeUnit.MILLISECONDS); + manager.quiesceWithFuture(10000, bundleList).get(15000, TimeUnit.MILLISECONDS); assertEquals("Participant 1 should have started once", 1, participant1.getStartedCount()); assertEquals("Participant 1 should finished once", 1, participant1.getFinishedCount()); @@ -239,8 +238,8 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { assertEquals("Participant 2 should not have finished", 0, participant2.getFinishedCount()); assertEquals("Participant 3 should have started once", 1, participant3.getStartedCount()); assertEquals("Participant 3 should finished once", 1, participant3.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); - assertTrue("Bundle "+b2.getSymbolicName()+" should not be in active state", b2.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b2.getSymbolicName() + " should not be in active state", b2.getState() != Bundle.ACTIVE); } @Test @@ -254,15 +253,15 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { bundleList = new ArrayList<Bundle>(); bundleList.add(b1); bundleList.add(b2); - assertEquals("Bundle "+b1.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b1.getState()); - assertEquals("Bundle "+b2.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b2.getState()); - assertEquals("Bundle "+b3.getSymbolicName()+" should be in active state", Bundle.ACTIVE, b3.getState()); - manager.quiesce(2000,bundleList); + assertEquals("Bundle " + b1.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b1.getState()); + assertEquals("Bundle " + b2.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b2.getState()); + assertEquals("Bundle " + b3.getSymbolicName() + " should be in active state", Bundle.ACTIVE, b3.getState()); + manager.quiesce(2000, bundleList); bundleList = new ArrayList<Bundle>(); bundleList.add(b2); bundleList.add(b3); - manager.quiesce(2000,bundleList); - timeoutTime = System.currentTimeMillis()+10000; + manager.quiesce(2000, bundleList); + timeoutTime = System.currentTimeMillis() + 10000; while (System.currentTimeMillis() < timeoutTime && (b1.getState() == Bundle.ACTIVE || b2.getState() == Bundle.ACTIVE || b3.getState() == Bundle.ACTIVE)) { Thread.sleep(500); } @@ -272,9 +271,9 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { assertEquals("Participant 2 should not have finished as it should never return from it's two quiesce requests", 0, participant2.getFinishedCount()); assertEquals("Participant 3 should have started twice as it has been asked to quiesce twice", 2, participant3.getStartedCount()); assertEquals("Participant 3 should finished twice as it should have waited a short time before returning from it's two quiesce requests", 2, participant3.getFinishedCount()); - assertTrue("Bundle "+b1.getSymbolicName()+" should not be in active state", b1.getState() != Bundle.ACTIVE); - assertTrue("Bundle "+b2.getSymbolicName()+" should not be in active state", b2.getState() != Bundle.ACTIVE); - assertTrue("Bundle "+b3.getSymbolicName()+" should not be in active state", b3.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b1.getSymbolicName() + " should not be in active state", b1.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b2.getSymbolicName() + " should not be in active state", b2.getState() != Bundle.ACTIVE); + assertTrue("Bundle " + b3.getSymbolicName() + " should not be in active state", b3.getState() != Bundle.ACTIVE); } public Option baseOptions() { @@ -295,10 +294,6 @@ public class QuiesceManagerTest extends AbstractIntegrationTest { // Bundles mavenBundle("org.osgi", "org.osgi.compendium").versionAsInProject(), mavenBundle("org.apache.aries", "org.apache.aries.util").versionAsInProject(), - mavenBundle("commons-lang", "commons-lang").versionAsInProject(), - mavenBundle("commons-collections", "commons-collections").versionAsInProject(), - mavenBundle("commons-pool", "commons-pool").versionAsInProject(), - mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.serp").versionAsInProject(), mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api").versionAsInProject(), mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.manager").versionAsInProject(), mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
