You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/03/06 12:48:46 UTC

[ignite] branch master updated: IGNITE-10674 Remove MARSH_CLASS_NAME=BinaryMarshaller from tests. (#6205)

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new cfa12b1  IGNITE-10674 Remove MARSH_CLASS_NAME=BinaryMarshaller from tests. (#6205)
cfa12b1 is described below

commit cfa12b19fac4d77f053e6e4f2997fccb5a007095
Author: Ilya Kasnacheev <il...@gmail.com>
AuthorDate: Wed Mar 6 15:48:36 2019 +0300

    IGNITE-10674 Remove MARSH_CLASS_NAME=BinaryMarshaller from tests. (#6205)
---
 .../ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java | 12 ------
 .../BinarySimpleNameTestPropertySelfTest.java      | 19 ++--------
 ...acheRebalancingUnmarshallingFailedSelfTest.java | 43 +++++++++++++++++++---
 .../continuous/CacheKeepBinaryIterationTest.java   |  6 ---
 .../testframework/config/GridTestProperties.java   |  3 --
 .../testframework/junits/GridAbstractTest.java     |  6 ---
 .../testframework/junits/IgniteTestResources.java  |  4 +-
 ...bjectsSimpleNameMapperComputeGridTestSuite.java |  1 -
 ...IgniteBinarySimpleNameMapperBasicTestSuite.java |  1 -
 ...inarySimpleNameMapperCacheFullApiTestSuite.java |  1 -
 .../testsuites/IgniteBinaryHibernateTestSuite.java | 37 -------------------
 .../IgniteBinaryHibernate5TestSuite.java           | 37 -------------------
 .../IgniteBinaryHibernate53TestSuite.java          | 37 -------------------
 13 files changed, 43 insertions(+), 164 deletions(-)

diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
index a8dc862..44fa5ba 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
@@ -30,8 +30,6 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -50,13 +48,8 @@ public abstract class AbstractJdbcPojoQuerySelfTest extends GridCommonAbstractTe
     /** Statement. */
     protected Statement stmt;
 
-    /** */
-    private String marshallerBackup = GridTestProperties.getProperty(GridTestProperties.MARSH_CLASS_NAME);
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         CacheConfiguration<?,?> cache = defaultCacheConfiguration();
@@ -103,11 +96,6 @@ public abstract class AbstractJdbcPojoQuerySelfTest extends GridCommonAbstractTe
     }
 
     /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, marshallerBackup);
-    }
-
-    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         stmt = DriverManager.getConnection(getURL()).createStatement();
 
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySimpleNameTestPropertySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySimpleNameTestPropertySelfTest.java
index ce98e33..7e1709e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySimpleNameTestPropertySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySimpleNameTestPropertySelfTest.java
@@ -27,7 +27,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
 import static org.apache.ignite.testframework.config.GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER;
-import static org.apache.ignite.testframework.config.GridTestProperties.MARSH_CLASS_NAME;
 
 /**
  * Tests testing framewrok, epecially BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER test property.
@@ -94,22 +93,12 @@ public class BinarySimpleNameTestPropertySelfTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     private void checkProperty(String expTypeName) throws Exception {
-        String marshBackup = GridTestProperties.getProperty(MARSH_CLASS_NAME);
+        IgniteBinary binary = startGrid().binary();
 
-        try {
-            GridTestProperties.setProperty(MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-
-            IgniteBinary binary = startGrid().binary();
-
-            BinaryObjectBuilder builder = binary.builder("org.ignite.test.TestClass");
+        BinaryObjectBuilder builder = binary.builder("org.ignite.test.TestClass");
 
-            BinaryObject bObj = builder.build();
+        BinaryObject bObj = builder.build();
 
-            assertEquals(expTypeName, bObj.type().typeName());
-        }
-        finally {
-            if (marshBackup != null)
-                GridTestProperties.setProperty(MARSH_CLASS_NAME, marshBackup);
-        }
+        assertEquals(expTypeName, bObj.type().typeName());
     }
 }
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
index 9ee0892..81cfaad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
@@ -29,6 +29,9 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.thread.IgniteThread;
@@ -44,6 +47,9 @@ public class GridCacheRebalancingUnmarshallingFailedSelfTest extends GridCommonA
     /** Allows to change behavior of readExternal method. */
     protected static AtomicInteger readCnt = new AtomicInteger();
 
+    /** */
+    private volatile Marshaller marshaller;
+
     /** Test key 1. */
     private static class TestKey implements Externalizable {
         /** Field. */
@@ -109,6 +115,7 @@ public class GridCacheRebalancingUnmarshallingFailedSelfTest extends GridCommonA
         cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
 
         iCfg.setCacheConfiguration(cfg);
+        iCfg.setMarshaller(marshaller);
 
         return iCfg;
     }
@@ -117,12 +124,38 @@ public class GridCacheRebalancingUnmarshallingFailedSelfTest extends GridCommonA
      * @throws Exception e.
      */
     @Test
-    public void test() throws Exception {
-        String marshClsName = GridTestProperties.getProperty(GridTestProperties.MARSH_CLASS_NAME);
+    public void testBinary() throws Exception {
+        marshaller = new BinaryMarshaller();
+
+        runTest();
+    }
+
+
+    /**
+     * @throws Exception e.
+     */
+    @Test
+    public void testOptimized() throws Exception {
+        marshaller = new OptimizedMarshaller();
+
+        runTest();
+    }
 
-        // This test passes with binary marshaller because we do not unmarshall keys.
-        if (marshClsName != null && marshClsName.contains(BinaryMarshaller.class.getSimpleName()))
-            return;
+    /**
+     * @throws Exception e.
+     */
+    @Test
+    public void testJdk() throws Exception {
+        marshaller = new JdkMarshaller();
+
+        runTest();
+    }
+
+    /**
+     * @throws Exception e.
+     */
+    private void runTest() throws Exception {
+        assert marshaller != null;
 
         readCnt.set(Integer.MAX_VALUE);
 
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
index ffec514..8c97915 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
@@ -28,11 +28,9 @@ import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
@@ -52,10 +50,6 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest {
     /** */
     private static final int KEYS = 1025;
 
-    static {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-    }
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java b/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
index 9f6feab..8efd190 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
@@ -73,9 +73,6 @@ public final class GridTestProperties {
     private static final Map<String, Map<String, String>> pathProps = new HashMap<>();
 
     /** */
-    public static final String MARSH_CLASS_NAME = "marshaller.class";
-
-    /** */
     public static final String ENTRY_PROCESSOR_CLASS_NAME = "entry.processor.class";
 
     /** Binary marshaller compact footers property. */
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index b5edfd9..b4f2205 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -156,9 +156,6 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
     /** Null name for execution map. */
     private static final String NULL_NAME = UUID.randomUUID().toString();
 
-    /** */
-    private static final boolean BINARY_MARSHALLER = false;
-
     /** Ip finder for TCP discovery. */
     public static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) {{
         setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
@@ -224,9 +221,6 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
         System.setProperty(IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY, "1");
         System.setProperty(IGNITE_CLIENT_CACHE_CHANGE_MESSAGE_TIMEOUT, "1000");
 
-        if (BINARY_MARSHALLER)
-            GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-
         if (GridTestClockTimer.startTestTimer()) {
             Thread timer = new Thread(new GridTestClockTimer(), "ignite-clock-for-tests");
 
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
index 156f99b..a424779 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
@@ -39,7 +39,6 @@ import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.marshaller.MarshallerContextTestImpl;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.LoggerResource;
-import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
 import org.apache.ignite.thread.IgniteThreadPoolExecutor;
 import org.jetbrains.annotations.Nullable;
@@ -243,8 +242,7 @@ public class IgniteTestResources {
      * @throws IgniteCheckedException If failed.
      */
     public static synchronized Marshaller getMarshaller() throws IgniteCheckedException {
-        String marshallerName =
-            System.getProperty(MARSH_CLASS_NAME, GridTestProperties.getProperty(GridTestProperties.MARSH_CLASS_NAME));
+        String marshallerName = System.getProperty(MARSH_CLASS_NAME);
 
         Marshaller marsh;
 
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsSimpleNameMapperComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsSimpleNameMapperComputeGridTestSuite.java
index b655c04..2c9bc6a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsSimpleNameMapperComputeGridTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsSimpleNameMapperComputeGridTestSuite.java
@@ -32,7 +32,6 @@ public class IgniteBinaryObjectsSimpleNameMapperComputeGridTestSuite {
     /** */
     @BeforeClass
     public static void init() {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
         GridTestProperties.setProperty(GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER, "true");
     }
 }
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperBasicTestSuite.java
index 99540a9..d66c63f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperBasicTestSuite.java
@@ -32,7 +32,6 @@ public class IgniteBinarySimpleNameMapperBasicTestSuite {
     /** */
     @BeforeClass
     public static void init() {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
         GridTestProperties.setProperty(GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER, "true");
     }
 }
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperCacheFullApiTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperCacheFullApiTestSuite.java
index 90fa9e0..453b999 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperCacheFullApiTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinarySimpleNameMapperCacheFullApiTestSuite.java
@@ -34,7 +34,6 @@ public class IgniteBinarySimpleNameMapperCacheFullApiTestSuite {
     /** */
     @BeforeClass
     public static void init() {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
         GridTestProperties.setProperty(GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER, "true");
     }
 }
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
deleted file mode 100644
index 7425238..0000000
--- a/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
+++ /dev/null
@@ -1,37 +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.ignite.testsuites;
-
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/** */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    IgniteHibernateTestSuite.class
-})
-public class IgniteBinaryHibernateTestSuite {
-    /** */
-    @BeforeClass
-    public static void init() {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-    }
-}
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
deleted file mode 100644
index 2a33e08..0000000
--- a/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
+++ /dev/null
@@ -1,37 +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.ignite.testsuites;
-
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/** */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    IgniteHibernate5TestSuite.class
-})
-public class IgniteBinaryHibernate5TestSuite {
-    /** */
-    @BeforeClass
-    public static void init() {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-    }
-}
diff --git a/modules/hibernate-5.3/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate53TestSuite.java b/modules/hibernate-5.3/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate53TestSuite.java
deleted file mode 100644
index 6ce688c..0000000
--- a/modules/hibernate-5.3/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate53TestSuite.java
+++ /dev/null
@@ -1,37 +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.ignite.testsuites;
-
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/** */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    IgniteHibernate53TestSuite.class
-})
-public class IgniteBinaryHibernate53TestSuite {
-    /** */
-    @BeforeClass
-    public static void init()  {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-    }
-}