ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [1/6] incubator-ignite git commit: IGNITE-141 - Marshallers refactoring
Date Sat, 28 Feb 2015 03:48:19 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-141 [created] 6653e55e5


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
index 07ca949..fc43dcc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
@@ -18,14 +18,10 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.resources.*;
@@ -34,8 +30,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 
-import java.util.*;
-
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderImplSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderImplSelfTest.java
index e433856..6caeab6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderImplSelfTest.java
@@ -128,13 +128,6 @@ public class GridDataLoaderImplSelfTest extends GridCommonAbstractTest
{
 
             Ignite g0 = grid(0);
 
-            Marshaller marsh = g0.configuration().getMarshaller();
-
-            if (marsh instanceof OptimizedMarshaller)
-                assertTrue(((OptimizedMarshaller)marsh).isRequireSerializable());
-            else
-                fail("Expected GridOptimizedMarshaller, but found: " + marsh.getClass().getName());
-
             IgniteDataLoader<Integer, String> dataLdr = g0.dataLoader(null);
 
             Map<Integer, String> map = U.newHashMap(KEYS_COUNT);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/internal/processors/streamer/GridStreamerEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/streamer/GridStreamerEvictionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/streamer/GridStreamerEvictionSelfTest.java
index 03ed31f..8985a91 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/streamer/GridStreamerEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/streamer/GridStreamerEvictionSelfTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.streamer;
 
-import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.marshaller.optimized.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerPerformanceTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerPerformanceTest.java
index 1e7c9a0..df00966 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerPerformanceTest.java
@@ -102,8 +102,6 @@ public class GridMarshallerPerformanceTest extends GridCommonAbstractTest
{
 
         final OptimizedMarshaller marsh = new OptimizedMarshaller();
 
-        marsh.setClassNames(Arrays.asList(TestObject.class.getName()));
-
         IgniteInClosure<TestObject> writer = new CIX1<TestObject>() {
             @Override public void applyx(TestObject obj) throws IgniteCheckedException {
                 tuple.set(marsh.marshal(obj));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
index f2639a4..1d0967f 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.marshaller.optimized;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.testframework.*;
@@ -37,7 +36,6 @@ public class OptimizedMarshallerSelfTest extends GridMarshallerAbstractTest
{
         OptimizedMarshaller m = new OptimizedMarshaller();
 
         m.setRequireSerializable(false);
-        m.setClassNames(F.asList(GoodMarshallable.class.getName(), NoMarshallable.class.getName()));
 
         return m;
     }
@@ -115,75 +113,6 @@ public class OptimizedMarshallerSelfTest extends GridMarshallerAbstractTest
{
     }
 
     /**
-     * @throws Exception If failed.
-     */
-    public void testGoodMarshallable() throws Exception {
-        GoodMarshallable obj = new GoodMarshallable("String", 100);
-
-        GoodMarshallable newObj = unmarshal(marshal(obj));
-
-        assertEquals("String", newObj.getString());
-        assertEquals(100, newObj.getInt());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBadMarshallable() throws Exception {
-        BadMarshallable obj = new BadMarshallable("String", 100);
-
-        try {
-            System.out.println(unmarshal(marshal(obj)));
-
-            assert false;
-        }
-        catch (IgniteCheckedException e) {
-            assert e.getCause() instanceof IOException;
-            assert e.getCause().getMessage().contains("must return the value of the field");
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void checkPerformance() throws Exception {
-        final int cnt = 5_000_000;
-
-        for (int j = 0; j < 5; j++) {
-            long start = System.nanoTime();
-
-            for (int i = 0; i < cnt; i++) {
-                String s = "string-" + i;
-
-                NoMarshallable obj = new NoMarshallable(s, i);
-
-                NoMarshallable newObj = unmarshal(marshal(obj));
-
-                assertEquals(s, newObj.getString());
-            }
-
-            X.println("Marshalling NoMarshallable duration: " + ((System.nanoTime() - start)
/ 1_000_000) + "ms");
-        }
-
-
-        for (int j = 0; j < 5; j++) {
-            long start = System.nanoTime();
-
-            for (int i = 0; i < cnt; i++) {
-                String s = "string-" + i;
-
-                GoodMarshallable obj = new GoodMarshallable(s, i);
-
-                GoodMarshallable newObj = unmarshal(marshal(obj));
-
-                assertEquals(s, newObj.getString());
-            }
-
-            X.println("Marshalling Marshallable duration: " + ((System.nanoTime() - start)
/ 1_000_000) + "ms");
-        }
-    }
-
-    /**
      * Class for nested execution test.
      */
     private static class NestedTestObject implements Serializable {
@@ -350,103 +279,4 @@ public class OptimizedMarshallerSelfTest extends GridMarshallerAbstractTest
{
             this.link = link;
         }
     }
-
-    /**
-     *
-     */
-    public static class GoodMarshallable implements OptimizedMarshallable, Serializable {
-        /** Class ID required by {@link OptimizedMarshallable}. */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
-        private String str;
-
-        /** */
-        private int i;
-
-        /**
-         * @param str String.
-         * @param i Integer.
-         */
-        public GoodMarshallable(String str, int i) {
-            this.str = str;
-            this.i = i;
-        }
-
-        /**
-         * @return Int value.
-         */
-        private int getInt() {
-            return i;
-        }
-
-        /**
-         * @return String value
-         */
-        private String getString() {
-            return str;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-    }
-
-    /**
-     *
-     */
-    public static class NoMarshallable implements Serializable {
-        /** */
-        private String str;
-
-        /** */
-        private int i;
-
-        /**
-         * @param str String.
-         * @param i Integer.
-         */
-        public NoMarshallable(String str, int i) {
-            this.str = str;
-            this.i = i;
-        }
-
-        /**
-         * @return Int value.
-         */
-        private int getInt() {
-            return i;
-        }
-
-        /**
-         * @return String value
-         */
-        private String getString() {
-            return str;
-        }
-    }
-
-    /**
-     *
-     */
-    private static class BadMarshallable extends TestObject implements OptimizedMarshallable
{
-        /** Class ID required by {@link OptimizedMarshallable}. */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /**
-         * @param str String.
-         * @param i Integer.
-         */
-        private BadMarshallable(String str, int i) {
-            super(str, i);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return new Object();
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
index 9d3784a..bf2b734 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
@@ -223,69 +223,6 @@ public class OptimizedMarshallerTest extends GridCommonAbstractTest {
     }
 
     /**
-     * Tests {@link OptimizedMarshaller#setClassNames(List)}.
-     *
-     * @throws IgniteCheckedException If marshalling failed.
-     */
-    public void testUserPreregisteredNames() throws IgniteCheckedException {
-        Object obj = new SomeSerializable(null);
-
-        // Clear caches.
-        ((Map)U.staticField(OptimizedMarshallerUtils.class, "CLS_DESC_CACHE")).clear();
-        OptimizedClassResolver.userClasses(null, null);
-
-        Marshaller marsh = new OptimizedMarshaller();
-
-        int size1 = marsh.marshal(obj).length;
-
-        // Clear caches.
-        ((Map)U.staticField(OptimizedMarshallerUtils.class, "CLS_DESC_CACHE")).clear();
-        OptimizedClassResolver.userClasses(null, null);
-
-        OptimizedMarshaller marshPreregistered = new OptimizedMarshaller();
-
-        marshPreregistered.setClassNames(Arrays.asList(SomeSerializable.class.getName()));
-
-        int size2 = marshPreregistered.marshal(obj).length;
-
-        assertTrue(size1 > size2);
-    }
-
-    /**
-     * Tests {@link OptimizedMarshaller#setClassNames(List)}.
-     *
-     * @throws IgniteCheckedException If marshalling failed.
-     * @throws IOException If an I/O error occurs.
-     */
-    public void testUserPreregisteredNamesPath() throws IgniteCheckedException, IOException
{
-        Object obj = new SomeSerializable(null);
-
-        // Clear caches.
-        ((Map)U.staticField(OptimizedMarshallerUtils.class, "CLS_DESC_CACHE")).clear();
-        OptimizedClassResolver.userClasses(null, null);
-
-        Marshaller marsh = new OptimizedMarshaller();
-
-        int size1 = marsh.marshal(obj).length;
-
-        // Clear caches.
-        ((Map)U.staticField(OptimizedMarshallerUtils.class, "CLS_DESC_CACHE")).clear();
-        OptimizedClassResolver.userClasses(null, null);
-
-        OptimizedMarshaller marshPreregistered = new OptimizedMarshaller();
-
-        File namesFile = File.createTempFile("gg-", null);
-
-        U.writeStringToFile(namesFile, SomeSerializable.class.getName(), "UTF-8");
-
-        marshPreregistered.setClassNamesPath(namesFile.getAbsolutePath());
-
-        int size2 = marshPreregistered.marshal(obj).length;
-
-        assertTrue(size1 > size2);
-    }
-
-    /**
      * Tests {@link Proxy}.
      *
      * @throws IgniteCheckedException If marshalling failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java
index 8145e37..83e9aba 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java
@@ -216,7 +216,7 @@ public class OptimizedObjectStreamSelfTest extends GridCommonAbstractTest
{
      */
     public void testRequireSerializable() throws Exception {
         try {
-            new OptimizedMarshaller(true, null, null, 0).marshal(new Object());
+            new OptimizedMarshaller(true).marshal(new Object());
 
             assert false : "Exception not thrown.";
         }
@@ -242,7 +242,9 @@ public class OptimizedObjectStreamSelfTest extends GridCommonAbstractTest
{
         Arrays.fill(obj.longArr, 100L);
         Arrays.fill(obj.doubleArr, 100.0d);
 
-        final OptimizedMarshaller marsh = new OptimizedMarshaller(false, null, null, 5);
+        final OptimizedMarshaller marsh = new OptimizedMarshaller();
+
+        marsh.setPoolSize(5);
 
         try {
             multithreaded(new Callable<Object>() {


Mime
View raw message