You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cs...@apache.org on 2020/04/01 16:08:40 UTC

[sling-org-apache-sling-distribution-journal] branch master updated (9bafbba -> 399ca8c)

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

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


    from 9bafbba  SLING-9321 - Make fields final
     new 01920c3  Revert "SLING-9321 - Make fields final"
     new 399ca8c  Revert "SLING-9321 - Use contructor injection"

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../service/subscriber/BookKeeperFactory.java      | 34 +++++++++++++---------
 .../journal/impl/subscriber/SubscriberTest.java    |  3 +-
 2 files changed, 22 insertions(+), 15 deletions(-)


[sling-org-apache-sling-distribution-journal] 01/02: Revert "SLING-9321 - Make fields final"

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 01920c39cd2a99b56a50311a6573e53e98852ead
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Wed Apr 1 18:08:04 2020 +0200

    Revert "SLING-9321 - Make fields final"
    
    This reverts commit 9bafbbacea25460cfb47fb01f23b47ac4c0d8c91.
---
 .../distribution/journal/service/subscriber/BookKeeperFactory.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java b/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
index ae051f3..152f12d 100644
--- a/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
+++ b/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
@@ -44,9 +44,9 @@ public class BookKeeperFactory {
     
     private final Packaging packaging;
 
-    private final BundleContext context;
+    private BundleContext context;
 
-    private final Integer idleMillies;
+    private Integer idleMillies;
     
     @Activate
     public BookKeeperFactory(


[sling-org-apache-sling-distribution-journal] 02/02: Revert "SLING-9321 - Use contructor injection"

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 399ca8cd0e43b513c3d238a4062b3c359e25ec71
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Wed Apr 1 18:08:17 2020 +0200

    Revert "SLING-9321 - Use contructor injection"
    
    This reverts commit 3b1886c435304d76d6a8054def0e71ba9a142d00.
---
 .../service/subscriber/BookKeeperFactory.java      | 30 +++++++++++++---------
 .../journal/impl/subscriber/SubscriberTest.java    |  3 ++-
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java b/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
index 152f12d..b0cdbcb 100644
--- a/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
+++ b/src/main/java/org/apache/sling/distribution/journal/service/subscriber/BookKeeperFactory.java
@@ -28,37 +28,43 @@ import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.distribution.journal.messages.Messages.PackageStatusMessage;
 import org.apache.sling.distribution.packaging.DistributionPackageBuilder;
 import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.event.EventAdmin;
 
 @Component(service = BookKeeperFactory.class, immediate = true)
 public class BookKeeperFactory {
+    
+
 
-    private final ResourceResolverFactory resolverFactory;
+    @Reference
+    private ResourceResolverFactory resolverFactory;
     
-    private final EventAdmin eventAdmin;
+    @Reference
+    private EventAdmin eventAdmin;
     
-    private final SubscriberMetrics subscriberMetrics;
+    @Reference
+    private SubscriberMetrics subscriberMetrics;
     
-    private final Packaging packaging;
+    @Reference
+    private Packaging packaging;
 
     private BundleContext context;
 
     private Integer idleMillies;
     
-    @Activate
-    public BookKeeperFactory(
-            @Reference ResourceResolverFactory resolverFactory,
-            @Reference EventAdmin eventAdmin, 
-            @Reference SubscriberMetrics subscriberMetrics, 
-            @Reference Packaging packaging,
-            BundleContext context, Map<String, Object> properties) {
+    public BookKeeperFactory() {
+    }
+    
+    public BookKeeperFactory(ResourceResolverFactory resolverFactory,
+            EventAdmin eventAdmin, SubscriberMetrics subscriberMetrics, Packaging packaging) {
         this.resolverFactory = resolverFactory;
         this.eventAdmin = eventAdmin;
         this.subscriberMetrics = subscriberMetrics;
         this.packaging = packaging;
+    }
+
+    public void activate(BundleContext context, Map<String, Object> properties) {
         this.context = context;
         this.idleMillies = (Integer) properties.getOrDefault("idleMillies", SubscriberIdle.DEFAULT_IDLE_TIME_MILLIS);
         requireNonNull(resolverFactory);
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 99784f8..4d0710c 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
@@ -189,8 +189,9 @@ public class SubscriberTest {
         Awaitility.setDefaultPollDelay(Duration.ZERO);
         Awaitility.setDefaultPollInterval(Duration.ONE_HUNDRED_MILLISECONDS);
         
+        bookKeeperFactory = new BookKeeperFactory(resolverFactory, eventAdmin, subscriberMetrics, packaging);
         Map<String, Object> props = new HashMap<String, Object>();
-        bookKeeperFactory = new BookKeeperFactory(resolverFactory, eventAdmin, subscriberMetrics, packaging, context, props);
+        bookKeeperFactory.activate(context, props);
         subscriber.bookKeeperFactory = bookKeeperFactory;
         when(packageBuilder.getType()).thenReturn("journal");
         when(slingSettings.getSlingId()).thenReturn(SUB1_SLING_ID);