This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git


The following commit(s) were added to refs/heads/master by this push:
     new 90af51a  SLING-11986 : Bundle relies on Guava (15)
90af51a is described below

commit 90af51a5ffa90c4481de7c9d9b515189d3580ba1
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Thu Jul 27 17:29:59 2023 +0200

    SLING-11986 : Bundle relies on Guava (15)
---
 pom.xml                                            |  8 +++----
 .../journal/impl/discovery/DiscoveryService.java   |  5 ++---
 .../impl/publisher/DistributionPublisherTest.java  |  4 +---
 .../journal/impl/subscriber/SubscriberTest.java    | 25 +++++++++++-----------
 4 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/pom.xml b/pom.xml
index 14ffd82..057c1d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -167,7 +167,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             
<artifactId>org.apache.sling.distribution.journal.messages</artifactId>
-            <version>0.5.1-T20230628-65874b9</version>
+            <version>0.5.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -210,19 +210,19 @@
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-api</artifactId>
             <version>2.16.0</version>
-            <scope>compile</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
             <version>2.16.0</version>
-            <scope>compile</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit.vault</groupId>
             <artifactId>org.apache.jackrabbit.vault</artifactId>
             <version>3.6.4</version>
-            <scope>compile</scope>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/impl/discovery/DiscoveryService.java
 
b/src/main/java/org/apache/sling/distribution/journal/impl/discovery/DiscoveryService.java
index 7b5e9e3..1ec0829 100644
--- 
a/src/main/java/org/apache/sling/distribution/journal/impl/discovery/DiscoveryService.java
+++ 
b/src/main/java/org/apache/sling/distribution/journal/impl/discovery/DiscoveryService.java
@@ -24,6 +24,7 @@ import static 
org.apache.sling.commons.scheduler.Scheduler.PROPERTY_SCHEDULER_PE
 import static org.apache.sling.distribution.journal.HandlerAdapter.create;
 
 import java.io.Closeable;
+import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -54,8 +55,6 @@ import org.apache.sling.distribution.journal.Reset;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.ImmutableMap;
-
 /**
  * Listens for discovery messages and tracks presence of Subscribers as well as
  * the last processed offset of each Subscriber
@@ -186,7 +185,7 @@ public class DiscoveryService implements Runnable {
          * We only have one DiscoveryService but possibly more than one 
DistributionPublisher. 
          * So we send an event for each log message and let them listen to 
these.
          */
-        Event event = new Event(TOPIC_DISTRIBUTION_LOG, 
ImmutableMap.of(KEY_MESSAGE, logMsg)); 
+        Event event = new Event(TOPIC_DISTRIBUTION_LOG, 
Collections.singletonMap(KEY_MESSAGE, logMsg)); 
         eventAdmin.postEvent(event);
     }
 }
diff --git 
a/src/test/java/org/apache/sling/distribution/journal/impl/publisher/DistributionPublisherTest.java
 
b/src/test/java/org/apache/sling/distribution/journal/impl/publisher/DistributionPublisherTest.java
index f5eaeb3..c7e0838 100644
--- 
a/src/test/java/org/apache/sling/distribution/journal/impl/publisher/DistributionPublisherTest.java
+++ 
b/src/test/java/org/apache/sling/distribution/journal/impl/publisher/DistributionPublisherTest.java
@@ -81,8 +81,6 @@ import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.util.converter.Converters;
 
-import com.google.common.collect.ImmutableMap;
-
 public class DistributionPublisherTest {
 
     private static final String SUBAGENT1 = "subscriber-agent1";
@@ -155,7 +153,7 @@ public class DistributionPublisherTest {
     public void before() {
         MockitoAnnotations.initMocks(this);
         when(packageBuilder.getType()).thenReturn("journal");
-        Map<String, String> props = ImmutableMap.of("name", PUB1AGENT1);
+        Map<String, String> props = Collections.singletonMap("name", 
PUB1AGENT1);
         PublisherConfiguration config = 
Converters.standardConverter().convert(props).to(PublisherConfiguration.class);
         when(slingSettings.getSlingId()).thenReturn("pub1sling");
         when(context.registerService(Mockito.eq(DistributionAgent.class), 
Mockito.eq(publisher),
diff --git 
a/src/test/java/org/apache/sling/distribution/journal/impl/subscriber/SubscriberTest.java
 
b/src/test/java/org/apache/sling/distribution/journal/impl/subscriber/SubscriberTest.java
index bd19e55..753378a 100644
--- 
a/src/test/java/org/apache/sling/distribution/journal/impl/subscriber/SubscriberTest.java
+++ 
b/src/test/java/org/apache/sling/distribution/journal/impl/subscriber/SubscriberTest.java
@@ -115,8 +115,6 @@ import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.util.converter.Converters;
 
-import com.google.common.collect.ImmutableMap;
-
 @SuppressWarnings("unchecked")
 public class SubscriberTest {
 
@@ -267,7 +265,7 @@ public class SubscriberTest {
     @Test
     public void testReceiveNotSubscribed() throws DistributionException {
         assumeNoPrecondition();
-        initSubscriber(ImmutableMap.of("agentNames", "dummy"));
+        initSubscriber(Collections.singletonMap("agentNames", "dummy"));
         assertThat(subscriber.getState(), 
equalTo(DistributionAgentState.IDLE));
         
         MessageInfo info = createInfo(100);
@@ -334,7 +332,7 @@ public class SubscriberTest {
     @Test
     public void testImportPostProcessError() throws DistributionException, 
ImportPostProcessException {
         assumeNoPrecondition();
-        initSubscriber(ImmutableMap.of("maxRetries", "0"));
+        initSubscriber(Collections.singletonMap("maxRetries", "0"));
         doThrow(new ImportPostProcessException("Failed post process")).
             when(importPostProcessor).process(any());
 
@@ -362,7 +360,7 @@ public class SubscriberTest {
     @Test
     public void testSendFailedStatus() throws DistributionException {
         assumeNoPrecondition();
-        initSubscriber(ImmutableMap.of("maxRetries", "1"));
+        initSubscriber(Collections.singletonMap("maxRetries", "1"));
         whenInstallPackage()
         .thenThrow(new RuntimeException("Expected"));
 
@@ -377,7 +375,7 @@ public class SubscriberTest {
     public void testSendSuccessStatus() throws DistributionException, 
InterruptedException {
         assumeNoPrecondition();
         // Only editable subscriber will send status
-        initSubscriber(ImmutableMap.of("editable", "true"));
+        initSubscriber(Collections.singletonMap("editable", "true"));
 
         MessageInfo info = createInfo(0l);
         PackageMessage message = BASIC_ADD_PACKAGE;
@@ -390,7 +388,7 @@ public class SubscriberTest {
     @Test
     public void testSkipBecauseOfPrecondition() throws DistributionException, 
InterruptedException, TimeoutException {
         when(precondition.canProcess(eq(SUB1_AGENT_NAME), 
anyLong())).thenReturn(Decision.SKIP);
-        initSubscriber(ImmutableMap.of("editable", "true"));
+        initSubscriber(Collections.singletonMap("editable", "true"));
 
         MessageInfo info = createInfo(11l);
         PackageMessage message = BASIC_ADD_PACKAGE;
@@ -403,7 +401,7 @@ public class SubscriberTest {
     @Test
     public void testPreconditionTimeoutExceptionBecauseOfShutdown() throws 
DistributionException, InterruptedException, TimeoutException, IOException {
         when(precondition.canProcess(eq(SUB1_AGENT_NAME), 
anyLong())).thenReturn(Decision.WAIT);
-        initSubscriber(ImmutableMap.of("editable", "true"));
+        initSubscriber(Collections.singletonMap("editable", "true"));
         long startedAt = System.currentTimeMillis();
 
         MessageInfo info = createInfo(11l);
@@ -475,11 +473,12 @@ public class SubscriberTest {
     }
 
     private void initSubscriber(Map<String, String> overrides) {
-        Map<String, Object> basicProps = ImmutableMap.of(
-            "name", SUB1_AGENT_NAME,
-            "agentNames", PUB1_AGENT_NAME,
-            "idleMillies", 1000,
-            "subscriberIdleCheck", true);
+        Map<String, Object> basicPropsOrig = new HashMap<>();
+        basicPropsOrig.put("name", SUB1_AGENT_NAME);
+        basicPropsOrig.put("agentNames", PUB1_AGENT_NAME);
+        basicPropsOrig.put("idleMillies", 1000);
+        basicPropsOrig.put("subscriberIdleCheck", true);
+        Map<String, Object> basicProps = 
Collections.unmodifiableMap(basicPropsOrig);
         Map<String, Object> props = new HashMap<>();
         props.putAll(basicProps);
         props.putAll(overrides);

Reply via email to