You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/07/07 20:16:18 UTC

[01/50] [abbrv] git commit: Implemented shard count persistence.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-164 [deleted] 280f51707
  refs/heads/USERGRID-174 2781766e1 -> 5163de914
  refs/heads/akka-job-scheduler-replacement [created] c7b861275
  refs/heads/cloud-formation-scripts [created] 9046e8899
  refs/heads/master 7dd337212 -> c7b861275
  refs/heads/performance-fixes e3f61ecb5 -> b64af62ec
  refs/heads/two-dot-o b6364bd9f -> 71cb9c266
  refs/pull/182/merge [deleted] bd2f138ed
  refs/pull/188/head 280f51707 -> c030dbaea
  refs/pull/188/merge [deleted] 05d1fa64d
  refs/pull/194/merge [deleted] 0baccb5c3
  refs/pull/195/head 3faf865cf -> 3472adaee
  refs/pull/195/merge [deleted] 046b0cb78
  refs/pull/198/merge 5a8dbe895 -> 7e318fa60 (forced update)
  refs/pull/200/head 470128269 -> b7a88d9fc
  refs/pull/200/merge [deleted] 405a02645
  refs/pull/203/head [created] c1127f92c
  refs/pull/204/head [created] 04d2839ff
  refs/pull/205/head [created] f4cd72c47
  refs/pull/206/head [created] 6f4423e89
  refs/pull/206/merge [created] 3d34a4390
  refs/pull/207/head [created] 19116416f
  refs/pull/208/head [created] 914c6fa1f
  refs/pull/209/head [created] 98e89bb62
  refs/pull/210/head [created] 9046e8899
  refs/pull/211/head [created] 5163de914
  refs/pull/211/merge [created] 58918e901
  refs/pull/212/head [created] 23f5a1137
  refs/pull/213/head [created] fe88acbc2
  refs/pull/214/head [created] 3f3bb46a3
  refs/pull/215/head [created] c54849ed9
  refs/pull/216/head [created] 0ae961a65
  refs/pull/217/head [created] 6853f7ceb
  refs/pull/218/head [created] efd3292be
  refs/pull/218/merge [created] 0f479fa74
  refs/pull/219/head [created] d3753f32e
  refs/pull/220/head [created] 5127c83bc
  refs/pull/221/head [created] ceeb66f82
  refs/pull/222/head [created] 7e4fc083b
  refs/pull/223/head [created] 1b11c501e
  refs/pull/224/head [created] fd29736d1
  refs/pull/225/head [created] db037b180
  refs/pull/225/merge [created] 488ecbe26
  refs/pull/226/head [created] 630830d5a
  refs/pull/227/head [created] f2fd25a4e
  refs/pull/227/merge [created] 756327144
  refs/pull/228/head [created] 2b2bb8556
  refs/pull/228/merge [created] 540a449d5
  refs/pull/229/head [created] 97eaead30
  refs/pull/229/merge [created] 49b490ed8
  refs/pull/230/head [created] 97e5dfbf8
  refs/pull/231/head [created] 1143d43aa
  refs/pull/231/merge [created] 0a48ce648
  refs/pull/232/head [created] f2fd25a4e
  refs/pull/232/merge [created] e3e2dadd8
  refs/pull/233/head [created] 598644d6c
  refs/pull/234/head [created] b6e445d6b
  refs/pull/235/head [created] 4fe70f4c3
  refs/pull/236/head [created] 9b6d81978
  refs/pull/237/head [created] 639157137
  refs/pull/238/head [created] 155c8095b
  refs/pull/239/head [created] 2a98cae99


Implemented shard count persistence.


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

Branch: refs/heads/two-dot-o
Commit: a8fc5a56e59941f9591bfea7211e3d4df6106483
Parents: b56e641
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Jun 26 18:41:34 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Jun 26 18:41:34 2014 -0600

----------------------------------------------------------------------
 .../persistence/graph/guice/GraphModule.java    |  14 +-
 .../shard/EdgeShardCounterSerialization.java    |  63 --------
 .../serialization/impl/shard/count/Counter.java |  10 ++
 .../count/NodeShardCounterSerialization.java    |   4 +-
 .../NodeShardCounterSerializationImpl.java      | 139 +++++++++++++++++
 .../impl/shard/count/ShardKey.java              |  24 ++-
 .../impl/EdgeShardCounterSerializationImpl.java | 142 ------------------
 .../shard/impl/NodeShardAllocationImpl.java     |   9 +-
 .../EdgeShardCounterSerializationTest.java      | 148 -------------------
 .../impl/shard/NodeShardAllocationTest.java     |  47 +++---
 .../shard/count/NodeShardApproximationTest.java |  13 +-
 .../NodeShardCounterSerializationTest.java      | 126 ++++++++++++++++
 12 files changed, 347 insertions(+), 392 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
index dcf0718..f096740 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
@@ -43,16 +43,16 @@ import org.apache.usergrid.persistence.graph.serialization.NodeSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.EdgeSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.NodeSerializationImpl;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardCounterSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardStrategy;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardAllocation;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardCache;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.EdgeShardCounterSerializationImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardApproximationImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardCounterSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardCounterSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.EdgeShardSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.NodeShardAllocationImpl;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardApproximationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.NodeShardCacheImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.SizebasedEdgeShardStrategy;
 
@@ -92,13 +92,14 @@ public class GraphModule extends AbstractModule {
         bind( NodeShardAllocation.class ).to( NodeShardAllocationImpl.class );
         bind( NodeShardApproximation.class ).to( NodeShardApproximationImpl.class );
         bind( NodeShardCache.class ).to( NodeShardCacheImpl.class );
+        bind( NodeShardCounterSerialization.class ).to( NodeShardCounterSerializationImpl.class );
 
         /**
          * Bind our strategies based on their internal annotations.
          */
 
         bind( EdgeShardSerialization.class ).to( EdgeShardSerializationImpl.class );
-        bind( EdgeShardCounterSerialization.class ).to( EdgeShardCounterSerializationImpl.class );
+
 
 
         //Repair/cleanup classes.
@@ -113,6 +114,9 @@ public class GraphModule extends AbstractModule {
         bind( EdgeDeleteListener.class).to( EdgeDeleteListenerImpl.class );
 
 
+        /**
+         * Bind our implementation
+         */
 
         /********
          * Migration bindings
@@ -128,7 +132,7 @@ public class GraphModule extends AbstractModule {
         migrationBinding.addBinding().to( Key.get( EdgeSerialization.class, StorageEdgeSerialization.class ) );
 
         migrationBinding.addBinding().to( Key.get( EdgeShardSerialization.class ) );
-        migrationBinding.addBinding().to( Key.get( EdgeShardCounterSerialization.class ) );
+        migrationBinding.addBinding().to( Key.get( NodeShardCounterSerialization.class ) );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerialization.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerialization.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerialization.java
deleted file mode 100644
index a9aa1ba..0000000
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerialization.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.graph.serialization.impl.shard;
-
-
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.migration.Migration;
-import org.apache.usergrid.persistence.model.entity.Id;
-
-import com.netflix.astyanax.MutationBatch;
-
-
-/**
- * The interface to define counter operations.  Note that the implementation may not be immediately consistent.
- *
- * TODO: Ivestigate this further with CountMinSketch.  Since our cardinality needs to be "good enough", we may be able
- * to offer much better performance than the Cassandra counters by using CountMinSketch in a time series manner on each node, and persisting it's map
- * in memory with period flush into a standard CF.  On query, we can read a unioned column.
- * On flush, we can flush, then read+union and set the timestamp on the column so that only 1 union will be the max.
- *
- */
-public interface EdgeShardCounterSerialization extends Migration{
-
-    /**
-     * Write a new time shard for the meta data
-     * @param scope The scope to write
-     * @param nodeId The id in the edge
-     * @param shardId The shard Id to use
-     * @param types The types to write to.  Can be edge type, or edgeType+id type
-     */
-    public MutationBatch writeMetaDataLog( ApplicationScope scope, Id nodeId, long shardId, long count, String... types );
-
-
-    /**
-     * Get the most recent rollup of all of the given summations.  If one is not present the optional will be empty
-     * @param scope
-     * @param nodeId
-     * @param shardId
-     * @param types
-     * @return
-     */
-    public long getCount(ApplicationScope scope, Id nodeId, long shardId, String... types);
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/Counter.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/Counter.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/Counter.java
index 47d89e9..4318200 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/Counter.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/Counter.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard.count;
 
 
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -100,6 +101,15 @@ public class Counter {
 
 
     /**
+     * Get all entries
+     * @return
+     */
+    public Set<Map.Entry<ShardKey, AtomicLong>> getEntries(){
+        return counts.entrySet();
+    }
+
+
+    /**
      * Get the count of the number of times we've been incremented
      * @return
      */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerialization.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerialization.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerialization.java
index aa95e69..41eb525 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerialization.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerialization.java
@@ -19,13 +19,15 @@
 package org.apache.usergrid.persistence.graph.serialization.impl.shard.count;
 
 
+import org.apache.usergrid.persistence.core.migration.Migration;
+
 import com.netflix.astyanax.MutationBatch;
 
 
 /**
  * Serialization for flushing and reading counters
  */
-public interface NodeShardCounterSerialization {
+public interface NodeShardCounterSerialization  extends Migration {
 
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
new file mode 100644
index 0000000..da318bf
--- /dev/null
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
@@ -0,0 +1,139 @@
+/*
+ * 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.graph.serialization.impl.shard.count;
+
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.marshal.CounterColumnType;
+
+import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
+import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
+import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.OrganizationScopedRowKeySerializer;
+import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.graph.GraphFig;
+import org.apache.usergrid.persistence.graph.exception.GraphRuntimeException;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.EdgeRowKey;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.EdgeRowKeySerializer;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+import com.netflix.astyanax.connectionpool.exceptions.NotFoundException;
+import com.netflix.astyanax.model.Column;
+import com.netflix.astyanax.serializers.LongSerializer;
+
+
+
+@Singleton
+public class NodeShardCounterSerializationImpl implements NodeShardCounterSerialization {
+
+
+    /**
+     * Edge shards
+     */
+    private static final MultiTennantColumnFamily<ApplicationScope, EdgeRowKey, Long> EDGE_SHARD_COUNTS =
+            new MultiTennantColumnFamily<>( "Edge_Shard_Counts",
+                    new OrganizationScopedRowKeySerializer<>( new EdgeRowKeySerializer() ), LongSerializer.get() );
+
+
+    protected final Keyspace keyspace;
+    protected final CassandraConfig cassandraConfig;
+    protected final GraphFig graphFig;
+
+
+    @Inject
+    public NodeShardCounterSerializationImpl( final Keyspace keyspace, final CassandraConfig cassandraConfig,
+                                            final GraphFig graphFig ) {
+        this.keyspace = keyspace;
+        this.cassandraConfig = cassandraConfig;
+        this.graphFig = graphFig;
+    }
+
+
+    @Override
+    public MutationBatch flush( final Counter counter ) {
+
+
+        Preconditions.checkNotNull( counter, "counter must be specified" );
+
+
+        final MutationBatch batch = keyspace.prepareMutationBatch();
+
+        for ( Map.Entry<ShardKey, AtomicLong> entry : counter.getEntries() ) {
+
+            final ShardKey key = entry.getKey();
+            final long value = entry.getValue().get();
+
+            final EdgeRowKey edgeRowKey = new EdgeRowKey( key.getNodeId(), key.getEdgeTypes() );
+
+            final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.getScope(), edgeRowKey );
+
+
+            batch.withRow( EDGE_SHARD_COUNTS, rowKey ).incrementCounterColumn( key.getShardId(), value );
+        }
+
+
+        return batch;
+    }
+
+
+    @Override
+    public long getCount( final ShardKey key ) {
+
+        final EdgeRowKey edgeRowKey = new EdgeRowKey( key.getNodeId(), key.getEdgeTypes() );
+
+        final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.getScope(), edgeRowKey );
+
+
+        try {
+            OperationResult<Column<Long>> column =
+                    keyspace.prepareQuery( EDGE_SHARD_COUNTS ).getKey( rowKey ).getColumn( key.getShardId() ).execute();
+
+            return column.getResult().getLongValue();
+        }
+        //column not found, return 0
+        catch ( NotFoundException nfe ) {
+            return 0;
+        }
+        catch ( ConnectionException e ) {
+            throw new GraphRuntimeException( "An error occurred connecting to cassandra", e );
+        }
+    }
+
+
+    @Override
+    public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+        return Collections.singleton(
+                new MultiTennantColumnFamilyDefinition( EDGE_SHARD_COUNTS, BytesType.class.getSimpleName(),
+                        ColumnTypes.LONG_TYPE_REVERSED, CounterColumnType.class.getSimpleName(),
+                        MultiTennantColumnFamilyDefinition.CacheOption.KEYS ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/ShardKey.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/ShardKey.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/ShardKey.java
index 2e6cc1d..63c87d3 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/ShardKey.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/ShardKey.java
@@ -35,9 +35,7 @@ public class ShardKey {
     private final String[] edgeTypes;
 
 
-    public ShardKey( final ApplicationScope scope, final Id nodeId, final long shardId, final String[] edgeTypes ) {
-
-
+    public ShardKey( final ApplicationScope scope, final Id nodeId, final long shardId, final String... edgeTypes ) {
         this.scope = scope;
         this.nodeId = nodeId;
         this.shardId = shardId;
@@ -73,6 +71,26 @@ public class ShardKey {
     }
 
 
+    public ApplicationScope getScope() {
+        return scope;
+    }
+
+
+    public Id getNodeId() {
+        return nodeId;
+    }
+
+
+    public long getShardId() {
+        return shardId;
+    }
+
+
+    public String[] getEdgeTypes() {
+        return edgeTypes;
+    }
+
+
     @Override
     public int hashCode() {
         int result = scope.hashCode();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardCounterSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardCounterSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardCounterSerializationImpl.java
deleted file mode 100644
index 5e46c3a..0000000
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardCounterSerializationImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.graph.serialization.impl.shard.impl;
-
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.cassandra.db.marshal.BytesType;
-import org.apache.cassandra.db.marshal.CounterColumnType;
-
-import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.graph.GraphFig;
-import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
-import org.apache.usergrid.persistence.core.astyanax.OrganizationScopedRowKeySerializer;
-import org.apache.usergrid.persistence.graph.exception.GraphRuntimeException;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardCounterSerialization;
-import org.apache.usergrid.persistence.model.entity.Id;
-
-import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.OperationResult;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import com.netflix.astyanax.connectionpool.exceptions.NotFoundException;
-import com.netflix.astyanax.model.Column;
-import com.netflix.astyanax.serializers.LongSerializer;
-
-
-@Singleton
-public class EdgeShardCounterSerializationImpl implements EdgeShardCounterSerialization {
-
-
-    /**
-     * Edge shards
-     */
-    private static final MultiTennantColumnFamily<ApplicationScope, EdgeRowKey, Long> EDGE_SHARD_COUNTS =
-            new MultiTennantColumnFamily<>( "Edge_Shard_Counts",
-                    new OrganizationScopedRowKeySerializer<>( new EdgeRowKeySerializer() ), LongSerializer.get() );
-
-
-    protected final Keyspace keyspace;
-    protected final CassandraConfig cassandraConfig;
-    protected final GraphFig graphFig;
-
-
-    @Inject
-    public EdgeShardCounterSerializationImpl( final Keyspace keyspace, final CassandraConfig cassandraConfig,
-                                              final GraphFig graphFig ) {
-        this.keyspace = keyspace;
-        this.cassandraConfig = cassandraConfig;
-        this.graphFig = graphFig;
-    }
-
-
-    @Override
-    public MutationBatch writeMetaDataLog( final ApplicationScope scope, final Id nodeId, final long shardId,
-                                           final long count, final String... types ) {
-
-        ValidationUtils.validateApplicationScope( scope );
-        ValidationUtils.verifyIdentity(nodeId);
-        Preconditions.checkArgument( shardId > -1, "shardId must be greater than -1" );
-        Preconditions.checkNotNull( types );
-
-        final EdgeRowKey key = new EdgeRowKey( nodeId, types );
-
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope, key );
-
-        final MutationBatch batch = keyspace.prepareMutationBatch();
-
-        batch.withRow( EDGE_SHARD_COUNTS, rowKey ).incrementCounterColumn( shardId, count );
-
-        return batch;
-    }
-
-
-    @Override
-    public long getCount( final ApplicationScope scope, final Id nodeId, final long shardId, final String... types ) {
-
-
-        ValidationUtils.validateApplicationScope( scope );
-        ValidationUtils.verifyIdentity(nodeId);
-        Preconditions.checkArgument( shardId > -1, "shardId must be greater than -1" );
-        Preconditions.checkNotNull( types );
-
-
-        final EdgeRowKey key = new EdgeRowKey( nodeId, types );
-
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope, key );
-
-
-        try {
-            OperationResult<Column<Long>> column =
-                    keyspace.prepareQuery( EDGE_SHARD_COUNTS ).getKey( rowKey ).getColumn( shardId ).execute();
-
-            return column.getResult().getLongValue();
-        }
-        //column not found, return 0
-        catch ( NotFoundException nfe ) {
-            return 0;
-        }
-        catch ( ConnectionException e ) {
-            throw new GraphRuntimeException( "An error occurred connecting to cassandra", e );
-        }
-
-    }
-
-
-    @Override
-    public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
-        return Collections.singleton(
-                new MultiTennantColumnFamilyDefinition( EDGE_SHARD_COUNTS, BytesType.class.getSimpleName(),
-                        ColumnTypes.LONG_TYPE_REVERSED,  CounterColumnType.class.getSimpleName(),
-                        MultiTennantColumnFamilyDefinition.CacheOption.KEYS ) );
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
index cec2737..dc34d73 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
@@ -30,9 +30,10 @@ import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphFig;
 import org.apache.usergrid.persistence.graph.exception.GraphRuntimeException;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardCounterSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardAllocation;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardCounterSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.ShardKey;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Optional;
@@ -49,7 +50,7 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
 
 
     private final EdgeShardSerialization edgeShardSerialization;
-    private final EdgeShardCounterSerialization edgeShardCounterSerialization;
+    private final NodeShardCounterSerialization edgeShardCounterSerialization;
     private final TimeService timeService;
     private final GraphFig graphFig;
     private final Keyspace keyspace;
@@ -57,7 +58,7 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
 
     @Inject
     public NodeShardAllocationImpl( final EdgeShardSerialization edgeShardSerialization,
-                                    final EdgeShardCounterSerialization edgeShardCounterSerialization,
+                                    final NodeShardCounterSerialization edgeShardCounterSerialization,
                                     final TimeService timeService, final GraphFig graphFig, final Keyspace keyspace ) {
         this.edgeShardSerialization = edgeShardSerialization;
         this.edgeShardCounterSerialization = edgeShardCounterSerialization;
@@ -156,7 +157,7 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
         /**
          * Check out if we have a count for our shard allocation
          */
-        final long count = edgeShardCounterSerialization.getCount( scope, nodeId, maxShard, edgeType );
+        final long count = edgeShardCounterSerialization.getCount( new ShardKey( scope, nodeId, maxShard, edgeType ));
 
         if ( count < graphFig.getShardSize() ) {
             return false;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerializationTest.java
deleted file mode 100644
index ccc3de1..0000000
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardCounterSerializationTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.graph.serialization.impl.shard;
-
-
-import java.util.Stack;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import org.jukito.UseModules;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.apache.usergrid.persistence.core.cassandra.ITRunner;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
-import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.google.inject.Inject;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-
-@RunWith( ITRunner.class )
-@UseModules( { TestGraphModule.class } )
-public class EdgeShardCounterSerializationTest {
-
-
-    @Inject
-    @Rule
-    public MigrationManagerRule migrationManagerRule;
-
-
-    @Inject
-    private EdgeShardCounterSerialization edgeShardCounterSerialization;
-
-    protected ApplicationScope scope;
-
-
-    @Before
-    public void setup() {
-        scope = mock( ApplicationScope.class );
-
-        Id orgId = mock( Id.class );
-
-        when( orgId.getType() ).thenReturn( "organization" );
-        when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
-
-        when( scope.getApplication() ).thenReturn( orgId );
-    }
-
-
-    @Test
-    public void testSingleCount() throws ConnectionException {
-
-        final Id id = createId( "test" );
-        final long shard = 1000l;
-        final String[] types = { "type", "subtype" };
-
-        final long toWrite = 1000l;
-
-        edgeShardCounterSerialization.writeMetaDataLog( scope, id, shard, toWrite, types ).execute();
-
-
-        final long count = edgeShardCounterSerialization.getCount( scope, id, shard, types );
-
-        assertEquals( "Correct amount returned", toWrite, count );
-    }
-
-
-    @Test
-    public void testConcurrentWrites() throws ConnectionException, ExecutionException, InterruptedException {
-
-        final Id id = createId( "test" );
-        final long shard = 1000l;
-        final String[] types = { "type", "subtype" };
-
-        final long toWrite = 1000l;
-
-
-        final int workerCount = 2;
-        final int iterations = 1000;
-
-        ExecutorService executors = Executors.newFixedThreadPool( workerCount );
-
-        Stack<Future<Void>> futures = new Stack<Future<Void>>();
-
-        for ( int i = 0; i < workerCount; i++ ) {
-
-           final Future<Void> future =  executors.submit( new Callable<Void>() {
-
-                @Override
-                public Void call() throws Exception {
-
-                    for ( int i = 0; i < iterations; i++ ) {
-                        edgeShardCounterSerialization.writeMetaDataLog( scope, id, shard, toWrite, types ).execute();
-                    }
-
-                    return null;
-                }
-            } );
-
-            futures.push( future );
-        }
-
-        /**
-         * Wait until they're all done
-         */
-        for(Future<Void> future: futures){
-            future.get();
-        }
-
-
-        final long count = edgeShardCounterSerialization.getCount( scope, id, shard, types );
-
-        final long expected = toWrite * iterations * workerCount;
-
-        assertEquals( "Correct amount returned", expected, count );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index 1578be2..5b4c4e7 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -31,6 +31,8 @@ import org.mockito.ArgumentCaptor;
 import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphFig;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardCounterSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.ShardKey;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.NodeShardAllocationImpl;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -82,8 +84,8 @@ public class NodeShardAllocationTest {
     public void noShards() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization nodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -95,7 +97,7 @@ public class NodeShardAllocationTest {
         when( keyspace.prepareMutationBatch() ).thenReturn( batch );
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -119,8 +121,8 @@ public class NodeShardAllocationTest {
     public void existingFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization nodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -134,7 +136,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -165,8 +167,8 @@ public class NodeShardAllocationTest {
     public void lowCountFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization NodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -179,7 +181,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -204,9 +206,8 @@ public class NodeShardAllocationTest {
 
         final long count = graphFig.getShardSize() - 1;
 
-        when( edgeShardCounterSerialization
-                .getCount( same( scope ), same( nodeId ), eq( 0l ), same( type ), same( subType ) ) )
-                .thenReturn( count );
+        when( NodeShardCounterSerialization.getCount( eq( new ShardKey( scope, nodeId, 0l, type, subType ) ) ))
+                                           .thenReturn( count );
 
         final boolean result = approximation.auditMaxShard( scope, nodeId, type, subType );
 
@@ -218,8 +219,8 @@ public class NodeShardAllocationTest {
     public void equalCountFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization NodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -232,7 +233,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -256,8 +257,8 @@ public class NodeShardAllocationTest {
         final long shardCount = graphFig.getShardSize();
 
         //return a shard size equal to our max
-        when( edgeShardCounterSerialization
-                .getCount( same( scope ), same( nodeId ), eq( 0l ), same( type ), same( subType ) ) )
+        when( NodeShardCounterSerialization
+                .getCount(  eq(new ShardKey(  scope , nodeId, 0l,type , subType ) ) ))
                 .thenReturn( shardCount );
 
         ArgumentCaptor<Long> newUUIDValue = ArgumentCaptor.forClass( Long.class );
@@ -291,8 +292,8 @@ public class NodeShardAllocationTest {
     public void futureCountShardCleanup() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization NodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -305,7 +306,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -396,8 +397,8 @@ public class NodeShardAllocationTest {
     public void noShardsReturns() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final EdgeShardCounterSerialization edgeShardCounterSerialization =
-                mock( EdgeShardCounterSerialization.class );
+        final NodeShardCounterSerialization NodeShardCounterSerialization =
+                mock( NodeShardCounterSerialization.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -409,7 +410,7 @@ public class NodeShardAllocationTest {
         when( keyspace.prepareMutationBatch() ).thenReturn( batch );
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, edgeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index 5eb760c..6475ca6 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -22,6 +22,7 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard.count;
 import java.beans.PropertyChangeListener;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -39,10 +40,10 @@ import org.safehaus.guicyfig.Bypass;
 import org.safehaus.guicyfig.OptionState;
 import org.safehaus.guicyfig.Overrides;
 
+import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
 import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphFig;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardCounterSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -70,7 +71,7 @@ public class NodeShardApproximationTest {
 
     private GraphFig graphFig;
 
-    private EdgeShardCounterSerialization ser;
+    private NodeShardCounterSerialization ser;
     private NodeShardCounterSerialization nodeShardCounterSerialization;
     private TimeService timeService;
 
@@ -93,7 +94,7 @@ public class NodeShardApproximationTest {
         when( graphFig.getShardCacheSize() ).thenReturn( 10000l );
         when( graphFig.getShardSize() ).thenReturn( 250000l );
 
-        ser = mock( EdgeShardCounterSerialization.class );
+        ser = mock( NodeShardCounterSerialization.class );
         nodeShardCounterSerialization = mock( NodeShardCounterSerialization.class );
 
         when(nodeShardCounterSerialization.flush( any(Counter.class) )).thenReturn( mock( MutationBatch.class) );
@@ -273,6 +274,12 @@ public class NodeShardApproximationTest {
         public long getCount( final ShardKey key ) {
             return copy.get( key );
         }
+
+
+        @Override
+        public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+            return null;  //To change body of implemented methods use File | Settings | File Templates.
+        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8fc5a56/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
new file mode 100644
index 0000000..9968f67
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.graph.serialization.impl.shard.count;
+
+
+import org.jukito.UseModules;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
+import org.apache.usergrid.persistence.core.cassandra.CassandraRule;
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.graph.GraphFig;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.EdgeSerialization;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.google.inject.Inject;
+import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+@RunWith(ITRunner.class)
+@UseModules({ TestGraphModule.class })
+public class NodeShardCounterSerializationTest {
+
+    private static final Logger log = LoggerFactory.getLogger( NodeShardCounterSerializationTest.class );
+
+    @ClassRule
+    public static CassandraRule rule = new CassandraRule();
+
+
+    @Inject
+    @Rule
+    public MigrationManagerRule migrationManagerRule;
+
+
+    protected EdgeSerialization serialization;
+
+    @Inject
+    protected GraphFig graphFig;
+
+    @Inject
+    protected Keyspace keyspace;
+
+    @Inject
+    protected NodeShardCounterSerialization nodeShardCounterSerialization;
+
+    protected ApplicationScope scope;
+
+
+    @Before
+    public void setup() {
+        scope = mock( ApplicationScope.class );
+
+        Id orgId = mock( Id.class );
+
+        when( orgId.getType() ).thenReturn( "organization" );
+        when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
+
+        when( scope.getApplication() ).thenReturn( orgId );
+    }
+
+
+    @Test
+    public void testWritesRead() throws ConnectionException {
+
+
+        final Id id = createId( "test" );
+
+        ShardKey key1 = new ShardKey( scope, id, 0, "type1" );
+
+        ShardKey key2 = new ShardKey( scope, id, 0, "type2" );
+
+        ShardKey key3 = new ShardKey( scope, id, 1, "type1" );
+
+
+        Counter counter = new Counter();
+        counter.add( key1, 1000 );
+        counter.add( key2, 2000 );
+        counter.add( key3, 3000 );
+
+        nodeShardCounterSerialization.flush( counter ).execute();
+
+
+        final long time1 = nodeShardCounterSerialization.getCount( key1 );
+
+        assertEquals( 1000, time1 );
+
+        final long time2 = nodeShardCounterSerialization.getCount( key2 );
+
+        assertEquals( 2000, time2 );
+
+        final long time3 = nodeShardCounterSerialization.getCount( key3 );
+
+        assertEquals( 3000, time3 );
+    }
+}


[15/50] [abbrv] git commit: Merge f2fd25a4eee46b2306c4663ee9b18e8a88d2bd91 into a7ad7f8dc2f9d29e46bf23b993e2a67b93ab6117

Posted by sn...@apache.org.
Merge f2fd25a4eee46b2306c4663ee9b18e8a88d2bd91 into a7ad7f8dc2f9d29e46bf23b993e2a67b93ab6117


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

Branch: refs/pull/227/merge
Commit: 756327144907b99895540b3a0815e10c0461a497
Parents: a7ad7f8 f2fd25a
Author: GERey <gr...@apigee.com>
Authored: Fri Jun 27 17:46:14 2014 +0000
Committer: GERey <gr...@apigee.com>
Committed: Fri Jun 27 17:46:14 2014 +0000

----------------------------------------------------------------------
 .../main/resources/corepersistence.properties   | 45 --------------------
 .../main/resources/usergrid-default.properties  | 29 +++++++++++--
 .../usergrid/corepersistence/CpSetup.java       | 35 ++++++++-------
 3 files changed, 46 insertions(+), 63 deletions(-)
----------------------------------------------------------------------



[37/50] [abbrv] git commit: Enable registering stack for deploy goal

Posted by sn...@apache.org.
Enable registering stack for deploy goal


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

Branch: refs/heads/two-dot-o
Commit: 8f9aef207c2116d877155ab0f65db93950c3d96d
Parents: 9e4cedc
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 08:58:30 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 08:58:30 2014 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/usergrid/chop/runner/Controller.java    | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f9aef20/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
index e02b9e5..eb97d81 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
@@ -53,8 +53,6 @@ import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
-import javax.ws.rs.core.MediaType;
-
 
 /**
  * The Controller controls the process of executing chops on test classes.
@@ -63,7 +61,6 @@ import javax.ws.rs.core.MediaType;
 public class Controller implements IController, Runnable {
     private static final Logger LOG = LoggerFactory.getLogger( Controller.class );
 
-
     // @todo make this configurable and also put this into the project or runner fig
     private static final long DEFAULT_LAGER_WAIT_TIMEOUT_MILLIS = 120000;
     private final Object lock = new Object();
@@ -448,5 +445,4 @@ public class Controller implements IController, Runnable {
         currentDriver = null;
         state = state.next( Signal.COMPLETED );
     }
-
 }


[32/50] [abbrv] git commit: Remove unnecessary method

Posted by sn...@apache.org.
Remove unnecessary method


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

Branch: refs/heads/two-dot-o
Commit: 94c9a1ee3ea63661da52e9f65f074ed3b232542c
Parents: a735c5f
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Sat Jun 28 19:59:51 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Sat Jun 28 19:59:51 2014 +0300

----------------------------------------------------------------------
 .../coordinator/rest/TestableResource.java      | 38 --------------------
 1 file changed, 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/94c9a1ee/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
index ccac1c3..1592122 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
@@ -65,42 +65,4 @@ public abstract class TestableResource {
         return testMode != null &&
                 (testMode.equals(TestMode.INTEG.toString()) || testMode.equals(TestMode.UNIT.toString()));
     }
-
-    public CoordinatedStack getCoordinatedStack( CommitDao commitDao, ModuleDao moduleDao, UserDao userDao,
-                                                  StackCoordinator stackCoordinator, String artifactId,
-                                                  String commitId, String md5, String username,
-                                                  String groupId, String version, String vcsRepoUrl,
-                                                  String testPackage, File runnerJar )
-            throws IOException {
-        Commit commit = null;
-        Module module = null;
-
-        List<Commit> commits = commitDao.getByModule( artifactId );
-        for ( Commit returnedCommit : commits ) {
-            Module commitModule = moduleDao.get( returnedCommit.getModuleId() );
-            if ( commitModule.getArtifactId().equals( artifactId ) &&
-                    commitModule.getGroupId().equals( groupId ) &&
-                    commitModule.getVersion().equals( version ) )
-            {
-                commit = returnedCommit;
-                module = commitModule;
-            }
-        }
-
-        if ( module == null ) {
-            module = new BasicModule( groupId, artifactId, version, vcsRepoUrl, testPackage );
-            moduleDao.save( module );
-        }
-
-        if ( commit == null ) {
-            commit = new BasicCommit( commitId, module.getId(), md5, new Date(), runnerJar.getAbsolutePath() );
-            commitDao.save( commit );
-        }
-
-        // Send DEPLOY signal to coordinatedStack
-        Stack stack = CoordinatorUtils.getStackFromRunnerJar( runnerJar );
-        User chopUser = userDao.get( username );
-        CoordinatedStack coordinatedStack =  stackCoordinator.getCoordinatedStack( stack, chopUser, commit, module );
-        return coordinatedStack;
-    }
 }


[02/50] [abbrv] git commit: update dependencies versiona and remove duplicates

Posted by sn...@apache.org.
update dependencies versiona and remove duplicates


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

Branch: refs/pull/229/head
Commit: 97eaead30c180c647351d393c477ab67201ec58e
Parents: c7b8612
Author: Strong Liu <st...@hibernate.org>
Authored: Fri Jun 27 16:45:41 2014 +0800
Committer: Strong Liu <st...@hibernate.org>
Committed: Fri Jun 27 16:45:41 2014 +0800

----------------------------------------------------------------------
 stack/core/pom.xml                              | 10 +----
 .../persistence/hector/CountingMutator.java     | 12 +++++
 stack/pom.xml                                   | 46 +++++++++++++++-----
 stack/rest/pom.xml                              |  2 +-
 stack/test-utils/pom.xml                        | 27 ------------
 stack/websocket/pom.xml                         |  2 +-
 6 files changed, 50 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index dad4a6b..1decb2d 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -300,13 +300,6 @@
     <dependency>
       <groupId>org.apache.cassandra</groupId>
       <artifactId>cassandra-all</artifactId>
-      <!-- Exclude the old and problematic Snappy -->
-      <exclusions>
-        <exclusion>
-          <artifactId>snappy-java</artifactId>
-          <groupId>org.xerial.snappy</groupId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <dependency>
@@ -318,7 +311,6 @@
     <dependency>
       <artifactId>snappy-java</artifactId>
       <groupId>org.xerial.snappy</groupId>
-      <version>1.0.5</version>
     </dependency>
 
     <dependency>
@@ -521,7 +513,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jboss.netty</groupId>
+      <groupId>io.netty</groupId>
       <artifactId>netty</artifactId>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java b/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
index 8f8107a..14b2c9e 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
@@ -316,6 +316,18 @@ public class CountingMutator<K> implements Mutator<K> {
         return target.getPendingMutationCount();
     }
 
+    @Override
+    public <N> Mutator<K> addDeletion(K k, String s, N n, N n2, Serializer<N> nSerializer) {
+        target.addDeletion(k, s, n, n2, nSerializer);
+        return this;
+    }
+
+    @Override
+    public <N> Mutator<K> addDeletion(K k, String s, N n, N n2, Serializer<N> nSerializer, long l) {
+        target.addDeletion(k, s, n, n2, nSerializer, l);
+        checkAndFlush();
+        return this;
+    }
 
     /**
      * If our size is >= than our max, we'll flush

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 3a37577..6966010 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -98,21 +98,21 @@
     <amber-version>0.22-incubating</amber-version>
     <cassandra-version>1.2.12</cassandra-version>
     <hector-om-version>3.0-03</hector-om-version>
-    <hector-version>1.1-4</hector-version>
+    <hector-version>2.0-0</hector-version>
     <hector-test-version>1.1-4</hector-test-version>
-    <jackson-version>1.9.9</jackson-version>
+    <jackson-version>1.9.13</jackson-version>
     <jclouds.version>1.6.2-incubating</jclouds.version>
     <jersey-version>1.18</jersey-version>
     <junit-version>4.11</junit-version>
     <log4j-version>1.2.16</log4j-version>
     <metrics-version>2.1.2</metrics-version>
     <org.springframework.version>3.1.2.RELEASE</org.springframework.version>
-    <shiro-version>1.2.0</shiro-version>
-    <slf4j-version>1.6.1</slf4j-version>
+    <shiro-version>1.2.3</shiro-version>
+    <slf4j-version>1.7.7</slf4j-version>
     <snakeyaml-version>1.8</snakeyaml-version>
     <tomcat-version>7.0.42</tomcat-version>
     <antlr.version>3.4</antlr.version>
-    <tika.version>1.4</tika.version>
+    <tika.version>1.5</tika.version>
 
   </properties>
 
@@ -428,12 +428,18 @@
           </exclusion>
 
           <exclusion>
-                   <artifactId>snappy-java</artifactId>
-                   <groupId>org.xerial.snappy</groupId>
-            </exclusion>
+             <artifactId>snappy-java</artifactId>
+             <groupId>org.xerial.snappy</groupId>
+          </exclusion>
         </exclusions>
       </dependency>
 
+        <dependency>
+            <artifactId>snappy-java</artifactId>
+            <groupId>org.xerial.snappy</groupId>
+            <version>1.1.1-M3</version>
+        </dependency>
+
       <dependency>
         <groupId>org.apache.lucene</groupId>
         <artifactId>lucene-core</artifactId>
@@ -596,6 +602,11 @@
             <groupId>javax.activation</groupId>
             <artifactId>activation</artifactId>
           </exclusion>
+            <exclusion>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+            </exclusion>
+
         </exclusions>
       </dependency>
 
@@ -814,6 +825,7 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
           </exclusion>
+
         </exclusions>
       </dependency>
 
@@ -882,12 +894,18 @@
         <groupId>org.codehaus.jettison</groupId>
         <artifactId>jettison</artifactId>
         <version>1.2</version>
+          <exclusions>
+              <exclusion>
+                  <groupId>stax</groupId>
+                  <artifactId>stax-api</artifactId>
+              </exclusion>
+          </exclusions>
       </dependency>
 
       <dependency>
-        <groupId>org.jboss.netty</groupId>
+        <groupId>io.netty</groupId>
         <artifactId>netty</artifactId>
-        <version>3.2.7.Final</version>
+        <version>3.6.6.Final</version>
       </dependency>
 
       <dependency>
@@ -1198,7 +1216,7 @@
       <dependency>
         <groupId>junit</groupId>
         <artifactId>junit-dep</artifactId>
-        <version>4.10</version>
+        <version>4.11</version>
       </dependency>
 
       <dependency>
@@ -1251,6 +1269,12 @@
         <groupId>org.apache.jclouds.driver</groupId>
         <artifactId>jclouds-netty</artifactId>
         <version>${jclouds.version}</version>
+          <exclusions>
+              <exclusion>
+                  <groupId>io.netty</groupId>
+                  <artifactId>netty</artifactId>
+              </exclusion>
+          </exclusions>
       </dependency>
 
       <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index 90311e5..39fc3e7 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -366,7 +366,7 @@
               <groupId>${project.groupId}</groupId>
               <version>${project.version}</version>
               <file>
-                ${project.build.directory}/${project.artifactId}-${project.version}.jar
+                ${project.build.directory}/${project.artifactId}-${project.version}-classes.jar
               </file>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/stack/test-utils/pom.xml b/stack/test-utils/pom.xml
index 4be950b..d1d4784 100644
--- a/stack/test-utils/pom.xml
+++ b/stack/test-utils/pom.xml
@@ -73,31 +73,15 @@
       <version>${project.version}</version>
     </dependency>
 
-    <!--<dependency>-->
-    <!--<groupId>org.apache.usergrid</groupId>-->
-    <!--<artifactId>usergrid-services</artifactId>-->
-    <!--<version>${project.version}</version>-->
-    <!--</dependency>-->
-
-    <!-- Apache Dependencies -->
-
     <dependency>
       <groupId>org.apache.cassandra</groupId>
       <artifactId>cassandra-all</artifactId>
-      <!-- Exclude the old and problematic Snappy -->
-      <exclusions>
-        <exclusion>
-          <artifactId>snappy-java</artifactId>
-          <groupId>org.xerial.snappy</groupId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <!-- Include the slighly newer and less problematic snappy -->
     <dependency>
       <artifactId>snappy-java</artifactId>
       <groupId>org.xerial.snappy</groupId>
-      <version>1.0.5</version>
     </dependency>
 
     <dependency>
@@ -248,17 +232,6 @@
       <scope>test</scope>
     </dependency>
 
-    <!--<dependency>-->
-    <!--<groupId>org.slf4j</groupId>-->
-    <!--<artifactId>slf4j-log4j12</artifactId>-->
-    <!--<scope>test</scope>-->
-    <!--</dependency>-->
-
-    <!--<dependency>-->
-    <!--<groupId>log4j</groupId>-->
-    <!--<artifactId>log4j</artifactId>-->
-    <!--<scope>test</scope>-->
-    <!--</dependency>-->
 
     <dependency>
       <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/websocket/pom.xml
----------------------------------------------------------------------
diff --git a/stack/websocket/pom.xml b/stack/websocket/pom.xml
index 665ba18..10a7df5 100644
--- a/stack/websocket/pom.xml
+++ b/stack/websocket/pom.xml
@@ -142,7 +142,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jboss.netty</groupId>
+      <groupId>io.netty</groupId>
       <artifactId>netty</artifactId>
     </dependency>
 


[24/50] [abbrv] git commit: Merge branch 'two-dot-o' of https://github.com/usergrid/usergrid into two-dot-o

Posted by sn...@apache.org.
Merge branch 'two-dot-o' of https://github.com/usergrid/usergrid into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: b0ba23600a999f12665e58f63b0d993dc922ad43
Parents: b5194e7 a7ad7f8
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Jun 27 15:25:30 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Jun 27 15:25:30 2014 -0400

----------------------------------------------------------------------
 .../chop/webapp/service/shiro/ShiroRealm.java   |  4 +
 .../chop/webapp/view/user/KeyListLayout.java    |  6 +-
 .../chop/webapp/view/user/UserLayout.java       | 95 +++++++++++++++++---
 .../chop/webapp/view/user/UserListWindow.java   |  9 +-
 4 files changed, 100 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[17/50] [abbrv] git commit: removing uncessearcy lines

Posted by sn...@apache.org.
removing uncessearcy lines


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

Branch: refs/heads/two-dot-o
Commit: 06812a641a12e7831a4c175b35cfaf736bda0b4a
Parents: 1d1eed1
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 21:00:44 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 21:00:44 2014 +0300

----------------------------------------------------------------------
 .../chop/webapp/view/main/MainView.java         |   2 -
 .../chop/webapp/view/module/ModuleLayout.java   |   9 --
 .../webapp/view/module/ModuleListWindow.java    | 114 -------------------
 3 files changed, 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/06812a64/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
index 0127093..ed768da 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
@@ -31,7 +31,6 @@ import org.apache.usergrid.chop.webapp.service.shiro.ShiroRealm;
 import org.apache.usergrid.chop.webapp.view.module.ModuleLayout;
 import org.apache.usergrid.chop.webapp.view.chart.layout.OverviewChartLayout;
 import org.apache.usergrid.chop.webapp.view.log.LogLayout;
-import org.apache.usergrid.chop.webapp.view.module.ModuleListWindow;
 import org.apache.usergrid.chop.webapp.view.module.ModuleSelectListener;
 import org.apache.usergrid.chop.webapp.view.runner.RunnersLayout;
 import org.apache.usergrid.chop.webapp.view.user.UserListWindow;
@@ -72,7 +71,6 @@ public class MainView extends VerticalLayout implements ModuleSelectListener {
         modules.addClickListener( new Button.ClickListener() {
             @Override
             public void buttonClick(Button.ClickEvent clickEvent) {
-//                UI.getCurrent().addWindow( new ModuleListWindow( MainView.this ) );
                 tabSheetManager.addTabWithVerticalLayout( new ModuleLayout( MainView.this ), "Modules" );
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/06812a64/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
index 6c6d7d0..3f3757b 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
@@ -8,7 +8,6 @@ import com.vaadin.ui.VerticalLayout;
 import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.webapp.dao.ModuleDao;
 import org.apache.usergrid.chop.webapp.service.InjectorFactory;
-import org.apache.usergrid.chop.webapp.view.module.ModuleSelectListener;
 
 import java.util.List;
 
@@ -51,15 +50,7 @@ public class ModuleLayout extends VerticalLayout{
             Label artifactLabel = new Label( module.getArtifactId( ) );
             Label versionLabel = new Label( module.getVersion( ) );
 
-            // The Table item identifier for the row.
-            String itemId = new String( module.getId( ) );
-
-            // Create a button and handle its click. A Button does not
-            // know the item it is contained in, so we have to store the
-            // item ID as user-defined data.
             Button detailsField = new Button( "show details" );
-            detailsField.setId( itemId );
-            detailsField.setData( itemId );
             detailsField.addStyleName( "link" );
             detailsField.addClickListener( new Button.ClickListener( ) {
                 @Override

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/06812a64/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleListWindow.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleListWindow.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleListWindow.java
deleted file mode 100644
index 9d15498..0000000
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleListWindow.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.chop.webapp.view.module;
-
-
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-
-import org.apache.usergrid.chop.api.Module;
-import org.apache.usergrid.chop.webapp.dao.ModuleDao;
-import org.apache.usergrid.chop.webapp.service.InjectorFactory;
-import org.apache.usergrid.chop.webapp.view.util.PopupWindow;
-
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.ui.AbsoluteLayout;
-import com.vaadin.ui.TreeTable;
-
-
-public class ModuleListWindow extends PopupWindow {
-
-    private static final String PARENT_PREFIX = "parent:";
-
-    private final ModuleSelectListener listener;
-
-    public ModuleListWindow(ModuleSelectListener listener) {
-        super( "Modules" );
-        this.listener = listener;
-    }
-
-
-    @Override
-    protected void addItems(AbsoluteLayout mainLayout) {
-
-        TreeTable treeTable = getTree();
-        treeTable.setWidth( "100%" );
-        treeTable.setHeight( "420px" );
-
-        mainLayout.addComponent( treeTable, "left: 0px; top: 0px;" );
-    }
-
-
-    public TreeTable getTree() {
-
-        TreeTable treeTable = new TreeTable();
-        treeTable.setSelectable( true );
-        treeTable.addContainerProperty( "Group", String.class, "" );
-        treeTable.addContainerProperty( "Artifact", String.class, "" );
-        treeTable.addItemClickListener( getItemClickListener() );
-
-        addTreeItems( treeTable );
-
-        return treeTable;
-    }
-
-
-    private ItemClickEvent.ItemClickListener getItemClickListener() {
-        return new ItemClickEvent.ItemClickListener() {
-            @Override
-            public void itemClick(ItemClickEvent event) {
-                onItemClick(event);
-            }
-        };
-    }
-
-
-    private void onItemClick(ItemClickEvent event) {
-
-        String id = (String) event.getItemId();
-        boolean isModuleVersion = !StringUtils.startsWith( id, PARENT_PREFIX );
-
-        if (isModuleVersion) {
-            close();
-            listener.onModuleSelect(id);
-        }
-    }
-
-
-    private static void addTreeItems( TreeTable treeTable ) {
-
-        ModuleDao moduleDao = InjectorFactory.getInstance( ModuleDao.class );
-        List<Module> modules = moduleDao.getAll();
-
-        for (Module module : modules) {
-            addTreeItem( treeTable, module );
-        }
-    }
-
-
-    private static void addTreeItem( TreeTable treeTable, Module module ) {
-
-        String parentId = String.format( PARENT_PREFIX + "%s-%s", module.getGroupId(), module.getArtifactId() );
-        treeTable.addItem( new Object[] { module.getGroupId(), module.getArtifactId() }, parentId );
-        treeTable.addItem( new Object[] { module.getVersion(), "" }, module.getId() );
-
-        treeTable.setParent( module.getId(), parentId );
-    }
-}


[26/50] [abbrv] git commit: adding ASL license header

Posted by sn...@apache.org.
adding ASL license header


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

Branch: refs/heads/two-dot-o
Commit: b6e445d6b928cd92a190acc321e6f4fbc01c1988
Parents: 598644d
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 23:08:06 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 23:08:06 2014 +0300

----------------------------------------------------------------------
 .../chop/webapp/view/module/ModuleLayout.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b6e445d6/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
index 36d81fe..32d026a 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
@@ -1,3 +1,22 @@
+/*
+ * 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.chop.webapp.view.module;
 
 import com.vaadin.ui.Alignment;


[14/50] [abbrv] git commit: Merge 1143d43aae0e6ee6754f3feffbd82bc4e2e75413 into c7b8612759f37da299b271b5c08de2a3fa4d71c6

Posted by sn...@apache.org.
Merge 1143d43aae0e6ee6754f3feffbd82bc4e2e75413 into c7b8612759f37da299b271b5c08de2a3fa4d71c6


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

Branch: refs/pull/231/merge
Commit: 0a48ce648c7e84acd04c090c8318bb1b8bd8dc66
Parents: c7b8612 1143d43
Author: amuramoto <am...@users.noreply.github.com>
Authored: Fri Jun 27 17:28:41 2014 +0000
Committer: amuramoto <am...@users.noreply.github.com>
Committed: Fri Jun 27 17:28:41 2014 +0000

----------------------------------------------------------------------
 sdks/html5-javascript/lib/modules/Entity.js | 54 ++++++++++++++++++++++--
 sdks/ios/UGAPI/UGClient.h                   | 15 ++++++-
 sdks/ios/UGAPI/UGClient.m                   |  9 ++++
 3 files changed, 73 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[42/50] [abbrv] git commit: Setup stack with the latest runnerCount info

Posted by sn...@apache.org.
Setup stack with the latest runnerCount info


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

Branch: refs/heads/two-dot-o
Commit: 6391571374d3825028c15ced06f7ca4c24c3d194
Parents: 9b6d819
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 10:40:07 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 10:40:07 2014 +0300

----------------------------------------------------------------------
 .../chop/webapp/coordinator/StackCoordinator.java         | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/63915713/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index 58998cf..f0811d3 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -122,16 +122,20 @@ public class StackCoordinator {
     public CoordinatedStack setupStack( Stack stack, User user, Commit commit, Module module, int runnerCount ) {
 
         CoordinatedStack coordinatedStack = getCoordinatedStack( stack, user, commit, module );
-        if ( coordinatedStack != null ) {
+        if ( coordinatedStack != null && coordinatedStack.getRunnerCount() == runnerCount ) {
             LOG.info( "Stack {} is already registered", stack.getName() );
             if( coordinatedStack.getSetupState() == SetupStackState.SetUp ) {
                 return coordinatedStack;
             }
         }
-        else {
-            coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount );
+        else if ( coordinatedStack != null && coordinatedStack.getRunnerCount() != runnerCount  ) {
+            LOG.info( "Stack {} is registered with different runner count, first removing the old stack", stack.getName() );
+            registeredStacks.remove( coordinatedStack.hashCode() );
         }
 
+        LOG.info( "Registering new stack {}...", stack.getName() );
+        coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount );
+
         LOG.info( "Starting setup stack thread of {}...", stack.getName() );
         synchronized ( coordinatedStack ) {
             coordinatedStack.setSetupState( SetupStackSignal.SETUP );


[36/50] [abbrv] git commit: Remove unnecessary imports

Posted by sn...@apache.org.
Remove unnecessary imports


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

Branch: refs/heads/two-dot-o
Commit: 9e4cedc7373591737be4a1d1188687b3754fd7a3
Parents: 87ccf72
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 08:55:31 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 08:55:31 2014 +0300

----------------------------------------------------------------------
 .../java/org/apache/usergrid/chop/runner/Controller.java  | 10 ----------
 .../java/org/apache/usergrid/chop/runner/IController.java |  1 -
 .../chop/webapp/coordinator/rest/ResetResource.java       |  2 --
 3 files changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9e4cedc7/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
index cf7d639..e02b9e5 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
@@ -21,8 +21,6 @@ package org.apache.usergrid.chop.runner;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -31,15 +29,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.usergrid.chop.api.CoordinatorFig;
-import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.runner.drivers.Driver;
 import org.apache.usergrid.chop.runner.drivers.TimeDriver;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
-import org.apache.usergrid.chop.stack.SetupStackState;
 import org.reflections.Reflections;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.Runner;
@@ -55,7 +46,6 @@ import org.apache.usergrid.chop.stack.ChopCluster;
 import org.apache.usergrid.chop.stack.ICoordinatedCluster;
 import org.apache.usergrid.chop.stack.Instance;
 
-import org.safehaus.jettyjam.utils.CertUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9e4cedc7/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
index aaa7d8b..74e5387 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
@@ -23,7 +23,6 @@ import org.apache.usergrid.chop.api.Signal;
 import org.apache.usergrid.chop.api.StatsSnapshot;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.State;
-import org.apache.usergrid.chop.stack.SetupStackState;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9e4cedc7/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
index c40a530..b54f4b3 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
@@ -29,8 +29,6 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;


[25/50] [abbrv] git commit: Merge remote-tracking branch 'upstream/two-dot-o' into two-dot-o

Posted by sn...@apache.org.
Merge remote-tracking branch 'upstream/two-dot-o' into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: 598644d6c84f155141b320b7bd7b34fa47e4df7f
Parents: 7b75a82 b0ba236
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 22:58:16 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 22:58:16 2014 +0300

----------------------------------------------------------------------
 .../corepersistence/CpRelationManager.java      |    5 +
 .../persistence/index/impl/EsProvider.java      |   56 +-
 stack/rest/pom.xml                              | 1120 +++++++++---------
 .../apache/usergrid/rest/AbstractRestIT.java    |    7 +-
 .../java/org/apache/usergrid/rest/ITSetup.java  |   15 +-
 .../apache/usergrid/rest/TomcatResource.java    |  205 +++-
 stack/test-utils/pom.xml                        |  464 ++++----
 .../java/org/apache/usergrid/TomcatMain.java    |   56 +
 .../usergrid/cassandra/CassandraResource.java   |    6 +-
 9 files changed, 1073 insertions(+), 861 deletions(-)
----------------------------------------------------------------------



[43/50] [abbrv] git commit: Merge pull request #237 from fbicak/two-dot-o

Posted by sn...@apache.org.
Merge pull request #237 from fbicak/two-dot-o

Setup the stack with latest runner count information

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

Branch: refs/heads/two-dot-o
Commit: 5ff3c1ef943e11cef1702e130f2a3d6302f9eaa0
Parents: afb2cb2 6391571
Author: Yigit Sapli <yi...@apache.org>
Authored: Mon Jun 30 14:08:40 2014 +0600
Committer: Yigit Sapli <yi...@apache.org>
Committed: Mon Jun 30 14:08:40 2014 +0600

----------------------------------------------------------------------
 .../chop/webapp/coordinator/StackCoordinator.java         | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[11/50] [abbrv] git commit: [USERGRID-183]Adds connection reverse lookup support to iOS SDK

Posted by sn...@apache.org.
[USERGRID-183]Adds connection reverse lookup support to iOS SDK

	-Adds sync and async versions of getConnectedEntities:connectorID:connectionType:query:
	to support request of type GET /<someCollection>/<someEntity>/connecting/<someConnection>


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

Branch: refs/pull/231/merge
Commit: 8d4140e8cb587e94a00b9704e2ef7a3df676e590
Parents: c7b8612
Author: amuramoto <am...@apigee.com>
Authored: Fri Jun 27 10:17:09 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Fri Jun 27 10:17:09 2014 -0700

----------------------------------------------------------------------
 sdks/ios/UGAPI/UGClient.h | 15 ++++++++++++++-
 sdks/ios/UGAPI/UGClient.m |  9 +++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d4140e8/sdks/ios/UGAPI/UGClient.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGClient.h b/sdks/ios/UGAPI/UGClient.h
index 4e6a31f..c5241b1 100755
--- a/sdks/ios/UGAPI/UGClient.h
+++ b/sdks/ios/UGAPI/UGClient.h
@@ -220,7 +220,20 @@ set the response limit in UGQuery as well.
 // get entity connections
 -(UGClientResponse *)getEntityConnections: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType query:(UGQuery *)query;
 
-
+/*!
+ @abstract Get entities connected to the specified entity with the specified connection
+ @param connectorType
+ @param connectorID
+ @param connectionType
+ @param query
+ @return ApigeeClientResponse instance
+ @see ApigeeClientResponse ApigeeClientResponse
+ @see ApigeeQuery ApigeeQuery
+ */
+-(UGClientResponse *)getConnectedEntities:(NSString *)connectorType
+                                  connectorID:(NSString *)connectorID
+                               connectionType:(NSString *)connectionType
+                                        query:(UGQuery *)query;
 
 /********************* MESSAGE MANAGEMENT *********************/
 // post a message to a given queue

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d4140e8/sdks/ios/UGAPI/UGClient.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGClient.m b/sdks/ios/UGAPI/UGClient.m
index 9d6407a..0184ea7 100755
--- a/sdks/ios/UGAPI/UGClient.m
+++ b/sdks/ios/UGAPI/UGClient.m
@@ -1059,6 +1059,15 @@ NSString *g_deviceUUID = nil;
     return [self httpTransaction:url op:kUGHTTPPost opData:nil];
 }
 
+-(UGClientResponse *)getConnectedEntities: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType query:(UGQuery *)query
+{
+    NSMutableString *url = [self createURL:connectorType append2:connectorID append3: @"connecting" append4: connectionType];
+    if (query) {
+        [self appendQueryToURL:url query:query];
+    }
+    return [self httpTransaction:url op:kApigeeHTTPGet opData:nil];
+}
+
 /************************** MESSAGE MANAGEMENT **************************/
 /************************** MESSAGE MANAGEMENT **************************/
 /************************** MESSAGE MANAGEMENT **************************/


[18/50] [abbrv] git commit: code refactoring

Posted by sn...@apache.org.
code refactoring


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

Branch: refs/heads/two-dot-o
Commit: 010c4b048489ebca76a34c3fe84d1b79f7d30202
Parents: 06812a6
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 21:02:49 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 21:02:49 2014 +0300

----------------------------------------------------------------------
 .../org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/010c4b04/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
index 3f3757b..36d81fe 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
@@ -25,7 +25,7 @@ public class ModuleLayout extends VerticalLayout{
 
 
     public Table addTable( ){
-        Table table = new Table(" \n ");
+        Table table = new Table( " \n " );
         table.setHeight( "500px" );
         table.setWidth( "700px" );
 


[07/50] [abbrv] git commit: Merge 6595f919321c721d01e116a45d016e786d565fee into c7b8612759f37da299b271b5c08de2a3fa4d71c6

Posted by sn...@apache.org.
Merge 6595f919321c721d01e116a45d016e786d565fee into c7b8612759f37da299b271b5c08de2a3fa4d71c6


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

Branch: refs/pull/198/merge
Commit: 7e318fa60c11ca01de49902860e7f94d6f382c3a
Parents: c7b8612 6595f91
Author: Strong Liu <st...@hibernate.org>
Authored: Fri Jun 27 14:17:23 2014 +0000
Committer: Strong Liu <st...@hibernate.org>
Committed: Fri Jun 27 14:17:23 2014 +0000

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties  |   2 +-
 .../persistence/entities/Application.java       |  27 ++---
 .../main/resources/usergrid-core-context.xml    |   9 +-
 .../resources/usergrid-scheduler-context.xml    |  49 --------
 .../rest/applications/users/UsersResource.java  |  17 ++-
 .../applications/ApplicationsResource.java      |   3 +-
 .../usergrid/management/ManagementService.java  |   1 +
 .../cassandra/ManagementServiceImpl.java        | 116 ++++++++++---------
 .../exceptions/MissingEmailException.java       |  48 ++++++++
 .../usergrid/security/tokens/TokenCategory.java |   8 +-
 .../tokens/cassandra/TokenServiceImpl.java      |  23 +++-
 .../apache/usergrid/services/ServiceInfo.java   |   4 +-
 12 files changed, 175 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7e318fa6/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------


[40/50] [abbrv] git commit: Continue Style fixes

Posted by sn...@apache.org.
Continue Style fixes


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

Branch: refs/heads/two-dot-o
Commit: 9b6d819785fe4901609abbee7ab504eed35d16eb
Parents: c692c0f
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 09:20:26 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 09:20:26 2014 +0300

----------------------------------------------------------------------
 .../usergrid/chop/webapp/coordinator/StackCoordinator.java       | 4 ++--
 .../usergrid/chop/webapp/coordinator/rest/ResetResource.java     | 2 +-
 .../usergrid/chop/webapp/coordinator/rest/StopResource.java      | 2 +-
 .../usergrid/chop/webapp/coordinator/rest/UploadResource.java    | 1 -
 4 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b6d8197/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index c9a72b8..58998cf 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -88,8 +88,8 @@ public class StackCoordinator {
      * @param runnerCount
      * @return
      */
-    public CoordinatedStack setupStack( String commitId, String artifactId, String groupId, String version, String user,
-                                        int runnerCount ) {
+    public CoordinatedStack setupStack( String commitId, String artifactId, String groupId, String version,
+                                        String user, int runnerCount ) {
 
         User chopUser = userDao.get( user );
         File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), user, groupId, artifactId, version,

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b6d8197/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
index b54f4b3..6567e10 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
@@ -113,7 +113,7 @@ public class ResetResource extends TestableResource implements RestParams {
                            .build();
         }
         /** SetupStackState.SetUp */
-        LOG.info( "Stack is stopped, checking runner states..." );
+        LOG.info( "Stack is set up, checking runner states..." );
 
         /** Check state of all runners */
         String moduleId = BasicModule.createId( groupId, artifactId, version );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b6d8197/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
index a8c8694..af2294e 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
@@ -112,7 +112,7 @@ public class StopResource extends TestableResource implements RestParams {
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
-        /** SetupStackState.Setup */
+        /** SetupStackState.SetUp */
         LOG.info( "Stack is set up, checking runner states..." );
 
         /** Check state of all runners */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b6d8197/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index 00564d4..136760a 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -298,5 +298,4 @@ public class UploadResource extends TestableResource implements RestParams, Cons
 
         return coordinatorJarMd5;
     }
-
 }


[08/50] [abbrv] git commit: Merge pull request #230 from salihkardan/two-dot-o

Posted by sn...@apache.org.
Merge pull request #230 from salihkardan/two-dot-o

Do not allow admin user to see other users' AWS credential infromation

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

Branch: refs/heads/two-dot-o
Commit: a7ad7f8dc2f9d29e46bf23b993e2a67b93ab6117
Parents: 118103c 97e5dfb
Author: tonuquq <to...@gmail.com>
Authored: Fri Jun 27 19:12:46 2014 +0300
Committer: tonuquq <to...@gmail.com>
Committed: Fri Jun 27 19:12:46 2014 +0300

----------------------------------------------------------------------
 .../chop/webapp/service/shiro/ShiroRealm.java   |  4 +
 .../chop/webapp/view/user/KeyListLayout.java    |  6 +-
 .../chop/webapp/view/user/UserLayout.java       | 95 +++++++++++++++++---
 .../chop/webapp/view/user/UserListWindow.java   |  9 +-
 4 files changed, 100 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[48/50] [abbrv] git commit: Merge pull request #238 from salihkardan/statusMojo

Posted by sn...@apache.org.
Merge pull request #238 from salihkardan/statusMojo

Add status mojo to maven chop plugin

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

Branch: refs/heads/two-dot-o
Commit: 998dd71bb078ce2dff05f75af58a75f212ce79a9
Parents: 5ff3c1e 155c809
Author: Yigit Sapli <yi...@apache.org>
Authored: Tue Jul 1 20:22:05 2014 +0600
Committer: Yigit Sapli <yi...@apache.org>
Committed: Tue Jul 1 20:22:05 2014 +0600

----------------------------------------------------------------------
 .../apache/usergrid/chop/plugin/StatusMojo.java | 94 ++++++++++++++++++++
 .../webapp/coordinator/rest/StatusResource.java | 91 +++++++++++++++++++
 2 files changed, 185 insertions(+)
----------------------------------------------------------------------



[03/50] [abbrv] git commit: update dependencies versiona and remove duplicates

Posted by sn...@apache.org.
update dependencies versiona and remove duplicates


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

Branch: refs/pull/229/merge
Commit: 97eaead30c180c647351d393c477ab67201ec58e
Parents: c7b8612
Author: Strong Liu <st...@hibernate.org>
Authored: Fri Jun 27 16:45:41 2014 +0800
Committer: Strong Liu <st...@hibernate.org>
Committed: Fri Jun 27 16:45:41 2014 +0800

----------------------------------------------------------------------
 stack/core/pom.xml                              | 10 +----
 .../persistence/hector/CountingMutator.java     | 12 +++++
 stack/pom.xml                                   | 46 +++++++++++++++-----
 stack/rest/pom.xml                              |  2 +-
 stack/test-utils/pom.xml                        | 27 ------------
 stack/websocket/pom.xml                         |  2 +-
 6 files changed, 50 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index dad4a6b..1decb2d 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -300,13 +300,6 @@
     <dependency>
       <groupId>org.apache.cassandra</groupId>
       <artifactId>cassandra-all</artifactId>
-      <!-- Exclude the old and problematic Snappy -->
-      <exclusions>
-        <exclusion>
-          <artifactId>snappy-java</artifactId>
-          <groupId>org.xerial.snappy</groupId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <dependency>
@@ -318,7 +311,6 @@
     <dependency>
       <artifactId>snappy-java</artifactId>
       <groupId>org.xerial.snappy</groupId>
-      <version>1.0.5</version>
     </dependency>
 
     <dependency>
@@ -521,7 +513,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jboss.netty</groupId>
+      <groupId>io.netty</groupId>
       <artifactId>netty</artifactId>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java b/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
index 8f8107a..14b2c9e 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/hector/CountingMutator.java
@@ -316,6 +316,18 @@ public class CountingMutator<K> implements Mutator<K> {
         return target.getPendingMutationCount();
     }
 
+    @Override
+    public <N> Mutator<K> addDeletion(K k, String s, N n, N n2, Serializer<N> nSerializer) {
+        target.addDeletion(k, s, n, n2, nSerializer);
+        return this;
+    }
+
+    @Override
+    public <N> Mutator<K> addDeletion(K k, String s, N n, N n2, Serializer<N> nSerializer, long l) {
+        target.addDeletion(k, s, n, n2, nSerializer, l);
+        checkAndFlush();
+        return this;
+    }
 
     /**
      * If our size is >= than our max, we'll flush

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 3a37577..6966010 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -98,21 +98,21 @@
     <amber-version>0.22-incubating</amber-version>
     <cassandra-version>1.2.12</cassandra-version>
     <hector-om-version>3.0-03</hector-om-version>
-    <hector-version>1.1-4</hector-version>
+    <hector-version>2.0-0</hector-version>
     <hector-test-version>1.1-4</hector-test-version>
-    <jackson-version>1.9.9</jackson-version>
+    <jackson-version>1.9.13</jackson-version>
     <jclouds.version>1.6.2-incubating</jclouds.version>
     <jersey-version>1.18</jersey-version>
     <junit-version>4.11</junit-version>
     <log4j-version>1.2.16</log4j-version>
     <metrics-version>2.1.2</metrics-version>
     <org.springframework.version>3.1.2.RELEASE</org.springframework.version>
-    <shiro-version>1.2.0</shiro-version>
-    <slf4j-version>1.6.1</slf4j-version>
+    <shiro-version>1.2.3</shiro-version>
+    <slf4j-version>1.7.7</slf4j-version>
     <snakeyaml-version>1.8</snakeyaml-version>
     <tomcat-version>7.0.42</tomcat-version>
     <antlr.version>3.4</antlr.version>
-    <tika.version>1.4</tika.version>
+    <tika.version>1.5</tika.version>
 
   </properties>
 
@@ -428,12 +428,18 @@
           </exclusion>
 
           <exclusion>
-                   <artifactId>snappy-java</artifactId>
-                   <groupId>org.xerial.snappy</groupId>
-            </exclusion>
+             <artifactId>snappy-java</artifactId>
+             <groupId>org.xerial.snappy</groupId>
+          </exclusion>
         </exclusions>
       </dependency>
 
+        <dependency>
+            <artifactId>snappy-java</artifactId>
+            <groupId>org.xerial.snappy</groupId>
+            <version>1.1.1-M3</version>
+        </dependency>
+
       <dependency>
         <groupId>org.apache.lucene</groupId>
         <artifactId>lucene-core</artifactId>
@@ -596,6 +602,11 @@
             <groupId>javax.activation</groupId>
             <artifactId>activation</artifactId>
           </exclusion>
+            <exclusion>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+            </exclusion>
+
         </exclusions>
       </dependency>
 
@@ -814,6 +825,7 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
           </exclusion>
+
         </exclusions>
       </dependency>
 
@@ -882,12 +894,18 @@
         <groupId>org.codehaus.jettison</groupId>
         <artifactId>jettison</artifactId>
         <version>1.2</version>
+          <exclusions>
+              <exclusion>
+                  <groupId>stax</groupId>
+                  <artifactId>stax-api</artifactId>
+              </exclusion>
+          </exclusions>
       </dependency>
 
       <dependency>
-        <groupId>org.jboss.netty</groupId>
+        <groupId>io.netty</groupId>
         <artifactId>netty</artifactId>
-        <version>3.2.7.Final</version>
+        <version>3.6.6.Final</version>
       </dependency>
 
       <dependency>
@@ -1198,7 +1216,7 @@
       <dependency>
         <groupId>junit</groupId>
         <artifactId>junit-dep</artifactId>
-        <version>4.10</version>
+        <version>4.11</version>
       </dependency>
 
       <dependency>
@@ -1251,6 +1269,12 @@
         <groupId>org.apache.jclouds.driver</groupId>
         <artifactId>jclouds-netty</artifactId>
         <version>${jclouds.version}</version>
+          <exclusions>
+              <exclusion>
+                  <groupId>io.netty</groupId>
+                  <artifactId>netty</artifactId>
+              </exclusion>
+          </exclusions>
       </dependency>
 
       <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index 90311e5..39fc3e7 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -366,7 +366,7 @@
               <groupId>${project.groupId}</groupId>
               <version>${project.version}</version>
               <file>
-                ${project.build.directory}/${project.artifactId}-${project.version}.jar
+                ${project.build.directory}/${project.artifactId}-${project.version}-classes.jar
               </file>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/stack/test-utils/pom.xml b/stack/test-utils/pom.xml
index 4be950b..d1d4784 100644
--- a/stack/test-utils/pom.xml
+++ b/stack/test-utils/pom.xml
@@ -73,31 +73,15 @@
       <version>${project.version}</version>
     </dependency>
 
-    <!--<dependency>-->
-    <!--<groupId>org.apache.usergrid</groupId>-->
-    <!--<artifactId>usergrid-services</artifactId>-->
-    <!--<version>${project.version}</version>-->
-    <!--</dependency>-->
-
-    <!-- Apache Dependencies -->
-
     <dependency>
       <groupId>org.apache.cassandra</groupId>
       <artifactId>cassandra-all</artifactId>
-      <!-- Exclude the old and problematic Snappy -->
-      <exclusions>
-        <exclusion>
-          <artifactId>snappy-java</artifactId>
-          <groupId>org.xerial.snappy</groupId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <!-- Include the slighly newer and less problematic snappy -->
     <dependency>
       <artifactId>snappy-java</artifactId>
       <groupId>org.xerial.snappy</groupId>
-      <version>1.0.5</version>
     </dependency>
 
     <dependency>
@@ -248,17 +232,6 @@
       <scope>test</scope>
     </dependency>
 
-    <!--<dependency>-->
-    <!--<groupId>org.slf4j</groupId>-->
-    <!--<artifactId>slf4j-log4j12</artifactId>-->
-    <!--<scope>test</scope>-->
-    <!--</dependency>-->
-
-    <!--<dependency>-->
-    <!--<groupId>log4j</groupId>-->
-    <!--<artifactId>log4j</artifactId>-->
-    <!--<scope>test</scope>-->
-    <!--</dependency>-->
 
     <dependency>
       <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97eaead3/stack/websocket/pom.xml
----------------------------------------------------------------------
diff --git a/stack/websocket/pom.xml b/stack/websocket/pom.xml
index 665ba18..10a7df5 100644
--- a/stack/websocket/pom.xml
+++ b/stack/websocket/pom.xml
@@ -142,7 +142,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jboss.netty</groupId>
+      <groupId>io.netty</groupId>
       <artifactId>netty</artifactId>
     </dependency>
 


[05/50] [abbrv] git commit: Merge branch 'two-dot-o' of https://github.com/usergrid/usergrid into two-dot-o-fix-state-transitions

Posted by sn...@apache.org.
Merge branch 'two-dot-o' of https://github.com/usergrid/usergrid into two-dot-o-fix-state-transitions


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

Branch: refs/heads/two-dot-o
Commit: 5e42dbfaac280ceb9b28655ee63a15e6cd324419
Parents: 96c4ef9 118103c
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Fri Jun 27 16:32:47 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Fri Jun 27 16:32:47 2014 +0300

----------------------------------------------------------------------
 sdks/java/pom.xml                               |   8 +-
 stack/core/pom.xml                              |  15 -
 .../apache/usergrid/persistence/Results.java    |   4 +-
 stack/core/src/test/resources/log4j.properties  |   4 +-
 stack/corepersistence/collection/pom.xml        |  18 -
 .../impl/EntityCollectionManagerImpl.java       |   4 +-
 .../graph/impl/GraphManagerImpl.java            |  69 ++--
 stack/corepersistence/pom.xml                   |   2 +-
 stack/corepersistence/queryindex/pom.xml        |   7 -
 stack/launcher/pom.xml                          |   6 +
 .../java/org/apache/usergrid/launcher/App.java  |  10 +-
 stack/pom.xml                                   |   7 +-
 stack/query-validator/pom.xml                   |   4 +-
 .../query/validator/ApiServerRunner.java        |  20 +-
 stack/rest/pom.xml                              |   9 +-
 .../org/apache/usergrid/rest/ApiResponse.java   |  13 +-
 .../rest/JacksonCustomMapperProvider.java       |  21 +-
 .../org/apache/usergrid/rest/RootResource.java  |   4 +-
 .../usergrid/rest/TextToJsonSwapWriter.java     |  17 +-
 .../rest/applications/users/UserResource.java   |   4 +-
 .../usergrid/rest/test/PropertiesResource.java  |   4 +-
 .../apache/usergrid/rest/AbstractRestIT.java    | 128 ++++---
 .../java/org/apache/usergrid/rest/BasicIT.java  |  91 ++---
 .../apache/usergrid/rest/TestContextSetup.java  |   3 +-
 .../ApplicationRequestCounterIT.java            |  10 +-
 .../applications/ApplicationResourceIT.java     | 142 ++++----
 .../rest/applications/DevicesResourceIT.java    |  17 +-
 .../applications/assets/AssetResourceIT.java    |  96 +++---
 .../collection/BadGrammarQueryTest.java         |   5 +-
 .../collection/BrowserCompatibilityTest.java    |   5 +-
 .../collection/PagingResourceIT.java            |  13 +-
 .../collection/activities/AndOrQueryTest.java   |  15 +-
 .../collection/activities/OrderByTest.java      |  11 +-
 .../activities/PagingEntitiesTest.java          |  15 +-
 .../collection/activities/PutTest.java          |   7 +-
 .../collection/groups/GeoPagingTest.java        |  11 +-
 .../collection/groups/UpdateGroupIT.java        |  16 +-
 .../applications/events/EventsResourceIT.java   |  30 +-
 .../queues/AbstractQueueResourceIT.java         |  14 +-
 .../queues/QueueResourceLong1IT.java            |   3 +-
 .../queues/QueueResourceLong2IT.java            |   3 +-
 .../queues/QueueResourceLong3IT.java            |   7 +-
 .../queues/QueueResourceShortIT.java            |  23 +-
 .../applications/users/ActivityResourceIT.java  |   8 +-
 .../users/CollectionsResourceIT.java            |  48 ++-
 .../users/ConnectionResourceTest.java           |  28 +-
 .../applications/users/GroupResourceIT.java     |  64 ++--
 .../applications/users/OwnershipResourceIT.java |  11 +-
 .../users/PermissionsResourceIT.java            | 190 +++++------
 .../applications/users/RetrieveUsersTest.java   |   7 +-
 .../rest/applications/users/UserResourceIT.java | 342 +++++++++----------
 .../rest/applications/utils/TestUtils.java      |   2 +-
 .../rest/applications/utils/UserRepo.java       |  27 +-
 .../rest/management/ExportResourceIT.java       | 124 +++----
 .../rest/management/ManagementResourceIT.java   | 166 ++++-----
 .../rest/management/RegistrationIT.java         |  35 +-
 .../organizations/AdminEmailEncodingIT.java     |   5 +-
 .../organizations/OrganizationResourceIT.java   |  15 +-
 .../organizations/OrganizationsResourceIT.java  |  71 ++--
 .../applications/ApplicationsIT.java            |   5 +-
 .../rest/management/users/MUUserResourceIT.java |  87 +++--
 .../UsersOrganizationsResourceIT.java           |  14 +-
 .../rest/test/resource/EntityResource.java      |  15 +-
 .../rest/test/resource/NamedResource.java       |   6 +-
 .../rest/test/resource/SetResource.java         |   5 +-
 .../rest/test/resource/TestContext.java         |   7 +-
 .../rest/test/resource/ValueResource.java       |  43 ++-
 .../rest/test/resource/app/Application.java     |   9 +-
 .../rest/test/resource/app/UsersCollection.java |   5 +-
 .../rest/test/resource/app/queue/Queue.java     |  19 +-
 .../app/queue/SubscribersCollection.java        |  11 +-
 .../test/resource/app/queue/Transaction.java    |  13 +-
 .../resource/mgmt/ApplicationsCollection.java   |   5 +-
 .../rest/test/resource/mgmt/Management.java     |  18 +-
 .../resource/mgmt/OrganizationsCollection.java  |   5 +-
 .../rest/test/security/TestAdminUser.java       |  17 +-
 .../rest/test/security/TestAppUser.java         |  15 +-
 .../usergrid/rest/test/security/TestUser.java   |   2 +-
 stack/test-utils/pom.xml                        |  30 +-
 .../apache/usergrid/cassandra/Concurrent.java   |   2 +-
 80 files changed, 1197 insertions(+), 1194 deletions(-)
----------------------------------------------------------------------



[12/50] [abbrv] git commit: [USERGRID-184]Adds connection reverse lookup support to JS SDK

Posted by sn...@apache.org.
[USERGRID-184]Adds connection reverse lookup support to JS SDK

	-Adds getConnectedEntities to support requests of type GET /<someCollection>/<someEntity>/connecting/<someConnection>
	-Adds connectionsGetter worker so getConnectedEntities and getConnection share one set of request logic


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

Branch: refs/pull/231/merge
Commit: 1143d43aae0e6ee6754f3feffbd82bc4e2e75413
Parents: 8d4140e
Author: amuramoto <am...@apigee.com>
Authored: Fri Jun 27 10:24:34 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Fri Jun 27 10:24:34 2014 -0700

----------------------------------------------------------------------
 sdks/html5-javascript/lib/modules/Entity.js | 54 ++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1143d43a/sdks/html5-javascript/lib/modules/Entity.js
----------------------------------------------------------------------
diff --git a/sdks/html5-javascript/lib/modules/Entity.js b/sdks/html5-javascript/lib/modules/Entity.js
index 029951c..63e9a29 100644
--- a/sdks/html5-javascript/lib/modules/Entity.js
+++ b/sdks/html5-javascript/lib/modules/Entity.js
@@ -381,18 +381,60 @@ Usergrid.Entity.prototype.getEntityId = function(entity) {
 };
 
 /*
- *  gets an entities connections
+ *  gets entities this entity is connecting to
  *
  *  @method getConnections
  *  @public
  *  @param {string} connection
- *  @param {object} entity
  *  @param {function} callback
  *  @return {callback} callback(err, data, connections)
  *
  */
 Usergrid.Entity.prototype.getConnections = function(connection, callback) {
 
+  this.connectionGetter (connection, 'connecting', function (err, data) {
+    if (!err) {
+      doCallback(callback, [err, data, data.entities], self);
+    } else {
+      doCallback(callback, [null, data, data.entities], self);
+    }
+  });
+
+};
+
+/*
+ *  gets the entities that are connected to this entity
+ *
+ *  @method getConnections
+ *  @public
+ *  @param {string} connection
+ *  @param {function} callback
+ *  @return {callback} callback(err, data, connections)
+ *
+ */
+Usergrid.Entity.prototype.getConnectedEntities = function(connection, callback) {
+
+  this.connectionGetter (connection, 'connected', function (err, data) {
+    if (!err) {
+      doCallback(callback, [err, data, data.entities], self);
+    } else {
+      doCallback(callback, [null, data, data.entities], self);
+    }
+  });
+};
+
+/*
+ *  Worker that gets the entities that an entity are connecting to or connected by
+ *
+ *  @method connectionGetter
+ *  @public
+ *  @param {string} connection
+ *  @param connectedOrConnecting
+ *  @return {callback} callback(err, data, connections)
+ *
+ */
+Usergrid.Entity.prototype.connectionGetter = function(connection, connectedOrConnecting, callback) {
+
   var self = this;
 
   //connector info
@@ -409,14 +451,18 @@ Usergrid.Entity.prototype.getConnections = function(connection, callback) {
     return;
   }
 
-  var endpoint = connectorType + '/' + connector + '/' + connection + '/';
+  if (connectedOrConnecting == 'connected') {
+    var endpoint = connectorType + '/' + connector + '/connecting/' + connection + '/';
+  } else if (connectedOrConnecting == 'connecting') {
+    var endpoint = connectorType + '/' + connector + '/' + connection + '/';
+  }
   var options = {
     method: 'GET',
     endpoint: endpoint
   };
   this._client.request(options, function(err, data) {
     if (err && self._client.logging) {
-      console.log('entity could not be connected');
+      console.log('could not get connections');
     }
 
     self[connection] = {};


[50/50] [abbrv] git commit: Merge pull request #239 from usergrid/USERGRID-154

Posted by sn...@apache.org.
Merge pull request #239 from usergrid/USERGRID-154

Usergrid 154

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

Branch: refs/heads/two-dot-o
Commit: 71cb9c266a0038570bb40aec0908fc17d809a89e
Parents: 998dd71 2a98cae
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Tue Jul 1 17:31:08 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Tue Jul 1 17:31:08 2014 -0700

----------------------------------------------------------------------
 .../impl/EntityCollectionManagerImpl.java       |   2 +-
 .../core/hystrix/HystrixCassandra.java          | 132 +++++
 .../core/hystrix/HystrixObservable.java         |  92 ---
 .../persistence/core/rx/ObservableIterator.java |  15 +-
 stack/corepersistence/graph/pom.xml             |   8 +-
 .../usergrid/persistence/graph/GraphFig.java    |  38 +-
 .../graph/exception/GraphRuntimeException.java  |  52 ++
 .../graph/guice/CommitLogEdgeSerialization.java |  34 --
 .../persistence/graph/guice/GraphModule.java    | 164 +-----
 .../graph/impl/GraphManagerImpl.java            | 230 ++++----
 .../graph/impl/stage/EdgeDeleteRepairImpl.java  |  27 +-
 .../graph/impl/stage/EdgeMetaRepairImpl.java    |  55 +-
 .../graph/impl/stage/EdgeWriteCompact.java      |  48 --
 .../graph/impl/stage/EdgeWriteCompactImpl.java  | 140 -----
 .../impl/stage/NodeDeleteListenerImpl.java      |  76 +--
 .../impl/EdgeSerializationImpl.java             |  34 +-
 .../serialization/impl/MergedEdgeReader.java    |  90 ---
 .../impl/MergedEdgeReaderImpl.java              | 501 ----------------
 .../impl/NodeSerializationImpl.java             |   5 +-
 .../shard/EdgeShardCounterSerialization.java    |  63 ---
 .../impl/shard/NodeShardAllocation.java         |   4 +-
 .../impl/shard/NodeShardApproximation.java      |   6 +
 .../impl/shard/NodeShardCache.java              |  10 -
 .../serialization/impl/shard/count/Counter.java | 125 ++++
 .../shard/count/NodeShardApproximationImpl.java | 207 +++++++
 .../count/NodeShardCounterSerialization.java    |  48 ++
 .../NodeShardCounterSerializationImpl.java      | 139 +++++
 .../impl/shard/count/ShardKey.java              | 102 ++++
 .../impl/EdgeShardCounterSerializationImpl.java | 141 -----
 .../shard/impl/NodeShardAllocationImpl.java     | 137 +++--
 .../shard/impl/NodeShardApproximationImpl.java  | 158 ------
 .../impl/shard/impl/NodeShardCacheImpl.java     |  32 +-
 .../shard/impl/SizebasedEdgeShardStrategy.java  |  16 +-
 .../shard/impl/TimebasedEdgeShardStrategy.java  |  96 ----
 .../persistence/graph/GraphManagerIT.java       |  10 +-
 .../graph/GraphManagerShardingIT.java           | 189 +++++++
 .../graph/StorageGraphManagerIT.java            |   8 +-
 .../graph/impl/EdgeDeleteListenerTest.java      | 185 +-----
 .../graph/impl/EdgeWriteListenerTest.java       | 451 ---------------
 .../graph/impl/NodeDeleteListenerTest.java      |   6 +-
 .../graph/impl/stage/EdgeDeleteRepairTest.java  |  29 +-
 .../graph/impl/stage/EdgeMetaRepairTest.java    |   8 +-
 .../CommitlogSerializationTest.java             |  47 --
 .../MergedEdgeReaderImplComparatorTest.java     | 254 ---------
 .../impl/MergedEdgeReaderTest.java              | 507 -----------------
 .../impl/shard/CountMinSketchTest.java          | 249 --------
 .../EdgeShardCounterSerializationTest.java      | 148 -----
 .../impl/shard/NodeShardAllocationTest.java     |  59 +-
 .../impl/shard/NodeShardApproximationTest.java  | 142 -----
 .../shard/count/NodeShardApproximationTest.java | 565 +++++++++++++++++++
 .../NodeShardCounterSerializationTest.java      | 126 +++++
 stack/corepersistence/pom.xml                   |   2 +-
 52 files changed, 2087 insertions(+), 3925 deletions(-)
----------------------------------------------------------------------



[39/50] [abbrv] git commit: Style fixes

Posted by sn...@apache.org.
Style fixes


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

Branch: refs/heads/two-dot-o
Commit: c692c0f9ab7905b24b123578bee125657f9ff5cf
Parents: 722b8d3
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 09:16:23 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 09:16:23 2014 +0300

----------------------------------------------------------------------
 .../org/apache/usergrid/chop/stack/SetupStackSignal.java     | 1 -
 .../usergrid/chop/webapp/coordinator/StackCoordinator.java   | 8 ++++----
 .../chop/webapp/coordinator/rest/RunnerRegistryResource.java | 4 ++--
 .../chop/webapp/coordinator/rest/UploadResource.java         | 1 +
 4 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c692c0f9/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
index 2a4523d..8c37054 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
@@ -41,7 +41,6 @@ public enum SetupStackSignal {
         switch ( id ) {
             case 0:
                 return DESTROY;
-
             case 1:
                 return DEPLOY;
             case 2:

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c692c0f9/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index 9e38227..c9a72b8 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -293,8 +293,8 @@ public class StackCoordinator {
      * @param user
      * @return Setup state of given parameters' stack
      */
-    public SetupStackState stackStatus( String commitId, String artifactId, String groupId, String version,
-                                        String user ) {
+    public SetupStackState stackStatus( String commitId, String artifactId, String groupId,
+                                        String version, String user ) {
 
         CoordinatedStack stack = findCoordinatedStack( commitId, artifactId, groupId, version, user );
 
@@ -340,8 +340,8 @@ public class StackCoordinator {
                                            final String version, final String user, final int runnerCount ) {
 
         User chopUser = userDao.get( user );
-        File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), user, groupId, artifactId, version,
-                commitId );
+        File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), user, groupId, artifactId,
+                version, commitId );
 
         Stack stack = CoordinatorUtils.getStackFromRunnerJar( runnerJar );
         Module module = moduleDao.get( BasicModule.createId( groupId, artifactId, version ) );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c692c0f9/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
index 9f248d5..665122c 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
@@ -54,7 +54,7 @@ import java.util.Collections;
 @Produces( MediaType.APPLICATION_JSON )
 @Consumes( MediaType.APPLICATION_JSON )
 @Path( RunnerRegistryResource.ENDPOINT )
-public class RunnerRegistryResource extends TestableResource implements RestParams {
+public class RunnerRegistryResource extends TestableResource {
     public final static String ENDPOINT = "/runners";
 
     private static final Logger LOG = LoggerFactory.getLogger( RunnerRegistryResource.class );
@@ -65,6 +65,7 @@ public class RunnerRegistryResource extends TestableResource implements RestPara
     @Inject
     private RunnerCoordinator runnerCoordinator;
 
+
     public RunnerRegistryResource() {
         super( ENDPOINT );
     }
@@ -189,5 +190,4 @@ public class RunnerRegistryResource extends TestableResource implements RestPara
 
         return Response.ok( result ).build();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c692c0f9/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index 250b7be..00564d4 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -87,6 +87,7 @@ public class UploadResource extends TestableResource implements RestParams, Cons
     @Inject
     private StackCoordinator stackCoordinator;
 
+
     public UploadResource() {
         super( ENDPOINT );
     }


[45/50] [abbrv] git commit: Added shard counting when serializing edges

Posted by sn...@apache.org.
Added shard counting when serializing edges


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

Branch: refs/heads/two-dot-o
Commit: ba04cb6a60758020d0ec9f9a4a575ebf321373ef
Parents: 69c2580
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jun 30 16:24:50 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Jun 30 16:24:50 2014 -0600

----------------------------------------------------------------------
 .../impl/EdgeSerializationImpl.java             | 34 +++++++++++++-----
 .../impl/shard/NodeShardAllocation.java         | 15 ++++++--
 .../impl/shard/NodeShardCache.java              |  2 +-
 .../shard/impl/NodeShardAllocationImpl.java     | 19 +++++++---
 .../impl/shard/impl/NodeShardCacheImpl.java     | 10 ++----
 .../impl/shard/NodeShardAllocationTest.java     | 38 ++++++++++----------
 6 files changed, 75 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
index b61616e..10d1048 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
@@ -213,7 +213,9 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
 
             @Override
             public void countEdge( final Id rowId, final long shardId, final String... types ) {
-                edgeShardStrategy.increment( scope, rowId, shardId, 1l, types );
+                if(!isDeleted){
+                    edgeShardStrategy.increment( scope, rowId, shardId, 1l, types );
+                }
             }
 
 
@@ -278,7 +280,9 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         EdgeUtils.validateEdge( edge );
 
         final Id sourceNodeId = edge.getSourceNode();
+        final String souceNodeType = sourceNodeId.getType();
         final Id targetNodeId = edge.getTargetNode();
+        final String targetNodeType = targetNodeId.getType();
         final long timestamp = edge.getTimestamp();
         final String type = edge.getType();
 
@@ -287,20 +291,24 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
          * Key in the serializers based on the edge
          */
 
-        final RowKey sourceRowKey = new RowKey( sourceNodeId, type,
-                edgeShardStrategy.getWriteShard( scope, sourceNodeId, timestamp, type ) );
+        final long sourceRowKeyShard = edgeShardStrategy.getWriteShard( scope, sourceNodeId, timestamp, type );
+        final RowKey sourceRowKey = new RowKey( sourceNodeId, type, sourceRowKeyShard);
 
-        final RowKeyType sourceRowKeyType = new RowKeyType( sourceNodeId, type, targetNodeId,
-                edgeShardStrategy.getWriteShard( scope, sourceNodeId, timestamp, type, targetNodeId.getType() ) );
+
+
+        final long sourceWithTypeRowKeyShard =  edgeShardStrategy.getWriteShard( scope, sourceNodeId, timestamp, type, targetNodeType );
+
+        final RowKeyType sourceRowKeyType = new RowKeyType( sourceNodeId, type, targetNodeId, sourceWithTypeRowKeyShard );
 
         final DirectedEdge sourceEdge = new DirectedEdge( targetNodeId, timestamp );
 
 
-        final RowKey targetRowKey = new RowKey( targetNodeId, type,
-                edgeShardStrategy.getWriteShard( scope, targetNodeId, timestamp, type ) );
 
-        final RowKeyType targetRowKeyType = new RowKeyType( targetNodeId, type, sourceNodeId,
-                edgeShardStrategy.getWriteShard( scope, targetNodeId, timestamp, type, sourceNodeId.getType() ) );
+        final long targetRowKeyShard = edgeShardStrategy.getWriteShard( scope, targetNodeId, timestamp, type );
+        final RowKey targetRowKey = new RowKey( targetNodeId, type, targetRowKeyShard);
+
+        final long targetWithTypeRowKeyShard = edgeShardStrategy.getWriteShard( scope, targetNodeId, timestamp, type, souceNodeType );
+        final RowKeyType targetRowKeyType = new RowKeyType( targetNodeId, type, sourceNodeId, targetWithTypeRowKeyShard );
 
         final DirectedEdge targetEdge = new DirectedEdge( sourceNodeId, timestamp );
 
@@ -315,22 +323,30 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
          */
 
         op.writeEdge( sourceNodeEdgesCf, sourceRowKey, sourceEdge );
+        op.countEdge( sourceNodeId, sourceRowKeyShard, type );
 
         op.writeEdge( sourceNodeTargetTypeCf, sourceRowKeyType, sourceEdge );
+        op.countEdge( sourceNodeId, sourceWithTypeRowKeyShard, type, targetNodeType );
+
+
 
 
         /**
          * write edges from target<-source
          */
         op.writeEdge( targetNodeEdgesCf, targetRowKey, targetEdge );
+        op.countEdge( targetNodeId, targetRowKeyShard, type );
 
         op.writeEdge( targetNodeSourceTypeCf, targetRowKeyType, targetEdge );
+        op.countEdge( targetNodeId, targetWithTypeRowKeyShard, type, souceNodeType );
 
 
         /**
          * Write this in the timestamp log for this edge of source->target
          */
         op.writeVersion( graphEdgeVersionsCf, edgeRowKey, timestamp );
+
+
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
index 675d0dc..07ee490 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
@@ -38,7 +38,7 @@ public interface NodeShardAllocation {
     /**
      * Get all shards for the given info.  If none exist, a default shard should be allocated
      *
-     * @param scope
+     * @param scope The application scope
      * @param nodeId
      * @param maxShardId The max value to start seeking from.  Values <= this will be returned if specified
      * @param edgeTypes
@@ -51,7 +51,7 @@ public interface NodeShardAllocation {
     /**
      * Audit our highest shard for it's maximum capacity.  If it has reached the max capacity <=, it will allocate a new shard
      *
-     * @param scope The organization scope
+     * @param scope The app scope
      * @param nodeId The node id
      * @param edgeType The edge types
      * @return True if a new shard was allocated
@@ -59,4 +59,15 @@ public interface NodeShardAllocation {
     public boolean auditMaxShard(final ApplicationScope scope, final Id nodeId, final String... edgeType);
 
 
+    /**
+     * Increment the underlying counts on the shards
+     * @param scope The app scope
+     * @param nodeId The id of the node
+     * @param shardId The id of the shard
+     * @param amount The amount to increment
+     * @param edgeTypes The edge types to include in the count operation
+     */
+    public void increment(final ApplicationScope scope, final Id nodeId, final long shardId, final long amount, final String... edgeTypes);
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
index 7845ab0..6c83da2 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
@@ -61,5 +61,5 @@ public interface NodeShardCache {
      * @param count
      * @return The new local cached count
      */
-    public long increment(final ApplicationScope scope, final Id nodeId, final long shard, final long count, final String... edgeTypes);
+    public void increment(final ApplicationScope scope, final Id nodeId, final long shard, final long count, final String... edgeTypes);
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
index dc34d73..c28b693 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
@@ -32,6 +32,7 @@ import org.apache.usergrid.persistence.graph.GraphFig;
 import org.apache.usergrid.persistence.graph.exception.GraphRuntimeException;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardAllocation;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.NodeShardCounterSerialization;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.count.ShardKey;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -50,7 +51,8 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
 
 
     private final EdgeShardSerialization edgeShardSerialization;
-    private final NodeShardCounterSerialization edgeShardCounterSerialization;
+//    private final NodeShardCounterSerialization edgeShardCounterSerialization;
+    private final NodeShardApproximation nodeShardApproximation;
     private final TimeService timeService;
     private final GraphFig graphFig;
     private final Keyspace keyspace;
@@ -58,10 +60,10 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
 
     @Inject
     public NodeShardAllocationImpl( final EdgeShardSerialization edgeShardSerialization,
-                                    final NodeShardCounterSerialization edgeShardCounterSerialization,
+                                    final  NodeShardApproximation nodeShardApproximation,
                                     final TimeService timeService, final GraphFig graphFig, final Keyspace keyspace ) {
         this.edgeShardSerialization = edgeShardSerialization;
-        this.edgeShardCounterSerialization = edgeShardCounterSerialization;
+        this.nodeShardApproximation = nodeShardApproximation;
         this.timeService = timeService;
         this.graphFig = graphFig;
         this.keyspace = keyspace;
@@ -157,7 +159,9 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
         /**
          * Check out if we have a count for our shard allocation
          */
-        final long count = edgeShardCounterSerialization.getCount( new ShardKey( scope, nodeId, maxShard, edgeType ));
+
+
+        final long count = nodeShardApproximation.getCount( scope, nodeId, maxShard, edgeType );
 
         if ( count < graphFig.getShardSize() ) {
             return false;
@@ -178,4 +182,11 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
 
         return true;
     }
+
+
+    @Override
+    public void increment( final ApplicationScope scope, final Id nodeId, final long shardId, final long amount,
+                           final String... edgeTypes ) {
+       nodeShardApproximation.increment( scope, nodeId, shardId, amount, edgeTypes );
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
index bda3b04..d34c625 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
@@ -52,10 +52,6 @@ import com.google.inject.Inject;
  */
 public class NodeShardCacheImpl implements NodeShardCache {
 
-
-    private static final int SHARD_PAGE_SIZE = 1000;
-
-
     private final NodeShardAllocation nodeShardAllocation;
     private final GraphFig graphFig;
 
@@ -145,10 +141,8 @@ public class NodeShardCacheImpl implements NodeShardCache {
 
 
     @Override
-    public long increment( final ApplicationScope scope, final Id nodeId, final long shard, final long count,
-                                     final String... edgeTypes ) {
-        //TODO, implement this
-        return 0;
+    public void increment( final ApplicationScope scope, final Id nodeId, final long shard, final long count, final String... edgeTypes ) {
+        nodeShardAllocation.increment( scope, nodeId, shard, count, edgeTypes );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba04cb6a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index 5b4c4e7..3b9e074 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -84,8 +84,8 @@ public class NodeShardAllocationTest {
     public void noShards() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization nodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardCounterSerialization =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -121,8 +121,8 @@ public class NodeShardAllocationTest {
     public void existingFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization nodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardCounterSerialization =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -167,8 +167,8 @@ public class NodeShardAllocationTest {
     public void lowCountFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization NodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardApproximation =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -181,7 +181,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -206,7 +206,7 @@ public class NodeShardAllocationTest {
 
         final long count = graphFig.getShardSize() - 1;
 
-        when( NodeShardCounterSerialization.getCount( eq( new ShardKey( scope, nodeId, 0l, type, subType ) ) ))
+        when( nodeShardApproximation.getCount(scope, nodeId, 0l, type, subType ))
                                            .thenReturn( count );
 
         final boolean result = approximation.auditMaxShard( scope, nodeId, type, subType );
@@ -219,8 +219,8 @@ public class NodeShardAllocationTest {
     public void equalCountFutureShard() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization NodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardApproximation =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -233,7 +233,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -257,8 +257,8 @@ public class NodeShardAllocationTest {
         final long shardCount = graphFig.getShardSize();
 
         //return a shard size equal to our max
-        when( NodeShardCounterSerialization
-                .getCount(  eq(new ShardKey(  scope , nodeId, 0l,type , subType ) ) ))
+        when( nodeShardApproximation
+                .getCount(   scope , nodeId, 0l,type , subType  ))
                 .thenReturn( shardCount );
 
         ArgumentCaptor<Long> newUUIDValue = ArgumentCaptor.forClass( Long.class );
@@ -292,8 +292,8 @@ public class NodeShardAllocationTest {
     public void futureCountShardCleanup() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization NodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardApproximation =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -306,7 +306,7 @@ public class NodeShardAllocationTest {
 
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );
@@ -397,8 +397,8 @@ public class NodeShardAllocationTest {
     public void noShardsReturns() {
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final NodeShardCounterSerialization NodeShardCounterSerialization =
-                mock( NodeShardCounterSerialization.class );
+        final NodeShardApproximation nodeShardApproximation =
+                mock( NodeShardApproximation.class );
 
 
         final TimeService timeService = mock( TimeService.class );
@@ -410,7 +410,7 @@ public class NodeShardAllocationTest {
         when( keyspace.prepareMutationBatch() ).thenReturn( batch );
 
         NodeShardAllocation approximation =
-                new NodeShardAllocationImpl( edgeShardSerialization, NodeShardCounterSerialization, timeService,
+                new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
                         graphFig, keyspace );
 
         final Id nodeId = createId( "test" );


[06/50] [abbrv] git commit: Merge 97eaead30c180c647351d393c477ab67201ec58e into c7b8612759f37da299b271b5c08de2a3fa4d71c6

Posted by sn...@apache.org.
Merge 97eaead30c180c647351d393c477ab67201ec58e into c7b8612759f37da299b271b5c08de2a3fa4d71c6


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

Branch: refs/pull/229/merge
Commit: 49b490ed8eb72ef047df0bc599c54fa9fec68627
Parents: c7b8612 97eaead
Author: Strong Liu <st...@hibernate.org>
Authored: Fri Jun 27 13:50:29 2014 +0000
Committer: Strong Liu <st...@hibernate.org>
Committed: Fri Jun 27 13:50:29 2014 +0000

----------------------------------------------------------------------
 stack/core/pom.xml                              | 10 +----
 .../persistence/hector/CountingMutator.java     | 12 +++++
 stack/pom.xml                                   | 46 +++++++++++++++-----
 stack/rest/pom.xml                              |  2 +-
 stack/test-utils/pom.xml                        | 27 ------------
 stack/websocket/pom.xml                         |  2 +-
 6 files changed, 50 insertions(+), 49 deletions(-)
----------------------------------------------------------------------



[16/50] [abbrv] git commit: implement new module tab on coordinator web UI for better user exprerience

Posted by sn...@apache.org.
implement new module tab on coordinator web UI for better user exprerience


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

Branch: refs/heads/two-dot-o
Commit: 1d1eed1a1277fbe930e60da2a1b3ae7b2cfd6d1e
Parents: 97e5dfb
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 20:51:48 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 20:51:48 2014 +0300

----------------------------------------------------------------------
 .../webapp/view/chart/layout/ChartLayout.java   | 12 +++-
 .../chop/webapp/view/main/MainView.java         |  4 +-
 .../chop/webapp/view/module/ModuleLayout.java   | 73 ++++++++++++++++++++
 3 files changed, 87 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
index 514f902..e278dbe 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
@@ -21,6 +21,7 @@ package org.apache.usergrid.chop.webapp.view.chart.layout;
 
 import java.util.Set;
 
+import com.vaadin.ui.Notification;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -131,11 +132,14 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
         testNameCombo.setWidth( "155px" );
 
         metricCombo = UIUtil.createCombo( "Metric:", Metric.values() );
+        metricCombo.setWidth( "155px" );
 
         percentileCombo = UIUtil.createCombo( "Percentile:",
                 new String[] { "100", "90", "80", "70", "60", "50", "40", "30", "20", "10" } );
+        percentileCombo.setWidth( "155px" );
 
         failureCombo = UIUtil.createCombo( "Points to Plot:", FailureType.values() );
+        failureCombo.setWidth( "155px" );
 
         Button submitButton = new Button("Submit");
         submitButton.addClickListener(new Button.ClickListener() {
@@ -181,6 +185,12 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
 
     public void loadChart() {
 
+        Params params = getParams();
+        if ( params.getTestName() == null ){
+            Notification.show( "Warning", "You don't have run results yet !!!", Notification.Type.WARNING_MESSAGE );
+            return;
+        }
+
         // BUG: If common.js is loaded separately its content is not visible later
         String chartContent = FileUtil.getContent( "js/common.js" ) + FileUtil.getContent( chartFile );
         Chart chart = chartBuilder.getChart( getParams() );
@@ -207,4 +217,4 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
         detailsTable.setContent( json );
         noteLayout.load( params.getCommitId(), params.getRunNumber() );
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
index db16360..0127093 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.UI;
 import com.vaadin.ui.TabSheet;
 import org.apache.usergrid.chop.webapp.service.chart.Params;
 import org.apache.usergrid.chop.webapp.service.shiro.ShiroRealm;
+import org.apache.usergrid.chop.webapp.view.module.ModuleLayout;
 import org.apache.usergrid.chop.webapp.view.chart.layout.OverviewChartLayout;
 import org.apache.usergrid.chop.webapp.view.log.LogLayout;
 import org.apache.usergrid.chop.webapp.view.module.ModuleListWindow;
@@ -71,7 +72,8 @@ public class MainView extends VerticalLayout implements ModuleSelectListener {
         modules.addClickListener( new Button.ClickListener() {
             @Override
             public void buttonClick(Button.ClickEvent clickEvent) {
-                UI.getCurrent().addWindow( new ModuleListWindow( MainView.this ) );
+//                UI.getCurrent().addWindow( new ModuleListWindow( MainView.this ) );
+                tabSheetManager.addTabWithVerticalLayout( new ModuleLayout( MainView.this ), "Modules" );
             }
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
new file mode 100644
index 0000000..6c6d7d0
--- /dev/null
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
@@ -0,0 +1,73 @@
+package org.apache.usergrid.chop.webapp.view.module;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+import org.apache.usergrid.chop.api.Module;
+import org.apache.usergrid.chop.webapp.dao.ModuleDao;
+import org.apache.usergrid.chop.webapp.service.InjectorFactory;
+import org.apache.usergrid.chop.webapp.view.module.ModuleSelectListener;
+
+import java.util.List;
+
+
+public class ModuleLayout extends VerticalLayout{
+
+    private final ModuleSelectListener listener;
+
+    public ModuleLayout ( ModuleSelectListener listener ){
+        this.listener = listener;
+        Table userTable = addTable();
+        addComponent( userTable );
+        setComponentAlignment( userTable, Alignment.MIDDLE_CENTER );
+    }
+
+
+    public Table addTable( ){
+        Table table = new Table(" \n ");
+        table.setHeight( "500px" );
+        table.setWidth( "700px" );
+
+        table.addContainerProperty( "Group", Label.class, null );
+        table.addContainerProperty( "Artifact", Label.class, null );
+        table.addContainerProperty( "Version", Label.class, null );
+        table.addContainerProperty( "Results", Button.class, null );
+
+        loadData( table );
+        return table;
+    }
+
+    private void onItemClick( String id) {
+        listener.onModuleSelect( id );
+    }
+
+    public void loadData( Table userTable ){
+        ModuleDao moduleDao = InjectorFactory.getInstance( ModuleDao.class );
+        List<Module> modules = moduleDao.getAll();
+        for( final Module module : modules ) {
+            Label groupLabel = new Label( module.getGroupId( ) );
+            Label artifactLabel = new Label( module.getArtifactId( ) );
+            Label versionLabel = new Label( module.getVersion( ) );
+
+            // The Table item identifier for the row.
+            String itemId = new String( module.getId( ) );
+
+            // Create a button and handle its click. A Button does not
+            // know the item it is contained in, so we have to store the
+            // item ID as user-defined data.
+            Button detailsField = new Button( "show details" );
+            detailsField.setId( itemId );
+            detailsField.setData( itemId );
+            detailsField.addStyleName( "link" );
+            detailsField.addClickListener( new Button.ClickListener( ) {
+                @Override
+                public void buttonClick( Button.ClickEvent event ) {
+                    onItemClick( module.getId() );
+                }
+            } );
+            userTable.addItem( new Object[]{ groupLabel, artifactLabel, versionLabel, detailsField }, module.getId( ) );
+        }
+    }
+}
\ No newline at end of file


[31/50] [abbrv] git commit: Fix allowed destroy signal and bugs

Posted by sn...@apache.org.
Fix allowed destroy signal and bugs


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

Branch: refs/heads/two-dot-o
Commit: a735c5ff3a467cb4421f9aabb6c4490a73cbcafb
Parents: 61596df
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Sat Jun 28 19:53:12 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Sat Jun 28 19:53:12 2014 +0300

----------------------------------------------------------------------
 .../usergrid/chop/stack/SetupStackState.java    | 33 +++++++++++++-------
 chop/webapp/pom.xml                             |  3 +-
 .../webapp/coordinator/StackCoordinator.java    |  2 +-
 .../coordinator/rest/DestroyResource.java       |  4 +--
 .../rest/RunnerRegistryResource.java            | 11 +++----
 5 files changed, 30 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a735c5ff/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
index 4015d2c..3e6fdba 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
@@ -40,53 +40,62 @@ public enum SetupStackState {
     // Running ==> (Complete signal) ==> SetUp
     // Running ==> (Destroy signal) ==> Destroying
     // Running ==> (Stop signal) ==> Stopped
-    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE }, new Integer[] { 6, 4, 0 },
+    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE },
+            new Integer[] { 6, 4, 0 },
             "Running tests on stack.",
             "%s signal rejected. When Running only STOP, DESTROY and COMPLETE signal(s) which cause to transition into " +
                     "Stopped, Destroying and SetUp state(s) respectively" ),
 
     // Stopped ==> (reset signal) ==> SetUp
-    Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET, SetupStackSignal.DESTROY }, new Integer[] { 0, 4 },
+    Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET, SetupStackSignal.DESTROY },
+            new Integer[] { 0, 4 },
             "Tests are stopped while running, please reset first.",
             "%s signal rejected. When Stopped only RESET and DESTROY signal(s) which cause to transition into " +
                     "SetUp, Destroying state(s) respectively" ),
 
+    // JarNotFound ==> (setup signal) ==> SettingUp
     // JarNotFound ==> (deploy signal) ==> NotSetUp
-    JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY, SetupStackSignal.SETUP }, new Integer[] { 3, 1 },
+    JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY, SetupStackSignal.SETUP },
+            new Integer[] { 3, 1 },
             "No runner jars found with given parameters, deploy first.",
             "%s signal rejected. When JarNotFound only DEPLOY and SETUP signal(s) which cause to transition into " +
                     "NotSetUp and SettingUp state(s) respectively" ),
 
     // Destroying ==> (Complete signal) ==> NotSetUp
-    Destroying( 4, new SetupStackSignal[] { SetupStackSignal.COMPLETE }, new Integer[] { 3 },
+    Destroying( 4, new SetupStackSignal[] { SetupStackSignal.COMPLETE },
+            new Integer[] { 3 },
             "Currently being destroyed. Wait until it is finished to set up again.",
             "%s signal rejected. When Destroying only COMPLETE signal(s) can be sent which cause to " +
                     "transition into NotSetUp state(s) respectively" ),
 
-    // NotSetUp ==> (setup signal) ==> NotSetUp
+    // NotSetUp ==> (deploy signal) ==> NotSetUp
     // NotSetUp ==> (setup signal) ==> SettingUp
-    NotSetUp( 3, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY }, new Integer[] { 1, 3 },
+    NotSetUp( 3, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY },
+            new Integer[] { 1, 3 },
             "Jar is deployed but no stack set up with it.",
             "%s signal rejected. When NotSetUp only SETUP and DEPLOY signal(s) which cause to transition into " +
                     "SettingUp and NotSetUp state(s) respectively" ),
 
     // SetupFailed ==> (setup deploy) ==> NotSetUp
     // SetupFailed ==> (setup signal) ==> SettingUp
-    SetupFailed( 2, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY }, new Integer[] { 1, 3 },
+    SetupFailed( 2, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY },
+            new Integer[] { 1, 3 },
             "Stack was registered, however its setup failed. Call setup again to restart.",
             "%s signal rejected. When SetupFailed only SETUP and DEPLOY signal(s) which cause to transition into " +
                     "SettingUp and NotSetUp state(s) respectively" ),
 
+    // SettingUp ==> (Fail signal) ==> SetupFailed
     // SettingUp ==> (Complete signal) ==> SetUp
-    SettingUp( 1, new SetupStackSignal[] { SetupStackSignal.COMPLETE, SetupStackSignal.FAIL
-            , SetupStackSignal.DESTROY}, new Integer[] { 0, 2, 4 },
+    SettingUp( 1, new SetupStackSignal[] { SetupStackSignal.COMPLETE, SetupStackSignal.FAIL},
+            new Integer[] { 0, 2 },
             "Setting up the stack right now.",
-            "%s signal rejected. When SettingUp only COMPLETE, FAIL and DESTROY signal(s) can be sent which " +
-                    "cause to transition into SetUp, SetupFailed and Destroying state(s) respectively" ),
+            "%s signal rejected. When SettingUp only COMPLETE and FAIL signal(s) can be sent which " +
+                    "cause to transition into SetUp and SetupFailed state(s) respectively" ),
 
     // SetUp ==> (start signal) ==> Running
     // SetUp ==> (destroy signal) ==> NotSetUp
-    SetUp( 0, new SetupStackSignal[] { SetupStackSignal.DESTROY, SetupStackSignal.START }, new Integer[] { 4, 7 },
+    SetUp( 0, new SetupStackSignal[] { SetupStackSignal.DESTROY, SetupStackSignal.START },
+            new Integer[] { 4, 7 },
             "Stack is set up and ready to start the tests.",
             "%s signal rejected. When SetUp only DESTROY and SetUp signal(s) which cause to transition into " +
                     "NotSetUp and SetUp state(s) respectively" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a735c5ff/chop/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/chop/webapp/pom.xml b/chop/webapp/pom.xml
index caef3aa..f50a82e 100644
--- a/chop/webapp/pom.xml
+++ b/chop/webapp/pom.xml
@@ -19,6 +19,7 @@
     <properties>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <wagon.version>2.6</wagon.version>
+      <shade.plugin.version>2.2</shade.plugin.version>
       <wagon.plugin.version>1.0-beta-5</wagon.plugin.version>
       <webapp-shaded-jar>${project.artifactId}-${project.version}-shaded.${project.packaging}</webapp-shaded-jar>
       <wagon.webapp.copy.file>${project.build.directory}/${webapp-shaded-jar}</wagon.webapp.copy.file>
@@ -170,7 +171,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>2.2</version>
+        <version>${shade.plugin.version}</version>
         <executions>
           <execution>
             <phase>package</phase>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a735c5ff/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index bdc5231..9e38227 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -173,7 +173,7 @@ public class StackCoordinator {
         }
 
         synchronized ( coordinatedStack ) {
-            if ( coordinatedStack.getSetupState().accepts( SetupStackSignal.DESTROY ) ) {
+            if ( ! coordinatedStack.getSetupState().accepts( SetupStackSignal.DESTROY ) ) {
                 LOG.info( "Stack is in {} state, will not destroy.", coordinatedStack.getSetupState().toString() );
                 return;
             }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a735c5ff/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
index ff1ff21..e87126a 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
@@ -111,9 +111,7 @@ public class DestroyResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        /** SetupStackState.SetUp or SetupStackState.SettingUp
-         * or SetupStackState.Running or SetupStackState.Stopped */
-
+        LOG.debug( "Stack is {}, destroying... ", status.toString() );
         // Unregister runners first
         String moduleId = BasicModule.createId( groupId, artifactId, version );
         Collection<Runner> runners = runnerCoordinator.getRunners( user, commitId, moduleId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a735c5ff/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
index 2704efa..781a2b3 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
@@ -210,12 +210,11 @@ public class RunnerRegistryResource extends TestableResource implements RestPara
             @QueryParam( MODULE_VERSION ) String version,
             @QueryParam( COMMIT_ID ) String commitId
     ) {
-
-        LOG.info( "USERNAME: {}", username );
-        LOG.info( "MODULE_GROUPID: {}", groupId );
-        LOG.info( "MODULE_ARTIFACTID: {}", artifactId );
-        LOG.info( "MODULE_VERSION: {}", version );
-        LOG.info( "COMMIT_ID: {}", commitId );
+        LOG.debug( "USERNAME: {}", username );
+        LOG.debug( "MODULE_GROUPID: {}", groupId );
+        LOG.debug( "MODULE_ARTIFACTID: {}", artifactId );
+        LOG.debug( "MODULE_VERSION: {}", version );
+        LOG.debug( "COMMIT_ID: {}", commitId );
 
         CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, username );
         if ( stack.getSetupState().accepts( SetupStackSignal.COMPLETE ) ) {


[13/50] [abbrv] git commit: [USERGRID-184]Adds connection reverse lookup support to JS SDK

Posted by sn...@apache.org.
[USERGRID-184]Adds connection reverse lookup support to JS SDK

	-Adds getConnectedEntities to support requests of type GET /<someCollection>/<someEntity>/connecting/<someConnection>
	-Adds connectionsGetter worker so getConnectedEntities and getConnection share one set of request logic


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

Branch: refs/pull/231/head
Commit: 1143d43aae0e6ee6754f3feffbd82bc4e2e75413
Parents: 8d4140e
Author: amuramoto <am...@apigee.com>
Authored: Fri Jun 27 10:24:34 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Fri Jun 27 10:24:34 2014 -0700

----------------------------------------------------------------------
 sdks/html5-javascript/lib/modules/Entity.js | 54 ++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1143d43a/sdks/html5-javascript/lib/modules/Entity.js
----------------------------------------------------------------------
diff --git a/sdks/html5-javascript/lib/modules/Entity.js b/sdks/html5-javascript/lib/modules/Entity.js
index 029951c..63e9a29 100644
--- a/sdks/html5-javascript/lib/modules/Entity.js
+++ b/sdks/html5-javascript/lib/modules/Entity.js
@@ -381,18 +381,60 @@ Usergrid.Entity.prototype.getEntityId = function(entity) {
 };
 
 /*
- *  gets an entities connections
+ *  gets entities this entity is connecting to
  *
  *  @method getConnections
  *  @public
  *  @param {string} connection
- *  @param {object} entity
  *  @param {function} callback
  *  @return {callback} callback(err, data, connections)
  *
  */
 Usergrid.Entity.prototype.getConnections = function(connection, callback) {
 
+  this.connectionGetter (connection, 'connecting', function (err, data) {
+    if (!err) {
+      doCallback(callback, [err, data, data.entities], self);
+    } else {
+      doCallback(callback, [null, data, data.entities], self);
+    }
+  });
+
+};
+
+/*
+ *  gets the entities that are connected to this entity
+ *
+ *  @method getConnections
+ *  @public
+ *  @param {string} connection
+ *  @param {function} callback
+ *  @return {callback} callback(err, data, connections)
+ *
+ */
+Usergrid.Entity.prototype.getConnectedEntities = function(connection, callback) {
+
+  this.connectionGetter (connection, 'connected', function (err, data) {
+    if (!err) {
+      doCallback(callback, [err, data, data.entities], self);
+    } else {
+      doCallback(callback, [null, data, data.entities], self);
+    }
+  });
+};
+
+/*
+ *  Worker that gets the entities that an entity are connecting to or connected by
+ *
+ *  @method connectionGetter
+ *  @public
+ *  @param {string} connection
+ *  @param connectedOrConnecting
+ *  @return {callback} callback(err, data, connections)
+ *
+ */
+Usergrid.Entity.prototype.connectionGetter = function(connection, connectedOrConnecting, callback) {
+
   var self = this;
 
   //connector info
@@ -409,14 +451,18 @@ Usergrid.Entity.prototype.getConnections = function(connection, callback) {
     return;
   }
 
-  var endpoint = connectorType + '/' + connector + '/' + connection + '/';
+  if (connectedOrConnecting == 'connected') {
+    var endpoint = connectorType + '/' + connector + '/connecting/' + connection + '/';
+  } else if (connectedOrConnecting == 'connecting') {
+    var endpoint = connectorType + '/' + connector + '/' + connection + '/';
+  }
   var options = {
     method: 'GET',
     endpoint: endpoint
   };
   this._client.request(options, function(err, data) {
     if (err && self._client.logging) {
-      console.log('entity could not be connected');
+      console.log('could not get connections');
     }
 
     self[connection] = {};


[41/50] [abbrv] git commit: Merge pull request #236 from fbicak/two-dot-o

Posted by sn...@apache.org.
Merge pull request #236 from fbicak/two-dot-o

Change setup stack states with signals

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

Branch: refs/heads/two-dot-o
Commit: afb2cb22ea9e758bd5022ac48d6970ef4a1486d5
Parents: d86b5a3 9b6d819
Author: Yigit Sapli <yi...@apache.org>
Authored: Mon Jun 30 13:07:52 2014 +0600
Committer: Yigit Sapli <yi...@apache.org>
Committed: Mon Jun 30 13:07:52 2014 +0600

----------------------------------------------------------------------
 .../apache/usergrid/chop/client/ssh/Job.java    |   2 +-
 .../apache/usergrid/chop/plugin/DeployMojo.java |   7 +-
 .../usergrid/chop/stack/CoordinatedStack.java   |  19 +-
 .../usergrid/chop/stack/SetupStackSignal.java   |  56 +++++
 .../usergrid/chop/stack/SetupStackState.java    | 219 ++++++++++++++++++-
 chop/webapp/pom.xml                             |   2 +
 .../webapp/coordinator/SetupStackThread.java    |  16 +-
 .../webapp/coordinator/StackCoordinator.java    |  56 ++++-
 .../chop/webapp/coordinator/StackDestroyer.java |   3 +-
 .../coordinator/rest/DestroyResource.java       |   6 +-
 .../coordinator/rest/RunManagerResource.java    |   8 +-
 .../webapp/coordinator/rest/SetupResource.java  |   4 +-
 .../webapp/coordinator/rest/StartResource.java  |   2 +-
 .../webapp/coordinator/rest/UploadResource.java |  23 +-
 14 files changed, 377 insertions(+), 46 deletions(-)
----------------------------------------------------------------------



[44/50] [abbrv] git commit: Removed count min counters. They aren't easily distributed for concurrent counting.

Posted by sn...@apache.org.
Removed count min counters.  They aren't easily distributed for concurrent counting.


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

Branch: refs/heads/two-dot-o
Commit: 69c25801a4106cf533f0b76c1a2acd4128539d7b
Parents: a8fc5a5
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jun 30 14:36:25 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Jun 30 14:45:36 2014 -0600

----------------------------------------------------------------------
 stack/corepersistence/graph/pom.xml             |   8 +-
 .../impl/shard/CountMinSketchTest.java          | 249 -------------------
 .../shard/count/NodeShardApproximationTest.java |   2 -
 3 files changed, 1 insertion(+), 258 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/69c25801/stack/corepersistence/graph/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/pom.xml b/stack/corepersistence/graph/pom.xml
index b63c1dd..eee82fd 100644
--- a/stack/corepersistence/graph/pom.xml
+++ b/stack/corepersistence/graph/pom.xml
@@ -55,13 +55,7 @@
       <version>4.0</version>
     </dependency>
 
-    <!-- utilized for hyperloglog cardinality terms -->
-    <dependency>
-      <groupId>com.clearspring.analytics</groupId>
-      <artifactId>stream</artifactId>
-      <version>2.6.0</version>
-      <scope>test</scope>
-    </dependency>
+
 
     <dependency>
       <groupId>org.apache.usergrid</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/69c25801/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/CountMinSketchTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/CountMinSketchTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/CountMinSketchTest.java
deleted file mode 100644
index a6cf76e..0000000
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/CountMinSketchTest.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * 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.graph.serialization.impl.shard;
-
-
-import java.util.Stack;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.clearspring.analytics.hash.MurmurHash;
-import com.clearspring.analytics.stream.frequency.CountMinSketch;
-import com.clearspring.analytics.stream.frequency.IFrequency;
-import com.netflix.astyanax.serializers.UUIDSerializer;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class CountMinSketchTest {
-
-    private static final Logger log = LoggerFactory.getLogger( CountMinSketchTest.class );
-
-    private static final int SIZE = 250000;
-
-    private static final UUIDSerializer UUID_SER = UUIDSerializer.get();
-
-    private static final double EPS_OF_TOTAL_COUNT = 0.0075;
-
-    private static final double CONFIDENCE = 0.99;
-
-
-    private static final int SEED = 7364181;
-
-
-    @Test
-    public void testAccuracy() {
-
-        IFrequency baseSketch = new CountMinSketch( EPS_OF_TOTAL_COUNT, CONFIDENCE, SEED );
-
-        byte[] bytes = UUID_SER.toByteBuffer( UUIDGenerator.newTimeUUID() ).array();
-
-        long hash = MurmurHash.hash64( bytes );
-
-
-        for ( int i = 0; i < SIZE; i++ ) {
-            baseSketch.add( hash, 1 );
-        }
-
-
-        assertCardinality( baseSketch, hash, SIZE, SIZE, EPS_OF_TOTAL_COUNT );
-    }
-
-
-    @Test
-    public void testUnion() throws Exception {
-        CountMinSketch firstCounter = new CountMinSketch( EPS_OF_TOTAL_COUNT, CONFIDENCE, SEED );
-
-        CountMinSketch secondCounter = new CountMinSketch( EPS_OF_TOTAL_COUNT, CONFIDENCE, SEED );
-
-
-        byte[] bytes = UUID_SER.toByteBuffer( UUIDGenerator.newTimeUUID() ).array();
-
-        long hash = MurmurHash.hash64( bytes );
-
-        for ( int i = 0; i < SIZE; i++ ) {
-
-
-            //only offer every other hash
-            if ( i % 2 == 0 ) {
-                firstCounter.add( hash, 1 );
-            }
-
-            else {
-                secondCounter.add( hash, 1 );
-            }
-        }
-
-
-        int half = SIZE / 2;
-
-        assertCardinality( firstCounter, hash, half, half, EPS_OF_TOTAL_COUNT );
-
-        assertCardinality( secondCounter, hash, half, half, EPS_OF_TOTAL_COUNT );
-
-
-        //merge both of them into new modules
-        byte[] firstCounterBytes = CountMinSketch.serialize( firstCounter );
-        byte[] secondCounterBytes = CountMinSketch.serialize( secondCounter );
-
-        log.info( "The hyperLogLogBytes byte size is {}", firstCounterBytes.length );
-        log.info( "The secondCounterBytes byte size is {}", secondCounterBytes.length );
-
-        CountMinSketch deSerializedFirst = CountMinSketch.deserialize( firstCounterBytes );
-
-        CountMinSketch deSerializedSecond = CountMinSketch.deserialize( secondCounterBytes );
-
-
-        //now add them
-        CountMinSketch merged = CountMinSketch.merge( deSerializedFirst, deSerializedSecond );
-
-
-        assertCardinality( merged, hash, SIZE, SIZE, EPS_OF_TOTAL_COUNT );
-    }
-
-
-    @Test
-    @Ignore
-    public void testLargeEntrySize() throws Exception {
-
-
-        //create 10 billion unique entries
-        final long uniqueEntrySize = 10000000000l;
-        //        final long uniqueEntrySize = 1000000;
-
-
-        /**
-         * For each entry, increment its count this number of time
-         */
-        final int numCountIncrement = 10;
-
-        /**
-         * Increment by this amount every time
-         */
-        final int entryIncrement = 1000;
-
-        /**
-         * 2x our number of processors
-         */
-        final int concurrentWorkers = Runtime.getRuntime().availableProcessors() * 2;
-
-
-        ExecutorService service = Executors.newFixedThreadPool( concurrentWorkers );
-
-
-        final long countPerWorker = uniqueEntrySize / concurrentWorkers;
-
-
-        final CountMinSketch counter = new CountMinSketch( EPS_OF_TOTAL_COUNT, CONFIDENCE, SEED );
-
-
-        Stack<Future<Void>> futures = new Stack<Future<Void>>();
-
-        final Object mutex = new Object();
-
-        for ( int i = 0; i < concurrentWorkers; i++ ) {
-
-            Future<Void> future = service.submit( new Callable<Void>() {
-
-                @Override
-                public Void call() throws Exception {
-
-                    for ( long i = 0; i < countPerWorker; i++ ) {
-
-                        byte[] bytes = UUID_SER.toByteBuffer( UUIDGenerator.newTimeUUID() ).array();
-
-                        long hash = MurmurHash.hash64( bytes );
-
-                        for ( int j = 0; j < numCountIncrement; j++ ) {
-                            synchronized ( mutex ) {
-                                counter.add( hash, entryIncrement );
-                            }
-                        }
-
-
-                        assertCardinality( counter, hash, entryIncrement * numCountIncrement, uniqueEntrySize,
-                                EPS_OF_TOTAL_COUNT );
-                    }
-
-                    return null;
-                }
-            } );
-
-            futures.push( future );
-        }
-
-
-        /**
-         * Block until done
-         */
-        for ( Future<Void> future : futures ) {
-            future.get();
-        }
-    }
-
-
-    /**
-     * Verify the cardinality of the log
-     */
-    private void assertCardinality( IFrequency frequency, long hash, int expectedSize, long totalSize, double eps ) {
-
-
-        long estimatedCount = frequency.estimateCount( hash );
-
-        double totalDelta = totalSize * eps;
-
-        long min = ( long ) ( expectedSize - totalDelta );
-
-        long max = ( long ) ( expectedSize + totalDelta );
-
-        long delta = Math.abs( expectedSize - estimatedCount );
-
-        //        log.info( "Cardinality is {} for size {}.  Delta is {}", estimatedCount, expectedSize, delta );
-        //        log.info( "Expected min is {}", min );
-        //        log.info( "Expected max is {}", max );
-
-        //
-        //        if ( estimatedCount < min ) {
-        //            log.warn( "Low estimated count.  Min expected is {} but was {}", min, estimatedCount );
-        //        }
-        //
-        //        if ( estimatedCount > max ) {
-        //            log.warn( "High estimated count.  Max expected is {} but was {}", max, estimatedCount );
-        //        }
-
-        //                assertTrue( String.format("Min %d is <= the cardinality %d", min, estimatedCount),
-        // min <= estimatedCount );
-        //
-        //                assertTrue(String.format( "Cardinality %d is <= max %d ", estimatedCount, max),
-        // estimatedCount <= max );
-
-        assertTrue( String.format( "Min %d is <= the cardinality %d", min, estimatedCount ), min <= estimatedCount );
-
-        assertTrue( String.format( "Cardinality %d is <= max %d ", estimatedCount, max ), estimatedCount <= max );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/69c25801/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index 6475ca6..e849725 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -71,7 +71,6 @@ public class NodeShardApproximationTest {
 
     private GraphFig graphFig;
 
-    private NodeShardCounterSerialization ser;
     private NodeShardCounterSerialization nodeShardCounterSerialization;
     private TimeService timeService;
 
@@ -94,7 +93,6 @@ public class NodeShardApproximationTest {
         when( graphFig.getShardCacheSize() ).thenReturn( 10000l );
         when( graphFig.getShardSize() ).thenReturn( 250000l );
 
-        ser = mock( NodeShardCounterSerialization.class );
         nodeShardCounterSerialization = mock( NodeShardCounterSerialization.class );
 
         when(nodeShardCounterSerialization.flush( any(Counter.class) )).thenReturn( mock( MutationBatch.class) );


[35/50] [abbrv] git commit: Reduce coupling by differentiating runner states with setup stack states

Posted by sn...@apache.org.
Reduce coupling by differentiating runner states with setup stack states


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

Branch: refs/heads/two-dot-o
Commit: 87ccf72bd27cbd8b6e15dab5f47f996218a11b5e
Parents: 63a80af
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 08:50:43 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 08:50:43 2014 +0300

----------------------------------------------------------------------
 .../usergrid/chop/api/CoordinatorFig.java       |  7 ---
 .../apache/usergrid/chop/runner/Controller.java | 50 +-------------------
 .../usergrid/chop/runner/IController.java       |  5 --
 .../usergrid/chop/stack/SetupStackSignal.java   | 17 +++----
 .../usergrid/chop/stack/SetupStackState.java    | 29 ++----------
 .../webapp/coordinator/rest/ResetResource.java  |  7 +--
 .../rest/RunnerRegistryResource.java            | 33 -------------
 .../webapp/coordinator/rest/StartResource.java  |  3 --
 .../webapp/coordinator/rest/StopResource.java   |  9 +---
 .../webapp/coordinator/rest/UploadResource.java |  6 +--
 10 files changed, 18 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
----------------------------------------------------------------------
diff --git a/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java b/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
index 6a5fdaa..a238f59 100644
--- a/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
+++ b/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
@@ -92,13 +92,6 @@ public interface CoordinatorFig extends GuicyFig {
     String getRunnersUnregisterPath();
 
 
-    String RUNNERS_COMPLETED_PATH = "coordinator.endpoint.runners.completed";
-    String RUNNERS_COMPLETED_PATH_DEFAULT = "/runners/completed";
-    @Key( RUNNERS_COMPLETED_PATH )
-    @Default( RUNNERS_COMPLETED_PATH_DEFAULT )
-    String getRunnersCompletedPath();
-
-
     String ENDPOINT = "coordinator.endpoint";
     String ENDPOINT_DEFAULT = "https://localhost:8443";
     @Key( ENDPOINT )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
index 7fc9b3d..cf7d639 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
@@ -70,12 +70,9 @@ import javax.ws.rs.core.MediaType;
  * The Controller controls the process of executing chops on test classes.
  */
 @Singleton
-public class Controller implements IController, Runnable, RestParams {
+public class Controller implements IController, Runnable {
     private static final Logger LOG = LoggerFactory.getLogger( Controller.class );
 
-    private CoordinatorFig coordinatorFig;
-    private URL endpoint;
-
 
     // @todo make this configurable and also put this into the project or runner fig
     private static final long DEFAULT_LAGER_WAIT_TIMEOUT_MILLIS = 120000;
@@ -121,25 +118,6 @@ public class Controller implements IController, Runnable, RestParams {
     }
 
 
-    @Inject
-    private void setCoordinatorConfig( CoordinatorFig coordinatorFig ) {
-        this.coordinatorFig = coordinatorFig;
-
-        try {
-            endpoint = new URL( coordinatorFig.getEndpoint() );
-        }
-        catch ( MalformedURLException e ) {
-            LOG.error( "Failed to parse URL for coordinator", e );
-        }
-
-        // Need to get the configuration information for the coordinator
-        if ( ! CertUtils.isTrusted( endpoint.getHost() ) ) {
-            CertUtils.preparations( endpoint.getHost(), endpoint.getPort() );
-        }
-        Preconditions.checkState( CertUtils.isTrusted( endpoint.getHost() ), "coordinator must be trusted" );
-    }
-
-
     private void setProject( Project project ) {
         // if the project is null which should never really happen we just return
         // and stay in the INACTIVE state waiting for a load to activate this runner
@@ -479,32 +457,6 @@ public class Controller implements IController, Runnable, RestParams {
         LOG.info( "The controller has completed." );
         currentDriver = null;
         state = state.next( Signal.COMPLETED );
-        SetupStackState setupStackState = sendCompleteSignalToSetupStack();
-        LOG.info( "Coordinator stack state: {}", setupStackState );
-    }
-
-    public SetupStackState sendCompleteSignalToSetupStack() {
-        LOG.info( "Sending complete signal to Coordinator" );
-        WebResource resource = Client.create().resource( coordinatorFig.getEndpoint() );
-
-        LOG.info( "USERNAME: {}", coordinatorFig.getUsername() );
-        LOG.info( "MODULE_GROUPID: {}", project.getGroupId() );
-        LOG.info( "MODULE_ARTIFACTID: {}", project.getArtifactId() );
-        LOG.info( "MODULE_VERSION: {}", project.getVersion() );
-        LOG.info( "COMMIT_ID: {}", project.getVcsVersion() );
-
-        SetupStackState result = resource.path( coordinatorFig.getRunnersCompletedPath() )
-                .queryParam( USERNAME, coordinatorFig.getUsername() )
-                .queryParam( MODULE_GROUPID, project.getGroupId() )
-                .queryParam( MODULE_ARTIFACTID, project.getArtifactId() )
-                .queryParam( MODULE_VERSION, project.getVersion() )
-                .queryParam( COMMIT_ID, project.getVcsVersion() )
-                .type( MediaType.APPLICATION_JSON )
-                .get( SetupStackState.class );
-
-
-        return result;
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
index c540622..aaa7d8b 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
@@ -88,9 +88,4 @@ public interface IController {
      */
     Project getProject();
 
-    /**
-     * sends signal to coordinator to inform that all runners are finished
-     * @return Setup stack state of coordinator after signal sent
-     */
-    SetupStackState sendCompleteSignalToSetupStack();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
index 96caa4b..2a4523d 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
@@ -22,7 +22,7 @@ package org.apache.usergrid.chop.stack;
 
 public enum SetupStackSignal {
 
-    START( 0 ), STOP( 1 ), RESET( 2 ), DESTROY( 3 ), DEPLOY( 4 ), SETUP( 5 ), FAIL ( 6 ), COMPLETE ( 7 );
+    DESTROY( 0 ), DEPLOY( 1 ), SETUP( 2 ), FAIL ( 3 ), COMPLETE ( 4 );
 
     private final int signalID;
 
@@ -40,20 +40,15 @@ public enum SetupStackSignal {
     public SetupStackSignal get( int id ) {
         switch ( id ) {
             case 0:
-                return START;
-            case 1:
-                return STOP;
-            case 2:
-                return RESET;
-            case 3:
                 return DESTROY;
-            case 4:
+
+            case 1:
                 return DEPLOY;
-            case 5:
+            case 2:
                 return SETUP;
-            case 6:
+            case 3:
                 return FAIL;
-            case 7:
+            case 4:
                 return COMPLETE;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
index 3e6fdba..1847914 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
@@ -37,22 +37,6 @@ import com.google.common.base.Preconditions;
  * Represents the setup state of a stack
  */
 public enum SetupStackState {
-    // Running ==> (Complete signal) ==> SetUp
-    // Running ==> (Destroy signal) ==> Destroying
-    // Running ==> (Stop signal) ==> Stopped
-    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE },
-            new Integer[] { 6, 4, 0 },
-            "Running tests on stack.",
-            "%s signal rejected. When Running only STOP, DESTROY and COMPLETE signal(s) which cause to transition into " +
-                    "Stopped, Destroying and SetUp state(s) respectively" ),
-
-    // Stopped ==> (reset signal) ==> SetUp
-    Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET, SetupStackSignal.DESTROY },
-            new Integer[] { 0, 4 },
-            "Tests are stopped while running, please reset first.",
-            "%s signal rejected. When Stopped only RESET and DESTROY signal(s) which cause to transition into " +
-                    "SetUp, Destroying state(s) respectively" ),
-
     // JarNotFound ==> (setup signal) ==> SettingUp
     // JarNotFound ==> (deploy signal) ==> NotSetUp
     JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY, SetupStackSignal.SETUP },
@@ -92,13 +76,12 @@ public enum SetupStackState {
             "%s signal rejected. When SettingUp only COMPLETE and FAIL signal(s) can be sent which " +
                     "cause to transition into SetUp and SetupFailed state(s) respectively" ),
 
-    // SetUp ==> (start signal) ==> Running
     // SetUp ==> (destroy signal) ==> NotSetUp
-    SetUp( 0, new SetupStackSignal[] { SetupStackSignal.DESTROY, SetupStackSignal.START },
-            new Integer[] { 4, 7 },
+    SetUp( 0, new SetupStackSignal[] { SetupStackSignal.DESTROY },
+            new Integer[] { 4 },
             "Stack is set up and ready to start the tests.",
-            "%s signal rejected. When SetUp only DESTROY and SetUp signal(s) which cause to transition into " +
-                    "NotSetUp and SetUp state(s) respectively" );
+            "%s signal rejected. When SetUp only DESTROY signal(s) which cause to transition into " +
+                    "NotSetUp state(s) respectively" );
 
     private static final Logger LOG = LoggerFactory.getLogger( SetupStackState.class );
     private static final String SUCCESS_MSG = "%s signal accepted, transitioning from %s state to %s";
@@ -206,10 +189,6 @@ public enum SetupStackState {
                 return Destroying;
             case 5:
                 return JarNotFound;
-            case 6:
-                return Stopped;
-            case 7:
-                return Running;
         }
 
         throw new RuntimeException( "Should never get here!" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
index 48f3159..c40a530 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
@@ -108,13 +108,13 @@ public class ResetResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        if( ! status.equals( SetupStackState.Stopped ) ) {
+        if( ! status.equals( SetupStackState.SetUp ) ) {
             return Response.status( Response.Status.OK )
                            .entity( "Stack is " + status.toString() + ", cannot reset tests." )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
-        /** SetupStackState.Stopped */
+        /** SetupStackState.SetUp */
         LOG.info( "Stack is stopped, checking runner states..." );
 
         /** Check state of all runners */
@@ -197,9 +197,6 @@ public class ResetResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, user );
-        stack.setSetupState( SetupStackSignal.RESET );
-
         return Response.status( Response.Status.CREATED )
                        .entity( "All stopped runners have been reset." )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
index 781a2b3..9f248d5 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
@@ -26,10 +26,7 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
-import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.ModuleDao;
 import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
 import org.safehaus.jettyjam.utils.TestMode;
@@ -68,10 +65,6 @@ public class RunnerRegistryResource extends TestableResource implements RestPara
     @Inject
     private RunnerCoordinator runnerCoordinator;
 
-    @Inject
-    private StackCoordinator stackCoordinator;
-
-
     public RunnerRegistryResource() {
         super( ENDPOINT );
     }
@@ -197,30 +190,4 @@ public class RunnerRegistryResource extends TestableResource implements RestPara
         return Response.ok( result ).build();
     }
 
-
-    @SuppressWarnings( "unchecked" )
-    @GET
-    @Path( "/completed" )
-    @Consumes( MediaType.APPLICATION_JSON )
-    @Produces( MediaType.APPLICATION_JSON )
-    public Response runnersCompleted(
-            @QueryParam( USERNAME ) String username,
-            @QueryParam( MODULE_GROUPID ) String groupId,
-            @QueryParam( MODULE_ARTIFACTID ) String artifactId,
-            @QueryParam( MODULE_VERSION ) String version,
-            @QueryParam( COMMIT_ID ) String commitId
-    ) {
-        LOG.debug( "USERNAME: {}", username );
-        LOG.debug( "MODULE_GROUPID: {}", groupId );
-        LOG.debug( "MODULE_ARTIFACTID: {}", artifactId );
-        LOG.debug( "MODULE_VERSION: {}", version );
-        LOG.debug( "COMMIT_ID: {}", commitId );
-
-        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, username );
-        if ( stack.getSetupState().accepts( SetupStackSignal.COMPLETE ) ) {
-            stack.setSetupState( SetupStackSignal.COMPLETE );
-        }
-
-        return Response.status( Response.Status.OK ).entity( stack.getSetupState() ).build();
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
index 55dc11c..4a43ef6 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
@@ -30,7 +30,6 @@ import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
 import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -194,8 +193,6 @@ public class StartResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        stack.setSetupState( SetupStackSignal.START );
-
         return Response.status( Response.Status.CREATED )
                        .entity( "Started chop tests" )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
index 8baabbd..a8c8694 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
@@ -29,8 +29,6 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -108,13 +106,13 @@ public class StopResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        if( ! status.equals( SetupStackState.Running ) ) {
+        if( ! status.equals( SetupStackState.SetUp ) ) {
             return Response.status( Response.Status.OK )
                            .entity( "Stack is " + status.toString() + ", cannot stop tests." )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
-        /** SetupStackState.Running */
+        /** SetupStackState.Setup */
         LOG.info( "Stack is set up, checking runner states..." );
 
         /** Check state of all runners */
@@ -184,9 +182,6 @@ public class StopResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, user );
-        stack.setSetupState( SetupStackSignal.STOP );
-
         return Response.status( Response.Status.CREATED )
                        .entity( "All running runners have been stopped." )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/87ccf72b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index f7378ab..edc0550 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -195,8 +195,8 @@ public class UploadResource extends TestableResource implements RestParams, Cons
         LOG.debug( "extracted {} = {}", RestParams.MODULE_VERSION, version );
         LOG.debug( "extracted {} = {}", RestParams.USERNAME, username );
         LOG.debug( "extracted {} = {}", RestParams.VCS_REPO_URL, vcsRepoUrl );
-        LOG.debug( "extracted {} = {}", RestParams.TEST_PACKAGE, runnerCount );
-        LOG.debug( "extracted {} = {}", RestParams.RUNNER_COUNT, testPackage );
+        LOG.debug( "extracted {} = {}", RestParams.TEST_PACKAGE, testPackage );
+        LOG.debug( "extracted {} = {}", RestParams.RUNNER_COUNT, runnerCount );
         LOG.debug( "extracted {} = {}", RestParams.MD5, md5 );
 
         if( inTestMode( testMode ) ) {
@@ -261,7 +261,7 @@ public class UploadResource extends TestableResource implements RestParams, Cons
             commitDao.save( commit );
         }
 
-        stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
+//        stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
 
         return Response.status( Response.Status.CREATED ).entity( runnerJar.getAbsolutePath() ).build();
     }


[47/50] [abbrv] git commit: no need to check if runner jar is ready to deploy

Posted by sn...@apache.org.
no need to check if runner jar is ready to deploy


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

Branch: refs/heads/two-dot-o
Commit: 155c8095b74dbaddbd2549a000bb601dc163a1e4
Parents: be554bf
Author: Salih Kardan <ka...@gmail.com>
Authored: Tue Jul 1 11:24:24 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Tue Jul 1 11:24:24 2014 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/usergrid/chop/plugin/StatusMojo.java   | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/155c8095/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
----------------------------------------------------------------------
diff --git a/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
index a4a2176..db6904d 100644
--- a/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
+++ b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
@@ -45,11 +45,6 @@ public class StatusMojo extends MainMojo {
     public void execute() throws MojoExecutionException {
         initCertStore();
 
-        /** First check that the runner.jar is ready and up-to-date */
-        if ( ! isReadyToDeploy() ) {
-            throw new MojoExecutionException( "Runner file was not ready, quitting." );
-        }
-
         Properties props = new Properties();
         try {
             File extractedConfigPropFile = new File( getExtractedRunnerPath(), PROJECT_FILE );


[27/50] [abbrv] git commit: Ensure that TomcatMain process gets destroyed @after testing.

Posted by sn...@apache.org.
Ensure that TomcatMain process gets destroyed @after testing.


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

Branch: refs/heads/two-dot-o
Commit: 5defa054682471976aeb6513c8b89ca76642efab
Parents: b0ba236
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Jun 27 17:08:42 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Jun 27 17:08:42 2014 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/usergrid/rest/ITSetup.java    | 13 ++++++++-----
 .../java/org/apache/usergrid/rest/TomcatResource.java  |  1 -
 .../src/main/java/org/apache/usergrid/TomcatMain.java  |  1 -
 3 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5defa054/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
index 3e997c7..448a022 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
@@ -49,6 +49,10 @@ public class ITSetup extends ExternalResource {
     private SignInProviderFactory providerFactory;
     private Properties properties;
 
+    private boolean setupCalled = false;
+    private boolean ready = false;
+    private URI uri;
+
 
     public ITSetup( CassandraResource cassandraResource) {
         this.cassandraResource = cassandraResource;
@@ -62,10 +66,6 @@ public class ITSetup extends ExternalResource {
         tomcatResource.setWebAppsPath(webAppsPath);
     }
 
-    private boolean setupCalled = false;
-    private boolean ready = false;
-    private URI uri;
-
 
     @Override
     protected void before() throws Throwable {
@@ -100,7 +100,10 @@ public class ITSetup extends ExternalResource {
     }
 
 
-
+    @Override
+    protected void after() {
+        tomcatResource.after();
+    }
 
 
     public void protect() {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5defa054/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
index 3f85652..d7fd7f3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
@@ -61,7 +61,6 @@ public class TomcatResource extends ExternalResource {
 
     @Override
     protected void after() {    
-        // TODO: need something better than this, see also TomcatMain.
         process.destroy();
     }
         

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5defa054/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java b/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
index 4fe08e5..2cf353c 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
@@ -47,7 +47,6 @@ public class TomcatMain {
         log.info("-----------------------------------------------------------------");
         tomcat.start();
 
-        // TODO: figure out how to stop of this process at end of testing.
         while ( true ) {
             Thread.sleep(1000);
         }


[22/50] [abbrv] git commit: Merge 6f4423e8900c19b8c61016c6fc0c062f17f29a0e into c7b8612759f37da299b271b5c08de2a3fa4d71c6

Posted by sn...@apache.org.
Merge 6f4423e8900c19b8c61016c6fc0c062f17f29a0e into c7b8612759f37da299b271b5c08de2a3fa4d71c6


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

Branch: refs/pull/206/merge
Commit: 3d34a43908cf7915a0bbb3fb7a5e9904f7247fc3
Parents: c7b8612 6f4423e
Author: GERey <gr...@apigee.com>
Authored: Fri Jun 27 18:33:17 2014 +0000
Committer: GERey <gr...@apigee.com>
Committed: Fri Jun 27 18:33:17 2014 +0000

----------------------------------------------------------------------
 stack/rest/pom.xml | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[10/50] [abbrv] git commit: [USERGRID-183]Adds connection reverse lookup support to iOS SDK

Posted by sn...@apache.org.
[USERGRID-183]Adds connection reverse lookup support to iOS SDK

	-Adds sync and async versions of getConnectedEntities:connectorID:connectionType:query:
	to support request of type GET /<someCollection>/<someEntity>/connecting/<someConnection>


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

Branch: refs/pull/231/head
Commit: 8d4140e8cb587e94a00b9704e2ef7a3df676e590
Parents: c7b8612
Author: amuramoto <am...@apigee.com>
Authored: Fri Jun 27 10:17:09 2014 -0700
Committer: amuramoto <am...@apigee.com>
Committed: Fri Jun 27 10:17:09 2014 -0700

----------------------------------------------------------------------
 sdks/ios/UGAPI/UGClient.h | 15 ++++++++++++++-
 sdks/ios/UGAPI/UGClient.m |  9 +++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d4140e8/sdks/ios/UGAPI/UGClient.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGClient.h b/sdks/ios/UGAPI/UGClient.h
index 4e6a31f..c5241b1 100755
--- a/sdks/ios/UGAPI/UGClient.h
+++ b/sdks/ios/UGAPI/UGClient.h
@@ -220,7 +220,20 @@ set the response limit in UGQuery as well.
 // get entity connections
 -(UGClientResponse *)getEntityConnections: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType query:(UGQuery *)query;
 
-
+/*!
+ @abstract Get entities connected to the specified entity with the specified connection
+ @param connectorType
+ @param connectorID
+ @param connectionType
+ @param query
+ @return ApigeeClientResponse instance
+ @see ApigeeClientResponse ApigeeClientResponse
+ @see ApigeeQuery ApigeeQuery
+ */
+-(UGClientResponse *)getConnectedEntities:(NSString *)connectorType
+                                  connectorID:(NSString *)connectorID
+                               connectionType:(NSString *)connectionType
+                                        query:(UGQuery *)query;
 
 /********************* MESSAGE MANAGEMENT *********************/
 // post a message to a given queue

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d4140e8/sdks/ios/UGAPI/UGClient.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGClient.m b/sdks/ios/UGAPI/UGClient.m
index 9d6407a..0184ea7 100755
--- a/sdks/ios/UGAPI/UGClient.m
+++ b/sdks/ios/UGAPI/UGClient.m
@@ -1059,6 +1059,15 @@ NSString *g_deviceUUID = nil;
     return [self httpTransaction:url op:kUGHTTPPost opData:nil];
 }
 
+-(UGClientResponse *)getConnectedEntities: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType query:(UGQuery *)query
+{
+    NSMutableString *url = [self createURL:connectorType append2:connectorID append3: @"connecting" append4: connectionType];
+    if (query) {
+        [self appendQueryToURL:url query:query];
+    }
+    return [self httpTransaction:url op:kApigeeHTTPGet opData:nil];
+}
+
 /************************** MESSAGE MANAGEMENT **************************/
 /************************** MESSAGE MANAGEMENT **************************/
 /************************** MESSAGE MANAGEMENT **************************/


[46/50] [abbrv] git commit: adding status mojo to maven chop plugin

Posted by sn...@apache.org.
adding status mojo to maven chop plugin


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

Branch: refs/heads/two-dot-o
Commit: be554bf7695cf6ad6a6fac7ab28d25ecd4c06da2
Parents: 5ff3c1e
Author: Salih Kardan <ka...@gmail.com>
Authored: Tue Jul 1 11:17:33 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Tue Jul 1 11:17:33 2014 +0300

----------------------------------------------------------------------
 .../apache/usergrid/chop/plugin/StatusMojo.java | 99 ++++++++++++++++++++
 .../webapp/coordinator/rest/StatusResource.java | 91 ++++++++++++++++++
 2 files changed, 190 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/be554bf7/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
----------------------------------------------------------------------
diff --git a/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
new file mode 100644
index 0000000..a4a2176
--- /dev/null
+++ b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/StatusMojo.java
@@ -0,0 +1,99 @@
+/*
+ * 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.chop.plugin;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+
+import org.apache.usergrid.chop.api.Project;
+import org.apache.usergrid.chop.api.RestParams;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+
+/** Hits the coordinator endpoint to get current state */
+@Mojo ( name = "status" )
+public class StatusMojo extends MainMojo {
+
+    @Override
+    public void execute() throws MojoExecutionException {
+        initCertStore();
+
+        /** First check that the runner.jar is ready and up-to-date */
+        if ( ! isReadyToDeploy() ) {
+            throw new MojoExecutionException( "Runner file was not ready, quitting." );
+        }
+
+        Properties props = new Properties();
+        try {
+            File extractedConfigPropFile = new File( getExtractedRunnerPath(), PROJECT_FILE );
+            FileInputStream inputStream = new FileInputStream( extractedConfigPropFile );
+            props.load( inputStream );
+            inputStream.close();
+        }
+        catch ( Exception e ) {
+            LOG.error( "Error while reading project.properties in runner.jar", e );
+            throw new MojoExecutionException( e.getMessage() );
+        }
+
+        /** Status  */
+        DefaultClientConfig clientConfig = new DefaultClientConfig();
+        Client client = Client.create( clientConfig );
+        WebResource resource = client.resource( endpoint ).path( "/status" );
+
+        LOG.info( "Commit ID: {}", props.getProperty( Project.GIT_UUID_KEY ) );
+        LOG.info( "Artifact Id: {}", props.getProperty( Project.ARTIFACT_ID_KEY ) );
+        LOG.info( "Group Id: {}", props.getProperty( Project.GROUP_ID_KEY ) );
+        LOG.info( "Version: {}", props.getProperty( Project.PROJECT_VERSION_KEY ) );
+        LOG.info( "Username: {}", username );
+
+
+        ClientResponse resp = resource
+                .queryParam( RestParams.COMMIT_ID, props.getProperty( Project.GIT_UUID_KEY ) )
+                .queryParam( RestParams.MODULE_ARTIFACTID, props.getProperty( Project.ARTIFACT_ID_KEY ) )
+                .queryParam( RestParams.MODULE_GROUPID, props.getProperty( Project.GROUP_ID_KEY ) )
+                .queryParam( RestParams.MODULE_VERSION, props.getProperty( Project.PROJECT_VERSION_KEY ) )
+                .queryParam( RestParams.USERNAME, username )
+                .type( MediaType.APPLICATION_JSON )
+                .accept( MediaType.APPLICATION_JSON )
+                .post( ClientResponse.class );
+
+        if( resp.getStatus() != Response.Status.OK.getStatusCode() &&
+                resp.getStatus() != Response.Status.CREATED.getStatusCode() ) {
+            LOG.error( "Could not get the status from coordinator, HTTP status: {}", resp.getStatus() );
+            LOG.error( "Error Message: {}", resp.getEntity( String.class ) );
+
+            throw new MojoExecutionException( "Status plugin goal has failed" );
+        }
+
+        LOG.info( "====== Response from the coordinator ======" );
+        LOG.info( resp.getEntity( String.class ) );
+        LOG.info( "===========================================" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/be554bf7/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StatusResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StatusResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StatusResource.java
new file mode 100644
index 0000000..bdde58e
--- /dev/null
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StatusResource.java
@@ -0,0 +1,91 @@
+/*
+ * 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.chop.webapp.coordinator.rest;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.usergrid.chop.api.RestParams;
+import org.apache.usergrid.chop.stack.SetupStackState;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
+import org.safehaus.jettyjam.utils.TestMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+
+/**
+ * REST operation to get current state.
+ */
+@Singleton
+@Produces( MediaType.APPLICATION_JSON )
+@Path( StatusResource.ENDPOINT)
+public class StatusResource extends TestableResource implements RestParams {
+
+    public final static String ENDPOINT = "/status";
+
+    private static final Logger LOG = LoggerFactory.getLogger( DestroyResource.class );
+
+    @Inject
+    private StackCoordinator stackCoordinator;
+
+    public StatusResource() {
+        super( ENDPOINT );
+    }
+
+
+    @POST
+    @Consumes( MediaType.APPLICATION_JSON )
+    @Produces( MediaType.APPLICATION_JSON )
+    public Response status(
+            @QueryParam( RestParams.COMMIT_ID ) String commitId,
+            @QueryParam( RestParams.MODULE_ARTIFACTID ) String artifactId,
+            @QueryParam( RestParams.MODULE_GROUPID ) String groupId,
+            @QueryParam( RestParams.MODULE_VERSION ) String version,
+            @QueryParam( RestParams.USERNAME ) String user,
+            @Nullable @QueryParam( TestMode.TEST_MODE_PROPERTY ) String testMode
+    ) {
+
+        if( inTestMode( testMode ) ) {
+            LOG.info( "Calling /status in test mode ..." );
+            LOG.info( "  Commit Id: {}", commitId );
+            LOG.info( "  Group Id: {}", groupId );
+            LOG.info( "  Artifact Id: {}", artifactId );
+            LOG.info( "  Version: {}", version );
+            LOG.info( "  User: {}", user );
+        }
+        else {
+            LOG.info( "Calling /status" );
+        }
+
+        SetupStackState status = stackCoordinator.stackStatus( commitId, artifactId, groupId, version, user );
+
+        return Response.status( Response.Status.CREATED )
+                .entity( "Current state: " + status )
+                .type( MediaType.APPLICATION_JSON )
+                .build();
+    }
+}


[38/50] [abbrv] git commit: Enable registering stack for deploy goal

Posted by sn...@apache.org.
Enable registering stack for deploy goal


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

Branch: refs/heads/two-dot-o
Commit: 722b8d35496640e199b5ddbe53216f2dc5aa2a7c
Parents: 8f9aef2
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Mon Jun 30 08:58:36 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Mon Jun 30 08:58:36 2014 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/usergrid/chop/runner/IController.java | 1 -
 .../usergrid/chop/webapp/coordinator/rest/UploadResource.java      | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/722b8d35/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
index 74e5387..cb79943 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
@@ -86,5 +86,4 @@ public interface IController {
      * @return the project being chopped up
      */
     Project getProject();
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/722b8d35/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index edc0550..250b7be 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -261,7 +261,7 @@ public class UploadResource extends TestableResource implements RestParams, Cons
             commitDao.save( commit );
         }
 
-//        stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
+        stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
 
         return Response.status( Response.Status.CREATED ).entity( runnerJar.getAbsolutePath() ).build();
     }


[23/50] [abbrv] git commit: REST tests now run without OOM errors because Tomcat is forked as a separate process. Also simplified how tests are run by removing concurrency (for now). Still needs some work and it might be better for us to fork Cassandra a

Posted by sn...@apache.org.
REST tests now run without OOM errors because Tomcat is forked as a separate process. Also simplified how tests are run by removing concurrency (for now). Still needs some work and it might be better for us to fork Cassandra and ElasticSearch instead; seems like they might be easier to setup.


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

Branch: refs/heads/two-dot-o
Commit: b5194e7c6f82cb483bf0741eb7f95e04f537ba02
Parents: 188cbc9
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Jun 27 15:25:25 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Jun 27 15:25:25 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpRelationManager.java      |    5 +
 .../persistence/index/impl/EsProvider.java      |   54 +-
 stack/rest/pom.xml                              | 1120 +++++++++---------
 .../apache/usergrid/rest/AbstractRestIT.java    |    3 +-
 .../java/org/apache/usergrid/rest/ITSetup.java  |   15 +-
 .../apache/usergrid/rest/TomcatResource.java    |  203 +++-
 stack/test-utils/pom.xml                        |  472 ++++----
 .../java/org/apache/usergrid/TomcatMain.java    |   56 +
 8 files changed, 1061 insertions(+), 867 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index 80e6c0c..333ffc8 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -1529,6 +1529,11 @@ public class CpRelationManager implements RelationManager {
                 org.apache.usergrid.persistence.model.entity.Entity e =
                     ecm.load( cr.getId() ).toBlockingObservable().last();
 
+//                if ( e == null ) {
+//                    logger.error("Entity {}:{} not found", cr.getId().getType(), cr.getId().getUuid());
+//                    continue;
+//                }
+
                 if ( cr.getVersion().compareTo( e.getVersion()) < 0 )  {
                     logger.debug("Stale version uuid:{} type:{} version:{}", 
                         new Object[] {cr.getId().getUuid(), cr.getId().getType(), cr.getVersion()});

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
index 376f606..d696737 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
@@ -18,17 +18,6 @@
  */
 package org.apache.usergrid.persistence.index.impl;
 
-import org.elasticsearch.client.Client;
-import org.elasticsearch.common.settings.ImmutableSettings;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.node.Node;
-import org.elasticsearch.node.NodeBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.persistence.core.util.AvailablePortFinder;
-import org.apache.usergrid.persistence.index.IndexFig;
-
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import java.io.File;
@@ -36,9 +25,18 @@ import java.io.IOException;
 import java.util.Properties;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.RandomStringUtils;
+import org.apache.usergrid.persistence.core.util.AvailablePortFinder;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.elasticsearch.client.Client;
+import org.elasticsearch.common.settings.ImmutableSettings;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.node.Node;
+import org.elasticsearch.node.NodeBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * Provides access to ElasticSearch client.
+ * Provides access to ElasticSearch client and, optionally, embedded ElasticSearch for testing.
  */
 @Singleton
 public class EsProvider {
@@ -70,6 +68,8 @@ public class EsProvider {
 
                 int port = AvailablePortFinder.getNextAvailable(2000);
 
+                System.setProperty("EMBEDDED_ES_PORT", port+"");
+
                 File tempDir;
                 try {
                     tempDir = getTempDirectory();
@@ -83,28 +83,44 @@ public class EsProvider {
                     .put("transport.tcp.port", port)
                     .put("path.logs", tempDir.toString())
                     .put("path.data", tempDir.toString())
-                    .put("gateway.type", "none").put("index.store.type", "memory")
+                    .put("gateway.type", "none")
+                    .put("index.store.type", "memory")
                     .put("index.number_of_shards", 1)
-                    .put("index.number_of_replicas", 1).build();
+                    .put("index.number_of_replicas", 1)
+                    .build();
 
                 log.info("-----------------------------------------------------------------------");
-                log.info("Starting ElasticSearch embedded with settings: " + settings.getAsMap());
+                log.info("Starting ElasticSearch embedded with settings: \n" + settings.getAsMap() );
                 log.info("-----------------------------------------------------------------------");
 
-                Node node = NodeBuilder.nodeBuilder().local(true).settings(settings).node();
+                Node node = NodeBuilder.nodeBuilder().settings(settings)
+                    .clusterName( fig.getClusterName() ).node();
+
                 newClient = node.client();
 
-            } else { // build client that connects to all hosts
+
+            } else { // build client that connects to all configured hosts
 
                 final String hosts = fig.getHosts();
 
+                String allHosts = "";
+                String SEP = "";
+                for (String host : fig.getHosts().split(",")) {
+                    allHosts = SEP + host + ":" + fig.getPort();
+                    SEP = ",";
+                }
+
                 Settings settings = ImmutableSettings.settingsBuilder()
                     .put("client.transport.ping_timeout", 2000) // milliseconds
-                    .put("client.transport.nodes_sampler_interval", 100).put("http.enabled", false)
+                    .put("client.transport.nodes_sampler_interval", 100)
+                    .put("http.enabled", false)
 
                     // this assumes that we're using zen for host discovery.  Putting an 
                     // explicit set of bootstrap hosts ensures we connect to a valid cluster.
-                    .put("discovery.zen.ping.unicast.hosts", hosts).build();
+                    .put("discovery.zen.ping.unicast.hosts", allHosts)
+                    .build();
+
+                log.info("Creating ElasticSearch client with settings: " +  settings.getAsMap());
 
                 Node node = NodeBuilder.nodeBuilder().settings(settings)
                     .clusterName(fig.getClusterName())

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index cd3858c..5f2af18 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -17,587 +17,547 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.usergrid</groupId>
-    <artifactId>usergrid</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>usergrid-rest</artifactId>
-  <packaging>war</packaging>
-  <name>Usergrid REST</name>
-  <description>REST web services for Usergrid system.</description>
-
-  <!-- Override these properties in an active profile within your settings.xml -->
-  <properties>
-    <!-- If you got the resources, max parallelism = 6 forks -->
-    <rest.it.forkCount>3</rest.it.forkCount>
-    <core.it.suite.concurrency>1</core.it.suite.concurrency>
-  </properties>
-
-  <profiles>
-    <profile>
-      <id>unit</id>
-      <activation>
-        <property>
-          <name>unit</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-              <forkMode>once</forkMode>
-              <!-- TODO: make this into a small configuration but based on settings.xml -->
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
-
-              <includes>
-                <include>**/RestTestSuite.java</include>
-                <include>**/*Test.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*ITSuite.java</exclude>
-                <!-- TODO - add these suites too -->
-                <!-- <exclude>**/*Test.java</exclude> -->
-                <exclude>**/ConcurrentRest*Suite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>default</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-
-              <parallel>classes</parallel>
-              <forkCount>${rest.it.forkCount}</forkCount>
-              <reuseForks>false</reuseForks>
-              <perCoreThreadCount>false</perCoreThreadCount>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-              </argLine>
-
-              <includes>
-                <include>**/RestTestSuite.java</include>
-                <include>**/RestITSuite.java</include>
-                <include>**/*IT.java</include>
-                <include>**/*Test.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*Concurrent*Suite.java</exclude>
-                <exclude>**/ActivityResourceIT.java</exclude>
-                <exclude>**/AdminEmailEncodingIT.java</exclude>
-                <exclude>**/ApplicationRequestCounterIT.java</exclude>
-                <exclude>**/AssetResourceIT.java</exclude>
-                <exclude>**/BasicIT.java</exclude>
-                <exclude>**/CollectionsResourceIT.java</exclude>
-                <exclude>**/ContentTypeResourceIT.java</exclude>
-                <exclude>**/DevicesResourceIT.java</exclude>
-                <exclude>**/EventsResourceIT.java</exclude>
-                <exclude>**/GroupResourceIT.java</exclude>
-                <exclude>**/OrganizationResourceIT.java</exclude>
-                <exclude>**/OrganizationsResourceIT.java</exclude>
-                <exclude>**/OwnershipResourceIT.java</exclude>
-                <exclude>**/PagingResourceIT.java</exclude>
-                <exclude>**/PermissionsResourceIT.java</exclude>
-                <exclude>**/UserResourceIT.java</exclude>
-                <exclude>**/UsersOrganizationsResourceIT.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>scott</id>
-      <activation>
-        <property>
-          <name>unit-concurrent</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-
-              <parallel>classes</parallel>
-              <forkCount>${rest.it.forkCount}</forkCount>
-              <reuseForks>false</reuseForks>
-              <perCoreThreadCount>false</perCoreThreadCount>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-              </argLine>
-
-              <includes>
-                <include>**/RestTestSuite.java</include>
-                <include>**/RestITSuite.java</include>
-                <include>**/ManagementResourceIT.java</include>
-                <include>**/ApplicationResourceIT.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*Test.java</exclude>
-                <exclude>**/*Concurrent*Suite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>unit-concurrent</id>
-      <activation>
-        <property>
-          <name>unit-concurrent</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-              <forkMode>once</forkMode>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
-
-              <includes>
-                <include>**/ConcurrentRestTestSuite.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*Test.java</exclude>
-                <exclude>**/RestITSuite.java</exclude>
-                <exclude>**/RestTestSuite.java</exclude>
-                <exclude>**/ConcurrentRestITSuite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>integ-concurrent</id>
-      <activation>
-        <property>
-          <name>integ-concurrent</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.usergrid</groupId>
+        <artifactId>usergrid</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>usergrid-rest</artifactId>
+    <packaging>war</packaging>
+    <name>Usergrid REST</name>
+    <description>REST web services for Usergrid system.</description>
+
+    <!-- Override these properties in an active profile within your settings.xml -->
+    <properties>
+        <!-- If you got the resources, max parallelism = 6 forks -->
+        <rest.it.forkCount>1</rest.it.forkCount>
+        <core.it.suite.concurrency>1</core.it.suite.concurrency>
+    </properties>
+
+    <profiles>
+
+<!--        <profile>
+            <id>unit</id>
+            <activation>
+                <property>
+                    <name>unit</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <storage-config>${basedir}/src/test/conf</storage-config>
+                                <target.directory>${project.build.directory}</target.directory>
+                            </systemPropertyVariables>
+                            <forkMode>once</forkMode>
+                             TODO: make this into a small configuration but based on settings.xml 
+                            <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
+
+                            <includes>
+                                <include>**/RestTestSuite.java</include>
+                                <include>**/*Test.java</include>
+                            </includes>
+                            <excludes>
+                                <exclude>**/*IT.java</exclude>
+                                <exclude>**/*ITSuite.java</exclude>
+                                 TODO - add these suites too 
+                                 <exclude>**/*Test.java</exclude> 
+                                <exclude>**/ConcurrentRest*Suite.java</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>-->
+
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <storage-config>${basedir}/src/test/conf</storage-config>
+                                <target.directory>${project.build.directory}</target.directory>
+                            </systemPropertyVariables>
+
+<!--                            <parallel>classes</parallel>
+                            <forkCount>${rest.it.forkCount}</forkCount>
+                            <reuseForks>false</reuseForks>
+                            <perCoreThreadCount>false</perCoreThreadCount>
+                            <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
+                            </argLine>-->
+
+                            <includes>
+                                <include>**/RestTestSuite.java</include>
+                                <include>**/RestITSuite.java</include>
+                                <include>**/*IT.java</include>
+                                <include>**/*Test.java</include>
+                            </includes>
+                            <excludes>
+                                <exclude>**/*Concurrent*Suite.java</exclude>
+                                <exclude>**/ActivityResourceIT.java</exclude>
+                                <exclude>**/AdminEmailEncodingIT.java</exclude>
+                                <exclude>**/ApplicationRequestCounterIT.java</exclude>
+                                <exclude>**/AssetResourceIT.java</exclude>
+                                <exclude>**/BasicIT.java</exclude>
+                                <exclude>**/CollectionsResourceIT.java</exclude>
+                                <exclude>**/ContentTypeResourceIT.java</exclude>
+                                <exclude>**/DevicesResourceIT.java</exclude>
+                                <exclude>**/EventsResourceIT.java</exclude>
+                                <exclude>**/GroupResourceIT.java</exclude>
+                                <exclude>**/OrganizationResourceIT.java</exclude>
+                                <exclude>**/OrganizationsResourceIT.java</exclude>
+                                <exclude>**/OwnershipResourceIT.java</exclude>
+                                <exclude>**/PagingResourceIT.java</exclude>
+                                <exclude>**/PermissionsResourceIT.java</exclude>
+                                <exclude>**/UserResourceIT.java</exclude>
+                                <exclude>**/UsersOrganizationsResourceIT.java</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+<!--        <profile>
+            <id>unit-concurrent</id>
+            <activation>
+                <property>
+                    <name>unit-concurrent</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <storage-config>${basedir}/src/test/conf</storage-config>
+                                <target.directory>${project.build.directory}</target.directory>
+                            </systemPropertyVariables>
+                            <forkMode>once</forkMode>
+                            <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
+
+                            <includes>
+                                <include>**/ConcurrentRestTestSuite.java</include>
+                            </includes>
+                            <excludes>
+                                <exclude>**/*IT.java</exclude>
+                                <exclude>**/*Test.java</exclude>
+                                <exclude>**/RestITSuite.java</exclude>
+                                <exclude>**/RestTestSuite.java</exclude>
+                                <exclude>**/ConcurrentRestITSuite.java</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>-->
+
+<!--        <profile>
+            <id>integ-concurrent</id>
+            <activation>
+                <property>
+                    <name>integ-concurrent</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <storage-config>${basedir}/src/test/conf</storage-config>
+                                <target.directory>${project.build.directory}</target.directory>
+                            </systemPropertyVariables>
+                            <forkMode>once</forkMode>
+                            <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
+
+                            <includes>
+                                <include>**/ConcurrentRestITSuite.java</include>
+                                <include>**/LongRunningNotInSuiteIT.java</include>
+                                 an example 
+                            </includes>
+                            <excludes>
+                                <exclude>**/*IT.java</exclude>
+                                <exclude>**/*Test.java</exclude>
+                                <exclude>**/RestITSuite.java</exclude>
+                                <exclude>**/RestTestSuite.java</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>-->
+
+    </profiles>
+
+    <build>
+        <finalName>ROOT</finalName>
+
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.xml</include>
+                    <include>**/*.json</include>
+                </includes>
+            </resource>
+        </resources>
+
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </testResource>
+        </testResources>
+
         <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-              <forkMode>once</forkMode>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
-
-              <includes>
-                <include>**/ConcurrentRestITSuite.java</include>
-                <include>**/LongRunningNotInSuiteIT.java</include>
-                <!-- an example -->
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*Test.java</exclude>
-                <exclude>**/RestITSuite.java</exclude>
-                <exclude>**/RestTestSuite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.3</version>
+            </plugin>
+
+            <plugin>
+                <groupId>org.jasig.mojo.jspc</groupId>
+                <artifactId>jspc-maven-plugin</artifactId>
+                <version>2.0.0</version>
+                <configuration>
+                    <includeInProject>false</includeInProject>
+                    <webFragmentFile>${project.build.directory}/web-fragment.xml.txt</webFragmentFile>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>jspc</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.jasig.mojo.jspc</groupId>
+                        <artifactId>jspc-compiler-tomcat6</artifactId>
+                        <version>2.0.0</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <finalName>${project.artifactId}-${project.version}</finalName>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-a-jar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>classes</classifier>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>jsp-jar-execution</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>compiled-jsp</classifier>
+                            <classesDirectory>${project.build.directory}/jsp-source</classesDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>2.3.1</version>
+                <executions>
+                    <execution>
+                        <id>install jar</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>install-file</goal>
+                        </goals>
+                        <configuration>
+                            <packaging>jar</packaging>
+                            <artifactId>${project.artifactId}</artifactId>
+                            <groupId>${project.groupId}</groupId>
+                            <version>${project.version}</version>
+                            <file>
+                                ${project.build.directory}/${project.artifactId}-${project.version}.jar
+                            </file>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
-      </build>
-    </profile>
-  </profiles>
-
-  <build>
-    <finalName>ROOT</finalName>
-
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-        <includes>
-          <include>**/*.xml</include>
-          <include>**/*.json</include>
-        </includes>
-      </resource>
-    </resources>
-
-    <testResources>
-      <testResource>
-        <directory>src/test/resources</directory>
-        <filtering>true</filtering>
-        <includes>
-          <include>**/*</include>
-        </includes>
-      </testResource>
-    </testResources>
-
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
-        </configuration>
-      </plugin>
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-war-plugin</artifactId>
-        <version>2.3</version>
-      </plugin>
-
-      <plugin>
-        <groupId>org.jasig.mojo.jspc</groupId>
-        <artifactId>jspc-maven-plugin</artifactId>
-        <version>2.0.0</version>
-        <configuration>
-          <includeInProject>false</includeInProject>
-          <webFragmentFile>${project.build.directory}/web-fragment.xml.txt</webFragmentFile>
-        </configuration>
-        <executions>
-          <execution>
-            <id>jspc</id>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-        </executions>
-        <dependencies>
-          <dependency>
-            <groupId>org.jasig.mojo.jspc</groupId>
-            <artifactId>jspc-compiler-tomcat6</artifactId>
-            <version>2.0.0</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.3.2</version>
-        <configuration>
-          <finalName>${project.artifactId}-${project.version}</finalName>
-        </configuration>
-        <executions>
-          <execution>
-            <id>make-a-jar</id>
-            <phase>package</phase>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-            <configuration>
-              <classifier>classes</classifier>
-            </configuration>
-          </execution>
-          <execution>
-            <id>jsp-jar-execution</id>
-            <phase>package</phase>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-            <configuration>
-              <classifier>compiled-jsp</classifier>
-              <classesDirectory>${project.build.directory}/jsp-source</classesDirectory>
-            </configuration>
-          </execution>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-install-plugin</artifactId>
-        <version>2.3.1</version>
-        <executions>
-          <execution>
-            <id>install jar</id>
-            <phase>install</phase>
-            <goals>
-              <goal>install-file</goal>
-            </goals>
-            <configuration>
-              <packaging>jar</packaging>
-              <artifactId>${project.artifactId}</artifactId>
-              <groupId>${project.groupId}</groupId>
-              <version>${project.version}</version>
-              <file>
-                ${project.build.directory}/${project.artifactId}-${project.version}.jar
-              </file>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-
-    <!-- Usergrid Dependencies -->
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-config</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-core</artifactId>
-      <version>${project.version}</version>
-      <exclusions>
-        <exclusion>
-          <artifactId>commons-logging</artifactId>
-          <groupId>commons-logging</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-mongo-emulator</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <!-- Apache Dependencies -->
-
-    <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-    </dependency>
-
-    <!-- SUN, Javax Package, and Other Com Dependencies -->
-
-
-    <dependency>
-        <groupId>javax.servlet</groupId>
-        <artifactId>javax.servlet-api</artifactId>
-        <scope>provided</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>jstl</artifactId>
-    </dependency>
-
-
-    <dependency>
-      <groupId>com.sun.jersey.contribs</groupId>
-      <artifactId>jersey-multipart</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-json</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.jaxrs</groupId>
-      <artifactId>jackson-jaxrs-json-provider</artifactId>
-      <version>2.3.1</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.yammer.metrics</groupId>
-      <artifactId>metrics-spring</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-client</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>net.tanesha.recaptcha4j</groupId>
-      <artifactId>recaptcha4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-server</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.sun.jersey.contribs</groupId>
-      <artifactId>jersey-spring</artifactId>
-    </dependency>
-
-    <!-- Codehaus, Spring, and Other Org Dependencies -->
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-webmvc</artifactId>
-    </dependency>
-
-    <dependency>
-      <!-- TODO - should not scope be 'test' ? -->
-      <groupId>org.slf4j</groupId>
-      <artifactId>jcl-over-slf4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <!-- TODO - should not scope be 'test' ? -->
-      <groupId>org.slf4j</groupId>
-      <artifactId>jul-to-slf4j</artifactId>
-    </dependency>
-
-    <!-- Testing and Logging Dependencies -->
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-config</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-      <classifier>tests</classifier>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-test-utils</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-core</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-      <classifier>tests</classifier>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jvnet.mock-javamail</groupId>
-      <artifactId>mock-javamail</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.hectorclient</groupId>
-      <artifactId>hector-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat.embed</groupId>
-      <artifactId>tomcat-embed-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat.embed</groupId>
-      <artifactId>tomcat-embed-logging-juli</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat.embed</groupId>
-      <artifactId>tomcat-embed-jasper</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-jasper-el</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-jsp-api</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>juli</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <!--  use the external test client.  Just depend on the maven jetty plugin to launch jetty -->
-    <dependency>
-      <groupId>com.sun.jersey.jersey-test-framework</groupId>
-      <artifactId>jersey-test-framework-external</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>com.sun.jersey.jersey-test-framework</groupId>
-      <artifactId>jersey-test-framework-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-java-client</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-services</artifactId>
-      <version>2.0.0-SNAPSHOT</version>
-      <scope>test</scope>
-      <classifier>tests</classifier>
-    </dependency>
-
-  </dependencies>
+    </build>
+
+    <dependencies>
+
+        <!-- Usergrid Dependencies -->
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-config</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-core</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>commons-logging</artifactId>
+                    <groupId>commons-logging</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-mongo-emulator</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Apache Dependencies -->
+
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+
+        <!-- SUN, Javax Package, and Other Com Dependencies -->
+
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jstl</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-multipart</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-json</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <version>2.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.yammer.metrics</groupId>
+            <artifactId>metrics-spring</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>net.tanesha.recaptcha4j</groupId>
+            <artifactId>recaptcha4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-server</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-spring</artifactId>
+        </dependency>
+
+        <!-- Codehaus, Spring, and Other Org Dependencies -->
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+        </dependency>
+
+        <dependency>
+            <!-- TODO - should not scope be 'test' ? -->
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <!-- TODO - should not scope be 'test' ? -->
+            <groupId>org.slf4j</groupId>
+            <artifactId>jul-to-slf4j</artifactId>
+        </dependency>
+
+        <!-- Testing and Logging Dependencies -->
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-config</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-test-utils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-core</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jvnet.mock-javamail</groupId>
+            <artifactId>mock-javamail</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hectorclient</groupId>
+            <artifactId>hector-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-jasper</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jasper-el</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jsp-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>juli</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!--  use the external test client.  Just depend on the maven jetty plugin to launch jetty -->
+        <dependency>
+            <groupId>com.sun.jersey.jersey-test-framework</groupId>
+            <artifactId>jersey-test-framework-external</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sun.jersey.jersey-test-framework</groupId>
+            <artifactId>jersey-test-framework-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-java-client</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-services</artifactId>
+            <version>2.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+
+    </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
index c2df2e3..dd7db4d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
@@ -37,7 +37,6 @@ import java.util.Map;
 import java.util.UUID;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.UriBuilder;
-import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.java.client.Client;
 import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
@@ -56,7 +55,7 @@ import org.slf4j.LoggerFactory;
  * method(s) should following the following naming convention: test_[HTTP verb]_[action mapping]_[ok|fail][_[specific
  * failure condition if multiple]
  */
-@Concurrent()
+//@Concurrent()
 public abstract class AbstractRestIT extends JerseyTest {
     private static final Logger LOG = LoggerFactory.getLogger( AbstractRestIT.class );
     private static boolean usersSetup = false;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
index aa7aef8..3e997c7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
@@ -37,8 +37,6 @@ import org.apache.usergrid.services.ServiceManagerFactory;
 /** A {@link org.junit.rules.TestRule} that sets up services. */
 public class ITSetup extends ExternalResource {
 
-
-
     private static final Logger LOG = LoggerFactory.getLogger( ITSetup.class );
     private final CassandraResource cassandraResource;
     private final TomcatResource tomcatResource;
@@ -81,12 +79,15 @@ public class ITSetup extends ExternalResource {
                 setupCalled = true;
             }
 
+            emf =                cassandraResource.getBean( EntityManagerFactory.class );
+            smf =                cassandraResource.getBean( ServiceManagerFactory.class );
+            properties =         cassandraResource.getBean( "properties", Properties.class );
+            tokenService =       cassandraResource.getBean( TokenService.class );
+            providerFactory =    cassandraResource.getBean( SignInProviderFactory.class );
             applicationCreator = cassandraResource.getBean( ApplicationCreator.class );
-            emf = cassandraResource.getBean( EntityManagerFactory.class );
-            tokenService = cassandraResource.getBean( TokenService.class );
-            providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
-            properties = cassandraResource.getBean( "properties", Properties.class );
-            smf = cassandraResource.getBean( ServiceManagerFactory.class );
+
+            tomcatResource.setCassandraPort( cassandraResource.getRpcPort() );
+            tomcatResource.setElasticSearchPort( Integer.parseInt( System.getProperty("EMBEDDED_ES_PORT")) );
 
             tomcatResource.before();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
index a0f3f26..3f85652 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
@@ -16,70 +16,207 @@
  */
 package org.apache.usergrid.rest;
 
-
 import java.io.File;
 
 import org.junit.rules.ExternalResource;
 import org.apache.usergrid.cassandra.AvailablePortFinder;
 
-import org.apache.catalina.startup.Tomcat;
 import org.apache.commons.lang.math.RandomUtils;
 
-import com.google.common.io.Files;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.WebResource;
+import java.io.BufferedReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-/** @author tnine */
+/**
+ * Setup Tomcat to run Usergrid from src/main/webapps plus inherited (Maven) classpath. 
+ * Caller must provide Cassandra and ElasticSearch ports. 
+ * Generates Usergrid properties files.
+ */
 public class TomcatResource extends ExternalResource {
-
-    private static final Logger log = LoggerFactory.getLogger( TomcatResource.class );
+    private static final Logger log = LoggerFactory.getLogger(TomcatResource.class);
 
     public static final TomcatResource instance = new TomcatResource();
-    private static Object mutex = new Object();
-    private static final String CONTEXT = "/";
+    private static final Object mutex = new Object();
     private String webAppsPath;
     private int port;
-    private Tomcat tomcat;
+    private int esPort;
+    private int cassPort;
+    private boolean started = false;
 
-    protected TomcatResource(){
-    }
+    Process process = null;
 
+
+    protected TomcatResource() {}
+
+    @Override
+    protected void after() {    
+        // TODO: need something better than this, see also TomcatMain.
+        process.destroy();
+    }
+        
     @Override
     protected void before() throws Throwable {
-        if ( tomcat != null ) {
+
+        if (started) {
             return;
         }
 
-        synchronized ( mutex ) {
-            //second into mutex
-            if ( tomcat != null ) {
+        synchronized (mutex) {
+
+            if (started) {
                 return;
             }
 
-            File dataDir = Files.createTempDir();
-            dataDir.deleteOnExit();
+            port = AvailablePortFinder.getNextAvailable(9998 + RandomUtils.nextInt(10));
+
+            String propDirPath = createPropDir();
+
+            createPropertyFiles( propDirPath );
+
+            process = startTomcatProcess( propDirPath );
+
+            waitForTomcat();
+
+            started = true;
+        }
+    }
+
+    private String createPropDir() {
+        String propDirName = "target" + File.separator + "tomcat_" + port;
+        File newDir = new File( propDirName );
+        newDir.mkdirs();
+        String propDirPath = newDir.getAbsolutePath();
+        return propDirPath;
+    }
+
+    private void waitForTomcat() throws RuntimeException {
+        int count = 0;
+        while (count++ < 60) {
+            try {
+                Thread.sleep(1000);
+                Client c = Client.create();
+                WebResource wr = c.resource("http://localhost:" + port + "/status");
+                wr.get(String.class);
+                log.info("Tomcat is started.");
+                break;
+                
+            } catch (Exception e) {
+                log.info("Cannot connect: " + e.getMessage());
+            }
+            throw new RuntimeException("Tomcat process never started.");
+        }
+    }
+
+    private Process startTomcatProcess( String propDirPath ) throws IOException {
 
-            port = AvailablePortFinder.getNextAvailable( 9998 + RandomUtils.nextInt(10)  );
+        String javaHome = (String)System.getenv("JAVA_HOME");
 
-            tomcat = new Tomcat();
-            tomcat.setBaseDir( dataDir.getAbsolutePath() );
-            tomcat.setPort( port );
-            tomcat.addWebapp( CONTEXT, new File( getWebAppsPath() ).getAbsolutePath() );
+        ProcessBuilder pb = new ProcessBuilder(javaHome + "/bin/java",
+                "org.apache.usergrid.TomcatMain", "src/main/webapp", port + "");
 
-            log.info("-----------------------------------------------------------------");
-            log.info("Starting Tomcat port {} dir {}", port, dataDir.getAbsolutePath());
-            log.info("-----------------------------------------------------------------");
-            tomcat.start();
+        // ensure Tomcat gets same classpath we have
+        String classpath = System.getProperty("java.class.path");
+        List<String> path = new ArrayList<String>();
+        String parts[] = classpath.split( File.pathSeparator );
+        for ( String part : parts ) {
+            if ( part.endsWith("test-classes") ) {
+                continue;
+            }
+            path.add(part);
         }
+        // plus our special properties directory
+        path.add( propDirPath );
+        String newClasspath = StringUtils.join( path, File.pathSeparator );
+
+        Map<String, String> env = pb.environment();
+        StringBuilder sb = new StringBuilder();
+        sb.append( newClasspath );
+        env.put("CLASSPATH", sb.toString());
+
+        //pb.directory(new File("."));
+        pb.redirectErrorStream(true);
+
+        final Process p = pb.start();
+
+        log.debug("Started Tomcat process with classpath = " + newClasspath );
+
+        // use thread to log Tomcat output
+        new Thread( new Runnable() {
+            @Override
+            public void run() {
+                BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                String line = null;
+                try {
+                    while ((line = br.readLine()) != null) {
+                        log.info(line);
+                    }
+                } catch (IOException ex) {
+                    log.error("Error reading from Tomcat process", ex);
+                    return;
+                }
+            }
+        }).start();
+
+        return p;
     }
 
+    private void createPropertyFiles( String propDirPath ) throws IOException {
+
+        PrintWriter pw = new PrintWriter( 
+                new FileWriter( propDirPath + File.separator + "usergrid-custom.properties"));
+        
+        pw.println("cassandra.url=localhost:" + cassPort);
+        pw.println("usergrid.mongo.disable=true");
+        pw.println("swagger.basepath=http://sometestvalue");
+        pw.println("usergrid.counter.batch.size=1");
+        pw.println("usergrid.test=true");
+        pw.println("usergrid.sysadmin.login.name=superuser");
+        pw.println("usergrid.sysadmin.login.email=superuser@usergrid.com");
+        pw.println("usergrid.sysadmin.login.password=superpassword");
+        pw.println("usergrid.sysadmin.login.allowed=true");
+        pw.flush();
+        pw.close();
+        
+        pw = new PrintWriter( 
+                new FileWriter( propDirPath + File.separator + "corepersistence.properties"));
+        
+        pw.println("cassandra.hosts=127.0.0.1");
+        pw.println("cassandra.port=" + cassPort);
+        pw.println("cassandra.version=1.2");
+        pw.println("cassandra.cluster_name=Usergrid");
+        pw.println("cassandra.connections=20");
+        pw.println("cassandra.timeout=5000");
+        
+        pw.println("collections.keyspace=Usergrid_Applications");
+        pw.println("collections.keyspace.strategy.options=replication_factor:1");
+        pw.println("collections.keyspace.strategy.class=org.apache.cassandra.locator.SimpleStrategy");
+        pw.println("collection.stage.transient.timeout=6");
+        
+        pw.println("elasticsearch.hosts=127.0.0.1");
+        pw.println("elasticsearch.port=" + esPort);
+        pw.println("elasticsearch.cluster_name=usergrid_test");
+        pw.println("elasticsearch.index_prefix=usergrid");
+        
+        pw.println("index.query.limit.default=1000");
+        pw.flush();
+        pw.close();
+    }
 
     /**
-     * Get the port tomcat runs on
-     * @return
+     * Get the port Tomcat runs on.
      */
-    public int getPort(){
+    public int getPort() {
         return port;
     }
 
@@ -90,4 +227,12 @@ public class TomcatResource extends ExternalResource {
     public void setWebAppsPath(String webAppsPath) {
         this.webAppsPath = webAppsPath;
     }
+
+    void setCassandraPort(int cassPort) {
+        this.cassPort = cassPort;
+    }
+
+    void setElasticSearchPort(int esPort) {
+        this.esPort = esPort;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/stack/test-utils/pom.xml b/stack/test-utils/pom.xml
index 18a1d9c..e3b228c 100644
--- a/stack/test-utils/pom.xml
+++ b/stack/test-utils/pom.xml
@@ -17,235 +17,247 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.usergrid</groupId>
-    <artifactId>usergrid</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>usergrid-test-utils</artifactId>
-  <name>Usergrid Test Utils</name>
-  <description>Test Utilities for Usergrid system.</description>
-  <packaging>jar</packaging>
-
-  <build>
-    <testResources>
-      <testResource>
-        <directory>src/test/resources</directory>
-        <filtering>true</filtering>
-        <includes>
-          <include>**/*.properties</include>
-          <include>**/*.xml</include>
-        </includes>
-      </testResource>
-    </testResources>
-
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-
-        <configuration>
-          <systemPropertyVariables>
-            <storage-config>${basedir}/src/test/conf</storage-config>
-            <target-directory>${project.build.directory}</target-directory>
-          </systemPropertyVariables>
-          <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
-
-          <includes>
-            <include>**/CassandraResourceITSuite.java</include>
-            <!-- <include>**/CassandraResourceTest.java</include>-->
-          </includes>
-          <excludes>
-            <exclude>**/CassandraRunnerTest.java</exclude>
-            <exclude>**/OtherRunnerTest.java</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-
-    <dependency>
-      <groupId>org.apache.usergrid</groupId>
-      <artifactId>usergrid-config</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <!-- Apache Dependencies -->
-
-    <dependency>
-      <groupId>org.apache.cassandra</groupId>
-      <artifactId>cassandra-all</artifactId>
-      <!-- Exclude the old and problematic Snappy -->
-      <exclusions>
-        <exclusion>
-          <artifactId>snappy-java</artifactId>
-          <groupId>org.xerial.snappy</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <!-- Include the slighly newer and less problematic snappy -->
-    <dependency>
-      <artifactId>snappy-java</artifactId>
-      <groupId>org.xerial.snappy</groupId>
-      <version>1.0.5</version>
-    </dependency>
-
-    <dependency>
-      <groupId>jline</groupId>
-      <artifactId>jline</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.antlr</groupId>
-      <artifactId>antlr-runtime</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.cassandra</groupId>
-      <artifactId>cassandra-thrift</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-cli</groupId>
-      <artifactId>commons-cli</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.yammer.metrics</groupId>
-      <artifactId>metrics-core</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.shiro</groupId>
-      <artifactId>shiro-core</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.shiro</groupId>
-      <artifactId>shiro-spring</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.shiro</groupId>
-      <artifactId>shiro-web</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.yaml</groupId>
-      <artifactId>snakeyaml</artifactId>
-    </dependency>
-
-    <!-- Spring and Other Dependencies -->
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <exclusions>
-        <exclusion>
-          <artifactId>commons-logging</artifactId>
-          <groupId>commons-logging</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-expression</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-aop</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context-support</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <!-- TODO - should not scope be 'test' ? -->
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-
-    <dependency>
-      <!-- TODO - should not scope be 'test' ? -->
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit-dep</artifactId>
-    </dependency>
-
-    <!-- Test Dependencies -->
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
-      <version>1.9.9</version>
-      <type>jar</type>
-    </dependency>
-
-  </dependencies>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.usergrid</groupId>
+        <artifactId>usergrid</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>usergrid-test-utils</artifactId>
+    <name>Usergrid Test Utils</name>
+    <description>Test Utilities for Usergrid system.</description>
+    <packaging>jar</packaging>
+
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+            </testResource>
+        </testResources>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+
+                <configuration>
+                    <systemPropertyVariables>
+                        <storage-config>${basedir}/src/test/conf</storage-config>
+                        <target-directory>${project.build.directory}</target-directory>
+                    </systemPropertyVariables>
+                    <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar</argLine>
+
+                    <includes>
+                        <include>**/CassandraResourceITSuite.java</include>
+                        <!-- <include>**/CassandraResourceTest.java</include>-->
+                    </includes>
+                    <excludes>
+                        <exclude>**/CassandraRunnerTest.java</exclude>
+                        <exclude>**/OtherRunnerTest.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-config</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Apache Dependencies -->
+
+        <dependency>
+            <groupId>org.apache.cassandra</groupId>
+            <artifactId>cassandra-all</artifactId>
+            <!-- Exclude the old and problematic Snappy -->
+            <exclusions>
+                <exclusion>
+                    <artifactId>snappy-java</artifactId>
+                    <groupId>org.xerial.snappy</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- Include the slighly newer and less problematic snappy -->
+        <dependency>
+            <artifactId>snappy-java</artifactId>
+            <groupId>org.xerial.snappy</groupId>
+            <version>1.0.5</version>
+        </dependency>
+
+        <dependency>
+            <groupId>jline</groupId>
+            <artifactId>jline</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr-runtime</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cassandra</groupId>
+            <artifactId>cassandra-thrift</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.yammer.metrics</groupId>
+            <artifactId>metrics-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.yaml</groupId>
+            <artifactId>snakeyaml</artifactId>
+        </dependency>
+
+        <!-- Spring and Other Dependencies -->
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>commons-logging</artifactId>
+                    <groupId>commons-logging</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-expression</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <!-- TODO - should not scope be 'test' ? -->
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+        </dependency>
+
+        <dependency>
+            <!-- TODO - should not scope be 'test' ? -->
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit-dep</artifactId>
+        </dependency>
+
+        <!-- Test Dependencies -->
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-mapper-asl</artifactId>
+            <version>1.9.9</version>
+            <type>jar</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-catalina</artifactId>
+            <version>7.0.47</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>7.0.47</version>
+        </dependency>
+
+    </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b5194e7c/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java b/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
new file mode 100644
index 0000000..4fe08e5
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TomcatMain.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed 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;
+
+import com.google.common.io.Files;
+import java.io.File;
+import org.apache.catalina.startup.Tomcat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Simple wrapper for starting "embedded" Tomcat as it's own process, for testing.
+ */
+public class TomcatMain {
+    
+    private static final Logger log = LoggerFactory.getLogger( TomcatMain.class );
+
+    public static void main(String[] args) throws Exception {
+
+        String webappsPath = args[0];
+        int port = Integer.parseInt( args[1] );
+
+        File dataDir = Files.createTempDir();
+        dataDir.deleteOnExit();
+
+        Tomcat tomcat = new Tomcat();
+        tomcat.setBaseDir(dataDir.getAbsolutePath());
+        tomcat.setPort(port);
+        tomcat.addWebapp("/", new File(webappsPath).getAbsolutePath());
+
+        log.info("-----------------------------------------------------------------");
+        log.info("Starting Tomcat port {} dir {}", port, webappsPath);
+        log.info("-----------------------------------------------------------------");
+        tomcat.start();
+
+        // TODO: figure out how to stop of this process at end of testing.
+        while ( true ) {
+            Thread.sleep(1000);
+        }
+    }
+
+}


[34/50] [abbrv] git commit: Merge pull request #234 from salihkardan/chop-new-module-ui

Posted by sn...@apache.org.
Merge pull request #234 from salihkardan/chop-new-module-ui

Chop new module tab ui

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

Branch: refs/heads/two-dot-o
Commit: d86b5a3256bdc36f508302892ac6c44d74798f90
Parents: c3006f9 b6e445d
Author: asanaliev <as...@users.noreply.github.com>
Authored: Mon Jun 30 10:04:37 2014 +0600
Committer: asanaliev <as...@users.noreply.github.com>
Committed: Mon Jun 30 10:04:37 2014 +0600

----------------------------------------------------------------------
 .../webapp/view/chart/layout/ChartLayout.java   |  12 +-
 .../chop/webapp/view/main/MainView.java         |   4 +-
 .../chop/webapp/view/module/ModuleLayout.java   |  83 ++++++++++++++
 .../webapp/view/module/ModuleListWindow.java    | 114 -------------------
 4 files changed, 96 insertions(+), 117 deletions(-)
----------------------------------------------------------------------



[04/50] [abbrv] git commit: Change state of setupstack via signals to prevent it from entering disallowed states

Posted by sn...@apache.org.
Change state of setupstack via signals to prevent it from entering disallowed states


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

Branch: refs/heads/two-dot-o
Commit: 96c4ef95a8a05fb81e05f93e978c750656b0d919
Parents: 1b0a5e3
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Fri Jun 27 16:32:26 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Fri Jun 27 16:32:26 2014 +0300

----------------------------------------------------------------------
 .../apache/usergrid/chop/plugin/DeployMojo.java |   3 +
 .../usergrid/chop/stack/CoordinatedStack.java   |  19 +++-
 .../usergrid/chop/stack/IStackController.java   |  45 --------
 .../usergrid/chop/stack/SetupStackSignal.java   |   6 +-
 .../usergrid/chop/stack/SetupStackState.java    |  34 +++---
 .../usergrid/chop/stack/StackController.java    | 111 -------------------
 .../webapp/coordinator/SetupStackThread.java    |  16 +--
 .../webapp/coordinator/StackCoordinator.java    |  58 +++++++++-
 .../chop/webapp/coordinator/StackDestroyer.java |   3 +-
 .../webapp/coordinator/rest/ResetResource.java  |   5 +
 .../webapp/coordinator/rest/StartResource.java  |   5 +-
 .../webapp/coordinator/rest/StopResource.java   |   5 +
 .../coordinator/rest/TestableResource.java      |  56 ++++++++++
 .../webapp/coordinator/rest/UploadResource.java |  55 +++------
 14 files changed, 189 insertions(+), 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/DeployMojo.java
----------------------------------------------------------------------
diff --git a/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/DeployMojo.java b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/DeployMojo.java
index 99bbf39..0ec6227 100644
--- a/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/DeployMojo.java
+++ b/chop/plugin/src/main/java/org/apache/usergrid/chop/plugin/DeployMojo.java
@@ -118,9 +118,11 @@ public class DeployMojo extends MainMojo {
                 .queryParam( RestParams.MODULE_VERSION,
                         props.getProperty( Project.PROJECT_VERSION_KEY ) )
                 .queryParam( RestParams.USERNAME, username )
+                .queryParam( RestParams.VCS_REPO_URL, props.getProperty( Project.GIT_URL_KEY ) )
                 .queryParam( RestParams.TEST_PACKAGE,
                         props.getProperty( Project.TEST_PACKAGE_BASE ) )
                 .queryParam( RestParams.MD5, props.getProperty( Project.MD5_KEY ) )
+                .queryParam( RestParams.RUNNER_COUNT, runnerCount.toString() )
                 .type( MediaType.APPLICATION_JSON )
                 .accept( MediaType.APPLICATION_JSON )
                 .post( ClientResponse.class );
@@ -144,6 +146,7 @@ public class DeployMojo extends MainMojo {
             multipart.field( RestParams.USERNAME, username );
             multipart.field( RestParams.VCS_REPO_URL, props.getProperty( Project.GIT_URL_KEY ) );
             multipart.field( RestParams.TEST_PACKAGE, props.getProperty( Project.TEST_PACKAGE_BASE ) );
+            multipart.field( RestParams.RUNNER_COUNT, runnerCount.toString() );
             multipart.field( RestParams.MD5, props.getProperty( Project.MD5_KEY ) );
 
             FileInputStream in = new FileInputStream( source );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/stack/src/main/java/org/apache/usergrid/chop/stack/CoordinatedStack.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/CoordinatedStack.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/CoordinatedStack.java
index 9bdf3ea..82beb03 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/CoordinatedStack.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/CoordinatedStack.java
@@ -26,6 +26,9 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.commons.lang.builder.HashCodeBuilder;
 
 import org.apache.usergrid.chop.api.Commit;
@@ -39,6 +42,8 @@ import org.apache.usergrid.chop.api.Runner;
  */
 public class CoordinatedStack implements ICoordinatedStack {
 
+    private static final Logger LOG = LoggerFactory.getLogger( CoordinatedStack.class );
+
     private final Stack delegate;
     private final List<CoordinatedCluster> clusters;
     private final Commit commit;
@@ -160,7 +165,19 @@ public class CoordinatedStack implements ICoordinatedStack {
     }
 
 
-    public void setSetupState( SetupStackState setupState ) {
+    public void setSetupState( SetupStackSignal signal ) {
+        if ( setupState.accepts( signal ) ) {
+            LOG.info( setupState.getMessage( signal ) );
+            setupState = setupState.next( signal );
+            LOG.debug( "New state is: {}", setupState );
+        }
+        else {
+            LOG.error( setupState.getMessage( signal ) );
+        }
+    }
+
+
+    private void setSetupState( SetupStackState setupState ) {
         this.setupState = setupState;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/stack/src/main/java/org/apache/usergrid/chop/stack/IStackController.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/IStackController.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/IStackController.java
deleted file mode 100644
index 556f733..0000000
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/IStackController.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.usergrid.chop.stack;
-
-
-public interface IStackController {
-    /**
-     * Resets this IStackController if it has been prematurely stopped.
-     */
-    void reset();
-
-
-    /**
-     * Gets the State of this IStackController.
-     *
-     * @return the current state
-     */
-    SetupStackState getState();
-
-
-    /**
-     * Starts this IStackController which begins running the suite of chops.
-     */
-    void start();
-
-    /**
-     * Prematurely stops this IStackController. The IController will naturally stop
-     * itself after running all chops to fall back into the State.READY state.
-     */
-    void stop();
-
-
-    void setup();
-
-
-    void deploy();
-
-
-    void destroy();
-
-
-    /**
-     * Takes a signal parameter to determine whether to start, stop, reset etc.
-     */
-    void send( SetupStackSignal signal );
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
index 8885d5c..96caa4b 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackSignal.java
@@ -22,7 +22,7 @@ package org.apache.usergrid.chop.stack;
 
 public enum SetupStackSignal {
 
-    START( 0 ), STOP( 1 ), RESET( 2 ), DESTROY( 3 ), DEPLOY( 4 ), SETUP( 5 );
+    START( 0 ), STOP( 1 ), RESET( 2 ), DESTROY( 3 ), DEPLOY( 4 ), SETUP( 5 ), FAIL ( 6 ), COMPLETE ( 7 );
 
     private final int signalID;
 
@@ -51,6 +51,10 @@ public enum SetupStackSignal {
                 return DEPLOY;
             case 5:
                 return SETUP;
+            case 6:
+                return FAIL;
+            case 7:
+                return COMPLETE;
         }
 
         throw new RuntimeException( "Should never get here!" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
index 4bd3b84..809c12c 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
@@ -37,13 +37,13 @@ import com.google.common.base.Preconditions;
  * Represents the setup state of a stack
  */
 public enum SetupStackState {
-    // After tests finishes, it will automatically switch to SetUp state
+    // Running ==> (Complete signal) ==> SetUp
+    // Running ==> (Destroy signal) ==> NotSetUp
     // Running ==> (Stop signal) ==> Stopped
-    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP }, new Integer[] { 6 },
+    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE }, new Integer[] { 6, 3, 0 },
             "Running tests on stack.",
-            "%s signal rejected. When Running only a STOP signal(s) which cause to transition into " +
-                    "Stopped state(s) respectively" +
-                    " or it will automatically transition into SetUp state when tests are finished" ),
+            "%s signal rejected. When Running only a STOP, DESTROY and COMPLETE signal(s) which cause to transition into " +
+                    "Stopped, NotSetUp and SetUp state(s) respectively" ),
 
     // Stopped ==> (reset signal) ==> SetUp
     Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET }, new Integer[] { 0 },
@@ -51,17 +51,17 @@ public enum SetupStackState {
             "%s signal rejected. When Stopped only a RESET signal(s) which cause to transition into " +
                     "SetUp state(s) respectively" ),
 
-    // JarNotFound ==> (deploy signal) ==> JarAlreadyDeployed
-    JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY }, new Integer[] { 3 },
+    // JarNotFound ==> (deploy signal) ==> NotSetUp
+    JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY, SetupStackSignal.SETUP }, new Integer[] { 3, 1 },
             "No runner jars found with given parameters, deploy first.",
-            "%s signal rejected. When JarNotFound only a DEPLOY signal(s) which cause to transition into " +
-                    "JarAlreadyDeployed state(s) respectively" ),
+            "%s signal rejected. When JarNotFound only a DEPLOY and SETUP signal(s) which cause to transition into " +
+                    "NotSetUp and SettingUp state(s) respectively" ),
 
-    // After destroy finishes, it will automatically switch to NotSetUp state
-    Destroying( 4, new SetupStackSignal[] { }, new Integer[] { },
+    // Destroying ==> (Complete signal) ==> NotSetUp
+    Destroying( 4, new SetupStackSignal[] { SetupStackSignal.COMPLETE }, new Integer[] { 3 },
             "Currently being destroyed. Wait until it is finished to set up again.",
-            "%s signal rejected. When Destroying no Signal can be sent. It transitions into " +
-                    "NotSetUp state automatically when it finishes." ),
+            "%s signal rejected. When Destroying only a COMPLETE signal(s) can be sent which cause to " +
+                    "transition into NotSetUp state(s) respectively" ),
 
     // NotSetUp ==> (setup signal) ==> NotSetUp
     // NotSetUp ==> (setup signal) ==> SettingUp
@@ -77,11 +77,11 @@ public enum SetupStackState {
             "%s signal rejected. When SetupFailed only a SETUP and DEPLOY signal(s) which cause to transition into " +
                     "SettingUp and NotSetUp state(s) respectively" ),
 
-    // After setting up the stack finishes, it will automatically switch to SetUp state
-    SettingUp( 1, new SetupStackSignal[] { }, new Integer[] { },
+    // SettingUp ==> (Complete signal) ==> SetUp
+    SettingUp( 1, new SetupStackSignal[] { SetupStackSignal.COMPLETE, SetupStackSignal.FAIL }, new Integer[] { 0, 2 },
             "Setting up the stack right now.",
-            "%s signal rejected. When SettingUp no Signal can be sent. It transitions into " +
-                    "SetUp state automatically when it finishes." ),
+            "%s signal rejected. When SettingUp only a COMPLETE signal(s) can be sent which cause to " +
+                    "transition into SetUp state(s) respectively" ),
 
     // SetUp ==> (start signal) ==> Running
     // SetUp ==> (destroy signal) ==> NotSetUp

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/stack/src/main/java/org/apache/usergrid/chop/stack/StackController.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/StackController.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/StackController.java
deleted file mode 100644
index c8d1fca..0000000
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/StackController.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-*  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.chop.stack;
-
-
-import org.apache.usergrid.chop.api.State;
-
-import com.google.common.base.Preconditions;
-
-
-public class StackController implements IStackController{
-    private final Object lock = new Object();
-    private SetupStackState state = initializeState();
-
-
-    private SetupStackState initializeState() {
-        // TODO find the real state!!!
-        return SetupStackState.JarNotFound;
-    }
-
-
-    public void send( final SetupStackSignal signal ) {
-        Preconditions.checkState( state.accepts( signal ), state.getMessage( signal ) );
-
-        switch ( signal ) {
-            case STOP: stop(); break;
-            case START: start(); break;
-            case RESET: reset(); break;
-            case DESTROY: destroy(); break;
-            case DEPLOY: deploy(); break;
-            case SETUP: setup(); break;
-            default:
-                throw new IllegalStateException( "Just accepting start, stop, reset, destroy, deploy or setup." );
-        }
-    }
-
-    public void reset() {
-        synchronized ( lock ) {
-            Preconditions.checkState( state.accepts( SetupStackSignal.RESET ),
-                    "Cannot reset the controller in state: " + state );
-            state = state.next( SetupStackSignal.RESET );
-        }
-    }
-
-
-    @Override
-    public SetupStackState getState() {
-        return state;
-    }
-
-
-    @Override
-    public void start() {
-        synchronized ( lock ) {
-            Preconditions.checkState( state.accepts( SetupStackSignal.START ), "Cannot start the controller in state: " + state );
-            state = state.next( SetupStackSignal.START );
-            //            new Thread( this ).start();
-            lock.notifyAll();
-        }
-    }
-
-
-    @Override
-    public void stop() {
-        synchronized ( lock ) {
-            Preconditions.checkState( state.accepts( SetupStackSignal.STOP ), "Cannot stop a controller in state: " + state );
-            state = state.next( SetupStackSignal.STOP );
-            lock.notifyAll();
-        }
-    }
-
-
-    @Override
-    public void setup() {
-
-    }
-
-
-    @Override
-    public void deploy() {
-        synchronized ( lock ) {
-            Preconditions.checkState( state.accepts( SetupStackSignal.DEPLOY ), "Cannot deploy jar while controller in state: " + state );
-            state = state.next( SetupStackSignal.DEPLOY );
-            lock.notifyAll();
-        }
-
-    }
-
-
-    @Override
-    public void destroy() {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/SetupStackThread.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/SetupStackThread.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/SetupStackThread.java
index 4a065b6..5a506cf 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/SetupStackThread.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/SetupStackThread.java
@@ -37,7 +37,7 @@ import org.apache.usergrid.chop.stack.BasicInstanceSpec;
 import org.apache.usergrid.chop.stack.CoordinatedStack;
 import org.apache.usergrid.chop.stack.ICoordinatedCluster;
 import org.apache.usergrid.chop.stack.Instance;
-import org.apache.usergrid.chop.stack.SetupStackState;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.webapp.ChopUiFig;
 import org.apache.usergrid.chop.webapp.dao.ProviderParamsDao;
 import org.apache.usergrid.chop.webapp.service.InjectorFactory;
@@ -108,7 +108,7 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
                         " for cluster " + cluster.getName();
                 LOG.warn( errorMessage + ", aborting and terminating launched instances..." );
                 instanceManager.terminateInstances( launchedInstances );
-                stack.setSetupState( SetupStackState.SetupFailed );
+                stack.setSetupState( SetupStackSignal.FAIL );
                 stack.notifyAll();
                 return null;
             }
@@ -116,7 +116,7 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
                 errorMessage = "Key file " + keyFile + " for cluster " + cluster.getName() + " not found";
                 LOG.warn( errorMessage + ", aborting and terminating launched instances..." );
                 instanceManager.terminateInstances( launchedInstances );
-                stack.setSetupState( SetupStackState.SetupFailed );
+                stack.setSetupState( SetupStackSignal.FAIL );
                 stack.notifyAll();
                 return null;
             }
@@ -140,7 +140,7 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
             if ( ! success ) {
                 errorMessage = "SSH commands have failed, will not continue";
                 instanceManager.terminateInstances( launchedInstances );
-                stack.setSetupState( SetupStackState.SetupFailed );
+                stack.setSetupState( SetupStackSignal.FAIL );
                 stack.notifyAll();
                 return null;
             }
@@ -154,7 +154,7 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
             errorMessage = "No key found with name " + providerParams.getKeyName() + " for runners";
             LOG.warn( errorMessage + ", aborting and terminating launched instances..." );
             instanceManager.terminateInstances( launchedInstances );
-            stack.setSetupState( SetupStackState.SetupFailed );
+            stack.setSetupState( SetupStackSignal.FAIL );
             stack.notifyAll();
             return null;
         }
@@ -162,7 +162,7 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
             errorMessage = "Key file " + keyFile + " for runners not found";
             LOG.warn( errorMessage + ", aborting and terminating launched instances..." );
             instanceManager.terminateInstances( launchedInstances );
-            stack.setSetupState( SetupStackState.SetupFailed );
+            stack.setSetupState( SetupStackSignal.FAIL );
             stack.notifyAll();
             return null;
         }
@@ -190,12 +190,12 @@ public class SetupStackThread implements Callable<CoordinatedStack> {
         if ( ! success ) {
             errorMessage = "SSH commands have failed, will not continue";
             instanceManager.terminateInstances( launchedInstances );
-            stack.setSetupState( SetupStackState.SetupFailed );
+            stack.setSetupState( SetupStackSignal.FAIL );
             stack.notifyAll();
             return null;
         }
 
-        stack.setSetupState( SetupStackState.SetUp );
+        stack.setSetupState( SetupStackSignal.COMPLETE );
         LOG.info( "Stack {} is set up and ready...", stack.getName() );
 
         stack.notifyAll();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index 3f7e325..5b88cce 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -28,6 +28,7 @@ import java.util.concurrent.Executors;
 import org.apache.usergrid.chop.api.Commit;
 import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.stack.Stack;
 import org.apache.usergrid.chop.stack.User;
@@ -87,8 +88,8 @@ public class StackCoordinator {
      * @param runnerCount
      * @return
      */
-    public CoordinatedStack setupStack( String commitId, String artifactId, String groupId, String version,
-                                        String user, int runnerCount ) {
+    public CoordinatedStack setupStack( String commitId, String artifactId, String groupId, String version, String user,
+                                        int runnerCount ) {
 
         User chopUser = userDao.get( user );
         File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), user, groupId, artifactId, version,
@@ -133,7 +134,7 @@ public class StackCoordinator {
 
         LOG.info( "Starting setup stack thread of {}...", stack.getName() );
         synchronized ( coordinatedStack ) {
-            coordinatedStack.setSetupState( SetupStackState.SettingUp );
+            coordinatedStack.setSetupState( SetupStackSignal.SETUP );
             registeredStacks.put( coordinatedStack.hashCode(), coordinatedStack );
 
             SetupStackThread setupThread = new SetupStackThread( coordinatedStack );
@@ -179,11 +180,12 @@ public class StackCoordinator {
 
             // TODO should we also check run state of stack?
             LOG.info( "Starting to destroy stack instances of {}...", stack.getName() );
-            coordinatedStack.setSetupState( SetupStackState.Destroying );
+            coordinatedStack.setSetupState( SetupStackSignal.DESTROY );
             StackDestroyer destroyer = new StackDestroyer( coordinatedStack );
             destroyer.destroy();
             registeredStacks.remove( coordinatedStack.hashCode() );
             setupStackThreads.remove( coordinatedStack );
+            coordinatedStack.setSetupState( SetupStackSignal.COMPLETE );
             coordinatedStack.notifyAll();
         }
     }
@@ -239,7 +241,7 @@ public class StackCoordinator {
      * @return  matching coordinated stack, or null
      */
     public CoordinatedStack findCoordinatedStack( String commitId, String artifactId, String groupId, String version,
-                                                     String user ) {
+                                                  String user ) {
 
         User chopUser = userDao.get( user );
         if( chopUser == null ) {
@@ -292,7 +294,7 @@ public class StackCoordinator {
      * @return Setup state of given parameters' stack
      */
     public SetupStackState stackStatus( String commitId, String artifactId, String groupId, String version,
-                                              String user ) {
+                                        String user ) {
 
         CoordinatedStack stack = findCoordinatedStack( commitId, artifactId, groupId, version, user );
 
@@ -332,4 +334,48 @@ public class StackCoordinator {
             stack.notifyAll();
         }
     }
+
+
+    public CoordinatedStack registerStack( final String commitId, final String artifactId, final String groupId,
+                                           final String version, final String user, final int runnerCount ) {
+
+        User chopUser = userDao.get( user );
+        File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), user, groupId, artifactId, version,
+                commitId );
+
+        Stack stack = CoordinatorUtils.getStackFromRunnerJar( runnerJar );
+        Module module = moduleDao.get( BasicModule.createId( groupId, artifactId, version ) );
+        Commit commit = null;
+        for( Commit c: commitDao.getByModule( module.getId() ) ) {
+            if( commitId.equals( c.getId() ) ) {
+                commit = c;
+                break;
+            }
+        }
+
+        return registerStack( stack, chopUser, commit, module, runnerCount );
+    }
+
+
+    public CoordinatedStack registerStack( final Stack stack, final User user, final Commit commit, final Module
+            module, final int runnerCount ) {
+        CoordinatedStack coordinatedStack = getCoordinatedStack( stack, user, commit, module );
+        if ( coordinatedStack != null ) {
+            LOG.info( "Stack {} is already registered", stack.getName() );
+            if ( coordinatedStack.getSetupState() == SetupStackState.SetUp ) {
+                return coordinatedStack;
+            }
+        }
+        else {
+            coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount );
+        }
+
+        LOG.info( "Registering stack...", stack.getName() );
+        synchronized ( coordinatedStack ) {
+            coordinatedStack.setSetupState( SetupStackSignal.DEPLOY );
+            registeredStacks.put( coordinatedStack.hashCode(), coordinatedStack );
+        }
+
+        return coordinatedStack;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackDestroyer.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackDestroyer.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackDestroyer.java
index dfac136..1a1d1e4 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackDestroyer.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackDestroyer.java
@@ -31,7 +31,7 @@ import org.apache.usergrid.chop.spi.InstanceManager;
 import org.apache.usergrid.chop.stack.CoordinatedStack;
 import org.apache.usergrid.chop.stack.ICoordinatedCluster;
 import org.apache.usergrid.chop.stack.Instance;
-import org.apache.usergrid.chop.stack.SetupStackState;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.webapp.dao.ProviderParamsDao;
 import org.apache.usergrid.chop.webapp.service.InjectorFactory;
 
@@ -82,7 +82,6 @@ public class StackDestroyer {
         }
         LOG.info( "Destroying all {} cluster and runner instances of {} stack...", instances.size(), stack.getName() );
         instanceManager.terminateInstances( instances );
-        stack.setSetupState( SetupStackState.NotSetUp );
         LOG.info( "Destroyed {} stack.", stack.getName() );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
index 6567e10..8ef5eb6 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
@@ -29,6 +29,8 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -195,6 +197,9 @@ public class ResetResource extends TestableResource implements RestParams {
                            .build();
         }
 
+        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, user );
+        stack.setSetupState( SetupStackSignal.RESET );
+
         return Response.status( Response.Status.CREATED )
                        .entity( "All stopped runners have been reset." )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
index ff1d140..55dc11c 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StartResource.java
@@ -30,6 +30,7 @@ import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
 import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -108,7 +109,7 @@ public class StartResource extends TestableResource implements RestParams {
 
         if( ! status.equals( SetupStackState.SetUp ) ) {
             return Response.status( Response.Status.OK )
-                           .entity( SetupStackState.NotSetUp.getStackStateMessage() )
+                           .entity( status.getStackStateMessage() )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
@@ -193,6 +194,8 @@ public class StartResource extends TestableResource implements RestParams {
                            .build();
         }
 
+        stack.setSetupState( SetupStackSignal.START );
+
         return Response.status( Response.Status.CREATED )
                        .entity( "Started chop tests" )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
index af2294e..74d91aa 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
@@ -29,6 +29,8 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
 import org.apache.usergrid.chop.api.State;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -182,6 +184,9 @@ public class StopResource extends TestableResource implements RestParams {
                            .build();
         }
 
+        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, user );
+        stack.setSetupState( SetupStackSignal.STOP );
+
         return Response.status( Response.Status.CREATED )
                        .entity( "All running runners have been stopped." )
                        .type( MediaType.APPLICATION_JSON )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
index f8a8412..ccac1c3 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
@@ -19,8 +19,26 @@
 package org.apache.usergrid.chop.webapp.coordinator.rest;
 
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
 import org.safehaus.jettyjam.utils.TestMode;
 
+import org.apache.usergrid.chop.api.Commit;
+import org.apache.usergrid.chop.api.Module;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.Stack;
+import org.apache.usergrid.chop.stack.User;
+import org.apache.usergrid.chop.webapp.coordinator.CoordinatorUtils;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
+import org.apache.usergrid.chop.webapp.dao.CommitDao;
+import org.apache.usergrid.chop.webapp.dao.ModuleDao;
+import org.apache.usergrid.chop.webapp.dao.UserDao;
+import org.apache.usergrid.chop.webapp.dao.model.BasicCommit;
+import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
+
 
 /**
  * A base class for all signal resources.
@@ -47,4 +65,42 @@ public abstract class TestableResource {
         return testMode != null &&
                 (testMode.equals(TestMode.INTEG.toString()) || testMode.equals(TestMode.UNIT.toString()));
     }
+
+    public CoordinatedStack getCoordinatedStack( CommitDao commitDao, ModuleDao moduleDao, UserDao userDao,
+                                                  StackCoordinator stackCoordinator, String artifactId,
+                                                  String commitId, String md5, String username,
+                                                  String groupId, String version, String vcsRepoUrl,
+                                                  String testPackage, File runnerJar )
+            throws IOException {
+        Commit commit = null;
+        Module module = null;
+
+        List<Commit> commits = commitDao.getByModule( artifactId );
+        for ( Commit returnedCommit : commits ) {
+            Module commitModule = moduleDao.get( returnedCommit.getModuleId() );
+            if ( commitModule.getArtifactId().equals( artifactId ) &&
+                    commitModule.getGroupId().equals( groupId ) &&
+                    commitModule.getVersion().equals( version ) )
+            {
+                commit = returnedCommit;
+                module = commitModule;
+            }
+        }
+
+        if ( module == null ) {
+            module = new BasicModule( groupId, artifactId, version, vcsRepoUrl, testPackage );
+            moduleDao.save( module );
+        }
+
+        if ( commit == null ) {
+            commit = new BasicCommit( commitId, module.getId(), md5, new Date(), runnerJar.getAbsolutePath() );
+            commitDao.save( commit );
+        }
+
+        // Send DEPLOY signal to coordinatedStack
+        Stack stack = CoordinatorUtils.getStackFromRunnerJar( runnerJar );
+        User chopUser = userDao.get( username );
+        CoordinatedStack coordinatedStack =  stackCoordinator.getCoordinatedStack( stack, chopUser, commit, module );
+        return coordinatedStack;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96c4ef95/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index be16e66..6caaa22 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -27,8 +27,6 @@ import java.io.InputStreamReader;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Date;
-import java.util.List;
 import java.util.Properties;
 
 import javax.annotation.Nullable;
@@ -41,23 +39,20 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.apache.usergrid.chop.stack.SetupStackState;
-import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.safehaus.jettyjam.utils.TestMode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.chop.api.Commit;
 import org.apache.usergrid.chop.api.Constants;
-import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.RestParams;
+import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.ChopUiFig;
 import org.apache.usergrid.chop.webapp.coordinator.CoordinatorUtils;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.CommitDao;
 import org.apache.usergrid.chop.webapp.dao.ModuleDao;
-import org.apache.usergrid.chop.webapp.dao.model.BasicCommit;
-import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
+import org.apache.usergrid.chop.webapp.dao.UserDao;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -87,7 +82,6 @@ public class UploadResource extends TestableResource implements RestParams, Cons
     @Inject
     private StackCoordinator stackCoordinator;
 
-
     public UploadResource() {
         super( ENDPOINT );
     }
@@ -127,10 +121,12 @@ public class UploadResource extends TestableResource implements RestParams, Cons
             @QueryParam( RestParams.MODULE_GROUPID ) String groupId,
             @QueryParam( RestParams.MODULE_VERSION ) String version,
             @QueryParam( RestParams.USERNAME ) String username,
+            @QueryParam( VCS_REPO_URL ) String vcsRepoUrl,
             @QueryParam( TEST_PACKAGE ) String testPackage,
             @QueryParam( MD5 ) String md5,
+            @QueryParam( RestParams.RUNNER_COUNT ) int runnerCount,
             @Nullable @QueryParam( TestMode.TEST_MODE_PROPERTY ) String testMode
-    ) {
+                                ) throws IOException {
 
         if( inTestMode( testMode ) ) {
             LOG.info( "Calling /upload/status in test mode ..." );
@@ -175,10 +171,11 @@ public class UploadResource extends TestableResource implements RestParams, Cons
             @FormDataParam( VCS_REPO_URL ) String vcsRepoUrl,
             @FormDataParam( TEST_PACKAGE ) String testPackage,
             @FormDataParam( MD5 ) String md5,
+            @FormDataParam( RestParams.RUNNER_COUNT ) int runnerCount,
             @FormDataParam( CONTENT ) InputStream runnerJarStream,
             @Nullable @QueryParam( TestMode.TEST_MODE_PROPERTY ) String testMode
 
-    ) throws Exception {
+                                ) throws Exception {
 
         if( inTestMode( testMode ) ) {
             LOG.info( "Calling /upload/runner in test mode ..." );
@@ -193,14 +190,15 @@ public class UploadResource extends TestableResource implements RestParams, Cons
         LOG.debug( "extracted {} = {}", RestParams.MODULE_VERSION, version );
         LOG.debug( "extracted {} = {}", RestParams.USERNAME, username );
         LOG.debug( "extracted {} = {}", RestParams.VCS_REPO_URL, vcsRepoUrl );
-        LOG.debug( "extracted {} = {}", RestParams.TEST_PACKAGE, testPackage );
+        LOG.debug( "extracted {} = {}", RestParams.TEST_PACKAGE, runnerCount );
+        LOG.debug( "extracted {} = {}", RestParams.RUNNER_COUNT, testPackage );
         LOG.debug( "extracted {} = {}", RestParams.MD5, md5 );
 
         if( inTestMode( testMode ) ) {
             return Response.status( Response.Status.CREATED )
-                    .entity( SUCCESSFUL_TEST_MESSAGE )
-                    .type( MediaType.TEXT_PLAIN )
-                    .build();
+                           .entity( SUCCESSFUL_TEST_MESSAGE )
+                           .type( MediaType.TEXT_PLAIN )
+                           .build();
         }
 
         File runnerJar = CoordinatorUtils.getRunnerJar( chopUiFig.getContextPath(), username, groupId, artifactId,
@@ -232,31 +230,7 @@ public class UploadResource extends TestableResource implements RestParams, Cons
         // - this is bad news because we will get commits of other users :(
         // - we also need to qualify the commit with username, groupId,
         //   and the version of module as well
-
-        Commit commit = null;
-        Module module = null;
-
-        List<Commit> commits = commitDao.getByModule( artifactId );
-        for ( Commit returnedCommit : commits ) {
-            Module commitModule = moduleDao.get( returnedCommit.getModuleId() );
-            if ( commitModule.getArtifactId().equals( artifactId ) &&
-                    commitModule.getGroupId().equals( groupId ) &&
-                    commitModule.getVersion().equals( version ) )
-            {
-                commit = returnedCommit;
-                module = commitModule;
-            }
-        }
-
-        if ( module == null ) {
-            module = new BasicModule( groupId, artifactId, version, vcsRepoUrl, testPackage );
-            moduleDao.save( module );
-        }
-
-        if ( commit == null ) {
-            commit = new BasicCommit( commitId, module.getId(), md5, new Date(), runnerJar.getAbsolutePath() );
-            commitDao.save( commit );
-        }
+        stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
 
         return Response.status( Response.Status.CREATED ).entity( runnerJar.getAbsolutePath() ).build();
     }
@@ -292,4 +266,5 @@ public class UploadResource extends TestableResource implements RestParams, Cons
 
         return coordinatorJarMd5;
     }
+
 }


[30/50] [abbrv] git commit: Continue to fix start, stop and reset resources to reflect the changes of stack state transitions

Posted by sn...@apache.org.
Continue to fix start, stop and reset resources to reflect the changes of stack state transitions


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

Branch: refs/heads/two-dot-o
Commit: 61596df853a31faea25c898073ef138552083cb3
Parents: 08b2a1a
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Sat Jun 28 17:58:52 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Sat Jun 28 17:58:52 2014 +0300

----------------------------------------------------------------------
 .../usergrid/chop/api/CoordinatorFig.java       |  7 +++
 .../apache/usergrid/chop/client/ssh/Job.java    |  2 +-
 .../apache/usergrid/chop/runner/Controller.java | 64 +++++++++++++++++++-
 .../usergrid/chop/runner/IController.java       |  7 +++
 .../usergrid/chop/stack/SetupStackState.java    | 36 +++++------
 chop/webapp/pom.xml                             |  1 +
 .../webapp/coordinator/StackCoordinator.java    |  6 +-
 .../coordinator/rest/DestroyResource.java       |  6 +-
 .../coordinator/rest/RunManagerResource.java    | 37 ++---------
 .../rest/RunnerRegistryResource.java            | 36 ++++++++++-
 .../webapp/coordinator/rest/UploadResource.java | 37 ++++++++++-
 11 files changed, 179 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
----------------------------------------------------------------------
diff --git a/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java b/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
index a238f59..6a5fdaa 100644
--- a/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
+++ b/chop/api/src/main/java/org/apache/usergrid/chop/api/CoordinatorFig.java
@@ -92,6 +92,13 @@ public interface CoordinatorFig extends GuicyFig {
     String getRunnersUnregisterPath();
 
 
+    String RUNNERS_COMPLETED_PATH = "coordinator.endpoint.runners.completed";
+    String RUNNERS_COMPLETED_PATH_DEFAULT = "/runners/completed";
+    @Key( RUNNERS_COMPLETED_PATH )
+    @Default( RUNNERS_COMPLETED_PATH_DEFAULT )
+    String getRunnersCompletedPath();
+
+
     String ENDPOINT = "coordinator.endpoint";
     String ENDPOINT_DEFAULT = "https://localhost:8443";
     @Key( ENDPOINT )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/client/src/main/java/org/apache/usergrid/chop/client/ssh/Job.java
----------------------------------------------------------------------
diff --git a/chop/client/src/main/java/org/apache/usergrid/chop/client/ssh/Job.java b/chop/client/src/main/java/org/apache/usergrid/chop/client/ssh/Job.java
index ec2831b..2412aa6 100644
--- a/chop/client/src/main/java/org/apache/usergrid/chop/client/ssh/Job.java
+++ b/chop/client/src/main/java/org/apache/usergrid/chop/client/ssh/Job.java
@@ -51,7 +51,7 @@ public class Job implements Callable<ResponseInfo> {
 
     private static final Logger LOG = LoggerFactory.getLogger( Job.class );
 
-    protected static final int SESSION_CONNECT_TIMEOUT = 50000;
+    protected static final int SESSION_CONNECT_TIMEOUT = 100000;
 
     protected Collection<Command> commands;
     protected SshValues value;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
index eb97d81..7fc9b3d 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/Controller.java
@@ -21,6 +21,8 @@ package org.apache.usergrid.chop.runner;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -29,8 +31,15 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.chop.api.CoordinatorFig;
+import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.runner.drivers.Driver;
 import org.apache.usergrid.chop.runner.drivers.TimeDriver;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
+import org.apache.usergrid.chop.stack.SetupStackState;
 import org.reflections.Reflections;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.Runner;
@@ -46,6 +55,7 @@ import org.apache.usergrid.chop.stack.ChopCluster;
 import org.apache.usergrid.chop.stack.ICoordinatedCluster;
 import org.apache.usergrid.chop.stack.Instance;
 
+import org.safehaus.jettyjam.utils.CertUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,14 +63,20 @@ import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
+import javax.ws.rs.core.MediaType;
+
 
 /**
  * The Controller controls the process of executing chops on test classes.
  */
 @Singleton
-public class Controller implements IController, Runnable {
+public class Controller implements IController, Runnable, RestParams {
     private static final Logger LOG = LoggerFactory.getLogger( Controller.class );
 
+    private CoordinatorFig coordinatorFig;
+    private URL endpoint;
+
+
     // @todo make this configurable and also put this into the project or runner fig
     private static final long DEFAULT_LAGER_WAIT_TIMEOUT_MILLIS = 120000;
     private final Object lock = new Object();
@@ -105,6 +121,25 @@ public class Controller implements IController, Runnable {
     }
 
 
+    @Inject
+    private void setCoordinatorConfig( CoordinatorFig coordinatorFig ) {
+        this.coordinatorFig = coordinatorFig;
+
+        try {
+            endpoint = new URL( coordinatorFig.getEndpoint() );
+        }
+        catch ( MalformedURLException e ) {
+            LOG.error( "Failed to parse URL for coordinator", e );
+        }
+
+        // Need to get the configuration information for the coordinator
+        if ( ! CertUtils.isTrusted( endpoint.getHost() ) ) {
+            CertUtils.preparations( endpoint.getHost(), endpoint.getPort() );
+        }
+        Preconditions.checkState( CertUtils.isTrusted( endpoint.getHost() ), "coordinator must be trusted" );
+    }
+
+
     private void setProject( Project project ) {
         // if the project is null which should never really happen we just return
         // and stay in the INACTIVE state waiting for a load to activate this runner
@@ -444,5 +479,32 @@ public class Controller implements IController, Runnable {
         LOG.info( "The controller has completed." );
         currentDriver = null;
         state = state.next( Signal.COMPLETED );
+        SetupStackState setupStackState = sendCompleteSignalToSetupStack();
+        LOG.info( "Coordinator stack state: {}", setupStackState );
+    }
+
+    public SetupStackState sendCompleteSignalToSetupStack() {
+        LOG.info( "Sending complete signal to Coordinator" );
+        WebResource resource = Client.create().resource( coordinatorFig.getEndpoint() );
+
+        LOG.info( "USERNAME: {}", coordinatorFig.getUsername() );
+        LOG.info( "MODULE_GROUPID: {}", project.getGroupId() );
+        LOG.info( "MODULE_ARTIFACTID: {}", project.getArtifactId() );
+        LOG.info( "MODULE_VERSION: {}", project.getVersion() );
+        LOG.info( "COMMIT_ID: {}", project.getVcsVersion() );
+
+        SetupStackState result = resource.path( coordinatorFig.getRunnersCompletedPath() )
+                .queryParam( USERNAME, coordinatorFig.getUsername() )
+                .queryParam( MODULE_GROUPID, project.getGroupId() )
+                .queryParam( MODULE_ARTIFACTID, project.getArtifactId() )
+                .queryParam( MODULE_VERSION, project.getVersion() )
+                .queryParam( COMMIT_ID, project.getVcsVersion() )
+                .type( MediaType.APPLICATION_JSON )
+                .get( SetupStackState.class );
+
+
+        return result;
     }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
----------------------------------------------------------------------
diff --git a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
index cb79943..c540622 100644
--- a/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
+++ b/chop/runner/src/main/java/org/apache/usergrid/chop/runner/IController.java
@@ -23,6 +23,7 @@ import org.apache.usergrid.chop.api.Signal;
 import org.apache.usergrid.chop.api.StatsSnapshot;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.State;
+import org.apache.usergrid.chop.stack.SetupStackState;
 
 
 /**
@@ -86,4 +87,10 @@ public interface IController {
      * @return the project being chopped up
      */
     Project getProject();
+
+    /**
+     * sends signal to coordinator to inform that all runners are finished
+     * @return Setup stack state of coordinator after signal sent
+     */
+    SetupStackState sendCompleteSignalToSetupStack();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
index 809c12c..4015d2c 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/SetupStackState.java
@@ -38,56 +38,57 @@ import com.google.common.base.Preconditions;
  */
 public enum SetupStackState {
     // Running ==> (Complete signal) ==> SetUp
-    // Running ==> (Destroy signal) ==> NotSetUp
+    // Running ==> (Destroy signal) ==> Destroying
     // Running ==> (Stop signal) ==> Stopped
-    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE }, new Integer[] { 6, 3, 0 },
+    Running( 7, new SetupStackSignal[] { SetupStackSignal.STOP, SetupStackSignal.DESTROY, SetupStackSignal.COMPLETE }, new Integer[] { 6, 4, 0 },
             "Running tests on stack.",
-            "%s signal rejected. When Running only a STOP, DESTROY and COMPLETE signal(s) which cause to transition into " +
-                    "Stopped, NotSetUp and SetUp state(s) respectively" ),
+            "%s signal rejected. When Running only STOP, DESTROY and COMPLETE signal(s) which cause to transition into " +
+                    "Stopped, Destroying and SetUp state(s) respectively" ),
 
     // Stopped ==> (reset signal) ==> SetUp
-    Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET }, new Integer[] { 0 },
+    Stopped( 6, new SetupStackSignal[] { SetupStackSignal.RESET, SetupStackSignal.DESTROY }, new Integer[] { 0, 4 },
             "Tests are stopped while running, please reset first.",
-            "%s signal rejected. When Stopped only a RESET signal(s) which cause to transition into " +
-                    "SetUp state(s) respectively" ),
+            "%s signal rejected. When Stopped only RESET and DESTROY signal(s) which cause to transition into " +
+                    "SetUp, Destroying state(s) respectively" ),
 
     // JarNotFound ==> (deploy signal) ==> NotSetUp
     JarNotFound( 5, new SetupStackSignal[] { SetupStackSignal.DEPLOY, SetupStackSignal.SETUP }, new Integer[] { 3, 1 },
             "No runner jars found with given parameters, deploy first.",
-            "%s signal rejected. When JarNotFound only a DEPLOY and SETUP signal(s) which cause to transition into " +
+            "%s signal rejected. When JarNotFound only DEPLOY and SETUP signal(s) which cause to transition into " +
                     "NotSetUp and SettingUp state(s) respectively" ),
 
     // Destroying ==> (Complete signal) ==> NotSetUp
     Destroying( 4, new SetupStackSignal[] { SetupStackSignal.COMPLETE }, new Integer[] { 3 },
             "Currently being destroyed. Wait until it is finished to set up again.",
-            "%s signal rejected. When Destroying only a COMPLETE signal(s) can be sent which cause to " +
+            "%s signal rejected. When Destroying only COMPLETE signal(s) can be sent which cause to " +
                     "transition into NotSetUp state(s) respectively" ),
 
     // NotSetUp ==> (setup signal) ==> NotSetUp
     // NotSetUp ==> (setup signal) ==> SettingUp
     NotSetUp( 3, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY }, new Integer[] { 1, 3 },
             "Jar is deployed but no stack set up with it.",
-            "%s signal rejected. When NotSetUp only a SETUP and DEPLOY signal(s) which cause to transition into " +
+            "%s signal rejected. When NotSetUp only SETUP and DEPLOY signal(s) which cause to transition into " +
                     "SettingUp and NotSetUp state(s) respectively" ),
 
     // SetupFailed ==> (setup deploy) ==> NotSetUp
     // SetupFailed ==> (setup signal) ==> SettingUp
     SetupFailed( 2, new SetupStackSignal[] { SetupStackSignal.SETUP, SetupStackSignal.DEPLOY }, new Integer[] { 1, 3 },
             "Stack was registered, however its setup failed. Call setup again to restart.",
-            "%s signal rejected. When SetupFailed only a SETUP and DEPLOY signal(s) which cause to transition into " +
+            "%s signal rejected. When SetupFailed only SETUP and DEPLOY signal(s) which cause to transition into " +
                     "SettingUp and NotSetUp state(s) respectively" ),
 
     // SettingUp ==> (Complete signal) ==> SetUp
-    SettingUp( 1, new SetupStackSignal[] { SetupStackSignal.COMPLETE, SetupStackSignal.FAIL }, new Integer[] { 0, 2 },
+    SettingUp( 1, new SetupStackSignal[] { SetupStackSignal.COMPLETE, SetupStackSignal.FAIL
+            , SetupStackSignal.DESTROY}, new Integer[] { 0, 2, 4 },
             "Setting up the stack right now.",
-            "%s signal rejected. When SettingUp only a COMPLETE signal(s) can be sent which cause to " +
-                    "transition into SetUp state(s) respectively" ),
+            "%s signal rejected. When SettingUp only COMPLETE, FAIL and DESTROY signal(s) can be sent which " +
+                    "cause to transition into SetUp, SetupFailed and Destroying state(s) respectively" ),
 
     // SetUp ==> (start signal) ==> Running
     // SetUp ==> (destroy signal) ==> NotSetUp
     SetUp( 0, new SetupStackSignal[] { SetupStackSignal.DESTROY, SetupStackSignal.START }, new Integer[] { 4, 7 },
             "Stack is set up and ready to start the tests.",
-            "%s signal rejected. When SetUp only a DESTROY and SetUp signal(s) which cause to transition into " +
+            "%s signal rejected. When SetUp only DESTROY and SetUp signal(s) which cause to transition into " +
                     "NotSetUp and SetUp state(s) respectively" );
 
     private static final Logger LOG = LoggerFactory.getLogger( SetupStackState.class );
@@ -100,7 +101,8 @@ public enum SetupStackState {
     private final String rejectedMessage;
 
 
-    private SetupStackState( int stateID, SetupStackSignal[] signals, Integer[] states, String stackStateMessage, String rejectedMessage ) {
+    private SetupStackState( int stateID, SetupStackSignal[] signals, Integer[] states, String stackStateMessage,
+            String rejectedMessage ) {
         Assert.assertTrue( states.length == signals.length );
         this.stackStateMessage = stackStateMessage;
         this.stateID = stateID;
@@ -216,7 +218,7 @@ public enum SetupStackState {
             return null;
         }
 
-        LOG.info( "Got signal {} in {} state: stateID = " + stateID, signal, toString() );
+        LOG.debug( "Got signal {} in {} state: stateID = " + stateID, signal, toString() );
 
         return get( stateID );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/chop/webapp/pom.xml b/chop/webapp/pom.xml
index 117bdb6..caef3aa 100644
--- a/chop/webapp/pom.xml
+++ b/chop/webapp/pom.xml
@@ -170,6 +170,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
+        <version>2.2</version>
         <executions>
           <execution>
             <phase>package</phase>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index 5b88cce..bdc5231 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -173,7 +173,7 @@ public class StackCoordinator {
         }
 
         synchronized ( coordinatedStack ) {
-            if ( coordinatedStack.getSetupState() != SetupStackState.SetUp ) {
+            if ( coordinatedStack.getSetupState().accepts( SetupStackSignal.DESTROY ) ) {
                 LOG.info( "Stack is in {} state, will not destroy.", coordinatedStack.getSetupState().toString() );
                 return;
             }
@@ -362,9 +362,7 @@ public class StackCoordinator {
         CoordinatedStack coordinatedStack = getCoordinatedStack( stack, user, commit, module );
         if ( coordinatedStack != null ) {
             LOG.info( "Stack {} is already registered", stack.getName() );
-            if ( coordinatedStack.getSetupState() == SetupStackState.SetUp ) {
-                return coordinatedStack;
-            }
+            return coordinatedStack;
         }
         else {
             coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
index cecb274..ff1ff21 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/DestroyResource.java
@@ -26,6 +26,7 @@ import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
 import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
@@ -103,14 +104,15 @@ public class DestroyResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        if( ! status.equals( SetupStackState.SetUp ) ) {
+        if( ! status.accepts( SetupStackSignal.DESTROY ) ) {
             return Response.status( Response.Status.OK )
                            .entity( "Stack is " + status.toString() + ", will not destroy." )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
 
-        /** SetupStackState.SetUp */
+        /** SetupStackState.SetUp or SetupStackState.SettingUp
+         * or SetupStackState.Running or SetupStackState.Stopped */
 
         // Unregister runners first
         String moduleId = BasicModule.createId( groupId, artifactId, version );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
index b4cf702..a4ff74c 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
@@ -24,9 +24,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
 
 import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
@@ -36,11 +33,6 @@ import com.sun.jersey.multipart.FormDataParam;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Run;
 import org.apache.usergrid.chop.api.Runner;
-import org.apache.usergrid.chop.api.State;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.SetupStackSignal;
-import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
-import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.RunDao;
 import org.apache.usergrid.chop.webapp.dao.RunResultDao;
 import org.apache.usergrid.chop.webapp.dao.RunnerDao;
@@ -58,7 +50,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
@@ -81,12 +78,6 @@ public class RunManagerResource extends TestableResource implements RestParams {
     @Inject
     private RunnerDao runnerDao;
 
-    @Inject
-    private RunnerCoordinator runnerCoordinator;
-
-    @Inject
-    private StackCoordinator stackCoordinator;
-
 
     protected RunManagerResource() {
         super( ENDPOINT );
@@ -171,22 +162,6 @@ public class RunManagerResource extends TestableResource implements RestParams {
         Collection<Run> runs = runDao.getMap( commitId, runNumber, testClass, runners ).values() ;
 
         Boolean allFinished = runs.size() == runners.size();
-        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, username );
-
-        Map<Runner, State> states = runnerCoordinator.getStates( runners );
-
-        Collection<Runner> readyRunners = new LinkedList<Runner>();
-        for ( Runner runner: runners ) {
-            State state = states.get( runner );
-            if( state == State.READY ) {
-                readyRunners.add( runner );
-            }
-        }
-
-        if( readyRunners.size() == runners.size() ) {
-            LOG.info( "All runners are ready, sending " + SetupStackSignal.COMPLETE + " signal.." );
-            stack.setSetupState( SetupStackSignal.COMPLETE );
-        }
 
         return Response.status( Response.Status.CREATED ).entity( allFinished ).build();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
index 665122c..2704efa 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunnerRegistryResource.java
@@ -26,7 +26,10 @@ import com.google.inject.Singleton;
 import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Runner;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
 import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.ModuleDao;
 import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
 import org.safehaus.jettyjam.utils.TestMode;
@@ -54,7 +57,7 @@ import java.util.Collections;
 @Produces( MediaType.APPLICATION_JSON )
 @Consumes( MediaType.APPLICATION_JSON )
 @Path( RunnerRegistryResource.ENDPOINT )
-public class RunnerRegistryResource extends TestableResource {
+public class RunnerRegistryResource extends TestableResource implements RestParams {
     public final static String ENDPOINT = "/runners";
 
     private static final Logger LOG = LoggerFactory.getLogger( RunnerRegistryResource.class );
@@ -65,6 +68,9 @@ public class RunnerRegistryResource extends TestableResource {
     @Inject
     private RunnerCoordinator runnerCoordinator;
 
+    @Inject
+    private StackCoordinator stackCoordinator;
+
 
     public RunnerRegistryResource() {
         super( ENDPOINT );
@@ -190,4 +196,32 @@ public class RunnerRegistryResource extends TestableResource {
 
         return Response.ok( result ).build();
     }
+
+
+    @SuppressWarnings( "unchecked" )
+    @GET
+    @Path( "/completed" )
+    @Consumes( MediaType.APPLICATION_JSON )
+    @Produces( MediaType.APPLICATION_JSON )
+    public Response runnersCompleted(
+            @QueryParam( USERNAME ) String username,
+            @QueryParam( MODULE_GROUPID ) String groupId,
+            @QueryParam( MODULE_ARTIFACTID ) String artifactId,
+            @QueryParam( MODULE_VERSION ) String version,
+            @QueryParam( COMMIT_ID ) String commitId
+    ) {
+
+        LOG.info( "USERNAME: {}", username );
+        LOG.info( "MODULE_GROUPID: {}", groupId );
+        LOG.info( "MODULE_ARTIFACTID: {}", artifactId );
+        LOG.info( "MODULE_VERSION: {}", version );
+        LOG.info( "COMMIT_ID: {}", commitId );
+
+        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, username );
+        if ( stack.getSetupState().accepts( SetupStackSignal.COMPLETE ) ) {
+            stack.setSetupState( SetupStackSignal.COMPLETE );
+        }
+
+        return Response.status( Response.Status.OK ).entity( stack.getSetupState() ).build();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/61596df8/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
index 6caaa22..f7378ab 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/UploadResource.java
@@ -27,6 +27,8 @@ import java.io.InputStreamReader;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Date;
+import java.util.List;
 import java.util.Properties;
 
 import javax.annotation.Nullable;
@@ -39,20 +41,23 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.apache.usergrid.chop.stack.SetupStackState;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.safehaus.jettyjam.utils.TestMode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.chop.api.Commit;
 import org.apache.usergrid.chop.api.Constants;
+import org.apache.usergrid.chop.api.Module;
 import org.apache.usergrid.chop.api.Project;
 import org.apache.usergrid.chop.api.RestParams;
-import org.apache.usergrid.chop.stack.SetupStackState;
 import org.apache.usergrid.chop.webapp.ChopUiFig;
 import org.apache.usergrid.chop.webapp.coordinator.CoordinatorUtils;
-import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.CommitDao;
 import org.apache.usergrid.chop.webapp.dao.ModuleDao;
-import org.apache.usergrid.chop.webapp.dao.UserDao;
+import org.apache.usergrid.chop.webapp.dao.model.BasicCommit;
+import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -230,6 +235,32 @@ public class UploadResource extends TestableResource implements RestParams, Cons
         // - this is bad news because we will get commits of other users :(
         // - we also need to qualify the commit with username, groupId,
         //   and the version of module as well
+
+        Commit commit = null;
+        Module module = null;
+
+        List<Commit> commits = commitDao.getByModule( artifactId );
+        for ( Commit returnedCommit : commits ) {
+            Module commitModule = moduleDao.get( returnedCommit.getModuleId() );
+            if ( commitModule.getArtifactId().equals( artifactId ) &&
+                    commitModule.getGroupId().equals( groupId ) &&
+                    commitModule.getVersion().equals( version ) )
+            {
+                commit = returnedCommit;
+                module = commitModule;
+            }
+        }
+
+        if ( module == null ) {
+            module = new BasicModule( groupId, artifactId, version, vcsRepoUrl, testPackage );
+            moduleDao.save( module );
+        }
+
+        if ( commit == null ) {
+            commit = new BasicCommit( commitId, module.getId(), md5, new Date(), runnerJar.getAbsolutePath() );
+            commitDao.save( commit );
+        }
+
         stackCoordinator.registerStack( commitId, artifactId, groupId, version, username, runnerCount );
 
         return Response.status( Response.Status.CREATED ).entity( runnerJar.getAbsolutePath() ).build();


[29/50] [abbrv] git commit: Merge pull request #235 from GERey/USERGRID-182_properties-consolidation_ug

Posted by sn...@apache.org.
Merge pull request #235 from GERey/USERGRID-182_properties-consolidation_ug

Included the core persistence properties into the usergrid-default.prope...

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

Branch: refs/heads/two-dot-o
Commit: c3006f9bc19cf29122c7af5d001c0b210fe029fd
Parents: 5defa05 4fe70f4
Author: Dave Johnson <da...@rollerweblogger.org>
Authored: Fri Jun 27 17:38:45 2014 -0400
Committer: Dave Johnson <da...@rollerweblogger.org>
Committed: Fri Jun 27 17:38:45 2014 -0400

----------------------------------------------------------------------
 .../main/resources/corepersistence.properties   | 45 --------------------
 .../main/resources/usergrid-default.properties  | 25 +++++++++++
 .../usergrid/corepersistence/CpSetup.java       | 37 +++++++++-------
 3 files changed, 46 insertions(+), 61 deletions(-)
----------------------------------------------------------------------



[21/50] [abbrv] git commit: Merge branch 'master' of https://github.com/usergrid/usergrid into USERGRID-176_fix-maven-3.2

Posted by sn...@apache.org.
Merge branch 'master' of https://github.com/usergrid/usergrid into USERGRID-176_fix-maven-3.2

# By Todd Nine (23) and others
# Via Todd Nine (5) and others
* 'master' of https://github.com/usergrid/usergrid: (42 commits)
  Fixes bug and serializer re-use
  Updated contribution section
  Fixes issue with incorrect page size hint causing too many round trips during iteration.
  Moved many updates to modules and rebuilt SDK
  Added test to prove issue
  updated assets sample in the README
  fixed error in callback for download()
  Added support for new assets functionality with attachAsset() and downloadAsset()
  Removal of the log4j.xml.
  Removed duplicate stdout appender. The same one is added in the properties file, so we do not need the same one in the xml.
  Disabled query validator until we merge in ES changes.
  Revert "Merge pull request #182 from GERey/fix-query-validator-tests"
  Revert "Merge pull request #182 from GERey/fix-query-validator-tests"
  Updates repair process to page through large organization counts.
  Made test 1.6 compatible
  Removed redundant casts
  Revert "Updated source to be 1.7 compatible"
  updated README to reflect info about git-wip as canonical source
  Fixes subtraction issue with Sets.difference not working recursively.
  Updated source to be 1.7 compatible
  ...


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

Branch: refs/pull/206/merge
Commit: 6f4423e8900c19b8c61016c6fc0c062f17f29a0e
Parents: 8cb1644 c7b8612
Author: grey <gr...@apigee.com>
Authored: Fri Jun 27 11:33:08 2014 -0700
Committer: grey <gr...@apigee.com>
Committed: Fri Jun 27 11:33:08 2014 -0700

----------------------------------------------------------------------
 README.md                                       |  23 +-
 sdks/html5-javascript/README.md                 |  76 ++--
 sdks/html5-javascript/lib/modules/Asset.js      | 168 ++++++---
 sdks/html5-javascript/lib/modules/Entity.js     | 179 +++++++++-
 sdks/html5-javascript/lib/modules/Group.js      |   2 +-
 sdks/html5-javascript/usergrid.js               | 237 +++++++++++--
 sdks/html5-javascript/usergrid.min.js           |   6 +-
 sdks/nodejs/lib/usergrid.js                     | 156 +++++++++
 .../main/resources/usergrid-default.properties  |   3 +
 stack/config/src/test/resources/log4j.xml       |  40 ---
 .../usergrid/mq/cassandra/QueueManagerImpl.java |  38 +-
 .../mq/cassandra/io/AbstractSearch.java         |   5 +-
 .../mq/cassandra/io/ConsumerTransaction.java    |  12 +-
 .../cassandra/CassandraPersistenceUtils.java    |   9 +-
 .../persistence/cassandra/CassandraService.java | 137 ++------
 .../cassandra/EntityManagerFactoryImpl.java     |   5 +-
 .../cassandra/EntityManagerImpl.java            |  58 ++--
 .../persistence/cassandra/GeoIndexManager.java  |  23 +-
 .../persistence/cassandra/QueryProcessor.java   |  61 +---
 .../cassandra/RelationManagerImpl.java          |  59 ++--
 .../persistence/cassandra/Serializers.java      |  14 +-
 .../persistence/hector/CountingMutator.java     | 344 +++++++++++++++++++
 .../usergrid/persistence/query/ir/AllNode.java  |   6 +
 .../persistence/query/ir/BooleanNode.java       |   6 +
 .../query/ir/EmailIdentifierNode.java           |   6 +
 .../query/ir/NameIdentifierNode.java            |   6 +
 .../usergrid/persistence/query/ir/NotNode.java  |   6 +
 .../persistence/query/ir/OrderByNode.java       |  10 +-
 .../persistence/query/ir/QueryNode.java         |   6 +
 .../persistence/query/ir/SliceNode.java         |   6 +
 .../query/ir/UuidIdentifierNode.java            |   6 +
 .../persistence/query/ir/WithinNode.java        |   6 +
 .../query/ir/result/SubtractionIterator.java    |   2 +-
 .../usergrid/persistence/CountingMutatorIT.java | 134 ++++++++
 .../apache/usergrid/persistence/IndexIT.java    |   4 +-
 .../cassandra/QueryProcessorTest.java           | 105 +++++-
 .../query/IntersectionTransitivePagingIT.java   | 165 +++++++++
 .../query/IntersectionUnionPagingIT.java        |   4 +-
 .../persistence/query/NotSubPropertyIT.java     | 178 ++++++++++
 stack/core/src/test/resources/log4j.properties  |   1 +
 stack/pom.xml                                   |   2 +-
 .../apache/usergrid/rest/AbstractRestIT.java    |  11 +
 .../applications/users/MatrixQueryTests.java    | 212 ++++++++++++
 .../rest/test/resource/MatrixResource.java      |  64 ++++
 .../rest/test/resource/NamedResource.java       |   5 +
 .../rest/test/resource/SetResource.java         |  12 +
 .../rest/test/resource/ValueResource.java       |  18 +-
 .../usergrid/services/ServiceRequest.java       |  11 +-
 .../org/apache/usergrid/tools/AppNameFix.java   |  59 +++-
 .../RepairingMismatchedApplicationMetadata.java |  92 +++--
 stack/tools/src/main/resources/log4j.properties |  45 +++
 stack/tools/src/main/resources/log4j.xml        |  29 --
 52 files changed, 2356 insertions(+), 516 deletions(-)
----------------------------------------------------------------------



[28/50] [abbrv] git commit: Merge f2fd25a4eee46b2306c4663ee9b18e8a88d2bd91 into 5defa054682471976aeb6513c8b89ca76642efab

Posted by sn...@apache.org.
Merge f2fd25a4eee46b2306c4663ee9b18e8a88d2bd91 into 5defa054682471976aeb6513c8b89ca76642efab


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

Branch: refs/pull/232/merge
Commit: e3e2dadd8c2593258085b24893fef6d6183eda59
Parents: 5defa05 f2fd25a
Author: GERey <gr...@apigee.com>
Authored: Fri Jun 27 21:08:51 2014 +0000
Committer: GERey <gr...@apigee.com>
Committed: Fri Jun 27 21:08:51 2014 +0000

----------------------------------------------------------------------
 .../main/resources/corepersistence.properties   | 45 --------------------
 .../main/resources/usergrid-default.properties  | 29 +++++++++++--
 .../usergrid/corepersistence/CpSetup.java       | 35 ++++++++-------
 3 files changed, 46 insertions(+), 63 deletions(-)
----------------------------------------------------------------------



[09/50] [abbrv] git commit: Fix start, stop and reset resources to reflect the changes of stack state transitions

Posted by sn...@apache.org.
Fix start, stop and reset resources to reflect the changes of stack state transitions


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

Branch: refs/heads/two-dot-o
Commit: 08b2a1a477bbd0e3193ab4dd01193ccb908b9544
Parents: 5e42dbf
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Fri Jun 27 19:33:16 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Fri Jun 27 19:33:16 2014 +0300

----------------------------------------------------------------------
 .../webapp/coordinator/rest/ResetResource.java  |  6 ++--
 .../coordinator/rest/RunManagerResource.java    | 29 ++++++++++++++++++++
 .../webapp/coordinator/rest/StopResource.java   |  4 +--
 3 files changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/08b2a1a4/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
index 8ef5eb6..48f3159 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/ResetResource.java
@@ -108,14 +108,14 @@ public class ResetResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        if( ! status.equals( SetupStackState.SetUp ) ) {
+        if( ! status.equals( SetupStackState.Stopped ) ) {
             return Response.status( Response.Status.OK )
                            .entity( "Stack is " + status.toString() + ", cannot reset tests." )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
-        /** SetupStackState.SetUp */
-        LOG.info( "Stack is set up, checking runner states..." );
+        /** SetupStackState.Stopped */
+        LOG.info( "Stack is stopped, checking runner states..." );
 
         /** Check state of all runners */
         String moduleId = BasicModule.createId( groupId, artifactId, version );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/08b2a1a4/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
index b51934e..b4cf702 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
@@ -24,7 +24,9 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
@@ -34,6 +36,11 @@ import com.sun.jersey.multipart.FormDataParam;
 import org.apache.usergrid.chop.api.RestParams;
 import org.apache.usergrid.chop.api.Run;
 import org.apache.usergrid.chop.api.Runner;
+import org.apache.usergrid.chop.api.State;
+import org.apache.usergrid.chop.stack.CoordinatedStack;
+import org.apache.usergrid.chop.stack.SetupStackSignal;
+import org.apache.usergrid.chop.webapp.coordinator.RunnerCoordinator;
+import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
 import org.apache.usergrid.chop.webapp.dao.RunDao;
 import org.apache.usergrid.chop.webapp.dao.RunResultDao;
 import org.apache.usergrid.chop.webapp.dao.RunnerDao;
@@ -74,6 +81,12 @@ public class RunManagerResource extends TestableResource implements RestParams {
     @Inject
     private RunnerDao runnerDao;
 
+    @Inject
+    private RunnerCoordinator runnerCoordinator;
+
+    @Inject
+    private StackCoordinator stackCoordinator;
+
 
     protected RunManagerResource() {
         super( ENDPOINT );
@@ -158,6 +171,22 @@ public class RunManagerResource extends TestableResource implements RestParams {
         Collection<Run> runs = runDao.getMap( commitId, runNumber, testClass, runners ).values() ;
 
         Boolean allFinished = runs.size() == runners.size();
+        CoordinatedStack stack = stackCoordinator.findCoordinatedStack( commitId, artifactId, groupId, version, username );
+
+        Map<Runner, State> states = runnerCoordinator.getStates( runners );
+
+        Collection<Runner> readyRunners = new LinkedList<Runner>();
+        for ( Runner runner: runners ) {
+            State state = states.get( runner );
+            if( state == State.READY ) {
+                readyRunners.add( runner );
+            }
+        }
+
+        if( readyRunners.size() == runners.size() ) {
+            LOG.info( "All runners are ready, sending " + SetupStackSignal.COMPLETE + " signal.." );
+            stack.setSetupState( SetupStackSignal.COMPLETE );
+        }
 
         return Response.status( Response.Status.CREATED ).entity( allFinished ).build();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/08b2a1a4/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
index 74d91aa..8baabbd 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/StopResource.java
@@ -108,13 +108,13 @@ public class StopResource extends TestableResource implements RestParams {
                            .build();
         }
 
-        if( ! status.equals( SetupStackState.SetUp ) ) {
+        if( ! status.equals( SetupStackState.Running ) ) {
             return Response.status( Response.Status.OK )
                            .entity( "Stack is " + status.toString() + ", cannot stop tests." )
                            .type( MediaType.APPLICATION_JSON )
                            .build();
         }
-        /** SetupStackState.SetUp */
+        /** SetupStackState.Running */
         LOG.info( "Stack is set up, checking runner states..." );
 
         /** Check state of all runners */


[19/50] [abbrv] git commit: Merge remote-tracking branch 'upstream/two-dot-o' into two-dot-o

Posted by sn...@apache.org.
Merge remote-tracking branch 'upstream/two-dot-o' into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: 7b75a82e6614da8a44b1512e21935d611633e0ce
Parents: 010c4b0 a7ad7f8
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 21:03:25 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 21:03:25 2014 +0300

----------------------------------------------------------------------

----------------------------------------------------------------------



[33/50] [abbrv] git commit: Remove unnecessary imports

Posted by sn...@apache.org.
Remove unnecessary imports


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

Branch: refs/heads/two-dot-o
Commit: 63a80af0495df93057ad423a0a431dc82831b451
Parents: 94c9a1e
Author: Furkan Bicak <bi...@safehaus.org>
Authored: Sat Jun 28 20:00:32 2014 +0300
Committer: Furkan Bicak <bi...@safehaus.org>
Committed: Sat Jun 28 20:00:32 2014 +0300

----------------------------------------------------------------------
 .../webapp/coordinator/rest/TestableResource.java | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/63a80af0/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
index 1592122..f8a8412 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/TestableResource.java
@@ -19,26 +19,8 @@
 package org.apache.usergrid.chop.webapp.coordinator.rest;
 
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
 import org.safehaus.jettyjam.utils.TestMode;
 
-import org.apache.usergrid.chop.api.Commit;
-import org.apache.usergrid.chop.api.Module;
-import org.apache.usergrid.chop.stack.CoordinatedStack;
-import org.apache.usergrid.chop.stack.Stack;
-import org.apache.usergrid.chop.stack.User;
-import org.apache.usergrid.chop.webapp.coordinator.CoordinatorUtils;
-import org.apache.usergrid.chop.webapp.coordinator.StackCoordinator;
-import org.apache.usergrid.chop.webapp.dao.CommitDao;
-import org.apache.usergrid.chop.webapp.dao.ModuleDao;
-import org.apache.usergrid.chop.webapp.dao.UserDao;
-import org.apache.usergrid.chop.webapp.dao.model.BasicCommit;
-import org.apache.usergrid.chop.webapp.dao.model.BasicModule;
-
 
 /**
  * A base class for all signal resources.


[49/50] [abbrv] git commit: Fixed local consistency issue during long flushes.

Posted by sn...@apache.org.
Fixed local consistency issue during long flushes.


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

Branch: refs/heads/two-dot-o
Commit: 2a98cae997bb418557d1e962c32eabd6026a0725
Parents: ba04cb6
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Jul 1 18:00:29 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Jul 1 18:00:29 2014 -0600

----------------------------------------------------------------------
 .../usergrid/persistence/graph/GraphFig.java    |  23 +--
 .../persistence/graph/guice/GraphModule.java    |   5 +-
 .../impl/shard/NodeShardAllocation.java         |  11 --
 .../impl/shard/NodeShardCache.java              |  10 -
 .../shard/count/NodeShardApproximationImpl.java |  61 +++---
 .../shard/impl/NodeShardAllocationImpl.java     | 118 ++++++------
 .../impl/shard/impl/NodeShardCacheImpl.java     |  19 +-
 .../shard/impl/SizebasedEdgeShardStrategy.java  |  16 +-
 .../persistence/graph/GraphManagerIT.java       |  10 +-
 .../graph/GraphManagerShardingIT.java           | 189 +++++++++++++++++++
 .../impl/shard/NodeShardAllocationTest.java     |  12 +-
 .../shard/count/NodeShardApproximationTest.java |  13 --
 12 files changed, 312 insertions(+), 175 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/GraphFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/GraphFig.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/GraphFig.java
index ca36ffc..e0ce45c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/GraphFig.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/GraphFig.java
@@ -35,12 +35,6 @@ public interface GraphFig extends GuicyFig {
 
     public static final String REPAIR_CONCURRENT_SIZE = "usergrid.graph.repair.concurrent.size";
 
-
-
-    public static final String WRITE_TIMEOUT = "usergrid.graph.write.timeout";
-
-    public static final String READ_TIMEOUT = "usergrid.graph.read.timeout";
-
     public static final String SHARD_SIZE = "usergrid.graph.shard.size";
 
     public static final String SHARD_CACHE_SIZE = "usergrid.graph.shard.cache.size";
@@ -59,17 +53,6 @@ public interface GraphFig extends GuicyFig {
     int getScanPageSize();
 
 
-    @Default("10000")
-    @Key(WRITE_TIMEOUT)
-    int getWriteTimeout();
-
-    /**
-     * Get the read timeout (in milliseconds) that we should allow when reading from the data source
-     */
-    @Default("10000")
-    @Key(READ_TIMEOUT)
-    int getReadTimeout();
-
 
     @Default("5")
     @Key(REPAIR_CONCURRENT_SIZE)
@@ -77,13 +60,11 @@ public interface GraphFig extends GuicyFig {
 
 
 
-    @Default("10000")
+    @Default("500000")
     @Key(SHARD_SIZE)
     long getShardSize();
 
 
-
-
     @Default("30000")
     @Key(SHARD_CACHE_TIMEOUT)
     long getShardCacheTimeout();
@@ -93,7 +74,7 @@ public interface GraphFig extends GuicyFig {
     long getShardCacheSize();
 
 
-    @Default( "100000" )
+    @Default( "10000" )
     @Key( COUNTER_WRITE_FLUSH_COUNT )
     long getCounterFlushCount();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
index f096740..aca8d00 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
@@ -145,9 +145,10 @@ public class GraphModule extends AbstractModule {
     @StorageEdgeSerialization
     public EdgeSerialization permanentStorageSerialization( final NodeShardCache cache, final Keyspace keyspace,
                                                             final CassandraConfig cassandraConfig,
-                                                            final GraphFig graphFig ) {
+                                                            final GraphFig graphFig,
+                                                            final NodeShardApproximation shardApproximation) {
 
-        final EdgeShardStrategy sizeBasedStrategy = new SizebasedEdgeShardStrategy( cache );
+        final EdgeShardStrategy sizeBasedStrategy = new SizebasedEdgeShardStrategy( cache, shardApproximation );
 
         final EdgeSerializationImpl edgeSerialization =
                 new EdgeSerializationImpl( keyspace, cassandraConfig, graphFig, sizeBasedStrategy );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
index 07ee490..1097ced 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocation.java
@@ -59,15 +59,4 @@ public interface NodeShardAllocation {
     public boolean auditMaxShard(final ApplicationScope scope, final Id nodeId, final String... edgeType);
 
 
-    /**
-     * Increment the underlying counts on the shards
-     * @param scope The app scope
-     * @param nodeId The id of the node
-     * @param shardId The id of the shard
-     * @param amount The amount to increment
-     * @param edgeTypes The edge types to include in the count operation
-     */
-    public void increment(final ApplicationScope scope, final Id nodeId, final long shardId, final long amount, final String... edgeTypes);
-
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
index 6c83da2..667fdbf 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
@@ -52,14 +52,4 @@ public interface NodeShardCache {
      */
     public Iterator<Long> getVersions(final ApplicationScope scope, final Id nodeId, final long  maxTimestamp, final String... edgeType);
 
-
-    /**
-     * Increment the cached counter amount for this shard
-     * @param scope
-     * @param nodeId
-     * @param shard
-     * @param count
-     * @return The new local cached count
-     */
-    public void increment(final ApplicationScope scope, final Id nodeId, final long shard, final long count, final String... edgeTypes);
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationImpl.java
index a67b9fb..7dc763f 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationImpl.java
@@ -24,8 +24,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.inject.Inject;
 
-import org.apache.cassandra.thrift.Mutation;
-
 import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -57,8 +55,16 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
     private final NodeShardCounterSerialization nodeShardCounterSerialization;
     private final TimeService timeService;
 
+    /**
+     * Counter currently implemented
+     */
     private volatile Counter currentCounter;
 
+    /**
+     * The counter that is currently in process of flushing to Cassandra.  Can be null
+     */
+    private volatile Counter flushPending;
+
 
     /**
      * Create a time shard approximation with the correct configuration.
@@ -108,6 +114,10 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
 
         try {
             count = currentCounter.get( key );
+
+            if ( flushPending != null ) {
+                count += flushPending.get( key );
+            }
         }
         finally {
             readLock.unlock();
@@ -121,12 +131,11 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
 
     @Override
     public void flush() {
-        final Counter toFlush;
 
         writeLockLock.lock();
 
         try {
-            toFlush = currentCounter;
+            flushPending = currentCounter;
             currentCounter = new Counter();
         }
         finally {
@@ -135,7 +144,7 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
 
 
         //copy to the batch outside of the command for performance
-        final MutationBatch batch =  nodeShardCounterSerialization.flush( toFlush );
+        final MutationBatch batch = nodeShardCounterSerialization.flush( flushPending );
 
         /**
          * Execute the command in hystrix to avoid slamming cassandra
@@ -156,11 +165,20 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
             @Override
             protected Object getFallback() {
                 //we've failed to mutate.  Merge this count back into the current one
-                currentCounter.merge( toFlush );
+                currentCounter.merge( flushPending );
 
                 return null;
             }
         }.execute();
+
+        writeLockLock.lock();
+
+        try {
+            flushPending = null;
+        }
+        finally {
+            writeLockLock.unlock();
+        }
     }
 
 
@@ -169,22 +187,21 @@ public class NodeShardApproximationImpl implements NodeShardApproximation {
      */
     private void checkFlush() {
 
-        //we shouldn't flush we've not pass our timeout
-        if ( currentCounter.getCreateTimestamp() + graphFig.getCounterFlushInterval() > timeService.getCurrentTime()
-                //or we're not past the invocation count
-                && currentCounter.getInvokeCount() < graphFig.getCounterFlushCount() ) {
-            return;
+        //there's no flush pending and we're past the timeout or count
+        if ( flushPending == null && (
+                currentCounter.getCreateTimestamp() + graphFig.getCounterFlushInterval() > timeService.getCurrentTime()
+                        || currentCounter.getInvokeCount() >= graphFig.getCounterFlushCount() ) ) {
+
+
+            /**
+             * Fire the flush action asynchronously
+             */
+            Schedulers.immediate().createWorker().schedule( new Action0() {
+                @Override
+                public void call() {
+                    flush();
+                }
+            } );
         }
-
-
-        /**
-         * Fire the flush action asynchronously
-         */
-        Schedulers.immediate().createWorker().schedule( new Action0() {
-            @Override
-            public void call() {
-                flush();
-            }
-        } );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
index c28b693..cf70669 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
@@ -55,18 +55,16 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
     private final NodeShardApproximation nodeShardApproximation;
     private final TimeService timeService;
     private final GraphFig graphFig;
-    private final Keyspace keyspace;
 
 
     @Inject
     public NodeShardAllocationImpl( final EdgeShardSerialization edgeShardSerialization,
-                                    final  NodeShardApproximation nodeShardApproximation,
-                                    final TimeService timeService, final GraphFig graphFig, final Keyspace keyspace ) {
+                                    final NodeShardApproximation nodeShardApproximation,
+                                    final TimeService timeService, final GraphFig graphFig ) {
         this.edgeShardSerialization = edgeShardSerialization;
         this.nodeShardApproximation = nodeShardApproximation;
         this.timeService = timeService;
         this.graphFig = graphFig;
-        this.keyspace = keyspace;
     }
 
 
@@ -77,59 +75,59 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
                 edgeShardSerialization.getEdgeMetaData( scope, nodeId, maxShardId, edgeTypes );
 
         final PushbackIterator<Long> pushbackIterator = new PushbackIterator( existingShards );
-
-
-        final long now = timeService.getCurrentTime();
-
-
-        final List<Long> futures = new ArrayList<Long>();
-
-
-        //loop through all shards, any shard > now+1 should be deleted
-        while ( pushbackIterator.hasNext() ) {
-
-            final Long value = pushbackIterator.next();
-
-            //we're done, our current time uuid is greater than the value stored
-            if ( now >= value ) {
-                //push it back into the iterator
-                pushbackIterator.pushback( value );
-                break;
-            }
-
-            futures.add( value );
-        }
-
-
-        //we have more than 1 future value, we need to remove it
-
-        MutationBatch cleanup = keyspace.prepareMutationBatch();
-
-        //remove all futures except the last one, it is the only value we shouldn't lazy remove
-        for ( int i = 0; i < futures.size() -1; i++ ) {
-            final long toRemove = futures.get( i );
-
-            final MutationBatch batch = edgeShardSerialization.removeEdgeMeta( scope, nodeId, toRemove, edgeTypes );
-
-            cleanup.mergeShallow( batch );
-        }
-
-
-        try {
-            cleanup.execute();
-        }
-        catch ( ConnectionException e ) {
-            throw new GraphRuntimeException( "Unable to remove future shards, mutation error", e );
-        }
-
-
-        final int futuresSize =  futures.size();
-
-        if ( futuresSize > 0 ) {
-            pushbackIterator.pushback( futures.get( futuresSize - 1 ) );
-        }
-
-
+//
+//
+//        final long now = timeService.getCurrentTime();
+//
+//
+//        final List<Long> futures = new ArrayList<Long>();
+//
+//
+//        //loop through all shards, any shard > now+1 should be deleted
+//        while ( pushbackIterator.hasNext() ) {
+//
+//            final Long value = pushbackIterator.next();
+//
+//            //we're done, our current time uuid is greater than the value stored
+//            if ( now >= value ) {
+//                //push it back into the iterator
+//                pushbackIterator.pushback( value );
+//                break;
+//            }
+//
+//            futures.add( value );
+//        }
+//
+//
+//        //we have more than 1 future value, we need to remove it
+//
+//        MutationBatch cleanup = keyspace.prepareMutationBatch();
+//
+//        //remove all futures except the last one, it is the only value we shouldn't lazy remove
+//        for ( int i = 0; i < futures.size() -1; i++ ) {
+//            final long toRemove = futures.get( i );
+//
+//            final MutationBatch batch = edgeShardSerialization.removeEdgeMeta( scope, nodeId, toRemove, edgeTypes );
+//
+//            cleanup.mergeShallow( batch );
+//        }
+//
+//
+//        try {
+//            cleanup.execute();
+//        }
+//        catch ( ConnectionException e ) {
+//            throw new GraphRuntimeException( "Unable to remove future shards, mutation error", e );
+//        }
+//
+//
+//        final int futuresSize =  futures.size();
+//
+//        if ( futuresSize > 0 ) {
+//            pushbackIterator.pushback( futures.get( futuresSize - 1 ) );
+//        }
+//
+//
         /**
          * Nothing to iterate, return an iterator with 0.
          */
@@ -183,10 +181,4 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
         return true;
     }
 
-
-    @Override
-    public void increment( final ApplicationScope scope, final Id nodeId, final long shardId, final long amount,
-                           final String... edgeTypes ) {
-       nodeShardApproximation.increment( scope, nodeId, shardId, amount, edgeTypes );
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
index d34c625..3b78898 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
@@ -139,13 +139,6 @@ public class NodeShardCacheImpl implements NodeShardCache {
         return iterator;
     }
 
-
-    @Override
-    public void increment( final ApplicationScope scope, final Id nodeId, final long shard, final long count, final String... edgeTypes ) {
-        nodeShardAllocation.increment( scope, nodeId, shard, count, edgeTypes );
-    }
-
-
     /**
      * This is a race condition.  We could re-init the shard while another thread is reading it.  This is fine, the read
      * doesn't have to be precise.  The algorithm accounts for stale data.
@@ -160,12 +153,12 @@ public class NodeShardCacheImpl implements NodeShardCache {
                       @Override
                       public CacheEntry load( final CacheKey key ) throws Exception {
 
-
-                          /**
-                           * Perform an audit in case we need to allocate a new shard
-                           */
-                          nodeShardAllocation.auditMaxShard( key.scope, key.id, key.types );
-                          //TODO, we need to put some sort of upper bounds on this, it could possibly get too large
+//
+//                          /**
+//                           * Perform an audit in case we need to allocate a new shard
+//                           */
+//                          nodeShardAllocation.auditMaxShard( key.scope, key.id, key.types );
+//                          //TODO, we need to put some sort of upper bounds on this, it could possibly get too large
 
 
                           final Iterator<Long> edges = nodeShardAllocation

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeShardStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeShardStrategy.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeShardStrategy.java
index c1dd2dc..f246f23 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeShardStrategy.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeShardStrategy.java
@@ -21,10 +21,10 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard.impl;
 
 
 import java.util.Iterator;
-import java.util.UUID;
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardStrategy;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardCache;
 import org.apache.usergrid.persistence.model.entity.Id;
 
@@ -40,11 +40,15 @@ public class SizebasedEdgeShardStrategy implements EdgeShardStrategy {
 
 
     private final NodeShardCache shardCache;
+    private final NodeShardApproximation shardApproximation;
 
 
     @Inject
-    public SizebasedEdgeShardStrategy( final NodeShardCache shardCache ) {this.shardCache = shardCache;}
-
+    public SizebasedEdgeShardStrategy( final NodeShardCache shardCache,
+                                       final NodeShardApproximation shardApproximation ) {
+        this.shardCache = shardCache;
+        this.shardApproximation = shardApproximation;
+    }
 
 
     @Override
@@ -62,9 +66,9 @@ public class SizebasedEdgeShardStrategy implements EdgeShardStrategy {
 
 
     @Override
-    public void increment( final ApplicationScope scope, final Id rowKeyId,
-                           final long shardId, final long count, final String... types ) {
-        shardCache.increment(  scope, rowKeyId, shardId, count, types );
+    public void increment( final ApplicationScope scope, final Id rowKeyId, final long shardId, final long count,
+                           final String... types ) {
+        shardApproximation.increment( scope, rowKeyId, shardId, count, types );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
index 364bd23..9fa4cbf 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
@@ -29,6 +29,7 @@ import org.junit.Test;
 
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchIdType;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -76,14 +77,7 @@ public abstract class GraphManagerIT {
 
     @Before
     public void mockApp() {
-        this.scope = mock( ApplicationScope.class );
-
-        Id orgId = mock( Id.class );
-
-        when( orgId.getType() ).thenReturn( "organization" );
-        when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
-
-        when( this.scope.getApplication() ).thenReturn( orgId );
+        this.scope = new ApplicationScopeImpl(createId("application")  );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
new file mode 100644
index 0000000..01e07b1
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
@@ -0,0 +1,189 @@
+/*
+ *
+ *  * 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.graph;
+
+
+import java.util.concurrent.TimeoutException;
+
+import org.jukito.UseModules;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+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.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.google.inject.Inject;
+
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+@RunWith( ITRunner.class )
+@UseModules( TestGraphModule.class )
+public class GraphManagerShardingIT {
+
+
+    @Inject
+    @Rule
+    public MigrationManagerRule migrationManagerRule;
+
+
+    @Inject
+    protected GraphManagerFactory emf;
+
+
+    @Inject
+    protected GraphFig graphFig;
+
+    @Inject
+    protected NodeShardApproximation nodeShardApproximation;
+
+    protected ApplicationScope scope;
+
+
+
+
+    @Before
+    public void mockApp() {
+        this.scope = new ApplicationScopeImpl(createId("application")  );
+    }
+
+
+    @Test
+    public void testWriteSourceType() throws TimeoutException, InterruptedException {
+
+        GraphManager gm = emf.createEdgeManager( scope ) ;
+
+        final Id sourceId = createId( "source" );
+        final String edgeType = "test";
+
+
+
+
+        final long flushCount = graphFig.getCounterFlushCount();
+        final long maxShardSize = graphFig.getShardSize();
+
+
+
+
+        final long startTime = System.currentTimeMillis();
+
+        //each edge causes 4 counts
+        final long writeCount = flushCount/4;
+
+        assertTrue( "Shard size must be >= flush Count", maxShardSize >= flushCount );
+
+        Id targetId = null;
+
+        for(long i = 0; i < writeCount; i ++){
+            targetId = createId("target") ;
+
+            final Edge edge = createEdge( sourceId, edgeType, targetId);
+
+            gm.writeEdge( edge ).toBlocking().last();
+
+        }
+
+
+        long shardCount = nodeShardApproximation.getCount( scope, sourceId, 0l, edgeType );
+
+        assertEquals("Shard count for source node should be the same as write count", writeCount, shardCount);
+
+
+        //now verify it's correct for the target
+
+        shardCount = nodeShardApproximation.getCount( scope, targetId, 0l, edgeType );
+
+        assertEquals(1, shardCount);
+
+    }
+
+
+    @Test
+    public void testWriteTargetType() throws TimeoutException, InterruptedException {
+
+        GraphManager gm = emf.createEdgeManager( scope ) ;
+
+        final Id targetId = createId( "target" );
+        final String edgeType = "test";
+
+
+
+
+        final long flushCount = graphFig.getCounterFlushCount();
+        final long maxShardSize = graphFig.getShardSize();
+
+
+
+
+        final long startTime = System.currentTimeMillis();
+
+        //each edge causes 4 counts
+        final long writeCount = flushCount/4;
+
+        assertTrue( "Shard size must be >= flush Count", maxShardSize >= flushCount );
+
+        Id sourceId = null;
+
+        for(long i = 0; i < writeCount; i ++){
+            sourceId = createId("source") ;
+
+            final Edge edge = createEdge( sourceId, edgeType, targetId);
+
+            gm.writeEdge( edge ).toBlocking().last();
+
+        }
+
+
+        long shardCount = nodeShardApproximation.getCount( scope, targetId, 0l, edgeType );
+
+        assertEquals("Shard count for source node should be the same as write count", writeCount, shardCount);
+
+
+        //now verify it's correct for the target
+
+        shardCount = nodeShardApproximation.getCount( scope, sourceId, 0l, edgeType );
+
+        assertEquals(1, shardCount);
+
+    }
+
+
+
+
+}
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index 3b9e074..5c846f1 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -98,7 +98,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardCounterSerialization, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";
@@ -137,7 +137,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardCounterSerialization, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";
@@ -182,7 +182,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";
@@ -234,7 +234,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";
@@ -307,7 +307,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";
@@ -411,7 +411,7 @@ public class NodeShardAllocationTest {
 
         NodeShardAllocation approximation =
                 new NodeShardAllocationImpl( edgeShardSerialization, nodeShardApproximation, timeService,
-                        graphFig, keyspace );
+                        graphFig );
 
         final Id nodeId = createId( "test" );
         final String type = "type";

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2a98cae9/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index e849725..da19ce5 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -423,19 +423,6 @@ public class NodeShardApproximationTest {
             return 0;  //To change body of implemented methods use File | Settings | File Templates.
         }
 
-
-        @Override
-        public int getWriteTimeout() {
-            return 0;  //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        @Override
-        public int getReadTimeout() {
-            return 0;  //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
         @Override
         public int getRepairConcurrentSize() {
             return 0;  //To change body of implemented methods use File | Settings | File Templates.


[20/50] [abbrv] git commit: Merge branch 'master' of https://github.com/usergrid/usergrid into USERGRID-176_fix-maven-3.2

Posted by sn...@apache.org.
Merge branch 'master' of https://github.com/usergrid/usergrid into USERGRID-176_fix-maven-3.2

# By Todd Nine (23) and others
# Via Todd Nine (5) and others
* 'master' of https://github.com/usergrid/usergrid: (42 commits)
  Fixes bug and serializer re-use
  Updated contribution section
  Fixes issue with incorrect page size hint causing too many round trips during iteration.
  Moved many updates to modules and rebuilt SDK
  Added test to prove issue
  updated assets sample in the README
  fixed error in callback for download()
  Added support for new assets functionality with attachAsset() and downloadAsset()
  Removal of the log4j.xml.
  Removed duplicate stdout appender. The same one is added in the properties file, so we do not need the same one in the xml.
  Disabled query validator until we merge in ES changes.
  Revert "Merge pull request #182 from GERey/fix-query-validator-tests"
  Revert "Merge pull request #182 from GERey/fix-query-validator-tests"
  Updates repair process to page through large organization counts.
  Made test 1.6 compatible
  Removed redundant casts
  Revert "Updated source to be 1.7 compatible"
  updated README to reflect info about git-wip as canonical source
  Fixes subtraction issue with Sets.difference not working recursively.
  Updated source to be 1.7 compatible
  ...


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

Branch: refs/pull/206/head
Commit: 6f4423e8900c19b8c61016c6fc0c062f17f29a0e
Parents: 8cb1644 c7b8612
Author: grey <gr...@apigee.com>
Authored: Fri Jun 27 11:33:08 2014 -0700
Committer: grey <gr...@apigee.com>
Committed: Fri Jun 27 11:33:08 2014 -0700

----------------------------------------------------------------------
 README.md                                       |  23 +-
 sdks/html5-javascript/README.md                 |  76 ++--
 sdks/html5-javascript/lib/modules/Asset.js      | 168 ++++++---
 sdks/html5-javascript/lib/modules/Entity.js     | 179 +++++++++-
 sdks/html5-javascript/lib/modules/Group.js      |   2 +-
 sdks/html5-javascript/usergrid.js               | 237 +++++++++++--
 sdks/html5-javascript/usergrid.min.js           |   6 +-
 sdks/nodejs/lib/usergrid.js                     | 156 +++++++++
 .../main/resources/usergrid-default.properties  |   3 +
 stack/config/src/test/resources/log4j.xml       |  40 ---
 .../usergrid/mq/cassandra/QueueManagerImpl.java |  38 +-
 .../mq/cassandra/io/AbstractSearch.java         |   5 +-
 .../mq/cassandra/io/ConsumerTransaction.java    |  12 +-
 .../cassandra/CassandraPersistenceUtils.java    |   9 +-
 .../persistence/cassandra/CassandraService.java | 137 ++------
 .../cassandra/EntityManagerFactoryImpl.java     |   5 +-
 .../cassandra/EntityManagerImpl.java            |  58 ++--
 .../persistence/cassandra/GeoIndexManager.java  |  23 +-
 .../persistence/cassandra/QueryProcessor.java   |  61 +---
 .../cassandra/RelationManagerImpl.java          |  59 ++--
 .../persistence/cassandra/Serializers.java      |  14 +-
 .../persistence/hector/CountingMutator.java     | 344 +++++++++++++++++++
 .../usergrid/persistence/query/ir/AllNode.java  |   6 +
 .../persistence/query/ir/BooleanNode.java       |   6 +
 .../query/ir/EmailIdentifierNode.java           |   6 +
 .../query/ir/NameIdentifierNode.java            |   6 +
 .../usergrid/persistence/query/ir/NotNode.java  |   6 +
 .../persistence/query/ir/OrderByNode.java       |  10 +-
 .../persistence/query/ir/QueryNode.java         |   6 +
 .../persistence/query/ir/SliceNode.java         |   6 +
 .../query/ir/UuidIdentifierNode.java            |   6 +
 .../persistence/query/ir/WithinNode.java        |   6 +
 .../query/ir/result/SubtractionIterator.java    |   2 +-
 .../usergrid/persistence/CountingMutatorIT.java | 134 ++++++++
 .../apache/usergrid/persistence/IndexIT.java    |   4 +-
 .../cassandra/QueryProcessorTest.java           | 105 +++++-
 .../query/IntersectionTransitivePagingIT.java   | 165 +++++++++
 .../query/IntersectionUnionPagingIT.java        |   4 +-
 .../persistence/query/NotSubPropertyIT.java     | 178 ++++++++++
 stack/core/src/test/resources/log4j.properties  |   1 +
 stack/pom.xml                                   |   2 +-
 .../apache/usergrid/rest/AbstractRestIT.java    |  11 +
 .../applications/users/MatrixQueryTests.java    | 212 ++++++++++++
 .../rest/test/resource/MatrixResource.java      |  64 ++++
 .../rest/test/resource/NamedResource.java       |   5 +
 .../rest/test/resource/SetResource.java         |  12 +
 .../rest/test/resource/ValueResource.java       |  18 +-
 .../usergrid/services/ServiceRequest.java       |  11 +-
 .../org/apache/usergrid/tools/AppNameFix.java   |  59 +++-
 .../RepairingMismatchedApplicationMetadata.java |  92 +++--
 stack/tools/src/main/resources/log4j.properties |  45 +++
 stack/tools/src/main/resources/log4j.xml        |  29 --
 52 files changed, 2356 insertions(+), 516 deletions(-)
----------------------------------------------------------------------