streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsulli...@apache.org
Subject svn commit: r1539733 - in /incubator/streams/branches/webservice: streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ streams-components/src/main/java/org/apache/streams/components/service/ streams-components/src/mai...
Date Thu, 07 Nov 2013 17:38:42 GMT
Author: dsullivan
Date: Thu Nov  7 17:38:41 2013
New Revision: 1539733

URL: http://svn.apache.org/r1539733
Log:
registering src returns same publisher url

Added:
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java
Modified:
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ActivityStreamsSubscriberWarehouseImpl.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsActivityPublishingService.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsPublisherRepositoryService.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsSubscriberRegistrationService.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/CassandraPublisherService.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityPublishingServiceImpl.java
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityReceivingServiceImpl.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/java/org/apache/streams/components/storm/StormSubscriberBolt.java
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceTest.java
    incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/PublisherRepository.java
    incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepository.java
    incubator/streams/branches/webservice/streams-persistence/src/test/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepositoryTest.java
    incubator/streams/branches/webservice/streams-web/src/main/webapp/WEB-INF/web.xml
    incubator/streams/branches/webservice/streams-web/src/test/java/org/apache/streams/mvc/integration/integration/IntegrationTest.java

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ActivityStreamsSubscriberWarehouseImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ActivityStreamsSubscriberWarehouseImpl.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ActivityStreamsSubscriberWarehouseImpl.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/activitysubscriber/impl/ActivityStreamsSubscriberWarehouseImpl.java
Thu Nov  7 17:38:41 2013
@@ -1,7 +1,5 @@
 package org.apache.streams.components.activitysubscriber.impl;
 
-import java.util.*;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriber;
@@ -11,6 +9,8 @@ import org.apache.streams.persistence.mo
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.*;
+
 @Component
 public class ActivityStreamsSubscriberWarehouseImpl implements ActivityStreamsSubscriberWarehouse
{
     private static final transient Log LOG = LogFactory.getLog(ActivityStreamsSubscriberWarehouseImpl.class);

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsActivityPublishingService.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsActivityPublishingService.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsActivityPublishingService.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsActivityPublishingService.java
Thu Nov  7 17:38:41 2013
@@ -1,7 +1,5 @@
 package org.apache.streams.components.service;
 
-import java.io.IOException;
-
 public interface StreamsActivityPublishingService {
     String publish(String publisherID, String activityJSON) throws Exception;
 }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsPublisherRepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsPublisherRepositoryService.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsPublisherRepositoryService.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsPublisherRepositoryService.java
Thu Nov  7 17:38:41 2013
@@ -4,5 +4,6 @@ import org.apache.streams.persistence.mo
 
 public interface StreamsPublisherRepositoryService {
     void savePublisher(ActivityStreamsPublisher publisher);
-    ActivityStreamsPublisher getActivityStreamsPublisher(String inRoute);
+    ActivityStreamsPublisher getActivityStreamsPublisherBySrc(String src);
+    ActivityStreamsPublisher getActivityStreamsPublisherByInRoute(String inRoute);
 }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsSubscriberRegistrationService.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsSubscriberRegistrationService.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsSubscriberRegistrationService.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/StreamsSubscriberRegistrationService.java
Thu Nov  7 17:38:41 2013
@@ -1,7 +1,5 @@
 package org.apache.streams.components.service;
 
-import java.io.IOException;
-
 public interface StreamsSubscriberRegistrationService {
     String register(String subscriberJSON) throws Exception;
 }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/CassandraPublisherService.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/CassandraPublisherService.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/CassandraPublisherService.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/CassandraPublisherService.java
Thu Nov  7 17:38:41 2013
@@ -24,7 +24,14 @@ public class CassandraPublisherService i
     }
 
     @Override
-    public ActivityStreamsPublisher getActivityStreamsPublisher(String inRoute) {
-        return repository.getPublisher(inRoute);
+    public ActivityStreamsPublisher getActivityStreamsPublisherBySrc(String src) {
+        return repository.getPublisherBySrc(src);
     }
+
+    @Override
+    public ActivityStreamsPublisher getActivityStreamsPublisherByInRoute(String inRoute)
{
+        return repository.getPublisherByInRoute(inRoute);
+    }
+
+
 }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityPublishingServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityPublishingServiceImpl.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityPublishingServiceImpl.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityPublishingServiceImpl.java
Thu Nov  7 17:38:41 2013
@@ -9,8 +9,6 @@ import org.apache.streams.persistence.mo
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.io.IOException;
-
 @Component
 public class StreamsActivityPublishingServiceImpl implements StreamsActivityPublishingService
{
     private Log log = LogFactory.getLog(StreamsActivityPublishingServiceImpl.class);
@@ -31,7 +29,7 @@ public class StreamsActivityPublishingSe
      * @return a success message if no errors were thrown
      * */
     public String publish(String publisherID, String activityJSON) throws Exception {
-        ActivityStreamsPublisher publisher = publisherService.getActivityStreamsPublisher(publisherID);
+        ActivityStreamsPublisher publisher = publisherService.getActivityStreamsPublisherByInRoute(publisherID);
         activityService.receiveActivity(publisher,activityJSON);
         return activityJSON;
     }

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityReceivingServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityReceivingServiceImpl.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityReceivingServiceImpl.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/service/impl/StreamsActivityReceivingServiceImpl.java
Thu Nov  7 17:38:41 2013
@@ -2,8 +2,8 @@ package org.apache.streams.components.se
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.streams.components.service.StreamsActivityReceivingService;
 import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
+import org.apache.streams.components.service.StreamsActivityReceivingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 

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=1539733&r1=1539732&r2=1539733&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
Thu Nov  7 17:38:41 2013
@@ -44,9 +44,15 @@ public class StreamsPublisherRegistratio
             throw new Exception("configuration src is null");
         }
 
-        publisher.setInRoute("" + UUID.randomUUID());
-        publisherRepositoryService.savePublisher(publisher);
+        ActivityStreamsPublisher fromDb = publisherRepositoryService.getActivityStreamsPublisherBySrc(publisher.getSrc());
 
-        return publisher.getInRoute();
+        if(fromDb != null){
+            return fromDb.getInRoute();
+        }else{
+            publisher.setInRoute("" + UUID.randomUUID());
+            publisherRepositoryService.savePublisher(publisher);
+
+            return publisher.getInRoute();
+        }
     }
 }

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=1539733&r1=1539732&r2=1539733&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
Thu Nov  7 17:38:41 2013
@@ -2,9 +2,9 @@ package org.apache.streams.components.se
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
 import org.apache.streams.components.service.StreamsSubscriberRegistrationService;
 import org.apache.streams.components.service.StreamsSubscriptionRepositoryService;
-import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
 import org.apache.streams.persistence.model.ActivityStreamsSubscription;
 import org.apache.streams.persistence.model.cassandra.CassandraSubscription;
 import org.codehaus.jackson.map.DeserializationConfig;

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormSubscriberBolt.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormSubscriberBolt.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormSubscriberBolt.java
(original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormSubscriberBolt.java
Thu Nov  7 17:38:41 2013
@@ -13,7 +13,7 @@ import org.springframework.beans.factory
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
+import java.util.Map;
 
 @Component
 public class StormSubscriberBolt extends BaseBasicBolt {

Added: 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=1539733&view=auto
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java
(added)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceTest.java
Thu Nov  7 17:38:41 2013
@@ -0,0 +1,47 @@
+package org.apache.streams.components.service;
+
+import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
+import org.apache.streams.components.service.impl.CassandraPublisherService;
+import org.apache.streams.components.service.impl.CassandraSubscriptionService;
+import org.apache.streams.components.service.impl.StreamsPublisherRegistrationServiceImpl;
+import org.apache.streams.components.service.impl.StreamsSubscriberRegistrationServiceImpl;
+import org.apache.streams.persistence.configuration.CassandraConfiguration;
+import org.apache.streams.persistence.repository.PublisherRepository;
+import org.apache.streams.persistence.repository.SubscriptionRepository;
+import org.apache.streams.persistence.repository.cassandra.CassandraKeyspace;
+import org.apache.streams.persistence.repository.cassandra.CassandraPublisherRepository;
+import org.apache.streams.persistence.repository.cassandra.CassandraSubscriptionRepository;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.createMock;
+
+public class StreamsPublisherRegistrationServiceTest {
+    private StreamsPublisherRegistrationService streamsPublisherRegistrationService;
+
+    @Before
+    public void setup(){
+
+        CassandraConfiguration configuration = new CassandraConfiguration();
+        configuration.setCassandraPort("127.0.0.1");
+        configuration.setPublisherColumnFamilyName("publishertestD");
+        configuration.setKeyspaceName("keyspacetest");
+
+        CassandraKeyspace keyspace = new CassandraKeyspace(configuration);
+        PublisherRepository publisherRepository = new CassandraPublisherRepository(keyspace,configuration);
+
+        StreamsPublisherRepositoryService publisherRepositoryService = new CassandraPublisherService(publisherRepository);
+
+        streamsPublisherRegistrationService = new StreamsPublisherRegistrationServiceImpl(publisherRepositoryService);
+    }
+
+    @Ignore
+    @Test
+    public void registerTest() throws Exception{
+        String subscriberJson = "{\"src\":\"example.com\"}";
+
+        String inRoute = streamsPublisherRegistrationService.register(subscriberJson);
+        assert(inRoute.equals(streamsPublisherRegistrationService.register(subscriberJson)));
+    }
+}

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=1539733&r1=1539732&r2=1539733&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
Thu Nov  7 17:38:41 2013
@@ -7,8 +7,6 @@ import org.apache.streams.persistence.co
 import org.apache.streams.persistence.repository.SubscriptionRepository;
 import org.apache.streams.persistence.repository.cassandra.CassandraKeyspace;
 import org.apache.streams.persistence.repository.cassandra.CassandraSubscriptionRepository;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;

Modified: incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/PublisherRepository.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/PublisherRepository.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/PublisherRepository.java
(original)
+++ incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/PublisherRepository.java
Thu Nov  7 17:38:41 2013
@@ -3,6 +3,7 @@ package org.apache.streams.persistence.r
 import org.apache.streams.persistence.model.ActivityStreamsPublisher;
 
 public interface PublisherRepository {
-    ActivityStreamsPublisher getPublisher(String inRoute);
+    ActivityStreamsPublisher getPublisherByInRoute(String inRoute);
+    ActivityStreamsPublisher getPublisherBySrc(String src);
     void save(ActivityStreamsPublisher publisher);
 }

Modified: incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepository.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepository.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepository.java
(original)
+++ incubator/streams/branches/webservice/streams-persistence/src/main/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepository.java
Thu Nov  7 17:38:41 2013
@@ -13,7 +13,7 @@ import org.springframework.beans.factory
 import org.springframework.stereotype.Component;
 
 @Component
-public class CassandraPublisherRepository implements PublisherRepository{
+public class CassandraPublisherRepository implements PublisherRepository {
 
     private static final Log LOG = LogFactory.getLog(CassandraActivityStreamsRepository.class);
 
@@ -26,18 +26,22 @@ public class CassandraPublisherRepositor
         this.keyspace = keyspace;
 
         try {
-            keyspace.getSession().execute("CREATE TABLE " + configuration.getPublisherColumnFamilyName()
+ " (" +
+            String createTableCQL = "CREATE TABLE " + configuration.getPublisherColumnFamilyName()
+ " (" +
                     "inroute text, " +
                     "src text, " +
 
-                    "PRIMARY KEY (inroute));");
+                    "PRIMARY KEY (inroute))";
+            String srcIndexCQL = "CREATE INDEX ON " + configuration.getPublisherColumnFamilyName()
+ "(src)";
+
+            keyspace.getSession().execute(createTableCQL);
+            keyspace.getSession().execute(srcIndexCQL);
         } catch (AlreadyExistsException ignored) {
         }
     }
 
     @Override
-    public void save(ActivityStreamsPublisher publisher){
-        String cql = "INSERT INTO " + configuration.getPublisherColumnFamilyName()  + " ("
+
+    public void save(ActivityStreamsPublisher publisher) {
+        String cql = "INSERT INTO " + configuration.getPublisherColumnFamilyName() + " ("
+
                 "inroute, src) " +
                 "VALUES ('" +
                 publisher.getInRoute() + "','" +
@@ -48,17 +52,39 @@ public class CassandraPublisherRepositor
     }
 
     @Override
-    public ActivityStreamsPublisher getPublisher(String inRoute){
-        String cql = "SELECT * FROM " + configuration.getPublisherColumnFamilyName()  + "
WHERE inroute = '" + inRoute+"'";
+    public ActivityStreamsPublisher getPublisherByInRoute(String inRoute) {
+        String cql = "SELECT * FROM " + configuration.getPublisherColumnFamilyName() + "
WHERE inroute = '" + inRoute + "'";
 
         ResultSet set = keyspace.getSession().execute(cql);
         Row row = set.one();
 
-        ActivityStreamsPublisher publisher = new CassandraPublisher();
-        publisher.setSrc(row.getString("src"));
-        publisher.setInRoute(row.getString("inroute"));
+        if (row != null) {
+            ActivityStreamsPublisher publisher = new CassandraPublisher();
+            publisher.setSrc(row.getString("src"));
+            publisher.setInRoute(row.getString("inroute"));
+
+            return publisher;
+        }
+
+        return null;
+    }
+
+    @Override
+    public ActivityStreamsPublisher getPublisherBySrc(String src) {
+        String cql = "SELECT * FROM " + configuration.getPublisherColumnFamilyName() + "
WHERE src = '" + src + "'";
+
+        ResultSet set = keyspace.getSession().execute(cql);
+        Row row = set.one();
+
+        if (row != null) {
+            ActivityStreamsPublisher publisher = new CassandraPublisher();
+            publisher.setSrc(row.getString("src"));
+            publisher.setInRoute(row.getString("inroute"));
+
+            return publisher;
+        }
 
-        return publisher;
+        return null;
     }
 
     public void dropTable() {

Modified: incubator/streams/branches/webservice/streams-persistence/src/test/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-persistence/src/test/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepositoryTest.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-persistence/src/test/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepositoryTest.java
(original)
+++ incubator/streams/branches/webservice/streams-persistence/src/test/java/org/apache/streams/persistence/repository/cassandra/CassandraPublisherRepositoryTest.java
Thu Nov  7 17:38:41 2013
@@ -39,7 +39,7 @@ public class CassandraPublisherRepositor
     @Test
     public void getPublisherTest(){
 
-        ActivityStreamsPublisher publisher = repository.getPublisher("inRoute");
+        ActivityStreamsPublisher publisher = repository.getPublisherByInRoute("inRoute");
 
         assertEquals(publisher.getSrc(),("http://www.google.com"));
         assertEquals(publisher.getId(),("newId"));

Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/WEB-INF/web.xml?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/WEB-INF/web.xml Thu
Nov  7 17:38:41 2013
@@ -1,6 +1,5 @@
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          id="Shindig"
          version="2.5">

Modified: incubator/streams/branches/webservice/streams-web/src/test/java/org/apache/streams/mvc/integration/integration/IntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/test/java/org/apache/streams/mvc/integration/integration/IntegrationTest.java?rev=1539733&r1=1539732&r2=1539733&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/test/java/org/apache/streams/mvc/integration/integration/IntegrationTest.java
(original)
+++ incubator/streams/branches/webservice/streams-web/src/test/java/org/apache/streams/mvc/integration/integration/IntegrationTest.java
Thu Nov  7 17:38:41 2013
@@ -1,12 +1,12 @@
 package org.apache.streams.mvc.integration.integration;
 
-import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
-import org.springframework.mock.web.*;
+import org.springframework.mock.web.MockHttpSession;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.context.web.WebAppConfiguration;
@@ -14,11 +14,11 @@ import org.springframework.test.web.serv
 import org.springframework.test.web.servlet.ResultActions;
 import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 import org.springframework.web.context.WebApplicationContext;
-import org.junit.Before;
 
 import javax.servlet.ServletException;
 
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @RunWith(SpringJUnit4ClassRunner.class)



Mime
View raw message