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 2014/12/11 21:52:54 UTC
[01/10] incubator-usergrid git commit: Finished first pass in core
Repository: incubator-usergrid
Updated Branches:
refs/heads/UG-rest-test-framework-overhaul 8437af50a -> ce26189f3
Finished first pass in core
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bc93f693
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bc93f693
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bc93f693
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: bc93f693a7a85c89dc59304fba825209e385ebfc
Parents: 43ed846
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 11:40:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 11:40:45 2014 -0700
----------------------------------------------------------------------
stack/core/pom.xml | 15 +---
.../org/apache/usergrid/AbstractCoreIT.java | 12 ++-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ------------
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 --------------------
.../usergrid/ConcurrentCoreTestSuite.java | 46 -----------
.../java/org/apache/usergrid/CoreITSuite.java | 58 --------------
.../java/org/apache/usergrid/CoreTestSuite.java | 45 -----------
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ------------
.../usergrid/batch/SchedulerTestSuite.java | 34 --------
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +++--
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 ++---
.../cassandra/EntityManagerFactoryImplIT.java | 21 +++--
.../query/AbstractIteratingQueryIT.java | 15 +++-
.../system/UsergridSystemMonitorIT.java | 14 +++-
15 files changed, 76 insertions(+), 413 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 61ce099..e5cdae5 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -183,19 +183,10 @@
<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 ${ug.argline}</argLine>
<includes>
- <include>**/*ConcurrentCoreITSuite.java</include>
- <include>**/SchedulerTestSuite.java</include>
- <include>**/SchedulerRuntime*IT.java</include>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
</includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/CoreITSuite.java</exclude>
- <exclude>**/CoreTestSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerITSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerTestSuite.java</exclude>
- <exclude>**/*Test.java</exclude>
- </excludes>
+
</configuration>
<version>2.15</version>
</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
index f58e426..da80714 100644
--- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
@@ -21,6 +21,9 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.JsonUtils;
@@ -29,7 +32,14 @@ public abstract class AbstractCoreIT {
private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class );
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl( CoreITSuite.cassandraResource, CoreITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
deleted file mode 100644
index d981ee9..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
+++ /dev/null
@@ -1,51 +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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- // HectorLockManagerIT.class,
- UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class, EntityConnectionsIT.class,
- EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class, MessagesIT.class,
- PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class ConcurrentCoreITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
deleted file mode 100644
index 1312950..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
+++ /dev/null
@@ -1,83 +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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.persistence.query.AllInCollectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionNoTypeIT;
-import org.apache.usergrid.persistence.query.MultiOrderByCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualConnectionIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- AllInCollectionIT.class, AllInConnectionIT.class, AllInConnectionNoTypeIT.class, MultiOrderByCollectionIT.class,
- MultiOrderByComplexUnionCollectionIT.class, MultiOrderByComplexUnionConnectionIT.class,
- SingleOrderByBoundRangeScanAscCollectionIT.class, SingleOrderByBoundRangeScanAscConnectionIT.class,
- SingleOrderByBoundRangeScanDescCollectionIT.class, SingleOrderByBoundRangeScanDescConnectionIT.class,
- SingleOrderByComplexIntersectionCollectionIT.class, SingleOrderByComplexIntersectionConnectionIT.class,
- SingleOrderByComplexUnionCollectionIT.class, SingleOrderByComplexUnionConnectionIT.class,
- SingleOrderByLessThanLimitCollectionIT.class, SingleOrderByLessThanLimitConnectionIT.class,
- SingleOrderByMaxLimitCollectionIT.class, SingleOrderByMaxLimitConnectionIT.class,
- SingleOrderByNoIntersectionCollectionIT.class, SingleOrderByNoIntersectionConnectionIT.class,
- SingleOrderByNotCollectionIT.class, SingleOrderByNotConnectionIT.class,
- SingleOrderBySameRangeScanGreaterCollectionIT.class, SingleOrderBySameRangeScanGreaterConnectionIT.class,
- SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.class, SingleOrderBySameRangeScanLessCollectionIT.class,
- SingleOrderBySameRangeScanLessConnectionIT.class, SingleOrderBySameRangeScanLessThanEqualCollectionIT.class,
- SingleOrderBySameRangeScanLessThanEqualConnectionIT.class
-})
-@Concurrent(threads = 1)
-public class ConcurrentCoreIteratorITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
deleted file mode 100644
index 56c7871..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
+++ /dev/null
@@ -1,46 +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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class ConcurrentCoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
deleted file mode 100644
index ff06a80..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
+++ /dev/null
@@ -1,58 +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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.cassandra.HectorLockManagerIT;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- HectorLockManagerIT.class, UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class,
- EntityConnectionsIT.class, EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class,
- MessagesIT.class, PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class CoreITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
deleted file mode 100644
index 314b4e5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
+++ /dev/null
@@ -1,45 +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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class CoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
deleted file mode 100644
index f8c9f87..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
+++ /dev/null
@@ -1,50 +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.batch;
-
-
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.job.SchedulerRuntime1IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime2IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime3IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime4IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime5IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime6IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime7IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime8IT;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- SchedulerRuntime1IT.class, SchedulerRuntime2IT.class, SchedulerRuntime3IT.class,
- SchedulerRuntime4IT.class, SchedulerRuntime5IT.class, SchedulerRuntime6IT.class,
- SchedulerRuntime7IT.class, SchedulerRuntime8IT.class
- })
-@Concurrent()
-@Ignore("TODO: Todd fix. Does not reliably pass on our build server.")
-// TODO - this suite actually runs correctly now so we can
-// remove this ignore if Todd is OK with it.
-public class SchedulerITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
deleted file mode 100644
index 7e62dd5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
+++ /dev/null
@@ -1,34 +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.batch;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.AppArgsTest;
-import org.apache.usergrid.batch.BulkJobExecutionUnitTest;
-import org.apache.usergrid.batch.UsergridJobFactoryTest;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class,
- })
-@Concurrent()
-public class SchedulerTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
index f939d0d..1d87b73 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -17,20 +17,20 @@
package org.apache.usergrid.batch.job;
-import com.google.common.util.concurrent.Service.State;
import java.util.Properties;
-import org.apache.usergrid.batch.SchedulerITSuite;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+
import org.apache.usergrid.batch.service.JobSchedulerService;
import org.apache.usergrid.batch.service.SchedulerService;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.SchemaManager;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Ignore;
+import com.google.common.util.concurrent.Service.State;
/**
@@ -44,8 +44,10 @@ public class AbstractSchedulerRuntimeIT {
protected static final String RUNLOOP_PROP = "usergrid.scheduler.job.interval";
protected static final String FAIL_PROP = "usergrid.scheduler.job.maxfail";
+
@ClassRule
- public static CassandraResource cassandraResource = SchedulerITSuite.cassandraResource;
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
index e360244..8a596a5 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
@@ -22,15 +22,15 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.count.SimpleBatcher;
import org.apache.usergrid.persistence.entities.Event;
@@ -61,7 +61,7 @@ public class CounterIT extends AbstractCoreIT {
@Before
public void getSubmitter() {
//set the batcher to block the submit so we wait for results when testing
- SimpleBatcher batcher = CoreITSuite.cassandraResource.getBean( SimpleBatcher.class );
+ SimpleBatcher batcher = cassandraResource.getBean( SimpleBatcher.class );
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index e839fa1..dc6593b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -21,13 +21,14 @@ import java.nio.ByteBuffer;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
-import me.prettyprint.hector.api.Keyspace;
-import static me.prettyprint.hector.api.factory.HFactory.createMutator;
-import me.prettyprint.hector.api.mutation.Mutator;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.cassandra.CassandraService;
import org.apache.usergrid.persistence.cassandra.IndexUpdate;
@@ -37,12 +38,14 @@ import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
+import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.mutation.Mutator;
+
+import static me.prettyprint.hector.api.factory.HFactory.createMutator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Concurrent()
@@ -445,7 +448,7 @@ public class IndexIT extends AbstractCoreIT {
RelationManagerImpl impl = (RelationManagerImpl)rm;
- CassandraService cass = CoreITSuite.cassandraResource.getBean( CassandraService.class );
+ CassandraService cass = cassandraResource.getBean( CassandraService.class );
ByteBufferSerializer buf = ByteBufferSerializer.get();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
index 4cc0dbd..4edd121 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
@@ -22,16 +22,19 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.ClassRule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
@@ -41,6 +44,7 @@ import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.cassandra.util.TraceTag;
import org.apache.usergrid.persistence.cassandra.util.TraceTagManager;
import org.apache.usergrid.persistence.cassandra.util.TraceTagReporter;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -57,8 +61,15 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
private static final Logger logger = LoggerFactory.getLogger( EntityManagerFactoryImplIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
public EntityManagerFactoryImplIT() {
- emf = CoreITSuite.cassandraResource.getBean( EntityManagerFactory.class );
+ emf = cassandraResource.getBean( EntityManagerFactory.class );
}
@@ -89,9 +100,9 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
@Before
public void initTracing() {
- traceTagManager = CoreITSuite.cassandraResource.getBean(
+ traceTagManager = cassandraResource.getBean(
"traceTagManager", TraceTagManager.class );
- traceTagReporter = CoreITSuite.cassandraResource.getBean(
+ traceTagReporter = cassandraResource.getBean(
"traceTagReporter", TraceTagReporter.class );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
index d8f31ff..ff47846 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
@@ -30,11 +30,12 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.ConcurrentCoreIteratorITSuite;
import org.apache.usergrid.CoreApplication;
import org.apache.usergrid.CoreITSetup;
import org.apache.usergrid.CoreITSetupImpl;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.persistence.Entity;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.persistence.Results;
@@ -48,10 +49,16 @@ public abstract class AbstractIteratingQueryIT {
public static final long WRITE_DELAY = 0; // milliseconds to delay between writes in loop
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl(
- ConcurrentCoreIteratorITSuite.cassandraResource,
- ConcurrentCoreIteratorITSuite.elasticSearchResource );
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
index 7456106..a9f9e18 100644
--- a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
@@ -20,13 +20,15 @@ package org.apache.usergrid.system;
import java.util.Date;
import org.junit.Before;
+import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.usergrid.CoreITSuite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.utils.MapUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.utils.MapUtils;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,12 +36,16 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent
public class UsergridSystemMonitorIT {
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
private UsergridSystemMonitor usergridSystemMonitor;
@Before
public void setupLocal() {
- usergridSystemMonitor = CoreITSuite.cassandraResource.getBean( UsergridSystemMonitor.class );
+ usergridSystemMonitor = cassandraResource.getBean( UsergridSystemMonitor.class );
}
[03/10] incubator-usergrid git commit: Finished rule for use in tests
and completed ExportServiceIT migration to the rule
Posted by sf...@apache.org.
Finished rule for use in tests and completed ExportServiceIT migration to the rule
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/cfff0cce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/cfff0cce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/cfff0cce
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: cfff0cce4faeeeee8dfbe3add8e622809db0c7bd
Parents: 5baf6cd
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:05:37 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:06:10 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 160 +++++++++++++++++++
.../management/cassandra/ExportServiceIT.java | 48 +++---
.../org/apache/usergrid/UUIDTestHelper.java | 38 +++++
3 files changed, 228 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
new file mode 100644
index 0000000..71a4740
--- /dev/null
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -0,0 +1,160 @@
+/*
+ * 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;
+
+
+import java.util.UUID;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.management.ApplicationInfo;
+import org.apache.usergrid.management.OrganizationInfo;
+import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.management.UserInfo;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+
+
+/**
+ * Creates a new org and admin for every method in the class. Also creates an application
+ */
+public class NewOrgAppAdminRule implements TestRule {
+
+ private final static Logger LOG = LoggerFactory.getLogger( CoreApplication.class );
+
+ public static final String ADMIN_NAME = "Test Admin";
+ public static final String ADMIN_PASSWORD = "password";
+
+ private final ServiceITSetup setup;
+
+ private OrganizationOwnerInfo organizationOwnerInfo;
+ private ApplicationInfo applicationInfo;
+
+
+ public NewOrgAppAdminRule( final ServiceITSetup setup ) {
+ this.setup = setup;
+ }
+
+
+ @Override
+ public Statement apply( final Statement base, final Description description ) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ before( description );
+
+ try {
+ base.evaluate();
+ }
+ finally {
+ after( description );
+ }
+ }
+ };
+ }
+
+
+ protected void after( Description description ) {
+ LOG.info( "Test {}: finish with application", description.getDisplayName() );
+ }
+
+
+ /**
+ * Get the org and admin user info
+ * @return
+ */
+ public OrganizationOwnerInfo getOrganizationOwnerInfo() {
+ return organizationOwnerInfo;
+ }
+
+
+ /**
+ * Get the applicationInfo
+ * @return
+ */
+ public ApplicationInfo getApplicationInfo() {
+ return applicationInfo;
+ }
+
+
+ /**
+ * Get the organization info
+ * @return
+ */
+ public OrganizationInfo getOrganizationInfo(){
+ return getOrganizationOwnerInfo().getOrganization();
+ }
+
+
+ /**
+ * Get the admin info
+ * @return
+ */
+ public UserInfo getAdminInfo(){
+ return getOrganizationOwnerInfo().getOwner();
+ }
+
+
+ /**
+ * Create the org admin and application
+ */
+ protected void before( Description description ) throws Exception {
+ final String className = description.getClassName();
+ final String methodName = description.getMethodName();
+ final String uuidString = newUUIDString();
+
+ final String orgName = className + uuidString;
+ final String appName = methodName;
+ final String adminUsername = uuidString;
+ final String email = uuidString + "@apache.org";
+
+ organizationOwnerInfo = createOwnerAndOrganization( orgName, adminUsername, email, ADMIN_NAME, ADMIN_PASSWORD );
+ applicationInfo = createApplication( organizationOwnerInfo.getOrganization().getUuid(), appName );
+ }
+
+
+ /**
+ * Create the org and the admin that owns it
+ */
+ public OrganizationOwnerInfo createOwnerAndOrganization( final String orgName, final String adminUsername,
+ final String adminEmail, final String adminName,
+ final String adminPassword ) throws Exception {
+ return setup.getMgmtSvc()
+ .createOwnerAndOrganization( orgName, adminUsername, adminName, adminEmail, adminPassword, false,
+ false );
+ }
+
+
+ /**
+ * Create the new application
+ */
+ public ApplicationInfo createApplication( final UUID organizationId, final String applicationName )
+ throws Exception {
+ return setup.getMgmtSvc().createApplication( organizationId, applicationName );
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index a5b499b..2c64836 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -35,7 +35,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.netty.config.NettyPayloadModule;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -43,6 +43,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.batch.JobExecution;
@@ -65,6 +66,7 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -88,24 +90,33 @@ public class ExportServiceIT {
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
- @BeforeClass
- public static void setup() throws Exception {
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private OrganizationInfo organization;
+ private UUID applicationId;
+
+
+
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "grey", "George Reyes", "george@reyes.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "george-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "george-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ organization = orgAppAdminRule.getOrganizationInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
setup.getEmf().refreshIndex();
}
@@ -288,8 +299,9 @@ public class ExportServiceIT {
catch ( Exception e ) {
//consumed because this checks to see if the file exists. If it doesn't then don't do anything and carry on.
}
- setup.getMgmtSvc()
- .createOwnerAndOrganization( "noExport", "junkUserName", "junkRealName", "ugExport@usergrid.com",
+
+ //create another org to ensure we don't export it
+ orgAppAdminRule.createOwnerAndOrganization( "noExport"+newUUIDString(), "junkUserName"+newUUIDString(), "junkRealName"+newUUIDString(), newUUIDString()+"ugExport@usergrid.com",
"123456789" );
S3Export s3Export = new MockS3ExportImpl("exportOneOrg.json");
@@ -334,8 +346,8 @@ public class ExportServiceIT {
public void testExportOneAppOnCollectionEndpoint() throws Exception {
File f = null;
- String orgName = "george-organization";
- String appName = "testAppCollectionTestNotExported";
+ String orgName = "george-organization"+newUUIDString();
+ String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -607,8 +619,8 @@ public class ExportServiceIT {
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss" + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" + i );
+ orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
new file mode 100644
index 0000000..dffe826
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class UUIDTestHelper {
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
[02/10] incubator-usergrid git commit: Updated maven config
Posted by sf...@apache.org.
Updated maven config
Remove suite classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5baf6cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5baf6cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5baf6cd8
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 5baf6cd87174d3303cc5b9a935dc19bc009f7de0
Parents: bc93f69
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 12:04:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 12:04:48 2014 -0700
----------------------------------------------------------------------
stack/services/pom.xml | 268 ++++---------------
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 15 +-
.../usergrid/management/OrganizationIT.java | 13 +-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 12 +-
.../management/cassandra/ExportServiceIT.java | 10 +-
.../cassandra/ManagementServiceIT.java | 11 +-
.../security/providers/FacebookProviderIT.java | 14 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 15 +-
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
14 files changed, 150 insertions(+), 383 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index 0537613..dd94eb7 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -46,199 +46,7 @@
</plugins>
</reporting>
- <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>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <!-- 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 ${ug.argline}</argLine>
-
- <includes>
- <include>**/ServiceTestSuite.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>**/ConcurrentService*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>${services.it.parallel}</parallel>
- <threadCount>${services.it.threadCount}</threadCount>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/*IT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*Concurrent*Suite.java</exclude>
- <exclude>**/ExportServiceIT.java</exclude>
- <exclude>**/ActivitiesServiceIT.java</exclude>
- <exclude>**/ApplicationCreatorIT.java</exclude>
- <exclude>**/ApplicationsServiceIT.java</exclude>
- <exclude>**/CollectionServiceIT.java</exclude>
- <exclude>**/ConnectionsServiceIT.java</exclude>
- <exclude>**/ManagementServiceIT.java</exclude>
- <exclude>**/EmailFlowIT.java</exclude>
- <exclude>**/FacebookProviderIT.java</exclude>
- <exclude>**/GroupServiceIT.java</exclude>
- <exclude>**/OrganizationIT.java</exclude>
- <exclude>**/PingIdentityProviderIT.java</exclude>
- <exclude>**/RoleIT.java</exclude>
- <exclude>**/RolesServiceIT.java</exclude>
- <exclude>**/ServiceRequestIT.java</exclude>
- <exclude>**/ServiceFactoryIT.java</exclude>
- <exclude>**/ServiceInvocationIT.java</exclude>
- <exclude>**/UsersServiceIT.class</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>
- <accessKey>${aws.s3.key}</accessKey>
- <secretKey>${aws.s3.secret}</secretKey>
- <bucketName>${aws.s3.bucket}</bucketName>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceTestSuite.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- <exclude>**/ConcurrentServiceITSuite.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>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceITSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
<!-- PROFILES -->
@@ -270,38 +78,52 @@
<directory>src/main/python</directory>
</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>
-
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
-
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <!-- <exclude>**/*Test.java</exclude> -->
- <exclude>**/*Concurrent*Suite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
+ <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>${services.it.forkCount}</forkCount>
+ <reuseForks>${services.it.reuseForks}</reuseForks>
+ <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 ${ug.argline}</argLine>
+ <includes>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+
+ <!-- exclude our serial tests -->
+ <excludes>
+ <exclude>**/*Scheduler*IT.java</exclude>
+ <exclude>**/*Notification*IT.java</exclude>
+ </excludes>
+ </configuration>
+
+ <!-- Serial execution -->
+ <executions>
+ <execution>
+ <id>single-thread-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*Scheduler*IT.java</include>
+ <include>**/*Notification*IT.java</include>
+ </includes>
+ <threadCount>1</threadCount>
+ </configuration>
+ </execution>
+ </executions>
+
+ <version>2.15</version>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
deleted file mode 100644
index 2db2c48..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
+++ /dev/null
@@ -1,60 +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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.security.tokens.TokenServiceIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ManagementServiceIT.class, ExportServiceIT.class ,EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RolesServiceIT.class, RoleIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, TokenServiceIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ConcurrentServiceITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
deleted file mode 100644
index 5edc4579..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
+++ /dev/null
@@ -1,64 +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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ExportServiceIT.class,
- ManagementServiceIT.class, EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RoleIT.class, RolesServiceIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ServiceITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 1d5ff7b..719fd86 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -48,14 +48,9 @@ import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
-import org.apache.usergrid.ServiceITSuite;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -95,13 +90,17 @@ public class EmailFlowIT {
private static final String ORGANIZATION_NAME = "email-test-org-1";
public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
- static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public TestName name = new TestName();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 02db523..92bb448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -25,13 +25,15 @@ import java.util.UUID;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import static org.junit.Assert.assertEquals;
@@ -47,7 +49,14 @@ public class OrganizationIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
index 9c1c0b7..b88ab24 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
@@ -31,11 +31,12 @@ import org.apache.shiro.subject.Subject;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
import org.apache.usergrid.security.shiro.utils.SubjectUtils;
@@ -46,11 +47,18 @@ import static org.junit.Assert.assertFalse;
public class RoleIT {
private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index b1a7d19..6b3bb0b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -19,18 +19,20 @@ package org.apache.usergrid.management.cassandra;
import java.util.Set;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -42,13 +44,17 @@ import static org.junit.Assert.assertTrue;
public class ApplicationCreatorIT {
private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
- private CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index f0c89d6..a5b499b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.batch.JobExecution;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
@@ -61,6 +60,7 @@ import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.JobData;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
@@ -82,7 +82,11 @@ public class ExportServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -93,7 +97,7 @@ public class ExportServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 6eb2865..4288d99 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
@@ -43,6 +42,7 @@ import org.apache.usergrid.persistence.CredentialsInfo;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalType;
import org.apache.usergrid.security.crypto.command.Md5HashCommand;
import org.apache.usergrid.security.crypto.command.Sha1HashCommand;
@@ -52,7 +52,6 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -67,7 +66,11 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -78,7 +81,7 @@ public class ManagementServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index 3ca4df5..c78e348 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static org.junit.Assert.assertEquals;
@@ -47,16 +49,22 @@ public class FacebookProviderIT {
private static SignInProviderFactory providerFactory;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
public static void setup() throws Exception {
- providerFactory = ServiceITSuite.cassandraResource.getBean( SignInProviderFactory.class );
+ providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
.createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
false );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
index ed03fb2..9fd9821 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static junit.framework.Assert.assertNotNull;
@@ -47,11 +49,17 @@ public class PingIdentityProviderIT {
private static OrganizationInfo organization;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 4e2a80c..49d939c 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -26,9 +26,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
@@ -37,10 +38,10 @@ import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.Application;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import org.apache.usergrid.security.AuthPrincipalType;
-import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl
- ;
+import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl;
import org.apache.usergrid.security.tokens.exceptions.ExpiredTokenException;
import org.apache.usergrid.security.tokens.exceptions.InvalidTokenException;
import org.apache.usergrid.utils.UUIDUtils;
@@ -63,7 +64,13 @@ public class TokenServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
index 30806ff..50262e9 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
@@ -17,13 +17,16 @@
package org.apache.usergrid.services;
+import org.junit.ClassRule;
import org.junit.Rule;
+
import org.apache.usergrid.ServiceApplication;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
@Concurrent()
@@ -31,8 +34,14 @@ public abstract class AbstractServiceIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ServiceApplication app = new ServiceApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
index 4ec0d43..5ff7c61 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
@@ -23,16 +23,18 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.usergrid.services.ServiceParameter.filter;
import static org.apache.usergrid.services.ServiceParameter.parameters;
@@ -43,11 +45,17 @@ public class ServiceRequestIT {
private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
[05/10] incubator-usergrid git commit: Fixes Creator test to use
unique strings
Posted by sf...@apache.org.
Fixes Creator test to use unique strings
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f0a9870c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f0a9870c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f0a9870c
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: f0a9870c85728fbda611376ec7475d0f2fc8e44b
Parents: 7ffe1ac
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 14:54:55 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 14:54:55 2014 -0700
----------------------------------------------------------------------
.../cassandra/ApplicationCreatorIT.java | 31 +++++++++++++-------
1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f0a9870c/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index 6b3bb0b..a3eaa08 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -34,6 +34,7 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -42,8 +43,6 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent()
public class ApplicationCreatorIT {
- private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
-
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
@@ -59,14 +58,18 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc()
- .createOwnerAndOrganization( "appcreatortest", "nate-appcreatortest",
- "Nate", "nate+appcreatortest@apigee.com", "password", true,
- false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String expecteAppname = "sandbox";
+ final String expectedName = orgName + "/" + expecteAppname;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortest/sandbox", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
Set<String> rolePerms = setup.getEmf().getEntityManager( appInfo.getId() ).getRolePermissions( "guest" );
assertNotNull( rolePerms );
@@ -76,13 +79,19 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( "appcreatortestcustom",
- "nate-appcreatortestcustom", "Nate", "nate+appcreatortestcustom@apigee.com", "password", true, false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String sampleAppName = "messagee" ;
+ final String expectedName = orgName + "/" + sampleAppName;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
- customCreator.setSampleAppName( "messagee" );
+ customCreator.setSampleAppName(sampleAppName);
ApplicationInfo appInfo = customCreator.createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortestcustom/messagee", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
}
}
[08/10] incubator-usergrid git commit: Fixes FB test
Posted by sf...@apache.org.
Fixes FB test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/21758341
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/21758341
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/21758341
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 217583418a590ad5e99144dc2ee5c66438731655
Parents: 942b000
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:46:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:46:48 2014 -0700
----------------------------------------------------------------------
.../usergrid/security/providers/FacebookProviderIT.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21758341/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index c78e348..90309bd 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -38,6 +38,9 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -66,9 +69,9 @@ public class FacebookProviderIT {
public static void setup() throws Exception {
providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
+ .createAdminUser( uniqueUsername(), "Facebook User", "user"+newUUIDString()+"@facebook.com", "test", false,
false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "fb-organization", adminUser, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), adminUser, true );
applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "fb-application" ).getId();
}
[09/10] incubator-usergrid git commit: Fixes TokenServiceIT and bug
in ManagementService counter test
Posted by sf...@apache.org.
Fixes TokenServiceIT and bug in ManagementService counter test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/31bb3f18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/31bb3f18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/31bb3f18
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 31bb3f18d358faa30ab451cfaf97aa78823d65fe
Parents: 2175834
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 17:03:34 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 17:03:34 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 5 ++-
.../security/tokens/TokenServiceIT.java | 40 ++++++++------------
.../usergrid/services/ServiceFactoryIT.java | 4 +-
3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index ddb2bbb..6957097 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -161,9 +161,10 @@ public class ManagementServiceIT {
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
- assertNotNull( counts.get( "admin_logins" ) );
- final long startCount = counts.get( "admin_logins" );
+ final Long existingCounts = counts.get( "admin_logins" );
+
+ final long startCount = existingCounts == null ? 0 : existingCounts;
setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 49d939c..67bc035 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.security.tokens;
import java.util.HashMap;
import java.util.Map;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
@@ -27,6 +28,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -73,15 +75,13 @@ public class TokenServiceIT {
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
- @BeforeClass
- public static void setup() throws Exception {
- log.info( "in setup" );
- adminUser =
- setup.getMgmtSvc().createAdminUser( "edanuff34", "Ed Anuff", "ed@anuff34.com", "test", false, false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "TokenServiceTestOrg", adminUser, true );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
- // TODO update to organizationName/applicationName
- setup.getMgmtSvc().createApplication( organization.getUuid(), "TokenServiceTestOrg/ed-application" ).getId();
+ @Before
+ public void setup() throws Exception {
+ log.info( "in setup" );
+ adminUser = newOrgAppAdminRule.getAdminInfo();
}
@@ -91,8 +91,8 @@ public class TokenServiceIT {
Map<String, Object> data = new HashMap<String, Object>() {
{
- put( "email", "ed@anuff34.com" );
- put( "username", "edanuff34" );
+ put( "email", adminUser.getEmail());
+ put( "username", adminUser.getUsername());
}
};
@@ -106,8 +106,8 @@ public class TokenServiceIT {
long last_access = tokenInfo.getAccessed();
assertEquals( "email_confirm", tokenInfo.getType() );
- assertEquals( "ed@anuff34.com", tokenInfo.getState().get( "email" ) );
- assertEquals( "edanuff34", tokenInfo.getState().get( "username" ) );
+ assertEquals( adminUser.getEmail(), tokenInfo.getState().get( "email" ) );
+ assertEquals( adminUser.getUsername(), tokenInfo.getState().get( "username" ) );
tokenInfo = setup.getTokenSvc().getTokenInfo( tokenStr );
@@ -311,9 +311,7 @@ public class TokenServiceIT {
@Test
public void appDefaultExpiration() throws Exception {
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo", "foobar", "foobar", "foo@bar.com", "foobar" );
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
Application app = em.getApplication();
AuthPrincipalInfo userPrincipal =
@@ -328,11 +326,7 @@ public class TokenServiceIT {
@Test
public void appExpiration() throws Exception {
-
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo2", "foobar2", "foobar", "foo2@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
@@ -409,11 +403,7 @@ public class TokenServiceIT {
@Test
public void appExpirationInfinite() throws Exception {
-
- OrganizationOwnerInfo orgInfo = setup.getMgmtSvc().createOwnerAndOrganization( "appExpirationInfinite",
- "appExpirationInfinite", "foobar", "appExpirationInfinite@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
index 71152c9..e4e576f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
@@ -26,6 +26,8 @@ import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.services.simple.SimpleService;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -40,7 +42,7 @@ public class ServiceFactoryIT extends AbstractServiceIT {
public void testPackagePrefixes() throws Exception {
logger.info( "test package prefixes" );
- UUID applicationId = setup.getEmf().createApplication( "org", "app" );
+ UUID applicationId = setup.getEmf().createApplication(uniqueOrg(), uniqueApp() );
ServiceManager sm = setup.getSmf().getServiceManager( applicationId );
Service service = sm.getService( "simple" );
assertEquals( "/simple", service.getServiceType() );
[07/10] incubator-usergrid git commit: Fixes OrganizationIT. Suffers
from same org->admin bug
Posted by sf...@apache.org.
Fixes OrganizationIT. Suffers from same org->admin bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/942b000a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/942b000a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/942b000a
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 942b000aca6eb0a4b65a66f49670cba426c7f608
Parents: bb05616
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:43:41 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:43:41 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceImpl.java | 2 --
.../usergrid/management/OrganizationIT.java | 23 ++++++++++++++------
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 34925b0..edea8fa 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -1179,7 +1179,6 @@ public class ManagementServiceImpl implements ManagementService {
EntityManager em = emf.getEntityManager( smf.getManagementAppId() );
User user = em.get( userId, User.class );
- em.refreshIndex();
CredentialsInfo newCredentials =
encryptionService.defaultEncryptedCredentials( newPassword, user.getUuid(), smf.getManagementAppId() );
@@ -1228,7 +1227,6 @@ public class ManagementServiceImpl implements ManagementService {
.plainTextCredentials( mongoPassword( ( String ) user.getProperty( "username" ), newPassword ),
user.getUuid(), smf.getManagementAppId() ) );
- em.refreshIndex();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 92bb448..47718f0 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -26,6 +26,7 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -36,6 +37,9 @@ import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -58,14 +62,17 @@ public class OrganizationIT {
@ClassRule
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
+
@Test
public void testCreateOrganization() throws Exception {
UserInfo user =
- setup.getMgmtSvc().createAdminUser( "edanuff2", "Ed Anuff", "ed@anuff.com2", "test", false, false );
+ setup.getMgmtSvc().createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), "test", false, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationIT", user, false );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, false );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
@@ -108,7 +115,7 @@ public class OrganizationIT {
assertEquals( user.getUuid(), principal.getUuid() );
UserInfo new_user = setup.getMgmtSvc()
- .createAdminUser( "test-user-133", "Test User", "test-user-133@mockserver.com",
+ .createAdminUser(uniqueUsername(), "Test User", uniqueEmail(),
"testpassword", true, true );
assertNotNull( new_user );
@@ -121,11 +128,13 @@ public class OrganizationIT {
String[] passwords = new String[] { "password1", "password2", "password3", "password4", "password5" };
+
+
UserInfo user = setup.getMgmtSvc()
- .createAdminUser( "edanuff3", "Ed Anuff", "ed2@anuff.com2", passwords[0], true, false );
+ .createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), passwords[0], true, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationTest2", user, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, true );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -151,7 +160,7 @@ public class OrganizationIT {
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
try {
- setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[2] );
+ setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[3] );
fail( "password change should fail" );
}
catch ( RecentlyUsedPasswordException e ) {
@@ -207,7 +216,7 @@ public class OrganizationIT {
}
// test history size w/ user belonging to 2 orgs
- OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization( "OrganizationTest3", user, false );
+ OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization(uniqueOrg(), user, false );
assertNotNull( organization2 );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
[06/10] incubator-usergrid git commit: Fixes EmailFlowIT and creates
utilities for testing.
Posted by sf...@apache.org.
Fixes EmailFlowIT and creates utilities for 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/bb05616a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bb05616a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bb05616a
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: bb05616aafd3023b096dd929a120d02e782f3124
Parents: f0a9870
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:14:28 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:20:52 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 3 +-
.../apache/usergrid/management/EmailFlowIT.java | 109 +++++++++++++------
.../cassandra/ApplicationCreatorIT.java | 23 ++--
.../management/cassandra/ExportServiceIT.java | 17 ++-
.../cassandra/ManagementServiceIT.java | 27 +++--
.../java/org/apache/usergrid/TestHelper.java | 75 +++++++++++++
.../org/apache/usergrid/UUIDTestHelper.java | 38 -------
7 files changed, 189 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
index 71a4740..ab7857e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -32,9 +32,8 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
/**
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 719fd86..f831448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -51,6 +51,11 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -87,8 +92,6 @@ import static org.junit.Assert.assertTrue;
*/
public class EmailFlowIT {
private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
- private static final String ORGANIZATION_NAME = "email-test-org-1";
- public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
@@ -114,12 +117,17 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-1@mockserver.com" );
setup.set( PROPERTIES_NOTIFY_ADMIN_OF_ACTIVATION, "true" );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo org_owner =
- createOwnerAndOrganization( ORGANIZATION_NAME, "test-user-1", "Test User", "test-user-1@mockserver.com",
- "testpassword", false, false );
+ createOwnerAndOrganization( orgName, userName, "Test User", email, "testpassword", false, false );
+
+
assertNotNull( org_owner );
- List<Message> inbox = Mailbox.get( "test-user-1@mockserver.com" );
+ List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
@@ -127,7 +135,7 @@ public class EmailFlowIT {
client.processMail();
Message confirmation = inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-1@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: " + email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -151,16 +159,23 @@ public class EmailFlowIT {
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-2@mockserver.com" );
- OrganizationOwnerInfo org_owner = createOwnerAndOrganization( ORGANIZATION_NAME_2, "test-user-2", "Test User",
- "test-user-2@mockserver.com", "testpassword", false, false );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
+ OrganizationOwnerInfo org_owner =
+ createOwnerAndOrganization( orgName, userName, "Test User", email,
+ "testpassword", false, false );
+
assertNotNull( org_owner );
- List<Message> user_inbox = Mailbox.get( "test-user-2@mockserver.com" );
+
+ List<Message> user_inbox = Mailbox.get( email );
assertFalse( user_inbox.isEmpty() );
Message confirmation = user_inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-2@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: "+email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -181,7 +196,7 @@ public class EmailFlowIT {
assertFalse( sysadmin_inbox.isEmpty() );
Message activation = sysadmin_inbox.get( 0 );
- assertEquals( "Request For Admin User Account Activation test-user-2@mockserver.com", activation.getSubject() );
+ assertEquals( "Request For Admin User Account Activation "+email, activation.getSubject() );
token = getTokenFromMessage( activation );
LOG.info( token );
@@ -204,10 +219,14 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS, "false" );
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "false" );
+
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo ooi = setup.getMgmtSvc()
- .createOwnerAndOrganization( "org-skipallemailtest", "user-skipallemailtest",
- "name-skipallemailtest", "nate+skipallemailtest@apigee.com",
- "password" );
+ .createOwnerAndOrganization(orgName, userName, "Test User", email,
+ "testpassword");
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
User user = em.get( ooi.getOwner().getUuid(), User.class );
@@ -234,23 +253,36 @@ public class EmailFlowIT {
}
+ /**
+ * Tests that when a user is added to an app and activation on that app is required, the org admin is emailed
+ * @throws Exception
+ *
+ * TODO, I'm not convinced this worked correctly. IT can't find users collection in the orgs. Therefore,
+ * I think this is a legitimate bug that was just found from fixing the tests to be unique admins orgs and emails
+ */
@Test
public void testAppUserActivationResetpwdMail() throws Exception {
- String orgName = this.getClass().getName() + "1";
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-4@mockserver.com";
- String passwd = "testpassword";
- OrganizationOwnerInfo orgOwner;
- orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+ OrganizationOwnerInfo orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
assertNotNull( orgOwner );
ApplicationInfo app = setup.getMgmtSvc().createApplication( orgOwner.getOrganization().getUuid(), appName );
+
+ //turn on app admin approval for app users
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserMailUrl", "testAppUserMailUrl@test.com", false );
- String subject = "Request For User Account Activation testAppUserMailUrl@test.com";
+ final String appUserUsername = uniqueUsername();
+ final String appUserEmail = uniqueEmail();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, false );
+
+ String subject = "Request For User Account Activation " + email;
String activation_url = String.format( setup.get( PROPERTIES_USER_ACTIVATION_URL ), orgName, appName,
user.getUuid().toString() );
@@ -261,7 +293,7 @@ public class EmailFlowIT {
List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "usergrid.com", "test", "somepassword" );
+ MockImapClient client = new MockImapClient( "usergrid.com", userName, "somepassword" );
client.processMail();
// subject ok
@@ -287,9 +319,9 @@ public class EmailFlowIT {
// reset_pwd
setup.getMgmtSvc().startAppUserPasswordResetFlow( app.getId(), user );
- inbox = Mailbox.get( "testAppUserMailUrl@test.com" );
+ inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- client = new MockImapClient( "test.com", "testAppUserMailUrl", "somepassword" );
+ client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
@@ -315,11 +347,13 @@ public class EmailFlowIT {
/** Tests to make sure a normal user must be activated by the admin after confirmation. */
@Test
public void testAppUserConfirmationMail() throws Exception {
- String orgName = this.getClass().getName();
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-45@mockserver.com";
- String passwd = "testpassword";
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+
OrganizationOwnerInfo orgOwner;
orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
@@ -331,18 +365,23 @@ public class EmailFlowIT {
assertNotNull( app );
enableEmailConfirmation( app.getId() );
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserConfMail", "testAppUserConfMail@test.com", true );
- String subject = "User Account Confirmation: testAppUserConfMail@test.com";
+
+ final String appUserEmail = uniqueEmail();
+ final String appUserUsername = uniqueUsername();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, true );
+
+ String subject = "User Account Confirmation: "+appUserEmail;
String urlProp = setup.get( PROPERTIES_USER_CONFIRMATION_URL );
String confirmation_url = String.format( urlProp, orgName, appName, user.getUuid().toString() );
// request confirmation
setup.getMgmtSvc().startAppUserActivationFlow( app.getId(), user );
- List<Message> inbox = Mailbox.get( "testAppUserConfMail@test.com" );
+ List<Message> inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "test.com", "testAppUserConfMail", "somepassword" );
+ MockImapClient client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index a3eaa08..0fbeb7d 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -22,8 +22,6 @@ import java.util.Set;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
@@ -34,7 +32,10 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -59,13 +60,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String expecteAppname = "sandbox";
final String expectedName = orgName + "/" + expecteAppname;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
@@ -80,13 +81,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String sampleAppName = "messagee" ;
final String expectedName = orgName + "/" + sampleAppName;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
customCreator.setSampleAppName(sampleAppName);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index 2c64836..53de224 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -66,7 +66,9 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -345,9 +347,11 @@ public class ExportServiceIT {
@Test
public void testExportOneAppOnCollectionEndpoint() throws Exception {
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+
+
File f = null;
- String orgName = "george-organization"+newUUIDString();
- String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -616,11 +620,14 @@ public class ExportServiceIT {
HashMap<String, Object> payload = payloadBuilder();
//creates 100s of organizations with some entities in each one to make sure we don't actually apply it
+ final String uniqueOrg = uniqueOrg();
+ final String uniqueApp = uniqueApp();
+
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
+ orgMade = setup.getMgmtSvc().createOrganization(uniqueOrg + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), uniqueApp + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 14a34b4..ddb2bbb 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.UUID;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -54,7 +53,11 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -486,11 +489,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine",uniqueEmail(), password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -515,7 +518,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -572,7 +575,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -635,10 +638,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "autneticateUser"+newUUIDString();
- String appName = "authenticateUser"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -738,10 +741,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
- String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
new file mode 100644
index 0000000..cf476e2
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class TestHelper {
+
+ /**
+ * Generate a unique name for an organization
+ * @return
+ */
+ public static String uniqueOrg(){
+ return "org" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique name for an application
+ * @return
+ */
+ public static String uniqueApp(){
+ return "app" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique username
+ * @return
+ */
+ public static String uniqueUsername(){
+ return "user" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique email
+ * @return
+ */
+ public static String uniqueEmail(){
+ return "user" + newUUIDString() + "@apache.org";
+ }
+
+
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
deleted file mode 100644
index dffe826..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
+++ /dev/null
@@ -1,38 +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;
-
-
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-
-/**
- * Simple class to manipulate UUIDs into strings for unique strings when testing
- */
-public class UUIDTestHelper {
-
- /**
- * Generate a new UUID, and remove all the '-' characters from the resulting string.
- * @return
- */
- public static String newUUIDString() {
- return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
- }
-}
[04/10] incubator-usergrid git commit: Fixes ManagementServiceIT
Posted by sf...@apache.org.
Fixes ManagementServiceIT
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/7ffe1ac7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/7ffe1ac7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/7ffe1ac7
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 7ffe1ac7a5a91bd6c603124953a33519e729c683
Parents: cfff0cc
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:13:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:13:45 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 79 +++++++++++++-------
1 file changed, 52 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7ffe1ac7/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 4288d99..14a34b4 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
@@ -30,6 +31,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -52,6 +54,7 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -66,33 +69,43 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
+
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
+
+
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private UUID applicationId;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "edanuff", "Ed Anuff", "ed@anuff.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "ed-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "ed-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
+
+ setup.getEmf().refreshIndex();
}
+
@Test
public void testGetTokenForPrincipalAdmin() throws Exception {
String token = ( ( ManagementServiceImpl ) setup.getMgmtSvc() )
@@ -140,15 +153,27 @@ public class ManagementServiceIT {
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
- setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
-
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
assertNotNull( counts.get( "admin_logins" ) );
- assertEquals( 1, counts.get( "admin_logins" ).intValue() );
+
+ final long startCount = counts.get( "admin_logins" );
+
+
+ setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
+
+
+ counts = em.getApplicationCounters();
+ LOG.info( JsonUtils.mapToJsonString( counts ) );
+ LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
+ assertNotNull( counts.get( "admin_logins" ) );
+
+ final long newCount = counts.get( "admin_logins" );
+
+ assertEquals( 1l, newCount - startCount );
}
@@ -461,11 +486,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", UUID.randomUUID() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -490,7 +515,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType";
+ String username = "testAdminPasswordChangeShaType"+newUUIDString();
String password = "test";
@@ -547,7 +572,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType";
+ String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
String password = "test";
@@ -610,10 +635,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "autneticateUser";
- String appName = "authenticateUser";
+ String orgName = "autneticateUser"+newUUIDString();
+ String appName = "authenticateUser"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -654,10 +679,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeShaType";
- String appName = "testAppUserPasswordChangeShaType";
+ String orgName = "testAppUserPasswordChangeShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -713,10 +738,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType";
- String appName = "testAppUserPasswordChangeMd5ShaType";
+ String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
[10/10] incubator-usergrid git commit: Merge branch 'two-dot-o' into
UG-rest-test-framework-overhaul
Posted by sf...@apache.org.
Merge branch 'two-dot-o' into UG-rest-test-framework-overhaul
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/ce26189f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/ce26189f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/ce26189f
Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: ce26189f317616048949dce9c13d6efd7c1427f8
Parents: 8437af5 31bb3f1
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Dec 11 13:52:36 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Dec 11 13:52:36 2014 -0700
----------------------------------------------------------------------
stack/core/pom.xml | 15 +-
.../org/apache/usergrid/AbstractCoreIT.java | 12 +-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ----
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 ------
.../usergrid/ConcurrentCoreTestSuite.java | 46 ----
.../java/org/apache/usergrid/CoreITSuite.java | 58 ----
.../java/org/apache/usergrid/CoreTestSuite.java | 45 ----
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ----
.../usergrid/batch/SchedulerTestSuite.java | 34 ---
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +-
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 +-
.../cassandra/EntityManagerFactoryImplIT.java | 21 +-
.../query/AbstractIteratingQueryIT.java | 15 +-
.../system/UsergridSystemMonitorIT.java | 14 +-
stack/services/pom.xml | 268 ++++---------------
.../cassandra/ManagementServiceImpl.java | 2 -
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/NewOrgAppAdminRule.java | 159 +++++++++++
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 124 ++++++---
.../usergrid/management/OrganizationIT.java | 36 ++-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 46 ++--
.../management/cassandra/ExportServiceIT.java | 63 +++--
.../cassandra/ManagementServiceIT.java | 94 ++++---
.../security/providers/FacebookProviderIT.java | 21 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 55 ++--
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceFactoryIT.java | 4 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
.../java/org/apache/usergrid/TestHelper.java | 75 ++++++
33 files changed, 687 insertions(+), 924 deletions(-)
----------------------------------------------------------------------