ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/26] ignite git commit: IGNITE-2064 Fixed more tests.
Date Thu, 10 Dec 2015 09:50:27 GMT
IGNITE-2064 Fixed more tests.


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

Branch: refs/heads/ignite-1537
Commit: 959c4d00220b9eb4f516d2b858b7b23c7fcf51b5
Parents: be17c9e
Author: Anton Vinogradov <av@apache.org>
Authored: Thu Dec 10 12:34:36 2015 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Thu Dec 10 12:34:36 2015 +0300

----------------------------------------------------------------------
 ...idCacheReplicatedUnswapAdvancedSelfTest.java | 42 +++++--------------
 .../GridCacheReplicatedPreloadSelfTest.java     | 44 +++++---------------
 .../tests/p2p/CacheDeploymentTestValue3.java    | 41 ++++++++++++++++++
 3 files changed, 61 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/959c4d00/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java
index e574418..8f3f3f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.replicated;
 
-import java.io.Serializable;
 import java.util.Collections;
 import java.util.concurrent.CountDownLatch;
 import org.apache.ignite.Ignite;
@@ -26,13 +25,12 @@ import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
-import org.apache.ignite.testframework.GridTestClassLoader;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
@@ -50,9 +48,6 @@ public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstrac
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setPeerClassLoadingLocalClassPathExclude(GridCacheReplicatedUnswapAdvancedSelfTest.class.getName(),
-            TestClass.class.getName());
-
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
 
         discoSpi.setIpFinder(IP_FINDER);
@@ -68,6 +63,9 @@ public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstrac
 
         cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
 
+        if (getTestGridName(1).equals(gridName) || cfg.getMarshaller() instanceof BinaryMarshaller)
+            cfg.setClassLoader(getExternalClassLoader());
+
         return cfg;
     }
 
@@ -84,11 +82,9 @@ public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstrac
         IgniteCache<Object, Object> cache2 = g2.cache(null);
 
         try {
-            ClassLoader ldr = new GridTestClassLoader(
-                GridCacheReplicatedUnswapAdvancedSelfTest.class.getName(),
-                TestClass.class.getName());
+            ClassLoader ldr = grid(1).configuration().getClassLoader();
 
-            Object v = ldr.loadClass(TestClass.class.getName()).newInstance();
+            Object v = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3").newInstance();
 
             info("v loader: " + v.getClass().getClassLoader());
 
@@ -132,7 +128,8 @@ public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstrac
             assert v2 != null;
             assert v2.toString().equals(v.toString());
             assert !v2.getClass().getClassLoader().equals(getClass().getClassLoader());
-            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader");
+            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")||
+                grid(2).configuration().getMarshaller() instanceof BinaryMarshaller;
 
             // To swap storage.
             cache2.localEvict(Collections.<Object>singleton(key));
@@ -145,31 +142,12 @@ public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstrac
 
             assert v2 != null;
 
-            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader");
+            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")|
+                grid(2).configuration().getMarshaller() instanceof BinaryMarshaller;
         }
         finally {
             stopGrid(1);
             stopGrid(2);
         }
     }
-    /**
-     * Test class.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class TestClass implements Serializable {
-        /** String value. */
-        private String s = "Test string";
-
-        /**
-         * @return String value.
-         */
-        public String getStr() {
-            return s;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(TestClass.class, this);
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/959c4d00/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 64f1495..5ee27c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.replicated.preloader;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -29,7 +28,6 @@ import java.util.Random;
 import java.util.UUID;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.cache.affinity.AffinityFunction;
@@ -39,16 +37,15 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
-import org.apache.ignite.testframework.GridTestClassLoader;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -93,8 +90,6 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
         cfg.setDiscoverySpi(disco);
 
         cfg.setCacheConfiguration(cacheConfiguration(gridName));
-        cfg.setPeerClassLoadingLocalClassPathExclude(GridCacheReplicatedPreloadSelfTest.class.getName(),
-            TestValue.class.getName());
 
         cfg.setDeploymentMode(CONTINUOUS);
 
@@ -106,6 +101,9 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
 
         cfg.setEventStorageSpi(spi);
 
+        if (getTestGridName(1).equals(gridName) || cfg.getMarshaller() instanceof BinaryMarshaller)
+            cfg.setClassLoader(getExternalClassLoader());
+
         return cfg;
     }
 
@@ -217,12 +215,9 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
             IgniteCache<Integer, Object> cache1 = g1.cache(null);
             IgniteCache<Integer, Object> cache2 = g2.cache(null);
 
-            ClassLoader ldr = new GridTestClassLoader(
-                GridCacheReplicatedPreloadSelfTest.class.getName(),
-                TestValue.class.getName(),
-                TestAffinityFunction.class.getName());
+            ClassLoader ldr = grid(1).configuration().getClassLoader();
 
-            Object v1 = ldr.loadClass(TestValue.class.getName()).newInstance();
+            Object v1 = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3").newInstance();
 
             cache1.put(1, v1);
 
@@ -235,7 +230,8 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
             assert v2 != null;
             assert v2.toString().equals(v1.toString());
             assert !v2.getClass().getClassLoader().equals(getClass().getClassLoader());
-            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader");
+            assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")
||
+                grid(2).configuration().getMarshaller() instanceof BinaryMarshaller;
 
             stopGrid(1);
 
@@ -252,7 +248,8 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
             assert v3 != null;
             assert v3.toString().equals(v1.toString());
             assert !v3.getClass().getClassLoader().equals(getClass().getClassLoader());
-            assert v3.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader");
+            assert v3.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")||
+                grid(3).configuration().getMarshaller() instanceof BinaryMarshaller;
         }
         finally {
             stopAllGrids();
@@ -504,27 +501,6 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
-     *
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class TestValue implements Serializable {
-        /** */
-        private String val = "test-" + System.currentTimeMillis();
-
-        /**
-         * @return Value
-         */
-        public String getValue() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(TestValue.class, this);
-        }
-    }
-
-    /**
      * Test affinity.
      */
     @SuppressWarnings({"PublicInnerClass"})

http://git-wip-us.apache.org/repos/asf/ignite/blob/959c4d00/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue3.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue3.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue3.java
new file mode 100644
index 0000000..643b0fc
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue3.java
@@ -0,0 +1,41 @@
+/*
+ *  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.tests.p2p;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Third test value for deployment.
+ */
+public class CacheDeploymentTestValue3 implements Serializable {
+    /** */
+    private String val = "test-" + System.currentTimeMillis();
+
+    /**
+     * @return Value
+     */
+    public String getValue() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheDeploymentTestValue3.class, this);
+    }
+}
\ No newline at end of file


Mime
View raw message