You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:23:03 UTC

[sling-org-apache-sling-jms] 11/14: SLING-6576 : Use official OSGi annotations

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

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

commit f594930888e0b665e5781a5b3b29da2c8f299416
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Mar 2 07:30:37 2017 +0000

    SLING-6576 : Use official OSGi annotations
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1785076 13f79535-47bb-0310-9956-ffa450edef68
---
 .../amq/ActiveMQConnectionFactoryService.java      | 54 ++++++++++----------
 .../apache/sling/jms/ConnectionFactoryService.java |  3 ++
 .../org/apache/sling/jms/impl/JMSQueueManager.java | 58 ++++++++++++++--------
 .../org/apache/sling/jms/impl/JMSTopicManager.java | 57 ++++++++++++---------
 .../amq/ActiveMQConnectionFactoryServiceTest.java  | 35 +++++++------
 .../org/apache/sling/jms/JMSQueueManagerTest.java  | 38 ++++++++------
 .../org/apache/sling/jms/JMSTopicManagerTest.java  | 32 ++++++------
 7 files changed, 161 insertions(+), 116 deletions(-)

diff --git a/src/main/java/org/apache/sling/amq/ActiveMQConnectionFactoryService.java b/src/main/java/org/apache/sling/amq/ActiveMQConnectionFactoryService.java
index 0fdca79..446dc4d 100644
--- a/src/main/java/org/apache/sling/amq/ActiveMQConnectionFactoryService.java
+++ b/src/main/java/org/apache/sling/amq/ActiveMQConnectionFactoryService.java
@@ -18,16 +18,20 @@
  */
 package org.apache.sling.amq;
 
+import javax.jms.ConnectionFactory;
+
 import org.apache.activemq.pool.PooledConnectionFactory;
-import org.apache.felix.scr.annotations.*;
 import org.apache.sling.jms.ConnectionFactoryService;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map;
-
-import javax.jms.ConnectionFactory;
-
 /**
  * Creates a ConnectionFactoryService that makes a pooled  JMS ConnectionFactory available to consumers. The implementation
  * of JMS is provided by ActiveMQ in this instances. If the component is left un-configured it will connection to vm://localhost:6161.
@@ -56,47 +60,43 @@ import javax.jms.ConnectionFactory;
  * properties:/foo/bar.properties uses a properties file as per http://activemq.apache.org/broker-properties-uri.html
  *
  */
-@Component(immediate = true, metatype = true, policy = ConfigurationPolicy.REQUIRE)
-@Service(value=ConnectionFactoryService.class)
+@Component(immediate = true,
+           configurationPolicy=ConfigurationPolicy.REQUIRE,
+           service = ConnectionFactoryService.class)
+@Designate(ocd = ActiveMQConnectionFactoryService.Config.class)
 public class ActiveMQConnectionFactoryService implements ConnectionFactoryService {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQConnectionFactoryService.class);
-    private PooledConnectionFactory pooledConnectionFactory;
-
-    // Where the broker is configured out of the box, the shutdown hook must be disabled.
-    // so that the deactivate method can perform the shutdown.
-    // This assumes that OSGi does shutdown properly.
-
     public static final String DEFAULT_BROKER_URI = "vm://localhost:61616?broker.useShutdownHook=false";
-    @Property(value = DEFAULT_BROKER_URI)
-    public static final String BROKER_URI = "jms.brokerUri";
-
 
+    @ObjectClassDefinition(name="Apache Sling Active MQ Connection Factory",
+            description="Connection factory for Active MQ")
+    public @interface Config {
+        // Where the broker is configured out of the box, the shutdown hook must be disabled.
+        // so that the deactivate method can perform the shutdown.
+        // This assumes that OSGi does shutdown properly.
+        @AttributeDefinition(name = "Broker URI", description="The URI to the broker.")
+        String jms_brokerUri() default DEFAULT_BROKER_URI;
+    }
+    private final Logger LOGGER = LoggerFactory.getLogger(ActiveMQConnectionFactoryService.class);
+    private PooledConnectionFactory pooledConnectionFactory;
 
 
     @Activate
-    public void activate(Map<String, Object> props) {
-
-        String brokerURL = (String) props.get(BROKER_URI);
-
-        pooledConnectionFactory = new PooledConnectionFactory(brokerURL);
+    public void activate(Config config) {
+        pooledConnectionFactory = new PooledConnectionFactory(config.jms_brokerUri());
         pooledConnectionFactory.start();
     }
 
 
     @Deactivate
-    public void deactivate(Map<String, Object> props) {
-
+    public void deactivate() {
         LOGGER.info("Stopping ActiveMQ Pooled connection factory");
         pooledConnectionFactory.stop();
         pooledConnectionFactory = null;
     }
 
-
-
     @Override
     public ConnectionFactory getConnectionFactory() {
         return pooledConnectionFactory;
     }
-
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/jms/ConnectionFactoryService.java b/src/main/java/org/apache/sling/jms/ConnectionFactoryService.java
index 396896c..32dd2b2 100644
--- a/src/main/java/org/apache/sling/jms/ConnectionFactoryService.java
+++ b/src/main/java/org/apache/sling/jms/ConnectionFactoryService.java
@@ -20,11 +20,14 @@ package org.apache.sling.jms;
 
 import javax.jms.ConnectionFactory;
 
+import org.osgi.annotation.versioning.ProviderType;
+
 /**
  * Implementations of this service provide JMS Connection factories. In general implementations should work OOTB with no
  * further configuration and provide an efficient JMS Connection Factory that allows sessions to be created with minimal
  * overhead.
  */
+@ProviderType
 public interface ConnectionFactoryService {
     /**
      *
diff --git a/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java b/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
index 37edecf..7cb50ca 100644
--- a/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
+++ b/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
@@ -18,15 +18,6 @@
  */
 package org.apache.sling.jms.impl;
 
-import org.apache.felix.scr.annotations.*;
-import org.apache.sling.jms.ConnectionFactoryService;
-import org.apache.sling.mom.*;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.Nonnull;
-import javax.jms.*;
 import java.io.Closeable;
 import java.util.Collections;
 import java.util.HashMap;
@@ -34,17 +25,42 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.annotation.Nonnull;
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.sling.jms.ConnectionFactoryService;
+import org.apache.sling.mom.MessageFilter;
+import org.apache.sling.mom.QueueManager;
+import org.apache.sling.mom.QueueReader;
+import org.apache.sling.mom.RequeueMessageException;
+import org.apache.sling.mom.Types;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * A JMS implementation of a QueueManager. It will allow callers to add messages to named queues, and consumers to read
  * messages from named queues in order. The component uses a single connection to the JMS broker, but dedicated sessions
  * for each send and for each Queue reader.
  */
-@Component(immediate = true)
-@Service(value = QueueManager.class)
+@Component(immediate = true, service = QueueManager.class)
 public class JMSQueueManager implements QueueManager {
 
-
-
     private static final Logger LOGGER = LoggerFactory.getLogger(JMSQueueManager.class);
     private static final String NRETRIES = "_nr";
     private static final Set<String> INTERNAL_PROPS = Collections.singleton(NRETRIES);
@@ -56,24 +72,19 @@ public class JMSQueueManager implements QueueManager {
     /**
      * Holds all QueueReader registrations.
      */
-    @Reference(referenceInterface = QueueReader.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
-            policy = ReferencePolicy.DYNAMIC,
-            bind="addReader",
-            unbind="removeReader")
     private final Map<ServiceReference<QueueReader>, QueueReaderHolder> registrations =
             new ConcurrentHashMap<ServiceReference<QueueReader>, QueueReaderHolder>();
 
     private Connection connection;
 
     @Activate
-    public synchronized void activate(Map<String, Object> properties) throws JMSException {
+    public synchronized void activate() throws JMSException {
         connection = connectionFactoryService.getConnectionFactory().createConnection();
         connection.start();
     }
 
     @Deactivate
-    public synchronized void deactivate(Map<String, Object> properties) throws JMSException {
+    public synchronized void deactivate() throws JMSException {
         for ( Map.Entry<ServiceReference<QueueReader>, QueueReaderHolder> e : registrations.entrySet()) {
             e.getValue().close();
         }
@@ -111,7 +122,6 @@ public class JMSQueueManager implements QueueManager {
 
     }
 
-
     /**
      * quietly close the session.
      * @param session
@@ -126,8 +136,11 @@ public class JMSQueueManager implements QueueManager {
         }
     }
 
-
     // Register Readers using OSGi Whiteboard pattern
+    @Reference(service = QueueReader.class,
+            cardinality = ReferenceCardinality.MULTIPLE,
+            policy = ReferencePolicy.DYNAMIC,
+            unbind="removeReader")
     public synchronized  void addReader(ServiceReference<QueueReader> serviceRef) {
         if (registrations.containsKey(serviceRef)) {
             LOGGER.error("Registration for service reference is already present {}",serviceRef);
@@ -178,6 +191,7 @@ public class JMSQueueManager implements QueueManager {
 
         }
 
+        @Override
         public void close() {
             try {
                 session.close();
diff --git a/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java b/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
index ebc2cc8..967a92f 100644
--- a/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
+++ b/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
@@ -18,12 +18,14 @@
  */
 package org.apache.sling.jms.impl;
 
-import org.apache.felix.scr.annotations.*;
-import org.apache.sling.jms.ConnectionFactoryService;
-import org.apache.sling.mom.*;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.annotation.Nonnull;
 import javax.jms.Connection;
@@ -35,17 +37,27 @@ import javax.jms.MessageListener;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.sling.jms.ConnectionFactoryService;
+import org.apache.sling.mom.MessageFilter;
+import org.apache.sling.mom.Subscriber;
+import org.apache.sling.mom.TopicManager;
+import org.apache.sling.mom.Types;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class provides support for sending messages to topics over JMS and subscribing to topics. It uses the ConnectionFactoryService
  * to interact with JMS. There is nothing in
  */
-@Component(immediate = true)
-@Service(value = TopicManager.class)
+@Component(immediate = true, service = TopicManager.class)
 public class JMSTopicManager implements TopicManager {
 
 
@@ -55,11 +67,6 @@ public class JMSTopicManager implements TopicManager {
     /**
      * Holds all QueueReader registrations.
      */
-    @Reference(referenceInterface = Subscriber.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
-            policy = ReferencePolicy.DYNAMIC,
-            bind="addSubscriber",
-            unbind="removeSubscriber")
     private final Map<ServiceReference<Subscriber>, SubscriberHolder> registrations =
             new ConcurrentHashMap<ServiceReference<Subscriber>, SubscriberHolder>();
 
@@ -69,17 +76,16 @@ public class JMSTopicManager implements TopicManager {
     private Connection connection;
     // A single session is used for listening to messages. Separate sessions are opened for sending to avoid synchronisation on sending operations.
     private Session session;
-    private final Object lock = new Object();
 
     @Activate
-    public synchronized  void activate(Map<String, Object> properties) throws JMSException {
-            connection = connectionFactoryService.getConnectionFactory().createConnection();
-            session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
-            connection.start();
+    public synchronized  void activate() throws JMSException {
+        connection = connectionFactoryService.getConnectionFactory().createConnection();
+        session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+        connection.start();
     }
 
     @Deactivate
-    public synchronized  void deactivate(Map<String, Object> properties) throws JMSException {
+    public synchronized  void deactivate() throws JMSException {
         for ( Map.Entry<ServiceReference<Subscriber>, SubscriberHolder> e : registrations.entrySet()) {
             e.getValue().close();
         }
@@ -118,6 +124,10 @@ public class JMSTopicManager implements TopicManager {
 
 
     // Register Subscribers using OSGi Whiteboard pattern
+    @Reference(service = Subscriber.class,
+            cardinality = ReferenceCardinality.MULTIPLE,
+            policy = ReferencePolicy.DYNAMIC,
+            unbind="removeSubscriber")
     public synchronized  void addSubscriber(ServiceReference<Subscriber> serviceRef) {
         if (registrations.containsKey(serviceRef)) {
             LOGGER.error("Registration for service reference is already present {}",serviceRef);
@@ -174,6 +184,7 @@ public class JMSTopicManager implements TopicManager {
 
         }
 
+        @Override
         public void close() {
             try {
                 filteredTopicSubscriber.close();
diff --git a/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java b/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
index 479f036..d926df4 100644
--- a/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
+++ b/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
@@ -19,17 +19,22 @@
 
 package org.apache.sling.amq;
 
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.jms.*;
-import java.util.HashMap;
-import java.util.Map;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
 
-import static org.junit.Assert.*;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  */
@@ -40,7 +45,7 @@ public class ActiveMQConnectionFactoryServiceTest {
     @Test
     public void testGetConnectionFactory() throws Exception {
         LOGGER.info("Starting test");
-        ActiveMQConnectionFactoryService cfs = ActiveMQConnectionFactoryServiceTest.activate(null);
+        ActiveMQConnectionFactoryService cfs = ActiveMQConnectionFactoryServiceTest.activate();
         ConnectionFactory cf = cfs.getConnectionFactory();
         Connection connection = cf.createConnection();
         Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
@@ -63,17 +68,15 @@ public class ActiveMQConnectionFactoryServiceTest {
     }
 
     public static void deactivate(@Nonnull ActiveMQConnectionFactoryService cfs) {
-        cfs.deactivate(new HashMap<String, Object>());
+        cfs.deactivate();
     }
 
     @Nonnull
-    public static ActiveMQConnectionFactoryService activate(@Nullable Map<String, Object> props) {
+    public static ActiveMQConnectionFactoryService activate() {
         ActiveMQConnectionFactoryService amqConnectionFactoryService = new ActiveMQConnectionFactoryService();
-        if ( props == null ) {
-            props = new HashMap<String, Object>();
-            props.put(ActiveMQConnectionFactoryService.BROKER_URI, ActiveMQConnectionFactoryService.DEFAULT_BROKER_URI);
-        }
-        amqConnectionFactoryService.activate(props);
+        final ActiveMQConnectionFactoryService.Config config = Mockito.mock(ActiveMQConnectionFactoryService.Config.class);
+        Mockito.when(config.jms_brokerUri()).thenReturn(ActiveMQConnectionFactoryService.DEFAULT_BROKER_URI);
+        amqConnectionFactoryService.activate(config);
         return amqConnectionFactoryService;
     }
 
diff --git a/src/test/java/org/apache/sling/jms/JMSQueueManagerTest.java b/src/test/java/org/apache/sling/jms/JMSQueueManagerTest.java
index b0e2744..cb99ed5 100644
--- a/src/test/java/org/apache/sling/jms/JMSQueueManagerTest.java
+++ b/src/test/java/org/apache/sling/jms/JMSQueueManagerTest.java
@@ -19,10 +19,29 @@
 
 package org.apache.sling.jms;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+
 import org.apache.sling.amq.ActiveMQConnectionFactoryService;
 import org.apache.sling.amq.ActiveMQConnectionFactoryServiceTest;
 import org.apache.sling.jms.impl.JMSQueueManager;
-import org.apache.sling.mom.*;
+import org.apache.sling.mom.QueueReader;
+import org.apache.sling.mom.RequeueMessageException;
+import org.apache.sling.mom.Types;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -37,15 +56,6 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.*;
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
 /**
  */
 public class JMSQueueManagerTest {
@@ -76,7 +86,7 @@ public class JMSQueueManagerTest {
         Mockito.when(serviceReference.getPropertyKeys()).thenAnswer(new Answer<String[]>() {
             @Override
             public String[] answer(InvocationOnMock invocationOnMock) throws Throwable {
-                return (String[]) serviceProperties.keySet().toArray(new String[serviceProperties.size()]);
+                return serviceProperties.keySet().toArray(new String[serviceProperties.size()]);
             }
         });
         Mockito.when(serviceReference.getProperty(Mockito.anyString())).thenAnswer(new Answer<Object>() {
@@ -85,7 +95,7 @@ public class JMSQueueManagerTest {
                 return serviceProperties.get(invocationOnMock.getArguments()[0]);
             }
         });
-        amqConnectionFactoryService = ActiveMQConnectionFactoryServiceTest.activate(null);
+        amqConnectionFactoryService = ActiveMQConnectionFactoryServiceTest.activate();
         jmsQueueManager = JMSQueueManagerTest.activate(amqConnectionFactoryService);
         testMap = JsonTest.createTestMap();
         passed = false;
@@ -96,7 +106,7 @@ public class JMSQueueManagerTest {
     private static JMSQueueManager activate(ActiveMQConnectionFactoryService amqConnectionFactoryService) throws NoSuchFieldException, IllegalAccessException, JMSException {
         JMSQueueManager jmsQueueManager = new JMSQueueManager();
         setPrivate(jmsQueueManager, "connectionFactoryService", amqConnectionFactoryService);
-        jmsQueueManager.activate(new HashMap<String, Object>());
+        jmsQueueManager.activate();
         return jmsQueueManager;
 
     }
@@ -117,7 +127,7 @@ public class JMSQueueManagerTest {
     }
 
     public static void deactivate(JMSQueueManager jmsQueueManager) throws JMSException {
-        jmsQueueManager.deactivate(new HashMap<String, Object>());
+        jmsQueueManager.deactivate();
     }
 
     @Test
diff --git a/src/test/java/org/apache/sling/jms/JMSTopicManagerTest.java b/src/test/java/org/apache/sling/jms/JMSTopicManagerTest.java
index 59bca13..452f9ca 100644
--- a/src/test/java/org/apache/sling/jms/JMSTopicManagerTest.java
+++ b/src/test/java/org/apache/sling/jms/JMSTopicManagerTest.java
@@ -18,10 +18,23 @@
  */
 package org.apache.sling.jms;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jms.JMSException;
+
 import org.apache.sling.amq.ActiveMQConnectionFactoryService;
 import org.apache.sling.amq.ActiveMQConnectionFactoryServiceTest;
 import org.apache.sling.jms.impl.JMSTopicManager;
-import org.apache.sling.mom.*;
+import org.apache.sling.mom.MessageFilter;
+import org.apache.sling.mom.Subscriber;
+import org.apache.sling.mom.Types;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,15 +49,6 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.JMSException;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
 /**
  */
 public class JMSTopicManagerTest {
@@ -75,7 +79,7 @@ public class JMSTopicManagerTest {
         Mockito.when(serviceReference.getPropertyKeys()).thenAnswer(new Answer<String[]>() {
             @Override
             public String[] answer(InvocationOnMock invocationOnMock) throws Throwable {
-                return (String[]) serviceProperties.keySet().toArray(new String[serviceProperties.size()]);
+                return serviceProperties.keySet().toArray(new String[serviceProperties.size()]);
             }
         });
         Mockito.when(serviceReference.getProperty(Mockito.anyString())).thenAnswer(new Answer<Object>() {
@@ -84,7 +88,7 @@ public class JMSTopicManagerTest {
                 return serviceProperties.get(invocationOnMock.getArguments()[0]);
             }
         });
-        amqConnectionFactoryService = ActiveMQConnectionFactoryServiceTest.activate(null);
+        amqConnectionFactoryService = ActiveMQConnectionFactoryServiceTest.activate();
         jsmTopicManager = JMSTopicManagerTest.activate(amqConnectionFactoryService);
         testMap = JsonTest.createTestMap();
         passed = false;
@@ -93,7 +97,7 @@ public class JMSTopicManagerTest {
     public static JMSTopicManager activate(ActiveMQConnectionFactoryService amqConnectionFactoryService) throws NoSuchFieldException, IllegalAccessException, JMSException {
         JMSTopicManager jsmTopicManager = new JMSTopicManager();
         setPrivate(jsmTopicManager, "connectionFactoryService", amqConnectionFactoryService);
-        jsmTopicManager.activate(new HashMap<String, Object>());
+        jsmTopicManager.activate();
         return jsmTopicManager;
 
     }
@@ -113,7 +117,7 @@ public class JMSTopicManagerTest {
     }
 
     public static void deactivate(JMSTopicManager jsmTopicManager) throws JMSException {
-        jsmTopicManager.deactivate(new HashMap<String, Object>());
+        jsmTopicManager.deactivate();
     }
 
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.