usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [2/4] git commit: moving files
Date Fri, 03 Oct 2014 19:10:24 GMT
moving files


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/95d3a8c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/95d3a8c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/95d3a8c7

Branch: refs/heads/sqs_queues
Commit: 95d3a8c717d256d6160e2faac57ec52f85764b76
Parents: e0dcf34
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Oct 3 10:53:42 2014 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Oct 3 10:53:42 2014 -0600

----------------------------------------------------------------------
 stack/corepersistence/queue/pom.xml             |  36 +++--
 .../persistence/queue/QueueManager.java         |   7 +
 .../persistence/queue/QueueManagerFactory.java  |  26 ++++
 .../usergrid/persistence/queue/QueueScope.java  |  31 ++++
 .../queue/guice/QueueManagerFactory.java        |   7 -
 .../persistence/queue/guice/QueueModule.java    |  17 +--
 .../queue/impl/QueueManagerImpl.java            |   9 ++
 .../persistence/queue/impl/QueueScopeImpl.java  |  87 +++++++++++
 .../persistence/queue/QueueManagerTest.java     | 150 +------------------
 .../queue/guice/TestQueueModule.java            |  21 ++-
 10 files changed, 212 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/pom.xml b/stack/corepersistence/queue/pom.xml
index 2b0c6c7..09d66c6 100644
--- a/stack/corepersistence/queue/pom.xml
+++ b/stack/corepersistence/queue/pom.xml
@@ -35,36 +35,34 @@
 
   <dependencies>
 
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>common</artifactId>
-      <version>${project.version}</version>
-    </dependency>
 
     <dependency>
       <groupId>org.apache.usergrid</groupId>
       <artifactId>common</artifactId>
       <version>${project.version}</version>
-      <classifier>tests</classifier>
-      <scope>test</scope>
     </dependency>
 
+
+
+    <!-- lang utils for setting uuids etc -->
+
     <dependency>
       <groupId>org.apache.commons</groupId>
-      <artifactId>commons-collections4</artifactId>
-      <version>4.0</version>
+      <artifactId>commons-lang3</artifactId>
+      <version>${commons.lang.version}</version>
     </dependency>
 
-
+    <!-- tests -->
 
     <dependency>
       <groupId>org.apache.usergrid</groupId>
-      <artifactId>collection</artifactId>
+      <artifactId>common</artifactId>
       <version>${project.version}</version>
-      <type>test-jar</type>
+      <classifier>tests</classifier>
       <scope>test</scope>
     </dependency>
 
+
     <dependency>
       <groupId>org.jukito</groupId>
       <artifactId>jukito</artifactId>
@@ -72,14 +70,20 @@
       <scope>test</scope>
     </dependency>
 
+
     <dependency>
-      <groupId>com.codahale.metrics</groupId>
-      <artifactId>metrics-core</artifactId>
-      <version>3.0.2</version>
+      <groupId>org.apache.usergrid</groupId>
+      <artifactId>collection</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
       <scope>test</scope>
     </dependency>
 
-
+    <dependency>
+      <groupId>com.amazonaws</groupId>
+      <artifactId>aws-java-sdk</artifactId>
+      <version>1.0.002</version>
+    </dependency>
 
   </dependencies>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManager.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManager.java
new file mode 100644
index 0000000..9d8a6aa
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManager.java
@@ -0,0 +1,7 @@
+package org.apache.usergrid.persistence.queue;
+
+/**
+ * Created by ApigeeCorporation on 10/3/14.
+ */
+public interface QueueManager {
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManagerFactory.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManagerFactory.java
new file mode 100644
index 0000000..79bcba9
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueManagerFactory.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.usergrid.persistence.queue;
+
+/**
+ * Created by ApigeeCorporation on 10/3/14.
+ */
+public interface QueueManagerFactory {
+    public QueueManager getQueueManager( final QueueScope scope );
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
new file mode 100644
index 0000000..b2b2ec6
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.usergrid.persistence.queue;
+
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+
+
+public interface QueueScope extends ApplicationScope {
+
+    /**
+     * Get the name of the the map
+     * @return
+     */
+    public String getName();
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueManagerFactory.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueManagerFactory.java
deleted file mode 100644
index 11fe0d7..0000000
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueManagerFactory.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.apache.usergrid.persistence.queue.guice;
-
-/**
- * Created by ApigeeCorporation on 10/3/14.
- */
-public class QueueManagerFactory {
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
index 6d7d56d..2168db9 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
@@ -19,16 +19,14 @@ package org.apache.usergrid.persistence.queue.guice;
 
 
 import org.apache.usergrid.persistence.core.migration.Migration;
-import org.apache.usergrid.persistence.queue.MapManager;
-import org.apache.usergrid.persistence.queue.MapManagerFactory;
-import org.apache.usergrid.persistence.queue.impl.MapManagerImpl;
-import org.apache.usergrid.persistence.queue.impl.MapSerialization;
-import org.apache.usergrid.persistence.queue.impl.MapSerializationImpl;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Key;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
 import com.google.inject.multibindings.Multibinder;
+import org.apache.usergrid.persistence.queue.QueueManager;
+import org.apache.usergrid.persistence.queue.QueueManagerFactory;
+import org.apache.usergrid.persistence.queue.impl.QueueManagerImpl;
 
 
 /**
@@ -43,15 +41,10 @@ public class QueueModule extends AbstractModule {
     protected void configure() {
 
         // create a guice factory for getting our collection manager
-        install( new FactoryModuleBuilder().implement( MapManager.class, MapManagerImpl.class
)
-                                           .build( MapManagerFactory.class ) );
+        install( new FactoryModuleBuilder().implement( QueueManager.class, QueueManagerImpl.class
)
+                                           .build( QueueManagerFactory.class ) );
 
 
-        bind( MapSerialization.class).to( MapSerializationImpl.class );
-
-        Multibinder<Migration> migrationBinding = Multibinder.newSetBinder( binder(),
Migration.class );
-        migrationBinding.addBinding().to(  Key.get( MapSerialization.class ) );
-
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerImpl.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerImpl.java
new file mode 100644
index 0000000..acf1d80
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerImpl.java
@@ -0,0 +1,9 @@
+package org.apache.usergrid.persistence.queue.impl;
+
+import org.apache.usergrid.persistence.queue.QueueManager;
+
+public class QueueManagerImpl implements QueueManager {
+    public QueueManagerImpl(){
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
new file mode 100644
index 0000000..d78a66d
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.usergrid.persistence.queue.impl;
+
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.queue.QueueScope;
+
+/**
+ * Created by ApigeeCorporation on 10/3/14.
+ */
+public class QueueScopeImpl implements QueueScope {
+    private final Id owner;
+    private final String name;
+
+
+    public QueueScopeImpl( final Id owner, final String name ) {
+        this.owner = owner;
+        this.name = name;
+    }
+
+
+
+    @Override
+    public Id getApplication() {
+        return owner;
+    }
+
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+    @Override
+    public boolean equals( final Object o ) {
+        if ( this == o ) {
+            return true;
+        }
+        if ( !( o instanceof QueueScopeImpl ) ) {
+            return false;
+        }
+
+        final QueueScopeImpl queueScope = ( QueueScopeImpl ) o;
+
+        if ( !name.equals( queueScope.name ) ) {
+            return false;
+        }
+        if ( !owner.equals( queueScope.owner ) ) {
+            return false;
+        }
+
+        return true;
+    }
+
+
+    @Override
+    public int hashCode() {
+        int result = owner.hashCode();
+        result = 31 * result + name.hashCode();
+        return result;
+    }
+
+
+    @Override
+    public String toString() {
+        return "QueueScopeImpl{" +
+                "owner=" + owner +
+                ", name='" + name + '\'' +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
index 240b42f..e34d877 100644
--- a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
+++ b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
@@ -20,6 +20,10 @@
 package org.apache.usergrid.persistence.queue;
 
 
+import org.apache.usergrid.persistence.queue.QueueManagerFactory;
+import org.apache.usergrid.persistence.queue.QueueScope;
+import org.apache.usergrid.persistence.queue.guice.TestQueueModule;
+import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
 import org.jukito.UseModules;
 import org.junit.Before;
 import org.junit.Rule;
@@ -28,8 +32,6 @@ import org.junit.runner.RunWith;
 
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.core.cassandra.ITRunner;
-import org.apache.usergrid.persistence.queue.guice.TestMapModule;
-import org.apache.usergrid.persistence.queue.impl.MapScopeImpl;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 
 import com.google.inject.Inject;
@@ -41,7 +43,7 @@ import static org.junit.Assert.assertNull;
 
 
 @RunWith( ITRunner.class )
-@UseModules( { TestMapModule.class } )
+@UseModules( { TestQueueModule.class } )
 public class QueueManagerTest {
 
 
@@ -51,156 +53,20 @@ public class QueueManagerTest {
 
 
     @Inject
-    protected MapManagerFactory mmf;
+    protected QueueManagerFactory mmf;
 
-    protected MapScope scope;
+    protected QueueScope scope;
 
 
     @Before
     public void mockApp() {
-        this.scope = new MapScopeImpl( new SimpleId( "application" ), "testMap" );
+        this.scope = new QueueScopeImpl( new SimpleId( "application" ), "testQueue" );
     }
 
 
     @Test
     public void writeReadString() {
-        MapManager mm = mmf.getMapManager( this.scope );
 
-        final String key = "key";
-        final String value = "value";
-
-        mm.putString( key, value );
-
-        final String returned = mm.getString( key );
-
-        assertEquals( value, returned );
-    }
-
-    @Test
-    public void writeReadUUID() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String key = "key";
-        final UUID value = UUID.randomUUID();
-
-        mm.putUuid( key, value );
-
-        final UUID returned = mm.getUuid( key );
-
-        assertEquals( value, returned );
-    }
-
-    @Test
-    public void writeReadLong() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String key = "key";
-        final Long value = 1234L;
-
-        mm.putLong( key, value );
-
-        final Long returned = mm.getLong( key );
-
-        assertEquals( value, returned );
-    }
-
-
-    @Test
-    public void readMissingEntry() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String returned = mm.getString( "key" );
-
-        assertNull( returned );
-
-        final Long returnedL = mm.getLong( "key" );
-
-        assertNull( returnedL );
-
-        final UUID returnedUUID = mm.getUuid( "key" );
-
-        assertNull( returnedUUID );
-    }
-
-
-    @Test
-    public void deleteString() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String key = "key";
-        final String value = "value";
-
-        mm.putString( key, value );
-
-        final String returned = mm.getString( key );
-
-        assertEquals( value, returned );
-
-        mm.delete( key );
-
-        final String postDelete = mm.getString( key );
-
-        assertNull( postDelete );
     }
 
-    @Test
-    public void deleteUUID() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String key = "key";
-        final UUID value = UUID.randomUUID();
-
-        mm.putUuid( key, value );
-
-        final UUID returned = mm.getUuid( key );
-
-        assertEquals( value, returned );
-
-        mm.delete( key );
-
-        final UUID postDelete = mm.getUuid( key );
-
-        assertNull( postDelete );
-    }
-
-    @Test
-    public void deleteLong() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        final String key = "key";
-        final Long value = 1L;
-
-        mm.putLong( key, value );
-
-        final Long returned = mm.getLong( key );
-
-        assertEquals( value, returned );
-
-        mm.delete( key );
-
-        final Long postDelete = mm.getLong( key );
-
-        assertNull( postDelete );
-    }
-
-
-    @Test( expected = NullPointerException.class )
-    public void nullInputString() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        mm.putString( null, null );
-    }
-
-    @Test( expected = NullPointerException.class )
-    public void nullInputLong() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        mm.putLong( null, null );
-    }
-    @Test( expected = NullPointerException.class )
-     public void nullInputUUID() {
-        MapManager mm = mmf.getMapManager( this.scope );
-
-        mm.putUuid( null, null );
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/95d3a8c7/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/guice/TestQueueModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/guice/TestQueueModule.java
b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/guice/TestQueueModule.java
index b54740b..b65725f 100644
--- a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/guice/TestQueueModule.java
+++ b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/guice/TestQueueModule.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
 package org.apache.usergrid.persistence.queue.guice;
 
 
@@ -6,11 +23,11 @@ import org.apache.usergrid.persistence.core.guice.CommonModule;
 
 
 
-public class TestMapModule extends TestModule {
+public class TestQueueModule extends TestModule {
 
     @Override
     protected void configure() {
         install( new CommonModule());
-        install( new MapModule() );
+        install( new QueueModule() );
     }
 }


Mime
View raw message