You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/03/13 19:24:26 UTC
[1/4] incubator-usergrid git commit: Fixes issue with duplicate pool
size definition
Repository: incubator-usergrid
Updated Branches:
refs/heads/USERGRID-466-change-write-consistency 8cea08db3 -> 45271d7a2
Fixes issue with duplicate pool size definition
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/97634dfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/97634dfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/97634dfc
Branch: refs/heads/USERGRID-466-change-write-consistency
Commit: 97634dfc6c5a8e7192d72567d68fd62bfd67a012
Parents: 19c6ad0
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Mar 12 12:14:58 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Mar 12 12:14:58 2015 -0600
----------------------------------------------------------------------
stack/awscluster/src/main/groovy/configure_elasticsearch.groovy | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/97634dfc/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
index 38b032f..173e4e6 100644
--- a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
+++ b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
@@ -87,7 +87,6 @@ threadpool:
bulk:
type: fixed
size: 160
- size: 16
queue_size: 1000
search:
size: 320
[2/4] incubator-usergrid git commit: Updated queuescope to be name
with no need for application id. We are only using them in our subsystems,
not applications.
Posted by sf...@apache.org.
Updated queuescope to be name with no need for application id. We are only using them in our subsystems, not applications.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/361060ec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/361060ec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/361060ec
Branch: refs/heads/USERGRID-466-change-write-consistency
Commit: 361060ec3c90488a8c944d2f30fc95310bd41453
Parents: 97634df
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Mar 13 09:10:28 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Mar 13 09:10:28 2015 -0600
----------------------------------------------------------------------
.../persistence/index/guice/QueueProvider.java | 116 +++++++++++++++++++
.../usergrid/persistence/queue/QueueScope.java | 2 +-
.../persistence/queue/QueueScopeFactory.java | 34 ------
.../persistence/queue/guice/QueueModule.java | 17 ++-
.../queue/impl/QueueScopeFactoryImpl.java | 48 --------
.../persistence/queue/impl/QueueScopeImpl.java | 27 +----
.../queue/impl/SQSQueueManagerImpl.java | 6 +-
.../persistence/queue/NoAWSCredsRule.java | 81 +++++++++++++
.../persistence/queue/QueueManagerTest.java | 29 ++---
.../services/notifications/QueueListener.java | 5 +-
.../usergrid/services/queues/QueueListener.java | 5 +-
11 files changed, 231 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/QueueProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/QueueProvider.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/QueueProvider.java
new file mode 100644
index 0000000..ea3e046
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/QueueProvider.java
@@ -0,0 +1,116 @@
+/*
+ * 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.index.guice;
+
+
+import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.impl.BufferQueue;
+import org.apache.usergrid.persistence.index.impl.BufferQueueInMemoryImpl;
+import org.apache.usergrid.persistence.index.impl.BufferQueueSQSImpl;
+import org.apache.usergrid.persistence.map.MapManagerFactory;
+import org.apache.usergrid.persistence.queue.QueueManagerFactory;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+
+/**
+ * A provider to allow users to configure their queue impl via properties
+ */
+@Singleton
+public class QueueProvider implements Provider<BufferQueue> {
+
+ private final IndexFig indexFig;
+
+ private final QueueManagerFactory queueManagerFactory;
+ private final MapManagerFactory mapManagerFactory;
+ private final MetricsFactory metricsFactory;
+
+ private BufferQueue bufferQueue;
+
+
+ @Inject
+ public QueueProvider( final IndexFig indexFig, final QueueManagerFactory queueManagerFactory,
+ final MapManagerFactory mapManagerFactory, final MetricsFactory metricsFactory ) {
+ this.indexFig = indexFig;
+
+
+ this.queueManagerFactory = queueManagerFactory;
+ this.mapManagerFactory = mapManagerFactory;
+ this.metricsFactory = metricsFactory;
+ }
+
+
+ @Override
+ @Singleton
+ public BufferQueue get() {
+ if ( bufferQueue == null ) {
+ bufferQueue = getQueue();
+ }
+
+
+ return bufferQueue;
+ }
+
+
+ private BufferQueue getQueue() {
+ final String value = indexFig.getQueueImplementation();
+
+ final Implementations impl = Implementations.valueOf( value );
+
+ switch ( impl ) {
+ case LOCAL:
+ return new BufferQueueInMemoryImpl( indexFig );
+ case SQS:
+ return new BufferQueueSQSImpl( queueManagerFactory, indexFig, mapManagerFactory, metricsFactory );
+ default:
+ throw new IllegalArgumentException( "Configuration value of " + getErrorValues() + " are allowed" );
+ }
+ }
+
+
+ private String getErrorValues() {
+ String values = "";
+
+ for ( final Implementations impl : Implementations.values() ) {
+ values += impl + ", ";
+ }
+
+ values = values.substring( 0, values.length() - 2 );
+
+ return values;
+ }
+
+
+ /**
+ * Different implementations
+ */
+ public static enum Implementations {
+ LOCAL,
+ SQS;
+
+
+ public String asString() {
+ return toString();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
index b2b2ec6..cf6bf24 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScope.java
@@ -21,7 +21,7 @@ package org.apache.usergrid.persistence.queue;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-public interface QueueScope extends ApplicationScope {
+public interface QueueScope {
/**
* Get the name of the the map
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScopeFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScopeFactory.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScopeFactory.java
deleted file mode 100644
index 3a508a9..0000000
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/QueueScopeFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one or more
- * * contributor license agreements. The ASF licenses this file to You
- * * under the Apache License, Version 2.0 (the "License"); you may not
- * * use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License. For additional information regarding
- * * copyright in this work, please see the NOTICE file in the top level
- * * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.persistence.queue;
-
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
-
-import java.util.UUID;
-
-/**
- * Created by ApigeeCorporation on 10/23/14.
- */
-public interface QueueScopeFactory {
-
- public QueueScope getScope( UUID id, String queueName);
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
index 4e487e1..1b2d6ea 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/guice/QueueModule.java
@@ -17,15 +17,16 @@
*/
package org.apache.usergrid.persistence.queue.guice;
-import com.google.inject.AbstractModule;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+import org.safehaus.guicyfig.GuicyFigModule;
+
import org.apache.usergrid.persistence.queue.QueueFig;
import org.apache.usergrid.persistence.queue.QueueManager;
import org.apache.usergrid.persistence.queue.QueueManagerFactory;
-import org.apache.usergrid.persistence.queue.QueueScopeFactory;
-import org.apache.usergrid.persistence.queue.impl.QueueScopeFactoryImpl;
import org.apache.usergrid.persistence.queue.impl.SQSQueueManagerImpl;
-import org.safehaus.guicyfig.GuicyFigModule;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
/**
@@ -43,10 +44,8 @@ public class QueueModule extends AbstractModule {
install( new GuicyFigModule( QueueFig.class) );
// create a guice factory for getting our collection manager
- install(new FactoryModuleBuilder()
- .implement(QueueManager.class, SQSQueueManagerImpl.class)
- .build(QueueManagerFactory.class));
- bind( QueueScopeFactory.class ).to( QueueScopeFactoryImpl.class );
+ install( new FactoryModuleBuilder().implement( QueueManager.class, SQSQueueManagerImpl.class )
+ .build( QueueManagerFactory.class ) );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeFactoryImpl.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeFactoryImpl.java
deleted file mode 100644
index a145a6e..0000000
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeFactoryImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one or more
- * * contributor license agreements. The ASF licenses this file to You
- * * under the Apache License, Version 2.0 (the "License"); you may not
- * * use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License. For additional information regarding
- * * copyright in this work, please see the NOTICE file in the top level
- * * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.persistence.queue.impl;
-
-import com.google.inject.Inject;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.queue.QueueFig;
-import org.apache.usergrid.persistence.queue.QueueScope;
-import org.apache.usergrid.persistence.queue.QueueScopeFactory;
-
-import java.util.UUID;
-
-/**
- * Returns scope for queues.
- */
-public class QueueScopeFactoryImpl implements QueueScopeFactory {
-
- private QueueFig fig;
-
- @Inject
- public QueueScopeFactoryImpl(QueueFig fig){
- this.fig = fig;
- }
-
- //applicationId is always ManagementApplicationId so not really needed here.
- @Override
- public QueueScope getScope(UUID applicationId, String queueName) {
- return new QueueScopeImpl(new SimpleId(applicationId, fig.getPrefix()), queueName);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
index a928803..381cd8e 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueScopeImpl.java
@@ -24,18 +24,14 @@ import org.apache.usergrid.persistence.queue.QueueScope;
* Created by ApigeeCorporation on 10/3/14.
*/
public class QueueScopeImpl implements QueueScope {
- private final Id owner;
+
private final String name;
- public QueueScopeImpl( final Id owner, final String name ) {
- this.owner = owner;
+ public QueueScopeImpl( final String name ) {
this.name = name;
}
- @Override
- public Id getApplication() {
- return owner;
- }
+
@Override
@@ -57,9 +53,7 @@ public class QueueScopeImpl implements QueueScope {
if ( !name.equals( queueScope.name ) ) {
return false;
}
- if ( !owner.equals( queueScope.owner ) ) {
- return false;
- }
+
return true;
}
@@ -67,17 +61,6 @@ public class QueueScopeImpl implements QueueScope {
@Override
public int hashCode() {
- int result = owner.hashCode();
- result = 31 * result + name.hashCode();
- return result;
- }
-
-
- @Override
- public String toString() {
- return "QueueScopeImpl{" +
- "owner=" + owner +
- ", name='" + name + '\'' +
- '}';
+ return name.hashCode();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
index 1fbd9b6..088359a 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SQSQueueManagerImpl.java
@@ -54,6 +54,7 @@ import com.amazonaws.services.sqs.model.SendMessageBatchRequestEntry;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
+import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -124,7 +125,10 @@ public class SQSQueueManagerImpl implements QueueManager {
private String getName() {
- String name = fig.getPrefix() + "_" + scope.getApplication().getType() + "_"+ scope.getName() + "_"+ scope.getApplication().getUuid().toString();
+ String name = fig.getPrefix() + "_" + scope.getName();
+
+ Preconditions.checkArgument(name.length() <= 80, "Your name must be < than 80 characters");
+
return name;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/NoAWSCredsRule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/NoAWSCredsRule.java b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/NoAWSCredsRule.java
new file mode 100644
index 0000000..45218c2
--- /dev/null
+++ b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/NoAWSCredsRule.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.usergrid.persistence.queue;
+
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import com.amazonaws.AmazonClientException;
+
+
+/**
+ * Created in an attempt to mark no aws cred tests as ignored. Blocked by this issue
+ * https://github.com/junit-team/junit/issues/116
+ *
+ * Until then, simply marks as passed, which is a bit dangerous
+ */
+public class NoAWSCredsRule implements TestRule {
+
+ public Statement apply( final Statement base, final Description description ) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+
+ try {
+ base.evaluate();
+ }
+ catch ( Throwable t ) {
+
+ if ( !isMissingCredsException( t ) ) {
+ throw t;
+ }
+
+
+ }
+ }
+ };
+ }
+
+
+ private boolean isMissingCredsException( final Throwable t ) {
+
+ if ( t instanceof AmazonClientException ) {
+
+ final AmazonClientException ace = ( AmazonClientException ) t;
+
+ if ( ace.getMessage().contains( "could not get aws access key" ) || ace.getMessage().contains(
+ "could not get aws secret key from system properties" ) ) {
+ //swallow
+ return true;
+ }
+ }
+
+ final Throwable cause = t.getCause();
+
+ if ( cause == null ) {
+ return false;
+ }
+
+
+ return isMissingCredsException( cause );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
index 935fd16..eecb9e1 100644
--- a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
+++ b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
@@ -25,24 +25,24 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
import org.apache.usergrid.persistence.queue.guice.TestQueueModule;
-import org.apache.usergrid.persistence.queue.impl.QueueScopeFactoryImpl;
import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
+import org.apache.usergrid.persistence.queue.impl.UsergridAwsCredentialsProvider;
import com.google.inject.Inject;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
@RunWith( ITRunner.class )
@UseModules( { TestQueueModule.class } )
@@ -53,8 +53,12 @@ public class QueueManagerTest {
@Inject
protected QueueManagerFactory qmf;
- @Inject
- protected QueueScopeFactory queueScopeFactory;
+ /**
+ * Mark tests as ignored if now AWS creds are present
+ */
+ @Rule
+ public NoAWSCredsRule awsCredsRule = new NoAWSCredsRule();
+
protected QueueScope scope;
private QueueManager qm;
@@ -62,21 +66,11 @@ public class QueueManagerTest {
@Before
public void mockApp() {
- this.scope = new QueueScopeImpl( new SimpleId( "application" ), "testQueue" );
+ this.scope = new QueueScopeImpl( "testQueue" );
qm = qmf.getQueueManager(scope);
- queueScopeFactory = new QueueScopeFactoryImpl(queueFig);
}
- @Test
- public void scopeFactory(){
- UUID uuid = UUID.randomUUID();
- String key = "test";
- QueueScope scope =queueScopeFactory.getScope(uuid,key);
- assertEquals(key,scope.getName());
- assertEquals(scope.getApplication().getUuid(),uuid);
- }
- @Ignore("need aws creds")
@Test
public void send() throws IOException,ClassNotFoundException{
String value = "bodytest";
@@ -92,7 +86,6 @@ public class QueueManagerTest {
}
- @Ignore("need aws creds")
@Test
public void sendMore() throws IOException,ClassNotFoundException{
HashMap<String,String> values = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
index d34cc22..e45b82a 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
@@ -29,6 +29,7 @@ import org.apache.usergrid.persistence.EntityManagerFactory;
import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
import org.apache.usergrid.persistence.queue.*;
import org.apache.usergrid.persistence.queue.QueueManager;
+import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
import org.apache.usergrid.services.ServiceManager;
import org.apache.usergrid.services.ServiceManagerFactory;
import org.apache.usergrid.services.notifications.impl.ApplicationQueueManagerImpl;
@@ -47,7 +48,6 @@ import java.util.concurrent.atomic.AtomicInteger;
public class QueueListener {
public final int MESSAGE_TRANSACTION_TIMEOUT = 25 * 1000;
private final QueueManagerFactory queueManagerFactory;
- private final QueueScopeFactory queueScopeFactory;
public long DEFAULT_SLEEP = 5000;
@@ -84,7 +84,6 @@ public class QueueListener {
this.emf = emf;
this.metricsService = smf.getApplicationContext().getBean( Injector.class ).getInstance(MetricsFactory.class);
this.properties = props;
- this.queueScopeFactory = smf.getApplicationContext().getBean( Injector.class ).getInstance(QueueScopeFactory.class);
}
/**
@@ -146,7 +145,7 @@ public class QueueListener {
com.codahale.metrics.Timer timer = metricsService.getTimer(QueueListener.class, "dequeue");
svcMgr = smf.getServiceManager(smf.getManagementAppId());
LOG.info("getting from queue {} ", queueName);
- QueueScope queueScope = queueScopeFactory.getScope(smf.getManagementAppId(), queueName);
+ QueueScope queueScope = new QueueScopeImpl( queueName ) {};
QueueManager queueManager = TEST_QUEUE_MANAGER != null ? TEST_QUEUE_MANAGER : queueManagerFactory.getQueueManager(queueScope);
// run until there are no more active jobs
long runCount = 0;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/361060ec/stack/services/src/main/java/org/apache/usergrid/services/queues/QueueListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/queues/QueueListener.java b/stack/services/src/main/java/org/apache/usergrid/services/queues/QueueListener.java
index 8277e86..b87904e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/queues/QueueListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/queues/QueueListener.java
@@ -29,6 +29,7 @@ import org.apache.usergrid.persistence.EntityManagerFactory;
import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
import org.apache.usergrid.persistence.queue.*;
import org.apache.usergrid.persistence.queue.QueueManager;
+import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
import org.apache.usergrid.services.ServiceManager;
import org.apache.usergrid.services.ServiceManagerFactory;
import org.apache.usergrid.services.notifications.impl.ApplicationQueueManagerImpl;
@@ -48,7 +49,6 @@ import java.util.concurrent.atomic.AtomicInteger;
public abstract class QueueListener {
public final int MESSAGE_TRANSACTION_TIMEOUT = 25 * 1000;
private final QueueManagerFactory queueManagerFactory;
- private final QueueScopeFactory queueScopeFactory;
public long DEFAULT_SLEEP = 5000;
@@ -93,7 +93,6 @@ public abstract class QueueListener {
this.emf = injector.getInstance( EntityManagerFactory.class ); //emf;
this.metricsService = injector.getInstance(MetricsFactory.class);
this.properties = props;
- this.queueScopeFactory = injector.getInstance(QueueScopeFactory.class);
}
@@ -165,7 +164,7 @@ public abstract class QueueListener {
com.codahale.metrics.Timer timer = metricsService.getTimer(QueueListener.class, "dequeue");
svcMgr = smf.getServiceManager(smf.getManagementAppId());
LOG.info("getting from queue {} ", queueName);
- QueueScope queueScope = queueScopeFactory.getScope(smf.getManagementAppId(), queueName);
+ QueueScope queueScope = new QueueScopeImpl( queueName);
QueueManager queueManager = TEST_QUEUE_MANAGER != null ? TEST_QUEUE_MANAGER : queueManagerFactory.getQueueManager(queueScope);
// run until there are no more active jobs
long runCount = 0;
[4/4] incubator-usergrid git commit: Merge branch 'USERGRID-466' into
USERGRID-466-change-write-consistency
Posted by sf...@apache.org.
Merge branch 'USERGRID-466' into USERGRID-466-change-write-consistency
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/45271d7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/45271d7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/45271d7a
Branch: refs/heads/USERGRID-466-change-write-consistency
Commit: 45271d7a26ad61063a13307ad567882afe387acc
Parents: 8cea08d 9d00c22
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Mar 13 12:24:16 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Mar 13 12:24:16 2015 -0600
----------------------------------------------------------------------
.../main/groovy/configure_elasticsearch.groovy | 1 -
.../persistence/index/guice/QueueProvider.java | 116 +++++++++++++++++++
.../usergrid/persistence/queue/QueueScope.java | 2 +-
.../persistence/queue/QueueScopeFactory.java | 34 ------
.../persistence/queue/guice/QueueModule.java | 17 ++-
.../queue/impl/QueueScopeFactoryImpl.java | 48 --------
.../persistence/queue/impl/QueueScopeImpl.java | 27 +----
.../queue/impl/SQSQueueManagerImpl.java | 6 +-
.../persistence/queue/NoAWSCredsRule.java | 81 +++++++++++++
.../persistence/queue/QueueManagerTest.java | 31 ++---
.../services/notifications/QueueListener.java | 5 +-
.../usergrid/services/queues/QueueListener.java | 5 +-
12 files changed, 232 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
[3/4] incubator-usergrid git commit: Merge branch 'USERGRID-466' of
https://git-wip-us.apache.org/repos/asf/incubator-usergrid into USERGRID-466
Posted by sf...@apache.org.
Merge branch 'USERGRID-466' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into USERGRID-466
Conflicts:
stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/QueueManagerTest.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/9d00c223
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/9d00c223
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/9d00c223
Branch: refs/heads/USERGRID-466-change-write-consistency
Commit: 9d00c2235111954abbbcf9e26afacca74df1c1bd
Parents: a1b557d 361060e
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Mar 13 12:23:53 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Mar 13 12:23:53 2015 -0600
----------------------------------------------------------------------
.../main/groovy/configure_elasticsearch.groovy | 1 -
.../persistence/index/guice/QueueProvider.java | 116 +++++++++++++++++++
.../usergrid/persistence/queue/QueueScope.java | 2 +-
.../persistence/queue/QueueScopeFactory.java | 34 ------
.../persistence/queue/guice/QueueModule.java | 17 ++-
.../queue/impl/QueueScopeFactoryImpl.java | 48 --------
.../persistence/queue/impl/QueueScopeImpl.java | 27 +----
.../queue/impl/SQSQueueManagerImpl.java | 6 +-
.../persistence/queue/NoAWSCredsRule.java | 81 +++++++++++++
.../persistence/queue/QueueManagerTest.java | 31 ++---
.../services/notifications/QueueListener.java | 5 +-
.../usergrid/services/queues/QueueListener.java | 5 +-
12 files changed, 232 insertions(+), 141 deletions(-)
----------------------------------------------------------------------