You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/02/12 23:28:31 UTC
[12/27] incubator-usergrid git commit: Removed concurrent annotations
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionCollectionIT.java
deleted file mode 100644
index f68296c..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderByNoIntersectionCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderByNoIntersectionCollection() throws Exception {
- singleOrderByNoIntersection( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionConnectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionConnectionIT.java
deleted file mode 100644
index 29b0c82..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNoIntersectionConnectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderByNoIntersectionConnectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderByNoIntersectionConnection() throws Exception {
- singleOrderByNoIntersection( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotCollectionIT.java
deleted file mode 100644
index fa196ee..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderByNotCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderByNotCollection() throws Exception {
- singleOrderByNot( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotConnectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotConnectionIT.java
deleted file mode 100644
index 6f0a86f..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderByNotConnectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderByNotConnectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderByNotConnection() throws Exception {
- singleOrderByNot( new ConnectionHelper(app) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterCollectionIT.java
deleted file mode 100644
index 7ae8a45..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanGreaterCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanGreaterCollection() throws Exception {
- singleOrderBySameRangeScanGreater( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterConnectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterConnectionIT.java
deleted file mode 100644
index 64fb7e8..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterConnectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanGreaterConnectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanGreaterConnection() throws Exception {
- singleOrderBySameRangeScanGreater( new ConnectionHelper(app) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.java
deleted file mode 100644
index ba0dda8..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanGreaterThanEqualCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanGreaterThanEqualCollection() throws Exception {
- singleOrderBySameRangeScanGreaterThanEqual( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessCollectionIT.java
deleted file mode 100644
index 0ccdde7..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanLessCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanLessCollection() throws Exception {
- singleOrderBySameRangeScanLessEqual( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessConnectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessConnectionIT.java
deleted file mode 100644
index 0d1d74f..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessConnectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanLessConnectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanLessConnection() throws Exception {
- singleOrderBySameRangeScanLessEqual( new ConnectionHelper(app) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualCollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualCollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualCollectionIT.java
deleted file mode 100644
index 303d1b2..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualCollectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanLessThanEqualCollectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanLessThanEqualCollection() throws Exception {
- singleOrderBySameRangeScanLessThanEqual( new CollectionIoHelper( app ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualConnectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualConnectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualConnectionIT.java
deleted file mode 100644
index 967b0ef..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/SingleOrderBySameRangeScanLessThanEqualConnectionIT.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query;
-
-
-import org.junit.Test;
-
-
-/** @author tnine */
-public class SingleOrderBySameRangeScanLessThanEqualConnectionIT extends AbstractIteratingQueryIT {
- @Test
- public void singleOrderBySameRangeScanLessThanEqualConnection() throws Exception {
- singleOrderBySameRangeScanLessThanEqual( new ConnectionHelper(app) );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
index d478942..a936e7f 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
@@ -21,6 +21,7 @@ import java.nio.ByteBuffer;
import java.util.UUID;
import org.junit.Test;
+
import org.apache.usergrid.utils.UUIDUtils;
import static junit.framework.Assert.assertNull;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
index e937162..b79b38a 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/InOrderIterator.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.UUID;
import org.junit.Ignore;
+
import org.apache.usergrid.persistence.cassandra.CursorCache;
import com.google.common.collect.Iterables;
@@ -58,7 +59,7 @@ public class InOrderIterator implements ResultIterator {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Iterable#iterator()
*/
@Override
@@ -73,7 +74,7 @@ public class InOrderIterator implements ResultIterator {
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Iterator#hasNext()
*/
@Override
@@ -88,7 +89,7 @@ public class InOrderIterator implements ResultIterator {
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Iterator#next()
*/
@Override
@@ -112,7 +113,7 @@ public class InOrderIterator implements ResultIterator {
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Iterator#remove()
*/
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
index 9f27463..540bf8b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/IntersectionIteratorTest.java
@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.UUID;
import org.junit.Test;
+
import org.apache.usergrid.utils.UUIDUtils;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIteratorTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIteratorTest.java
index 02ec0d6..7ab0f25 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIteratorTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIteratorTest.java
@@ -21,12 +21,13 @@ import java.util.Set;
import java.util.UUID;
import org.junit.Test;
+
import org.apache.usergrid.utils.UUIDUtils;
+import static org.apache.usergrid.persistence.query.ir.result.IteratorHelper.uuidColumn;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.apache.usergrid.persistence.query.ir.result.IteratorHelper.uuidColumn;
/** @author tnine */
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/UnionIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/UnionIteratorTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/UnionIteratorTest.java
index dae5b45..68d2313 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/UnionIteratorTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/ir/result/UnionIteratorTest.java
@@ -23,15 +23,16 @@ import java.util.Set;
import java.util.UUID;
import org.junit.Test;
+
import org.apache.usergrid.utils.UUIDUtils;
import me.prettyprint.cassandra.serializers.UUIDSerializer;
+import static org.apache.usergrid.persistence.query.ir.result.IteratorHelper.uuidColumn;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.apache.usergrid.persistence.query.ir.result.IteratorHelper.uuidColumn;
/**
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 976e5cc..9ca0e0c 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
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.apache.commons.lang.StringUtils;
import org.apache.usergrid.cassandra.SpringResource;
-import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.utils.MapUtils;
import static org.junit.Assert.assertEquals;
@@ -34,7 +33,6 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
-@Concurrent
public class UsergridSystemMonitorIT {
@ClassRule
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java b/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
index d2b8620..73a021c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
+++ b/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
@@ -34,8 +34,8 @@ public class ImmediateCounterRule extends ExternalResource {
private final SimpleBatcher batcher;
- public ImmediateCounterRule( final SpringResource springResource ) {
- batcher = springResource.getBean( SimpleBatcher.class );
+ public ImmediateCounterRule( ) {
+ batcher = SpringResource.getInstance().getBean( SimpleBatcher.class );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/utils/IndexUtilsTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/utils/IndexUtilsTest.java b/stack/core/src/test/java/org/apache/usergrid/utils/IndexUtilsTest.java
index e0e2c95..c107f20 100644
--- a/stack/core/src/test/java/org/apache/usergrid/utils/IndexUtilsTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/utils/IndexUtilsTest.java
@@ -20,13 +20,13 @@ package org.apache.usergrid.utils;
import java.util.List;
import java.util.Map.Entry;
-import org.apache.usergrid.persistence.entities.Activity;
-import org.apache.usergrid.persistence.entities.User;
-
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.persistence.entities.Activity;
+import org.apache.usergrid.persistence.entities.User;
+
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/java/org/apache/usergrid/utils/UUIDUtilsTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/utils/UUIDUtilsTest.java b/stack/core/src/test/java/org/apache/usergrid/utils/UUIDUtilsTest.java
index 2ec8140..71777ae 100644
--- a/stack/core/src/test/java/org/apache/usergrid/utils/UUIDUtilsTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/utils/UUIDUtilsTest.java
@@ -28,14 +28,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import static org.apache.usergrid.utils.UUIDUtils.getTimestampInMillis;
-import static org.apache.usergrid.utils.UUIDUtils.newTimeUUID;
-
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.usergrid.utils.UUIDUtils.getTimestampInMillis;
+import static org.apache.usergrid.utils.UUIDUtils.newTimeUUID;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/usergrid-custom-test.properties b/stack/core/src/test/resources/usergrid-custom-test.properties
index d093ca8..949b60e 100644
--- a/stack/core/src/test/resources/usergrid-custom-test.properties
+++ b/stack/core/src/test/resources/usergrid-custom-test.properties
@@ -12,14 +12,16 @@
# Core module test properties
-# these settings allow tests to run and consistently pass on 16GB MacBook Pro
-# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
+# these settings allow tests to run and consistently pass on 16GB MacBook Pro
+# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
cassandra.startup=external
elasticsearch.startup=external
cassandra.timeout=2000
cassandra.connections=1000
-hystrix.threadpool.graph_user.coreSize=50
-hystrix.threadpool.graph_async.coreSize=50
-collection.task.pool.threadsize=8
-collection.task.pool.queuesize=8
+
+#Not a good number for real systems. Write shards should be 2x cluster size from our tests
+#This is just way more efficient for a single node and the number of shards we're creating
+elasticsearch.number_shards=1
+elasticsearch.number_replicas=0
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/core/src/test/resources/usergrid-test-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/usergrid-test-context.xml b/stack/core/src/test/resources/usergrid-test-context.xml
index 8c246d5..25fc0f6 100644
--- a/stack/core/src/test/resources/usergrid-test-context.xml
+++ b/stack/core/src/test/resources/usergrid-test-context.xml
@@ -26,7 +26,7 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
-
+
<!-- configure our test properties -->
<bean id="properties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
@@ -44,10 +44,10 @@
<import resource="classpath:/usergrid-core-context.xml"/>
- <bean id="setup" class="org.apache.usergrid.corepersistence.HybridSetup">
- <constructor-arg ref="properties"/>
+ <bean id="setup" class="org.apache.usergrid.corepersistence.CpSetup">
<constructor-arg ref="entityManagerFactory"/>
<constructor-arg ref="cassandraService"/>
+ <constructor-arg ref="injector"/>
</bean>
<!-- Refer to a named schemaManager from the DataControl annotation thusly -->
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index eb9f61e..d239641 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -35,12 +35,17 @@ import java.util.Map;
public interface EntityIndex {
/**
- * This should ONLY ever be called once on application create.
+ * This should ONLY ever be called once on application create.
* Otherwise we're introducing slowness into our system
*/
public void initializeIndex();
/**
+ * Delete the index from ES
+ */
+ public void deleteIndex();
+
+ /**
* Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
* @param indexSuffix index name
* @param shards
@@ -95,12 +100,13 @@ public interface EntityIndex {
* Check health of cluster.
*/
public Health getClusterHealth();
-
+
/**
* Check health of this specific index.
*/
public Health getIndexHealth();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
index 7c2ae42..e2b1d52 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
@@ -27,6 +27,11 @@ import org.safehaus.guicyfig.EnvironResource;
import org.apache.usergrid.persistence.index.IndexFig;
+/**
+ * Sets elasticsearch variables into the environment
+ *
+ * TODO make static
+ */
public class ElasticSearchResource extends EnvironResource {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 894af80..bb1afde 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -982,11 +982,6 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${org.springframework.version}</version>
- </dependency>
<dependency>
<groupId>org.springframework</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
index 5c98785..9c1636a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
@@ -16,22 +16,17 @@
package org.apache.usergrid.rest.applications.collection;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.usergrid.corepersistence.TestGuiceModule;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.rest.AbstractRestIT;
-import org.apache.usergrid.rest.TestContextSetup;
-import org.apache.usergrid.rest.test.resource.CustomCollection;
-import org.apache.usergrid.utils.MapUtils;
-import static org.junit.Assert.fail;
+
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.rest.AbstractRestIT;
+import org.apache.usergrid.rest.TestContextSetup;
+
+import static org.junit.Assert.fail;
+
public class DuplicateNameIT extends AbstractRestIT {
@@ -43,30 +38,32 @@ public class DuplicateNameIT extends AbstractRestIT {
@Test
public void duplicateNamePrevention() {
- CustomCollection things = context.application().customCollection( "things" );
-
- Map<String, String> entity = MapUtils.hashMap( "name", "enzo" );
-
- try {
- things.create( entity );
- } catch (IOException ex) {
- logger.error("Cannot create entity", ex);
- }
-
- refreshIndex( context.getAppUuid() );
-
- Injector injector = Guice.createInjector( new TestGuiceModule( null ) );
- SerializationFig sfig = injector.getInstance( SerializationFig.class );
-
- // wait for any temporary unique value records to timeout
- try { Thread.sleep( sfig.getTimeout() * 1100 ); } catch (InterruptedException ignored) {}
+ fail("This test is incorrectly written and should not use direct serialization to test duplicate names");
- try {
- things.create( entity );
- fail("Should not have created duplicate entity");
-
- } catch (Exception ex) {
- // good
- }
+// CustomCollection things = context.application().customCollection( "things" );
+//
+// Map<String, String> entity = MapUtils.hashMap( "name", "enzo" );
+//
+// try {
+// things.create( entity );
+// } catch (IOException ex) {
+// logger.error("Cannot create entity", ex);
+// }
+//
+// refreshIndex( context.getAppUuid() );
+//
+// Injector injector = Guice.createInjector( new TestGuiceModule( null ) );
+// SerializationFig sfig = injector.getInstance( SerializationFig.class );
+//
+// // wait for any temporary unique value records to timeout
+// try { Thread.sleep( sfig.getTimeout() * 1100 ); } catch (InterruptedException ignored) {}
+//
+// try {
+// things.create( entity );
+// fail("Should not have created duplicate entity");
+//
+// } catch (Exception ex) {
+// // good
+// }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
index 5de4d7d..08f4580 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
@@ -20,6 +20,8 @@ import java.util.*;
import com.codahale.metrics.*;
import com.codahale.metrics.Timer;
+import com.google.inject.Injector;
+
import org.apache.usergrid.corepersistence.CpSetup;
import org.apache.usergrid.metrics.MetricsFactory;
import org.apache.usergrid.mq.Message;
@@ -89,9 +91,9 @@ public class NotificationsService extends AbstractCollectionService {
postTimer = metricsService.getTimer(this.getClass(), "execution_rest");
JobScheduler jobScheduler = new JobScheduler(sm,em);
String name = ApplicationQueueManagerImpl.getQueueNames(props);
- QueueScopeFactory queueScopeFactory = CpSetup.getInjector().getInstance(QueueScopeFactory.class);
+ QueueScopeFactory queueScopeFactory = getApplicationContext().getBean( Injector.class ).getInstance(QueueScopeFactory.class);
QueueScope queueScope = queueScopeFactory.getScope(smf.getManagementAppId(), name);
- queueManagerFactory = CpSetup.getInjector().getInstance(QueueManagerFactory.class);
+ queueManagerFactory = getApplicationContext().getBean( Injector.class ).getInstance(QueueManagerFactory.class);
QueueManager queueManager = TEST_QUEUE_MANAGER !=null ? TEST_QUEUE_MANAGER : queueManagerFactory.getQueueManager(queueScope);
notificationQueueManager = new ApplicationQueueManagerImpl(jobScheduler,em,queueManager,metricsService,props);
gracePeriod = jobScheduler.SCHEDULER_GRACE_PERIOD;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
index b5aaeda..0adbc2c 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
@@ -19,6 +19,8 @@ package org.apache.usergrid.services.notifications;
import com.codahale.metrics.*;
import com.codahale.metrics.Timer;
import com.google.common.cache.*;
+import com.google.inject.Injector;
+
import org.apache.usergrid.corepersistence.CpSetup;
import org.apache.usergrid.metrics.MetricsFactory;
@@ -73,12 +75,12 @@ public class QueueListener {
private int consecutiveCallsToRemoveDevices;
public QueueListener(ServiceManagerFactory smf, EntityManagerFactory emf, MetricsFactory metricsService, Properties props){
- this.queueManagerFactory = CpSetup.getInjector().getInstance(QueueManagerFactory.class);
+ this.queueManagerFactory = smf.getApplicationContext().getBean( Injector.class ).getInstance(QueueManagerFactory.class);
this.smf = smf;
this.emf = emf;
this.metricsService = metricsService;
this.properties = props;
- this.queueScopeFactory = CpSetup.getInjector().getInstance(QueueScopeFactory.class);
+ this.queueScopeFactory = smf.getApplicationContext().getBean( Injector.class ).getInstance(QueueScopeFactory.class);
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
index 0f0d0a3..a990bbb 100644
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
+++ b/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
@@ -48,8 +48,7 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
private ExportService exportService;
- public ServiceITSetupImpl( SpringResource springResource, ElasticSearchResource elasticSearchResource ) {
- super( springResource, elasticSearchResource );
+ public ServiceITSetupImpl( ) {
}
@@ -61,13 +60,13 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
protected void before( Description description ) throws Throwable {
super.before( description );
- managementService = springResource.getBean( ManagementService.class );
- applicationCreator = springResource.getBean( ApplicationCreator.class );
- tokenService = springResource.getBean( TokenService.class );
- providerFactory = springResource.getBean( SignInProviderFactory.class );
- properties = springResource.getBean( PropertiesFactoryBean.class ).getObject();
- smf = springResource.getBean( ServiceManagerFactory.class );
- exportService = springResource.getBean( ExportService.class );
+ managementService = SpringResource.getInstance().getBean( ManagementService.class );
+ applicationCreator = SpringResource.getInstance().getBean( ApplicationCreator.class );
+ tokenService = SpringResource.getInstance().getBean( TokenService.class );
+ providerFactory = SpringResource.getInstance().getBean( SignInProviderFactory.class );
+ properties = SpringResource.getInstance().getBean( PropertiesFactoryBean.class ).getObject();
+ smf = SpringResource.getInstance().getBean( ServiceManagerFactory.class );
+ exportService = SpringResource.getInstance().getBean( ExportService.class );
LOG.info( "Test setup complete..." );
}
@@ -93,7 +92,7 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
@Override
public CassandraService getCassSvc() {
- return springResource.getBean( CassandraService.class );
+ return SpringResource.getInstance().getBean( CassandraService.class );
}
@@ -108,7 +107,7 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
public ServiceManagerFactory getSmf() {
if ( smf == null ) {
- smf = springResource.getBean( ServiceManagerFactory.class );
+ smf = SpringResource.getInstance().getBean( ServiceManagerFactory.class );
}
return smf;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 a2127b1..d3763b2 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
@@ -92,17 +92,12 @@ import static org.junit.Assert.assertTrue;
public class EmailFlowIT {
private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( );
@Rule
public TestName name = new TestName();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 530e3be..21f00e3 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
@@ -52,15 +52,9 @@ public class OrganizationIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl();
@Rule
public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 b71598d..56c392c 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
@@ -47,18 +47,11 @@ import static org.junit.Assert.assertFalse;
public class RoleIT {
private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
-
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 6c33338..cb67efc 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
@@ -44,17 +44,11 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent()
public class ApplicationCreatorIT {
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl();
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 6ab8c16..6cd6fef 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
@@ -86,15 +86,9 @@ public class ExportServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( );
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@@ -163,11 +157,11 @@ public class ExportServiceIT {
entity[i] = em.create( "users", userProperties );
}
//creates connections
- em.createConnection(
- em.get( new SimpleEntityRef( "user", entity[0].getUuid()) ), "Vibrations",
+ em.createConnection(
+ em.get( new SimpleEntityRef( "user", entity[0].getUuid()) ), "Vibrations",
em.get( new SimpleEntityRef( "user", entity[1].getUuid()) ) );
- em.createConnection(
- em.get( new SimpleEntityRef( "user", entity[1].getUuid()) ), "Vibrations",
+ em.createConnection(
+ em.get( new SimpleEntityRef( "user", entity[1].getUuid()) ), "Vibrations",
em.get( new SimpleEntityRef( "user", entity[0].getUuid()) ) );
UUID exportUUID = exportService.schedule( payload );
@@ -243,11 +237,11 @@ public class ExportServiceIT {
}
em.refreshIndex();
//creates connections
- em.createConnection(
- em.get( new SimpleEntityRef( "user", entity[0].getUuid())), "Vibrations",
+ em.createConnection(
+ em.get( new SimpleEntityRef( "user", entity[0].getUuid())), "Vibrations",
em.get( new SimpleEntityRef( "user", entity[1].getUuid())) );
- em.createConnection(
- em.get( new SimpleEntityRef( "user", entity[1].getUuid())), "Vibrations",
+ em.createConnection(
+ em.get( new SimpleEntityRef( "user", entity[1].getUuid())), "Vibrations",
em.get( new SimpleEntityRef( "user", entity[0].getUuid())) );
UUID exportUUID = exportService.schedule( payload );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 c15cf83..da70064 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
@@ -73,15 +73,8 @@ public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl();
@Rule
@@ -151,7 +144,7 @@ public class ManagementServiceIT {
@Test
public void testCountAdminUserAction() throws Exception {
- SimpleBatcher batcher = springResource.getBean( SimpleBatcher.class );
+ SimpleBatcher batcher = SpringResource.getInstance().getBean( SimpleBatcher.class );
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 3622487..40bc5e8 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
@@ -52,22 +52,16 @@ public class FacebookProviderIT {
private static SignInProviderFactory providerFactory;
private static UUID applicationId;
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( );
@BeforeClass
public static void setup() throws Exception {
- providerFactory = springResource.getBean( SignInProviderFactory.class );
+ providerFactory = SpringResource.getInstance().getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
.createAdminUser( uniqueUsername(), "Facebook User", "user"+newUUIDString()+"@facebook.com", "test", false,
false );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 91c7ca8..d756049 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
@@ -49,17 +49,11 @@ public class PingIdentityProviderIT {
private static OrganizationInfo organization;
private static UUID applicationId;
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 632a337..c18cc69 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
@@ -61,15 +61,8 @@ public class TokenServiceIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
-
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( );
@Rule
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 293c8a5..03f8043 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
@@ -34,14 +34,9 @@ public abstract class AbstractServiceIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( );
@Rule
public ServiceApplication app = new ServiceApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 f105f4e..2bad78e 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
@@ -45,17 +45,12 @@ public class ServiceRequestIT {
private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
- @ClassRule
- public static SpringResource springResource = SpringResource.getInstance();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
index 6d737e1..99ae2c5 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
@@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory;
/**
* Create the resource that sets the cassandra properties
+ *
+ * TODO move from instance to static
*/
public class CassandraResource extends EnvironResource {
@@ -41,11 +43,8 @@ public class CassandraResource extends EnvironResource {
public static final int DEFAULT_RPC_PORT = 9160;
- public static final int DEFAULT_STORAGE_PORT = 7000;
- public static final int DEFAULT_SSL_STORAGE_PORT = 7001;
- public static final int DEFAULT_NATIVE_TRANSPORT_PORT = 9042;
- public static final String NATIVE_TRANSPORT_PORT_KEY = "native_transport_port";
- public static final String RPC_PORT_KEY = "rpc_port";
+
+ public static final String RPC_PORT_KEY = "rpc_port";
private static final Object lock = new Object();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/Concurrent.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/Concurrent.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/Concurrent.java
deleted file mode 100644
index 749acb1..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/Concurrent.java
+++ /dev/null
@@ -1,31 +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.cassandra;
-
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/** @author Mathieu Carbou (mathieu.carbou@gmail.com) */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface Concurrent {
- int threads() default 1;
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentJunitRunner.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentJunitRunner.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentJunitRunner.java
deleted file mode 100644
index 67c8d1b..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentJunitRunner.java
+++ /dev/null
@@ -1,91 +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.cassandra;
-
-
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.concurrent.CompletionService;
-import java.util.concurrent.ExecutorCompletionService;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.RunnerScheduler;
-
-
-/** @author Mathieu Carbou (mathieu.carbou@gmail.com) */
-public class ConcurrentJunitRunner extends BlockJUnit4ClassRunner {
- public ConcurrentJunitRunner( final Class<?> klass ) throws InitializationError {
- super( klass );
- setScheduler( new RunnerScheduler() {
- ExecutorService executorService = Executors.newFixedThreadPool(
- klass.isAnnotationPresent( Concurrent.class ) ? klass.getAnnotation( Concurrent.class ).threads() :
- ( int ) ( Runtime.getRuntime().availableProcessors() * 1.5 ),
- new NamedThreadFactory( klass.getSimpleName() ) );
- CompletionService<Void> completionService = new ExecutorCompletionService<Void>( executorService );
- Queue<Future<Void>> tasks = new LinkedList<Future<Void>>();
-
-
- @Override
- public void schedule( Runnable childStatement ) {
- tasks.offer( completionService.submit( childStatement, null ) );
- }
-
-
- @Override
- public void finished() {
- try {
- while ( !tasks.isEmpty() ) {
- tasks.remove( completionService.take() );
- }
- }
- catch ( InterruptedException e ) {
- Thread.currentThread().interrupt();
- }
- finally {
- while ( !tasks.isEmpty() ) {
- tasks.poll().cancel( true );
- }
- executorService.shutdownNow();
- }
- }
- } );
- }
-
-
- static final class NamedThreadFactory implements ThreadFactory {
- static final AtomicInteger poolNumber = new AtomicInteger( 1 );
- final AtomicInteger threadNumber = new AtomicInteger( 1 );
- final ThreadGroup group;
-
-
- NamedThreadFactory( String poolName ) {
- group = new ThreadGroup( poolName + "-" + poolNumber.getAndIncrement() );
- }
-
-
- @Override
- public Thread newThread( Runnable r ) {
- return new Thread( group, r, group.getName() + "-thread-" + threadNumber.getAndIncrement(), 0 );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentSuite.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentSuite.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentSuite.java
deleted file mode 100644
index d034608..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ConcurrentSuite.java
+++ /dev/null
@@ -1,117 +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.cassandra;
-
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.CompletionService;
-import java.util.concurrent.ExecutorCompletionService;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
-import org.junit.runner.Runner;
-import org.junit.runners.Suite;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.RunnerBuilder;
-import org.junit.runners.model.RunnerScheduler;
-
-
-/** @author Mathieu Carbou (mathieu.carbou@gmail.com) */
-public final class ConcurrentSuite extends Suite {
- public ConcurrentSuite( final Class<?> klass ) throws InitializationError {
- super( klass, new AllDefaultPossibilitiesBuilder( true ) {
- @Override
- public Runner runnerForClass( Class<?> testClass ) throws Throwable {
- List<RunnerBuilder> builders = Arrays.asList( new RunnerBuilder() {
- @Override
- public Runner runnerForClass( Class<?> testClass ) throws Throwable {
- Concurrent annotation = testClass.getAnnotation( Concurrent.class );
- if ( annotation != null ) {
- return new ConcurrentJunitRunner( testClass );
- }
- return null;
- }
- }, ignoredBuilder(), annotatedBuilder(), suiteMethodBuilder(), junit3Builder(), junit4Builder() );
- for ( RunnerBuilder each : builders ) {
- Runner runner = each.safeRunnerForClass( testClass );
- if ( runner != null ) {
- return runner;
- }
- }
- return null;
- }
- } );
- setScheduler( new RunnerScheduler() {
- ExecutorService executorService = Executors.newFixedThreadPool(
- klass.isAnnotationPresent( Concurrent.class ) ? klass.getAnnotation( Concurrent.class ).threads() :
- ( int ) ( Runtime.getRuntime().availableProcessors() * 1.5 ),
- new NamedThreadFactory( klass.getSimpleName() ) );
- CompletionService<Void> completionService = new ExecutorCompletionService<Void>( executorService );
- Queue<Future<Void>> tasks = new LinkedList<Future<Void>>();
-
-
- @Override
- public void schedule( Runnable childStatement ) {
- tasks.offer( completionService.submit( childStatement, null ) );
- }
-
-
- @Override
- public void finished() {
- try {
- while ( !tasks.isEmpty() ) {
- tasks.remove( completionService.take() );
- }
- }
- catch ( InterruptedException e ) {
- Thread.currentThread().interrupt();
- }
- finally {
- while ( !tasks.isEmpty() ) {
- tasks.poll().cancel( true );
- }
- executorService.shutdownNow();
- }
- }
- } );
- }
-
-
- static final class NamedThreadFactory implements ThreadFactory {
- static final AtomicInteger poolNumber = new AtomicInteger( 1 );
- final AtomicInteger threadNumber = new AtomicInteger( 1 );
- final ThreadGroup group;
-
-
- NamedThreadFactory( String poolName ) {
- group = new ThreadGroup( poolName + "-" + poolNumber.getAndIncrement() );
- }
-
-
- @Override
- public Thread newThread( Runnable r ) {
- return new Thread( group, r, group.getName() + "-thread-" + threadNumber.getAndIncrement(), 0 );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
index ef860f8..c14568e 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
@@ -26,19 +26,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+
/**
* A singleton resource for spring that is used during testing. This will intialize spring, and then hold on to the
* spring context within this singleton
*/
-public class SpringResource extends EnvironResource {
+public class SpringResource {
public static final Logger LOG = LoggerFactory.getLogger( SpringResource.class );
private static SpringResource instance;
private ConfigurableApplicationContext applicationContext;
- private SchemaManager schemaManager;
/**
@@ -91,23 +92,6 @@ public class SpringResource extends EnvironResource {
}
- /**
- * Creates the schema and performs any migration
- */
- public void migrate() {
- // if ( !applicationContext.isActive() ) {
- // LOG.info( "Restarting context..." );
- // applicationContext.refresh();
- // }
-
-
- LOG.info( "The SchemaManager is not specified - using the default SchemaManager impl" );
- this.schemaManager = applicationContext.getBean( SchemaManager.class );
-
- schemaManager.create();
- schemaManager.populateBaseData();
- }
-
/**
* Start our spring context. Only invoke this if it is not set
@@ -117,9 +101,21 @@ public class SpringResource extends EnvironResource {
LOG.info( "-------------------------------------------------------------------" );
LOG.info( "Initializing Spring" );
LOG.info( "-------------------------------------------------------------------" );
- String[] locations = { "usergrid-test-context.xml" };
- applicationContext = new ClassPathXmlApplicationContext( locations );
- // applicationContext.refresh();
+
+
+
+
+ //wire up cassandra and elasticsearch before we start spring, otherwise this won't work
+ new CassandraResource().start();
+
+ new ElasticSearchResource().start();
+
+ final String[] locations = { "usergrid-test-context.xml" };
+
+ this.applicationContext = new ClassPathXmlApplicationContext( locations );
+
+
+// applicationContext.refresh();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/setup/ConcurrentProcessSingleton.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/setup/ConcurrentProcessSingleton.java b/stack/test-utils/src/main/java/org/apache/usergrid/setup/ConcurrentProcessSingleton.java
new file mode 100644
index 0000000..1ccbbef
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/setup/ConcurrentProcessSingleton.java
@@ -0,0 +1,124 @@
+/*
+ * 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.setup;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.cassandra.SchemaManager;
+import org.apache.usergrid.cassandra.SpringResource;
+import org.apache.usergrid.lock.MultiProcessBarrier;
+import org.apache.usergrid.lock.MultiProcessLocalLock;
+
+
+/**
+ * A singleton that starts cassandra and configures it once per JVM
+ */
+public class ConcurrentProcessSingleton {
+
+
+ private static final String TEMP_FILE_PATH =
+ "target/surefirelocks/start_barrier-" + System.getProperty( "test.barrier.timestamp", "default" );
+
+ public static final int LOCK_PORT = Integer.parseInt( System.getProperty( "test.lock.port", "10101" ) );
+
+ public static final boolean CLEAN_STORAGE =
+ Boolean.parseBoolean( System.getProperty( "test.clean.storage", "false" ) );
+
+
+ public static final long ONE_MINUTE = 60000;
+
+ private static final Logger logger = LoggerFactory.getLogger( ConcurrentProcessSingleton.class );
+
+ private final MultiProcessLocalLock lock = new MultiProcessLocalLock( LOCK_PORT );
+ private final MultiProcessBarrier barrier = new MultiProcessBarrier( TEMP_FILE_PATH );
+
+
+ private static ConcurrentProcessSingleton instance;
+
+ private SpringResource springResource;
+
+
+ /**
+ * Create the default instance
+ */
+ private ConcurrentProcessSingleton() {
+ springResource = SpringResource.getInstance();
+ }
+
+
+ public SpringResource getSpringResource() {
+ return springResource;
+ }
+
+
+ private void startSystem() {
+ try {
+
+ //we have a lock, so init the system
+ if ( lock.tryLock() ) {
+
+
+ final SchemaManager schemaManager = SpringResource.getInstance().getBean( SchemaManager.class );
+
+
+ //maybe delete existing column families and indexes
+ if ( CLEAN_STORAGE ) {
+ schemaManager.destroy();
+ }
+
+ //create our schema
+ schemaManager.create();
+ schemaManager.populateBaseData();
+
+
+ //signal to other processes we've migrated, and they can proceed
+ barrier.proceed();
+ }
+
+
+ barrier.await( ONE_MINUTE );
+
+ lock.maybeReleaseLock();
+ }
+ catch ( Exception e ) {
+ throw new RuntimeException( "Unable to initialize system", e );
+ }
+ }
+
+
+ /**
+ * Get an instance of this singleton. If it is the first time this instance is created it will also initialize the
+ * system
+ */
+ public static synchronized ConcurrentProcessSingleton getInstance() {
+ if ( instance != null ) {
+ return instance;
+ }
+
+
+ instance = new ConcurrentProcessSingleton();
+ instance.startSystem();
+
+
+ return instance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java b/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
deleted file mode 100644
index a651fe3..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
+++ /dev/null
@@ -1,67 +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.setup;
-
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-
-/**
- * Initializes the casandra and configuration before starting spring
- */
-public class SpringIntegrationRunner extends BlockJUnit4ClassRunner {
-
-
- private static SystemSetup setup;
-
-
- /**
- *
- */
- public SpringIntegrationRunner( final Class<?> clazz ) throws InitializationError {
- super( clazz );
- }
-
-
- @Override
- protected Statement withBeforeClasses( final Statement statement ) {
-
- singletonSetup();
- return super.withBeforeClasses( statement );
- }
-
-
- private static synchronized void singletonSetup() {
-
- if ( setup != null ) {
- return;
- }
-
- setup = new SystemSetup();
- try {
- setup.maybeInitialize();
- }
- catch ( Exception e ) {
- throw new RuntimeException( "Unable to start subsystem" );
- }
- }
-}