Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1108 6792963fc -> 37c4bbcd5


IGNITE-1108 Fixed tests.


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

Branch: refs/heads/ignite-1108
Commit: 37c4bbcd5256b0ea5f4f770ee63a136387f757f2
Parents: 6792963
Author: nikolay_tikhonov <[email protected]>
Authored: Tue Jul 14 11:11:12 2015 +0300
Committer: nikolay_tikhonov <[email protected]>
Committed: Tue Jul 14 11:11:12 2015 +0300

----------------------------------------------------------------------
 .../org.apache.ignite.plugin.PluginProvider     |   2 +-
 .../internal/IgnitePluginLifecycleSelfTest.java |  86 +--------------
 .../internal/util/TestPluginProvider.java       | 106 +++++++++++++++++++
 3 files changed, 110 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/37c4bbcd/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
 
b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
index 4a42b6d..c325582 100644
--- 
a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
+++ 
b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.ignite.internal.IgnitePluginLifecycleSelfTest$TestPluginProvider
\ No newline at end of file
+org.apache.ignite.internal.util.TestPluginProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/37c4bbcd/modules/core/src/test/java/org/apache/ignite/internal/IgnitePluginLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/IgnitePluginLifecycleSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/IgnitePluginLifecycleSelfTest.java
index 0282f58..610ffd1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/IgnitePluginLifecycleSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/IgnitePluginLifecycleSelfTest.java
@@ -17,22 +17,15 @@
 
 package org.apache.ignite.internal;
 
-import org.apache.ignite.*;
-import org.apache.ignite.plugin.*;
-import org.apache.ignite.testframework.*;
+import org.apache.ignite.internal.util.*;
 import org.apache.ignite.testframework.junits.common.*;
 
-import java.util.concurrent.*;
-
 /**
  *
  */
 @GridCommonTest(group = "Kernal Self")
 public class IgnitePluginLifecycleSelfTest extends GridCommonAbstractTest {
     /** */
-    public static boolean enableAssert = false;
-
-    /** */
     public IgnitePluginLifecycleSelfTest() {
         super(false);
     }
@@ -47,7 +40,7 @@ public class IgnitePluginLifecycleSelfTest extends 
GridCommonAbstractTest {
      */
     public void testStopGrid() throws Exception {
         try {
-            enableAssert = true;
+            TestPluginProvider.enableAssert = true;
 
             startGrid("testGrid");
         }
@@ -56,7 +49,7 @@ public class IgnitePluginLifecycleSelfTest extends 
GridCommonAbstractTest {
                 stopGrid("testGrid", true);
             }
             finally {
-                enableAssert = false;
+                TestPluginProvider.enableAssert = false;
             }
         }
 
@@ -64,77 +57,4 @@ public class IgnitePluginLifecycleSelfTest extends 
GridCommonAbstractTest {
             && TestPluginProvider.bfStop && TestPluginProvider.stop && 
TestPluginProvider.afStop
         );
     }
-
-    /** */
-    public static class TestPluginCfg implements PluginConfiguration {
-    }
-
-    /** */
-    public static class TestPluginProvider extends 
PluginProviderAdapter<TestPluginCfg> {
-        /** */
-        IgniteKernal ignite;
-
-        public static boolean bfStart, start, afStart, bfStop, stop, afStop;
-
-
-        /** {@inheritDoc} */
-        @Override public String name() {
-            return "TestPlugin";
-        }
-
-        /** {@inheritDoc} */
-        @Override public IgnitePlugin plugin() {
-            return new IgnitePlugin() {};
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onBeforeStart() throws IgniteCheckedException {
-            bfStart = true;
-
-            if (enableAssert)
-                assertFalse(start || afStart || bfStop || stop || afStop);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void start(PluginContext ctx) throws 
IgniteCheckedException {
-            ignite = (IgniteKernal)ctx.grid();
-
-            start = true;
-
-            if (enableAssert)
-                assertFalse(afStart || bfStop || stop || afStop);
-        }
-
-        @Override public void onAfterStart() throws IgniteCheckedException {
-            afStart = true;
-
-            if (enableAssert)
-                assertFalse(bfStop || stop || afStop);
-        }
-
-        @Override public void onBeforeStop(boolean cancel) {
-            bfStop = true;
-
-            if (enableAssert)
-                assertFalse(stop || afStop);
-        }
-
-        @Override public void stop(boolean cancel) throws 
IgniteCheckedException {
-            stop = true;
-
-            if (enableAssert)
-                assertFalse(afStop);
-        }
-
-        @Override public void onAfterStop(boolean cancel) {
-            if (enableAssert)
-                GridTestUtils.assertThrows(null, new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        return ignite.cache(null);
-                    }
-                }, IllegalStateException.class, null);
-
-            afStop = true;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/37c4bbcd/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
new file mode 100644
index 0000000..5380964
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
@@ -0,0 +1,106 @@
+/*
+ * 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.ignite.internal.util;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.plugin.*;
+import org.apache.ignite.testframework.*;
+
+import java.util.concurrent.*;
+
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class TestPluginProvider extends 
PluginProviderAdapter<TestPluginProvider.TestPluginCfg> {
+    /** */
+    public static boolean bfStart, start, afStart, bfStop, stop, afStop;
+
+    /** */
+    public static boolean enableAssert = false;
+
+    /** */
+    IgniteKernal ignite;
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return "TestPlugin";
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgnitePlugin plugin() {
+        return new IgnitePlugin() {};
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onBeforeStart() throws IgniteCheckedException {
+        bfStart = true;
+
+        if (enableAssert)
+            assertFalse(start || afStart || bfStop || stop || afStop);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(PluginContext ctx) throws 
IgniteCheckedException {
+        ignite = (IgniteKernal)ctx.grid();
+
+        start = true;
+
+        if (enableAssert)
+            assertFalse(afStart || bfStop || stop || afStop);
+    }
+
+    @Override public void onAfterStart() throws IgniteCheckedException {
+        afStart = true;
+
+        if (enableAssert)
+            assertFalse(bfStop || stop || afStop);
+    }
+
+    @Override public void onBeforeStop(boolean cancel) {
+        bfStop = true;
+
+        if (enableAssert)
+            assertFalse(stop || afStop);
+    }
+
+    @Override public void stop(boolean cancel) throws IgniteCheckedException {
+        stop = true;
+
+        if (enableAssert)
+            assertFalse(afStop);
+    }
+
+    @Override public void onAfterStop(boolean cancel) {
+        if (enableAssert)
+            GridTestUtils.assertThrows(null, new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    return ignite.cache(null);
+                }
+            }, IllegalStateException.class, null);
+
+        afStop = true;
+    }
+
+    /** */
+    public static class TestPluginCfg implements PluginConfiguration {
+        // No-op.
+    }
+}

Reply via email to