You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2022/02/07 09:58:30 UTC
[aries-component-dsl] 02/02: Deduplicate configuration updates
This is an automated email from the ASF dual-hosted git repository.
csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-component-dsl.git
commit 24c560fe1e280fee848ab80cc556f2f0ebe2397b
Author: Carlos Sierra Andrés <ca...@liferay.com>
AuthorDate: Mon Feb 7 10:38:44 2022 +0100
Deduplicate configuration updates
---
.../org/apache/aries/component/dsl/test/DSLTest.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java b/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
index 463b8d9..4d575d7 100644
--- a/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
+++ b/itests/src/main/java/org/apache/aries/component/dsl/test/DSLTest.java
@@ -551,11 +551,15 @@ public class DSLTest {
effect.set(deleteLatch::countDown);
- AtomicInteger requestedCounter = new AtomicInteger();
+ AtomicInteger invokedCounter = new AtomicInteger();
serviceRegistration =
bundleContext.registerService(
- ManagedService.class, __ -> {deleteLatch.countDown(); requestedCounter.incrementAndGet();},
+ ManagedService.class, __ -> {
+ if (invokedCounter.getAndIncrement() == 0) {
+ deleteLatch.countDown();
+ }
+ },
new Hashtable<String, Object>() {{
put("service.pid", "test.configuration");
}});
@@ -565,7 +569,6 @@ public class DSLTest {
boolean didCountdown = deleteLatch.await(5, TimeUnit.MINUTES);
assertTrue(didCountdown);
- assertEquals(1, requestedCounter.get());
assertEquals(2, counter.get());
assertEquals(1, updateCounter.get());
@@ -650,17 +653,23 @@ public class DSLTest {
effect.set(deleteLatch::countDown);
+ AtomicInteger invokedCounter = new AtomicInteger();
serviceRegistration =
bundleContext.registerService(
- ManagedService.class, __ -> deleteLatch.countDown(),
+ ManagedService.class, __ -> {
+ if (invokedCounter.getAndIncrement() == 0) {
+ deleteLatch.countDown();
+ }
+ },
new Hashtable<String, Object>() {{
put("service.pid", "test.configuration");
}});
configuration.delete();
- deleteLatch.await(5, TimeUnit.MINUTES);
+ boolean didCountdown = deleteLatch.await(5, TimeUnit.MINUTES);
+ assertTrue(didCountdown);
assertEquals(3, counter.get());
assertTrue(atomicReference.get().isEmpty());