You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by ds...@apache.org on 2013/11/19 19:58:35 UTC

svn commit: r1543532 - in /incubator/streams/branches/webservice/streams-components/src: main/java/org/apache/streams/components/service/impl/ main/resources/ test/java/org/apache/streams/components/service/

Author: dsullivan
Date: Tue Nov 19 18:58:35 2013
New Revision: 1543532

URL: http://svn.apache.org/r1543532
Log:
making conversion class configurable

Modified:
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/ActivityRepositoryServiceImpl.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsPublisherRegistrationServiceImpl.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsSubscriberRegistrationServiceImpl.java
    incubator/streams/branches/webservice/streams-components/src/main/resources/streams_components_applicationContext.xml
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/ActivityRepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/ActivityRepositoryServiceImpl.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/ActivityRepositoryServiceImpl.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/ActivityRepositoryServiceImpl.java Tue Nov 19 18:58:35 2013
@@ -25,9 +25,9 @@ public class ActivityRepositoryServiceIm
     private ObjectMapper mapper;
 
     @Autowired
-    public ActivityRepositoryServiceImpl(ActivityStreamsRepository activityStreamsRepository) {
+    public ActivityRepositoryServiceImpl(ActivityStreamsRepository activityStreamsRepository, Class activityClass) {
         this.activityStreamsRepository = activityStreamsRepository;
-        this.activityClass = MongoActivityStreamsEntry.class;
+        this.activityClass = activityClass;
         this.mapper = new ObjectMapper();
         mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
     }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsPublisherRegistrationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsPublisherRegistrationServiceImpl.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsPublisherRegistrationServiceImpl.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsPublisherRegistrationServiceImpl.java Tue Nov 19 18:58:35 2013
@@ -24,10 +24,10 @@ public class StreamsPublisherRegistratio
     private ObjectMapper mapper;
 
     @Autowired
-    public StreamsPublisherRegistrationServiceImpl(PublisherRepository publisherRepositoryService) {
+    public StreamsPublisherRegistrationServiceImpl(PublisherRepository publisherRepositoryService, Class publisherClass) {
         this.publisherRepository = publisherRepositoryService;
         this.mapper = new ObjectMapper();
-        this.publisherClass = MongoPublisher.class;
+        this.publisherClass = publisherClass;
         mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
     }
 

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsSubscriberRegistrationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsSubscriberRegistrationServiceImpl.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsSubscriberRegistrationServiceImpl.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsSubscriberRegistrationServiceImpl.java Tue Nov 19 18:58:35 2013
@@ -27,12 +27,13 @@ public class StreamsSubscriberRegistrati
     @Autowired
     public StreamsSubscriberRegistrationServiceImpl(
             SubscriptionRepository subscriptionRepository,
-            ActivityStreamsSubscriberWarehouse activityStreamsSubscriberWarehouse
+            ActivityStreamsSubscriberWarehouse activityStreamsSubscriberWarehouse,
+            Class subscriptionClass
     ) {
         this.subscriptionRepository = subscriptionRepository;
         this.activityStreamsSubscriberWarehouse = activityStreamsSubscriberWarehouse;
         this.mapper = new ObjectMapper();
-        this.subscriptionClass = MongoSubscription.class;
+        this.subscriptionClass = subscriptionClass;
         mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
     }
 

Modified: incubator/streams/branches/webservice/streams-components/src/main/resources/streams_components_applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/resources/streams_components_applicationContext.xml?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/resources/streams_components_applicationContext.xml (original)
+++ incubator/streams/branches/webservice/streams-components/src/main/resources/streams_components_applicationContext.xml Tue Nov 19 18:58:35 2013
@@ -10,8 +10,16 @@
     <context:annotation-config />
     <context:component-scan base-package="org.apache.streams.components"/>
 
-    <!--<bean id="conversionClass" class="java.lang.Class" factory-method="forName">-->
-        <!--<constructor-arg value="org.apache.streams.persistence.model.mongo.MongoActivityStreamsEntry"/>-->
-    <!--</bean>-->
+    <bean id="activityClass" class="java.lang.Class" factory-method="forName">
+        <constructor-arg value="org.apache.streams.persistence.model.mongo.MongoActivityStreamsEntry"/>
+    </bean>
+
+    <bean id="publisherClass" class="java.lang.Class" factory-method="forName">
+        <constructor-arg value="org.apache.streams.persistence.model.mongo.MongoPublisher"/>
+    </bean>
+
+    <bean id="subscriptionClass" class="java.lang.Class" factory-method="forName">
+        <constructor-arg value="org.apache.streams.persistence.model.mongo.MongoSubscription"/>
+    </bean>
 
 </beans>
\ No newline at end of file

Modified: incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java Tue Nov 19 18:58:35 2013
@@ -2,6 +2,7 @@ package org.apache.streams.components.se
 
 import org.apache.streams.components.service.impl.StreamsPublisherRegistrationServiceImpl;
 import org.apache.streams.persistence.model.ActivityStreamsPublisher;
+import org.apache.streams.persistence.model.mongo.MongoPublisher;
 import org.apache.streams.persistence.repository.PublisherRepository;
 import org.junit.Before;
 import org.junit.Rule;
@@ -24,7 +25,7 @@ public class StreamsPublisherRegistratio
     @Before
     public void setup(){
         publisherRepository = createMock(PublisherRepository.class);
-        publisherRegistrationService = new StreamsPublisherRegistrationServiceImpl(publisherRepository);
+        publisherRegistrationService = new StreamsPublisherRegistrationServiceImpl(publisherRepository, MongoPublisher.class);
     }
 
     @Test

Modified: incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java Tue Nov 19 18:58:35 2013
@@ -3,6 +3,7 @@ package org.apache.streams.components.se
 import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
 import org.apache.streams.components.service.impl.StreamsSubscriberRegistrationServiceImpl;
 import org.apache.streams.persistence.configuration.CassandraConfiguration;
+import org.apache.streams.persistence.model.mongo.MongoSubscription;
 import org.apache.streams.persistence.repository.SubscriptionRepository;
 import org.apache.streams.persistence.repository.cassandra.CassandraKeyspace;
 import org.apache.streams.persistence.repository.cassandra.CassandraSubscriptionRepository;
@@ -28,7 +29,7 @@ public class StreamsSubscriberRegistrati
 
         ActivityStreamsSubscriberWarehouse warehouse = createMock(ActivityStreamsSubscriberWarehouse.class);
 
-        streamsSubscriberRegistrationService = new StreamsSubscriberRegistrationServiceImpl(subscriptionRepository, warehouse);
+        streamsSubscriberRegistrationService = new StreamsSubscriberRegistrationServiceImpl(subscriptionRepository, warehouse, MongoSubscription.class);
     }
 
     @Ignore

Modified: incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java?rev=1543532&r1=1543531&r2=1543532&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java Tue Nov 19 18:58:35 2013
@@ -3,6 +3,8 @@ package org.apache.streams.components.se
 import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
 import org.apache.streams.components.service.impl.StreamsSubscriberRegistrationServiceImpl;
 import org.apache.streams.persistence.model.ActivityStreamsSubscription;
+import org.apache.streams.persistence.model.mongo.MongoActivityStreamsEntry;
+import org.apache.streams.persistence.model.mongo.MongoSubscription;
 import org.apache.streams.persistence.repository.SubscriptionRepository;
 import org.junit.Before;
 import org.junit.Test;
@@ -23,7 +25,7 @@ public class StreamsSubscriberRegistrati
         subscriptionRepository = createMock(SubscriptionRepository.class);
         activityStreamsSubscriberWarehouse = createMock(ActivityStreamsSubscriberWarehouse.class);
 
-        subscriberRegistrationService = new StreamsSubscriberRegistrationServiceImpl(subscriptionRepository,activityStreamsSubscriberWarehouse);
+        subscriberRegistrationService = new StreamsSubscriberRegistrationServiceImpl(subscriptionRepository,activityStreamsSubscriberWarehouse, MongoSubscription.class);
     }
 
     @Test