add delay on refresh for tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f95a7569 Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f95a7569 Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f95a7569 Branch: refs/heads/USERGRID-347 Commit: f95a7569892adfee191b16745db32c62b9f4be52 Parents: 7002051 Author: Shawn Feldman <[email protected]> Authored: Fri Mar 20 13:37:37 2015 -0600 Committer: Shawn Feldman <[email protected]> Committed: Fri Mar 20 13:37:37 2015 -0600 ---------------------------------------------------------------------- .../org/apache/usergrid/CoreApplication.java | 2 +- .../java/org/apache/usergrid/CoreITSetup.java | 2 +- .../org/apache/usergrid/CoreITSetupImpl.java | 16 +++++++++--- .../org/apache/usergrid/TestEntityIndex.java | 27 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95a7569/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java b/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java index 00972ea..503da3d 100644 --- a/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java +++ b/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java @@ -217,7 +217,7 @@ public class CoreApplication implements Application, TestRule { @Override public void refreshIndex() { try{ - Thread.sleep(100); + Thread.sleep(50); }catch (InterruptedException ie){ } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95a7569/stack/core/src/test/java/org/apache/usergrid/CoreITSetup.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetup.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetup.java index a1db845..3745b49 100644 --- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetup.java +++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetup.java @@ -47,5 +47,5 @@ public interface CoreITSetup extends TestRule { Injector getInjector(); - EntityIndex getEntityIndex(); + TestEntityIndex getEntityIndex(); } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95a7569/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java index 4996684..3cc0815 100644 --- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java +++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java @@ -38,7 +38,7 @@ import org.apache.usergrid.utils.JsonUtils; import com.google.inject.Injector; -public class CoreITSetupImpl implements CoreITSetup { +public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex { private static final Logger LOG = LoggerFactory.getLogger( CoreITSetupImpl.class ); private final Injector injector; @@ -156,7 +156,17 @@ public class CoreITSetupImpl implements CoreITSetup { } @Override - public EntityIndex getEntityIndex(){ - return getInjector().getInstance(EntityIndex.class); + public TestEntityIndex getEntityIndex(){ + return this; + } + + @Override + public void refresh(){ + try{ + Thread.sleep(50); + }catch (InterruptedException ie){ + + } + getEntityIndex().refresh(); } } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95a7569/stack/core/src/test/java/org/apache/usergrid/TestEntityIndex.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/TestEntityIndex.java b/stack/core/src/test/java/org/apache/usergrid/TestEntityIndex.java new file mode 100644 index 0000000..cdbae3f --- /dev/null +++ b/stack/core/src/test/java/org/apache/usergrid/TestEntityIndex.java @@ -0,0 +1,27 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ +package org.apache.usergrid; + +/** + * abstract refresh implementation + */ +public interface TestEntityIndex { + void refresh(); +}
