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/07 19:07:30 UTC

svn commit: r1539741 - /incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/

Author: dsullivan
Date: Thu Nov  7 18:07:30 2013
New Revision: 1539741

URL: http://svn.apache.org/r1539741
Log:
changing names to integration test

Added:
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceIntegrationTest.java
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceIntegrationTest.java
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java
Removed:
    incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceTest.java
    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/StreamsSubscriberRegistrationServiceTest.java

Added: incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceIntegrationTest.java?rev=1539741&view=auto
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceIntegrationTest.java (added)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsActivityRepositoryServiceIntegrationTest.java Thu Nov  7 18:07:30 2013
@@ -0,0 +1,43 @@
+package org.apache.streams.components.service;
+
+import org.apache.streams.persistence.model.ActivityStreamsEntry;
+import org.apache.streams.persistence.model.cassandra.CassandraActivityStreamsEntry;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class StreamsActivityRepositoryServiceIntegrationTest {
+
+    @Test
+    public void parseJsonTest() throws IOException {
+        ObjectMapper mapper = new ObjectMapper();
+        String activityJson = "{\n" +
+                "     \"verb\": \"verb\",\n" +
+                "     \"tags\": \"tags\",\n" +
+                "     \"provider\": {\n" +
+                "          \"url\": \"www.example.com\"\n" +
+                "     },\n" +
+                "     \"actor\": {\n" +
+                "          \"id\": \"actorid\",\n" +
+                "          \"objectType\": \"actorobject\",\n" +
+                "          \"displayName\": \"actorname\",\n" +
+                "          \"url\": \"www.actorexampleurl.com\"\n" +
+                "     },\n" +
+                "     \"target\": {\n" +
+                "           \"id\": \"targetid\",\n" +
+                "           \"displayName\": \"targetname\",\n" +
+                "           \"url\": \"www.targeturl.com\"\n" +
+                "     },\n" +
+                "     \"object\": {\n" +
+                "           \"id\": \"objectid\",\n" +
+                "           \"displayName\": \"objectname\",\n" +
+                "           \"objectType\": \"object\",\n" +
+                "           \"url\": \"www.objecturl.org\"\n" +
+                "       }\n" +
+                " }";
+
+        ActivityStreamsEntry a2 = mapper.readValue(activityJson,CassandraActivityStreamsEntry.class);
+
+    }
+}

Added: incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceIntegrationTest.java?rev=1539741&view=auto
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceIntegrationTest.java (added)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsPublisherRegistrationServiceIntegrationTest.java Thu Nov  7 18:07:30 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 StreamsPublisherRegistrationServiceIntegrationTest {
+    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)));
+    }
+}

Added: 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=1539741&view=auto
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java (added)
+++ incubator/streams/branches/webservice/streams-components/src/test/java/org/apache/streams/components/service/StreamsSubscriberRegistrationServiceIntegrationTest.java Thu Nov  7 18:07:30 2013
@@ -0,0 +1,45 @@
+package org.apache.streams.components.service;
+
+import org.apache.streams.components.activitysubscriber.ActivityStreamsSubscriberWarehouse;
+import org.apache.streams.components.service.impl.CassandraSubscriptionService;
+import org.apache.streams.components.service.impl.StreamsSubscriberRegistrationServiceImpl;
+import org.apache.streams.persistence.configuration.CassandraConfiguration;
+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.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.createMock;
+
+public class StreamsSubscriberRegistrationServiceIntegrationTest {
+   private StreamsSubscriberRegistrationService streamsSubscriberRegistrationService;
+
+    @Before
+    public void setup(){
+
+        CassandraConfiguration configuration = new CassandraConfiguration();
+        configuration.setCassandraPort("127.0.0.1");
+        configuration.setSubscriptionColumnFamilyName("subscriptionstestB");
+        configuration.setKeyspaceName("keyspacetest");
+
+        CassandraKeyspace keyspace = new CassandraKeyspace(configuration);
+        SubscriptionRepository subscriptionRepository = new CassandraSubscriptionRepository(keyspace,configuration);
+
+        ActivityStreamsSubscriberWarehouse warehouse = createMock(ActivityStreamsSubscriberWarehouse.class);
+        StreamsSubscriptionRepositoryService repositoryService = new CassandraSubscriptionService(subscriptionRepository);
+
+        streamsSubscriberRegistrationService = new StreamsSubscriberRegistrationServiceImpl(repositoryService, warehouse);
+    }
+
+    @Ignore
+    @Test
+    public void registerTest() throws Exception{
+        String subscriberJson = "{\"username\":\"newUsername\"}";
+
+        String inRoute = streamsSubscriberRegistrationService.register(subscriberJson);
+        assert(inRoute.equals(streamsSubscriberRegistrationService.register(subscriberJson)));
+    }
+
+}