This is an automated email from the ASF dual-hosted git repository.
nizhikov 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 a3732918536 IGNITE-15803 Remove "instanceof BinaryMarshaller" from
tests (#11780)
a3732918536 is described below
commit a37329185366aab227956ff2fd4144fdc5ce5214
Author: Nikolay <[email protected]>
AuthorDate: Fri Dec 27 22:55:50 2024 +0300
IGNITE-15803 Remove "instanceof BinaryMarshaller" from tests (#11780)
---
.../internal/jdbc2/JdbcResultSetSelfTest.java | 4 +-
.../cache/store/jdbc/CacheJdbcPojoStoreTest.java | 140 +++++++--------------
.../cache/CacheEntryProcessorCopySelfTest.java | 4 +-
.../cache/CacheEnumOperationsAbstractTest.java | 14 +--
.../cache/CacheStartupInDeploymentModesTest.java | 10 --
.../GridCacheConditionalDeploymentSelfTest.java | 43 +------
.../processors/cache/IgniteCacheGroupsTest.java | 8 +-
...teCacheReadThroughEvictionsVariationsSuite.java | 10 +-
.../cache/IgniteCacheStoreValueAbstractTest.java | 43 +------
.../GridCacheReplicatedPreloadSelfTest.java | 34 +----
.../session/GridSessionCheckpointSelfTest.java | 10 +-
...inaryCacheConfigVariationsFullApiTestSuite.java | 13 --
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 44 +------
.../IgniteCacheAbstractInsertSqlQuerySelfTest.java | 67 ++--------
.../cache/IgniteCacheAbstractQuerySelfTest.java | 41 +++---
.../IgniteCacheAbstractSqlDmlQuerySelfTest.java | 51 ++------
.../IgniteCacheJoinQueryWithAffinityKeyTest.java | 5 +-
17 files changed, 107 insertions(+), 434 deletions(-)
diff --git
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
index 1470a5cfcf3..536744a5195 100644
---
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
+++
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
@@ -42,7 +42,6 @@ import
org.apache.ignite.cache.query.annotations.QuerySqlField;
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.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.testframework.GridTestUtils;
@@ -820,8 +819,7 @@ public class JdbcResultSetSelfTest extends
GridCommonAbstractTest {
@Test
public void testObject() throws Exception {
final Ignite ignite = ignite(0);
- final boolean binaryMarshaller =
ignite.configuration().getMarshaller() instanceof BinaryMarshaller;
- final IgniteBinary binary = binaryMarshaller ? ignite.binary() : null;
+ final IgniteBinary binary = ignite.binary();
ResultSet rs = stmt.executeQuery(SQL);
TestObjectField f1 = new TestObjectField(100, "AAAA");
diff --git
a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
index a1b02a75126..a3760ab032d 100644
---
a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
@@ -48,7 +48,6 @@ import
org.apache.ignite.cache.store.jdbc.model.OrganizationKey;
import org.apache.ignite.cache.store.jdbc.model.Person;
import org.apache.ignite.cache.store.jdbc.model.PersonComplexKey;
import org.apache.ignite.cache.store.jdbc.model.PersonKey;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -74,9 +73,6 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
/** Ignite. */
private Ignite ig;
- /** Binary enable. */
- private boolean binaryEnable;
-
/**
* @throws Exception If failed.
*/
@@ -291,8 +287,6 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
Ignite ig = U.field(store, "ignite");
this.ig = ig;
-
- binaryEnable = ig.configuration().getMarshaller() instanceof
BinaryMarshaller;
}
/**
@@ -385,49 +379,28 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
IgniteBiInClosure<Object, Object> c = new CI2<Object, Object>() {
@Override public void apply(Object k, Object v) {
- if (binaryEnable) {
- if (k instanceof BinaryObject && v instanceof
BinaryObject) {
- BinaryObject key = (BinaryObject)k;
- BinaryObject val = (BinaryObject)v;
-
- String keyType = key.type().typeName();
- String valType = val.type().typeName();
-
- if (OrganizationKey.class.getName().equals(keyType)
- && Organization.class.getName().equals(valType))
- orgKeys.add(key);
-
- if (PersonKey.class.getName().equals(keyType)
- && Person.class.getName().equals(valType))
- prnKeys.add(key);
-
- if (PersonComplexKey.class.getName().equals(keyType)
- && Person.class.getName().equals(valType))
- prnComplexKeys.add(key);
-
- if (BinaryTestKey.class.getName().equals(keyType)
- && BinaryTest.class.getName().equals(valType))
- binaryTestVals.add(val.field("bytes"));
- }
- }
- else {
- if (k instanceof OrganizationKey && v instanceof
Organization)
- orgKeys.add(k);
- else if (k instanceof PersonKey && v instanceof Person)
- prnKeys.add(k);
- else if (k instanceof BinaryTestKey && v instanceof
BinaryTest)
- binaryTestVals.add(((BinaryTest)v).getBytes());
- else if (k instanceof PersonComplexKey && v instanceof
Person) {
- PersonComplexKey key = (PersonComplexKey)k;
-
- Person val = (Person)v;
-
- assertTrue("Key ID should be the same as value ID",
key.getId() == val.getId());
- assertTrue("Key orgID should be the same as value
orgID", key.getOrgId() == val.getOrgId());
- assertEquals("name" + key.getId(), val.getName());
-
- prnComplexKeys.add(k);
- }
+ if (k instanceof BinaryObject && v instanceof BinaryObject) {
+ BinaryObject key = (BinaryObject)k;
+ BinaryObject val = (BinaryObject)v;
+
+ String keyType = key.type().typeName();
+ String valType = val.type().typeName();
+
+ if (OrganizationKey.class.getName().equals(keyType)
+ && Organization.class.getName().equals(valType))
+ orgKeys.add(key);
+
+ if (PersonKey.class.getName().equals(keyType)
+ && Person.class.getName().equals(valType))
+ prnKeys.add(key);
+
+ if (PersonComplexKey.class.getName().equals(keyType)
+ && Person.class.getName().equals(valType))
+ prnComplexKeys.add(key);
+
+ if (BinaryTestKey.class.getName().equals(keyType)
+ && BinaryTest.class.getName().equals(valType))
+ binaryTestVals.add(val.field("bytes"));
}
}
};
@@ -505,24 +478,16 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
IgniteBiInClosure<Object, Object> c = new CI2<Object, Object>() {
@Override public void apply(Object k, Object v) {
- if (binaryEnable) {
- if (k instanceof BinaryObject && v instanceof
BinaryObject) {
- BinaryObject key = (BinaryObject)k;
- BinaryObject val = (BinaryObject)v;
-
- String keyType = key.type().typeName();
- String valType = val.type().typeName();
-
- if (PersonComplexKey.class.getName().equals(keyType)
- && Person.class.getName().equals(valType))
- prnComplexKeys.add(key);
- }
- }
- else {
- if (k instanceof PersonComplexKey && v instanceof Person)
- prnComplexKeys.add(k);
- else
- fail("Unexpected entry [key=" + k + ", value=" + v +
"]");
+ if (k instanceof BinaryObject && v instanceof BinaryObject) {
+ BinaryObject key = (BinaryObject)k;
+ BinaryObject val = (BinaryObject)v;
+
+ String keyType = key.type().typeName();
+ String valType = val.type().typeName();
+
+ if (PersonComplexKey.class.getName().equals(keyType)
+ && Person.class.getName().equals(valType))
+ prnComplexKeys.add(key);
}
}
};
@@ -648,24 +613,13 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
IgniteBiInClosure<Object, Object> c = new CI2<Object, Object>() {
@Override public void apply(Object k, Object v) {
- if (binaryEnable) {
- assertTrue(k instanceof BinaryObject);
- assertTrue(v instanceof BinaryObject);
-
- BinaryObject val = (BinaryObject)v;
+ assertTrue(k instanceof BinaryObject);
+ assertTrue(v instanceof BinaryObject);
- assertTrue(Arrays.equals(picture, val.field("picture")));
- assertEquals(longDescription, val.field("description"));
- }
- else {
- assertTrue(k instanceof LogoKey);
- assertTrue(v instanceof Logo);
-
- Logo val = (Logo)v;
+ BinaryObject val = (BinaryObject)v;
- assertTrue(Arrays.equals(picture, val.getPicture()));
- assertEquals(longDescription, val.getDescription());
- }
+ assertTrue(Arrays.equals(picture, val.field("picture")));
+ assertEquals(longDescription, val.field("description"));
}
};
@@ -720,23 +674,19 @@ public class CacheJdbcPojoStoreTest extends
GridAbstractCacheStoreSelfTest<Cache
* @param obj Object.
*/
private Object wrap(Object obj) throws IllegalAccessException {
- if (binaryEnable) {
- Class<?> cls = obj.getClass();
+ Class<?> cls = obj.getClass();
- BinaryObjectBuilder builder = ig.binary().builder(cls.getName());
+ BinaryObjectBuilder builder = ig.binary().builder(cls.getName());
- for (Field f : cls.getDeclaredFields()) {
- if (f.getName().contains("serialVersionUID"))
- continue;
+ for (Field f : cls.getDeclaredFields()) {
+ if (f.getName().contains("serialVersionUID"))
+ continue;
- f.setAccessible(true);
-
- builder.setField(f.getName(), f.get(obj));
- }
+ f.setAccessible(true);
- return builder.build();
+ builder.setField(f.getName(), f.get(obj));
}
- return obj;
+ return builder.build();
}
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEntryProcessorCopySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEntryProcessorCopySelfTest.java
index 9902d03b1da..4bb57665a77 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEntryProcessorCopySelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEntryProcessorCopySelfTest.java
@@ -30,7 +30,6 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheEntryProcessor;
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.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -102,8 +101,7 @@ public class CacheEntryProcessorCopySelfTest extends
GridCommonAbstractTest {
// One deserialization due to copyOnRead == true.
// Additional deserialization in case p2p enabled and not
BinaryMarshaller due to storeValue == true on update entry.
- doTest(true, true, NEW_VAL, p2pEnabled &&
- !(grid.configuration().getMarshaller() instanceof
BinaryMarshaller) ? 2 : 1);
+ doTest(true, true, NEW_VAL, 1);
// No deserialization.
doTest(false, false, NEW_VAL, 0);
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
index 22710b6fa91..1d80d6ea049 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -26,8 +26,6 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.binary.BinaryEnumObjectImpl;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
@@ -187,15 +185,11 @@ public abstract class CacheEnumOperationsAbstractTest
extends GridCommonAbstract
* @param expVal Expected value.
*/
private static void assertBinaryEnum(IgniteCache<Object, Object> cache,
int key, TestEnum expVal) {
- Marshaller marsh = ((IgniteCacheProxy)cache).context().marshaller();
+ BinaryObject enumObj = (BinaryObject)cache.withKeepBinary().get(key);
- if (marsh instanceof BinaryMarshaller) {
- BinaryObject enumObj =
(BinaryObject)cache.withKeepBinary().get(key);
-
- assertEquals(expVal.ordinal(), enumObj.enumOrdinal());
- assertTrue(enumObj.type().isEnum());
- assertTrue(enumObj instanceof BinaryEnumObjectImpl);
- }
+ assertEquals(expVal.ordinal(), enumObj.enumOrdinal());
+ assertTrue(enumObj.type().isEnum());
+ assertTrue(enumObj instanceof BinaryEnumObjectImpl);
}
/**
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
index f1c341302fa..66d3e23638e 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
@@ -22,8 +22,6 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
@@ -40,14 +38,10 @@ public class CacheStartupInDeploymentModesTest extends
GridCommonAbstractTest {
/** */
private DeploymentMode deploymentMode;
- /** */
- private Marshaller marshaller;
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setMarshaller(marshaller);
cfg.setDeploymentMode(deploymentMode);
CacheConfiguration cacheCfg1 = new
CacheConfiguration(DEFAULT_CACHE_NAME);
@@ -76,7 +70,6 @@ public class CacheStartupInDeploymentModesTest extends
GridCommonAbstractTest {
@Test
public void testStartedInIsolatedMode() throws Exception {
deploymentMode = DeploymentMode.ISOLATED;
- marshaller = new BinaryMarshaller();
doCheckStarted(deploymentMode);
}
@@ -87,7 +80,6 @@ public class CacheStartupInDeploymentModesTest extends
GridCommonAbstractTest {
@Test
public void testStartedInPrivateMode() throws Exception {
deploymentMode = DeploymentMode.PRIVATE;
- marshaller = new BinaryMarshaller();
doCheckStarted(deploymentMode);
}
@@ -103,8 +95,6 @@ public class CacheStartupInDeploymentModesTest extends
GridCommonAbstractTest {
assertEquals(mode, ignite(0).configuration().getDeploymentMode());
- assert ignite(0).configuration().getMarshaller() instanceof
BinaryMarshaller;
-
IgniteCache rCache = ignite(0).cache(REPLICATED_CACHE);
checkPutCache(rCache);
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
index 6d35499b405..d1533d46ff5 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
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.IgniteUtils;
import org.apache.ignite.plugin.AbstractTestPluginProvider;
import org.apache.ignite.plugin.ExtensionRegistry;
@@ -108,47 +107,7 @@ public class GridCacheConditionalDeploymentSelfTest
extends GridCommonAbstractTe
public void testAddedDeploymentInfo() throws Exception {
GridCacheContext<?, ?> ctx = cacheContext();
- if (grid(0).configuration().getMarshaller() instanceof
BinaryMarshaller)
- assertFalse(ctx.deploymentEnabled());
- else {
- GridCacheIoManager ioMgr = cacheIoManager();
-
- TestMessage msg = new TestMessage();
-
- assertNull(msg.deployInfo());
-
- msg.addDepInfo = true;
-
- IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg,
grid(1).cluster().localNode().id());
-
- assertNotNull(msg.deployInfo());
- }
- }
-
- /**
- * @throws Exception In case of error.
- */
- @Test
- public void testAddedDeploymentInfo2() throws Exception {
- GridCacheContext<?, ?> ctx = cacheContext();
-
- if (grid(0).configuration().getMarshaller() instanceof
BinaryMarshaller)
- assertFalse(ctx.deploymentEnabled());
- else {
- assertTrue(ctx.deploymentEnabled());
-
- GridCacheIoManager ioMgr = cacheIoManager();
-
- TestMessage msg = new TestMessage();
-
- assertNull(msg.deployInfo());
-
- msg.addDepInfo = false;
-
- IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg,
grid(1).cluster().localNode().id());
-
- assertNull(msg.deployInfo());
- }
+ assertFalse(ctx.deploymentEnabled());
}
/**
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 79ad985183e..360d571e3a5 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -77,7 +77,6 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import
org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicyFactory;
@@ -3460,12 +3459,7 @@ public class IgniteCacheGroupsTest extends
GridCommonAbstractTest {
assertEquals(i + 10, aff2.partition(k));
assertEquals(i + 10, aff4.partition(k));
- int part;
-
- if (node.configuration().getMarshaller() instanceof
BinaryMarshaller)
- part = func.partition(node.binary().toBinary(k));
- else
- part = func.partition(k);
+ int part = func.partition(node.binary().toBinary(k));
assertEquals(part, aff5.partition(k));
assertEquals(part, aff6.partition(k));
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionsVariationsSuite.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionsVariationsSuite.java
index c180ea66f22..949dfad16f3 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionsVariationsSuite.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionsVariationsSuite.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
import java.util.List;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.lang.IgnitePredicate;
import
org.apache.ignite.testframework.configvariations.ConfigVariationsTestSuiteBuilder;
import org.apache.ignite.testframework.junits.DynamicSuite;
@@ -34,15 +33,8 @@ public class IgniteCacheReadThroughEvictionsVariationsSuite {
.withBasicCacheParams()
.withIgniteConfigFilters(new
IgnitePredicate<IgniteConfiguration>() {
/** {@inheritDoc} */
- @SuppressWarnings("RedundantIfStatement")
@Override public boolean apply(IgniteConfiguration cfg) {
- if (cfg.getMarshaller() != null && !(cfg.getMarshaller()
instanceof BinaryMarshaller))
- return false;
-
- if (cfg.isPeerClassLoadingEnabled())
- return false;
-
- return true;
+ return !cfg.isPeerClassLoadingEnabled();
}
})
.skipWaitPartitionMapExchange()
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
index 770f749fc2a..f48f929fd7f 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
@@ -27,7 +27,6 @@ import javax.cache.Cache;
import javax.cache.integration.CacheLoaderException;
import javax.cache.integration.CacheWriterException;
import javax.cache.processor.MutableEntry;
-import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheEntryProcessor;
@@ -38,13 +37,13 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryObjectImpl;
import
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
+
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
@@ -257,20 +256,6 @@ public abstract class IgniteCacheStoreValueAbstractTest
extends IgniteCacheAbstr
assertNotNull(keyObj);
- if (!isBinaryMarshallerUsed(ig)) {
- assertNotNull("Unexpected value, node: " + g,
- GridTestUtils.getFieldValue(keyObj,
CacheObjectAdapter.class, "val"));
-
- Object key0 =
keyObj.value(cache0.context().cacheObjectContext(), true);
- Object key1 =
keyObj.value(cache0.context().cacheObjectContext(), false);
- Object key2 =
keyObj.value(cache0.context().cacheObjectContext(), true);
- Object key3 =
keyObj.value(cache0.context().cacheObjectContext(), false);
-
- assertSame(key0, key1);
- assertSame(key1, key2);
- assertSame(key2, key3);
- }
-
CacheObject obj = e.rawGet();
if (obj != null) {
@@ -390,26 +375,9 @@ public abstract class IgniteCacheStoreValueAbstractTest
extends IgniteCacheAbstr
assertNotNull(keyObj);
- if (!isBinaryMarshallerUsed(ig)) {
- assertNotNull("Unexpected value, node: " + g,
- GridTestUtils.getFieldValue(keyObj,
CacheObjectAdapter.class, "val"));
-
- Object key0 =
keyObj.value(cache0.context().cacheObjectContext(), true);
- Object key1 =
keyObj.value(cache0.context().cacheObjectContext(), false);
- Object key2 =
keyObj.value(cache0.context().cacheObjectContext(), true);
- Object key3 =
keyObj.value(cache0.context().cacheObjectContext(), false);
-
- assertSame(key0, key1);
- assertSame(key1, key2);
- assertSame(key2, key3);
- }
-
CacheObject obj = e.rawGet();
if (obj != null) {
- if (!isBinaryMarshallerUsed(ig))
- assertNotNull("Unexpected value, node: " + g,
reflectiveValue(obj));
-
Object val0 =
obj.value(cache0.context().cacheObjectContext(), true);
assertNotNull("Unexpected value after value() requested1:
" + g, reflectiveValue(obj));
@@ -434,15 +402,6 @@ public abstract class IgniteCacheStoreValueAbstractTest
extends IgniteCacheAbstr
}
}
- /**
- * @param ig Ignite.
- * @return If binary marshaller is used.
- */
- private boolean isBinaryMarshallerUsed(Ignite ig) {
- return ig.configuration().getMarshaller() == null ||
- ig.configuration().getMarshaller() instanceof BinaryMarshaller;
- }
-
/**
* @param obj Object to extract value from.
* @return Cache object.
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 0cd0ba9f437..bb82bf00087 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
@@ -43,7 +43,6 @@ import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.binary.BinaryEnumObjectImpl;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
@@ -81,9 +80,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
/** */
private volatile boolean extClassloadingAtCfg = false;
- /** */
- private volatile boolean useExtClassLoader = false;
-
/** Disable p2p. */
private volatile boolean disableP2p = false;
@@ -121,9 +117,7 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
if (disableP2p)
cfg.setPeerClassLoadingEnabled(false);
- if (getTestIgniteInstanceName(1).equals(igniteInstanceName) ||
useExtClassLoader ||
- cfg.getMarshaller() instanceof BinaryMarshaller)
- cfg.setClassLoader(getExternalClassLoader());
+ cfg.setClassLoader(getExternalClassLoader());
if (cutromEvt) {
int[] evts = new int[EVTS_ALL.length + 1];
@@ -320,8 +314,6 @@ 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")
||
- grid(2).configuration().getMarshaller() instanceof
BinaryMarshaller;
Object e1 =
ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestEnumValue").getEnumConstants()[0];
@@ -329,19 +321,15 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
Object e2 = cache2.get(2);
- if (g1.configuration().getMarshaller() instanceof
BinaryMarshaller) {
- BinaryObject enumObj =
(BinaryObject)cache2.withKeepBinary().get(2);
+ BinaryObject enumObj =
(BinaryObject)cache2.withKeepBinary().get(2);
- assertEquals(0, enumObj.enumOrdinal());
- assertTrue(enumObj.type().isEnum());
- assertTrue(enumObj instanceof BinaryEnumObjectImpl);
- }
+ assertEquals(0, enumObj.enumOrdinal());
+ assertTrue(enumObj.type().isEnum());
+ assertTrue(enumObj instanceof BinaryEnumObjectImpl);
assert e2 != null;
assert e2.toString().equals(e1.toString());
assert
!e2.getClass().getClassLoader().equals(getClass().getClassLoader());
- assert
e2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")
||
- grid(2).configuration().getMarshaller() instanceof
BinaryMarshaller;
stopGrid(1);
@@ -358,8 +346,6 @@ 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")
||
- grid(3).configuration().getMarshaller() instanceof
BinaryMarshaller;
}
finally {
stopAllGrids();
@@ -373,7 +359,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
public void testExternalClassesAtConfiguration() throws Exception {
try {
extClassloadingAtCfg = true;
- useExtClassLoader = true;
Ignite g1 = startGrid(1);
@@ -415,7 +400,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
}
finally {
extClassloadingAtCfg = false;
- useExtClassLoader = false;
}
}
@@ -426,7 +410,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
public void testExternalClassesAtConfigurationDynamicStart() throws
Exception {
try {
extClassloadingAtCfg = false;
- useExtClassLoader = true;
Ignite g1 = startGrid(1);
Ignite g2 = startGrid(2);
@@ -451,7 +434,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
}
finally {
extClassloadingAtCfg = false;
- useExtClassLoader = false;
}
}
@@ -462,7 +444,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
public void testExternalClassesAtConfigurationDynamicStart2() throws
Exception {
try {
extClassloadingAtCfg = false;
- useExtClassLoader = true;
Ignite g1 = startGrid(1);
Ignite g2 = startGrid(2);
@@ -487,7 +468,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
}
finally {
extClassloadingAtCfg = false;
- useExtClassLoader = false;
}
}
@@ -497,7 +477,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
@Test
public void testExternalClassesAtMessage() throws Exception {
try {
- useExtClassLoader = true;
disableP2p = true;
final Class cls = (Class)getExternalClassLoader().
@@ -539,7 +518,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
}
finally {
- useExtClassLoader = false;
disableP2p = false;
}
}
@@ -565,7 +543,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
*/
private void testExternalClassesAtEvent0(boolean p2p) throws Exception {
try {
- useExtClassLoader = true;
cutromEvt = true;
if (p2p)
@@ -592,7 +569,6 @@ public class GridCacheReplicatedPreloadSelfTest extends
GridCommonAbstractTest {
latch.await();
}
finally {
- useExtClassLoader = false;
cutromEvt = false;
if (p2p)
diff --git
a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
index b1d7fbb7785..e5ac797dbf8 100644
---
a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
@@ -98,15 +98,13 @@ public class GridSessionCheckpointSelfTest extends
GridSessionCheckpointAbstract
cfg.setCheckpointSpi(spi);
- if (cfg.getMarshaller() instanceof BinaryMarshaller) {
- BinaryMarshaller marsh = (BinaryMarshaller)cfg.getMarshaller();
+ BinaryMarshaller marsh = (BinaryMarshaller)cfg.getMarshaller();
- BinaryContext ctx = new
BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
+ BinaryContext ctx = new
BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
- marsh.setContext(new MarshallerContextTestImpl(null));
+ marsh.setContext(new MarshallerContextTestImpl(null));
- marsh.setBinaryContext(ctx, cfg);
- }
+ marsh.setBinaryContext(ctx, cfg);
GridSessionCheckpointSelfTest.spi = spi;
diff --git
a/modules/core/src/test/java/org/apache/ignite/testsuites/WithKeepBinaryCacheConfigVariationsFullApiTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/WithKeepBinaryCacheConfigVariationsFullApiTestSuite.java
index cc072ec311f..dc9f289091a 100644
---
a/modules/core/src/test/java/org/apache/ignite/testsuites/WithKeepBinaryCacheConfigVariationsFullApiTestSuite.java
+++
b/modules/core/src/test/java/org/apache/ignite/testsuites/WithKeepBinaryCacheConfigVariationsFullApiTestSuite.java
@@ -20,10 +20,7 @@ package org.apache.ignite.testsuites;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import
org.apache.ignite.internal.processors.cache.WithKeepBinaryCacheFullApiTest;
-import org.apache.ignite.lang.IgnitePredicate;
import
org.apache.ignite.testframework.configvariations.ConfigVariationsTestSuiteBuilder;
import org.apache.ignite.testframework.junits.DynamicSuite;
import org.junit.runner.RunWith;
@@ -39,11 +36,6 @@ public class
WithKeepBinaryCacheConfigVariationsFullApiTestSuite {
return Stream.concat(
new
ConfigVariationsTestSuiteBuilder(WithKeepBinaryCacheFullApiTest.class)
.withBasicCacheParams()
- .withIgniteConfigFilters(new
IgnitePredicate<IgniteConfiguration>() {
- @Override public boolean apply(IgniteConfiguration cfg) {
- return cfg.getMarshaller() instanceof BinaryMarshaller;
- }
- })
.gridsCount(5)
.backups(1)
.testedNodesCount(3).withClients()
@@ -51,11 +43,6 @@ public class
WithKeepBinaryCacheConfigVariationsFullApiTestSuite {
new
ConfigVariationsTestSuiteBuilder(WithKeepBinaryCacheFullApiTest.class)
.withBasicCacheParams()
- .withIgniteConfigFilters(new
IgnitePredicate<IgniteConfiguration>() {
- @Override public boolean apply(IgniteConfiguration cfg) {
- return cfg.getMarshaller() instanceof BinaryMarshaller;
- }
- })
.gridsCount(5)
.backups(1)
.testedNodesCount(3).withClients()
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index 77ab338fd79..400d24d993c 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -45,7 +45,6 @@ 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.IgniteKernal;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import
org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
@@ -86,9 +85,6 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest
extends GridCommonA
/** Flag indicating if starting node should have cache. */
protected boolean hasCache;
- /** Whether BinaryMarshaller is set. */
- protected boolean binaryMarshaller;
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -179,11 +175,6 @@ public abstract class
IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
noOpCache = grid(0).getOrCreateCache("noop");
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- binaryMarshaller = grid(0).configuration().getMarshaller() instanceof
BinaryMarshaller;
- }
-
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
orgCache = null;
@@ -230,29 +221,16 @@ public abstract class
IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
if (personCache.getName().equals(meta.cacheName())) {
assertEquals("Invalid types size", 1, types.size());
assert types.contains("Person");
-
- if (binaryMarshaller) {
- assert
Object.class.getName().equals(meta.keyClass("Person"));
- assert
Object.class.getName().equals(meta.valueClass("Person"));
- }
- else {
- assert
AffinityKey.class.getName().equals(meta.keyClass("Person"));
- assert
Person.class.getName().equals(meta.valueClass("Person"));
- }
+ assert
Object.class.getName().equals(meta.keyClass("Person"));
+ assert
Object.class.getName().equals(meta.valueClass("Person"));
Map<String, String> fields = meta.fields("Person");
assert fields != null;
assert fields.size() == 3;
- if (binaryMarshaller) {
- assert
Integer.class.getName().equals(fields.get("AGE"));
- assert
Integer.class.getName().equals(fields.get("ORGID"));
- }
- else {
- assert int.class.getName().equals(fields.get("AGE"));
- assert int.class.getName().equals(fields.get("ORGID"));
- }
+ assert Integer.class.getName().equals(fields.get("AGE"));
+ assert Integer.class.getName().equals(fields.get("ORGID"));
assert String.class.getName().equals(fields.get("NAME"));
@@ -289,12 +267,7 @@ public abstract class
IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
else if (orgCache.getName().equals(meta.cacheName())) {
assertEquals("Invalid types size", 1, types.size());
assert types.contains("Organization");
-
- if (binaryMarshaller)
- assert
Object.class.getName().equals(meta.valueClass("Organization"));
- else
- assert
Organization.class.getName().equals(meta.valueClass("Organization"));
-
+ assert
Object.class.getName().equals(meta.valueClass("Organization"));
assert
String.class.getName().equals(meta.keyClass("Organization"));
Map<String, String> fields = meta.fields("Organization");
@@ -302,12 +275,7 @@ public abstract class
IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
assert fields != null;
assertEquals("Fields: " + fields, 2, fields.size());
- if (binaryMarshaller) {
- assert
Integer.class.getName().equals(fields.get("ID"));
- }
- else {
- assert int.class.getName().equals(fields.get("ID"));
- }
+ assert Integer.class.getName().equals(fields.get("ID"));
assert String.class.getName().equals(fields.get("NAME"));
}
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index 6237b895be0..5a249c57248 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -22,7 +22,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -35,11 +34,7 @@ import
org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.query.QueryUtils;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static
org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
@@ -49,28 +44,6 @@ import static
org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQu
*/
@SuppressWarnings("unchecked")
public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridCommonAbstractTest {
- /** */
- protected final Marshaller marsh;
-
- /**
- *
- */
- IgniteCacheAbstractInsertSqlQuerySelfTest() {
- try {
- marsh = IgniteTestResources.getMarshaller();
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
- }
- }
-
- /**
- * @return whether {@link #marsh} is an instance of {@link
BinaryMarshaller} or not.
- */
- boolean isBinaryMarshaller() {
- return marsh instanceof BinaryMarshaller;
- }
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -101,10 +74,7 @@ public abstract class
IgniteCacheAbstractInsertSqlQuerySelfTest extends GridComm
@Override protected void beforeTest() throws Exception {
super.beforeTest();
- if (!isBinaryMarshaller())
- createCaches();
- else
- createBinaryCaches();
+ createBinaryCaches();
ignite(0).createCache(cacheConfig("I2AT", true, false, Integer.class,
AllTypes.class));
}
@@ -244,40 +214,23 @@ public abstract class
IgniteCacheAbstractInsertSqlQuerySelfTest extends GridComm
*
*/
Object createPerson(int id, String name) {
- if (!isBinaryMarshaller()) {
- Person p = new Person(id);
- p.name = name;
-
- return p;
- }
- else {
- BinaryObjectBuilder o = grid(0).binary().builder("Person");
- o.setField("id", id);
- o.setField("name", name);
+ BinaryObjectBuilder o = grid(0).binary().builder("Person");
+ o.setField("id", id);
+ o.setField("name", name);
- return o.build();
- }
+ return o.build();
}
/**
*
*/
Object createPerson2(int id, String name, int valFld) {
- if (!isBinaryMarshaller()) {
- Person2 p = new Person2(id);
- p.name = name;
- p.IntVal = valFld;
-
- return p;
- }
- else {
- BinaryObjectBuilder o = grid(0).binary().builder("Person2");
- o.setField("id", id);
- o.setField("name", name);
- o.setField("IntVal", valFld);
+ BinaryObjectBuilder o = grid(0).binary().builder("Person2");
+ o.setField("id", id);
+ o.setField("name", name);
+ o.setField("IntVal", valFld);
- return o.build();
- }
+ return o.build();
}
/**
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index d50bc44b2c1..fe6a67abf32 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -78,7 +78,6 @@ import org.apache.ignite.events.CacheQueryReadEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.events.SqlQueryExecutionEvent;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.QueryUtils;
@@ -541,35 +540,33 @@ public abstract class IgniteCacheAbstractQuerySelfTest
extends GridCommonAbstrac
*/
@Test
public void testComplexTypeKeepBinary() throws Exception {
- if (ignite().configuration().getMarshaller() == null ||
ignite().configuration().getMarshaller() instanceof BinaryMarshaller) {
- IgniteCache<Key, GridCacheQueryTestValue> cache =
jcache(Key.class, GridCacheQueryTestValue.class);
+ IgniteCache<Key, GridCacheQueryTestValue> cache = jcache(Key.class,
GridCacheQueryTestValue.class);
- GridCacheQueryTestValue val1 = new GridCacheQueryTestValue();
+ GridCacheQueryTestValue val1 = new GridCacheQueryTestValue();
- val1.setField1("field1");
- val1.setField2(1);
- val1.setField3(1L);
+ val1.setField1("field1");
+ val1.setField2(1);
+ val1.setField3(1L);
- GridCacheQueryTestValue val2 = new GridCacheQueryTestValue();
+ GridCacheQueryTestValue val2 = new GridCacheQueryTestValue();
- val2.setField1("field2");
- val2.setField2(2);
- val2.setField3(2L);
- val2.setField6(null);
+ val2.setField1("field2");
+ val2.setField2(2);
+ val2.setField3(2L);
+ val2.setField6(null);
- cache.put(new Key(100500), val1);
- cache.put(new Key(100501), val2);
+ cache.put(new Key(100500), val1);
+ cache.put(new Key(100501), val2);
- QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> qry =
cache.withKeepBinary()
- .query(new SqlQuery<BinaryObject,
BinaryObject>(GridCacheQueryTestValue.class,
- "fieldName='field1' and field2=1 and field3=1 and
id=100500 and embeddedField2=11 and x=3"));
+ QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> qry =
cache.withKeepBinary()
+ .query(new SqlQuery<BinaryObject,
BinaryObject>(GridCacheQueryTestValue.class,
+ "fieldName='field1' and field2=1 and field3=1 and id=100500
and embeddedField2=11 and x=3"));
- Cache.Entry<BinaryObject, BinaryObject> entry =
F.first(qry.getAll());
+ Cache.Entry<BinaryObject, BinaryObject> entry = F.first(qry.getAll());
- assertNotNull(entry);
- assertEquals(Long.valueOf(100500L), entry.getKey().field("id"));
- assertEquals(val1, entry.getValue().deserialize());
- }
+ assertNotNull(entry);
+ assertEquals(Long.valueOf(100500L), entry.getKey().field("id"));
+ assertEquals(val1, entry.getValue().deserialize());
}
/**
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
index 72a38b48e00..acf21c17abc 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
@@ -21,7 +21,6 @@ import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedHashMap;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
@@ -31,38 +30,12 @@ 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.AbstractBinaryArraysTest;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.testframework.junits.IgniteTestResources;
/**
*
*/
@SuppressWarnings("unchecked")
public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest extends
AbstractBinaryArraysTest {
- /** */
- protected final Marshaller marsh;
-
- /**
- *
- */
- IgniteCacheAbstractSqlDmlQuerySelfTest() {
- try {
- marsh = IgniteTestResources.getMarshaller();
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
- }
- }
-
- /**
- * @return whether {@link #marsh} is an instance of {@link
BinaryMarshaller} or not.
- */
- protected boolean isBinaryMarshaller() {
- return marsh instanceof BinaryMarshaller;
- }
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -77,9 +50,7 @@ public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest
extends AbstractBin
startGridsMultiThreaded(3, true);
ignite(0).createCache(cacheConfig("S2P", true,
false).setIndexedTypes(String.class, Person.class));
-
- if (isBinaryMarshaller())
- ignite(0).createCache(createBinCacheConfig());
+ ignite(0).createCache(createBinCacheConfig());
}
/** {@inheritDoc} */
@@ -92,12 +63,10 @@ public abstract class
IgniteCacheAbstractSqlDmlQuerySelfTest extends AbstractBin
ignite(0).cache("S2P").put("k3", new Person(3, "Sylvia", "Green"));
ignite(0).cache("S2P").put("f0u4thk3y", new Person(4, "Jane",
"Silver"));
- if (isBinaryMarshaller()) {
- ignite(0).cache("S2P-bin").put("FirstKey", createBinPerson(1,
"John", "White"));
- ignite(0).cache("S2P-bin").put("SecondKey", createBinPerson(2,
"Joe", "Black"));
- ignite(0).cache("S2P-bin").put("k3", createBinPerson(3, "Sylvia",
"Green"));
- ignite(0).cache("S2P-bin").put("f0u4thk3y", createBinPerson(4,
"Jane", "Silver"));
- }
+ ignite(0).cache("S2P-bin").put("FirstKey", createBinPerson(1, "John",
"White"));
+ ignite(0).cache("S2P-bin").put("SecondKey", createBinPerson(2, "Joe",
"Black"));
+ ignite(0).cache("S2P-bin").put("k3", createBinPerson(3, "Sylvia",
"Green"));
+ ignite(0).cache("S2P-bin").put("f0u4thk3y", createBinPerson(4, "Jane",
"Silver"));
}
/**
@@ -109,10 +78,7 @@ public abstract class
IgniteCacheAbstractSqlDmlQuerySelfTest extends AbstractBin
* @return Person.
*/
Object createPerson(int id, String name, String secondName) {
- if (!isBinaryMarshaller())
- return new Person(id, name, secondName);
- else
- return createBinPerson(id, name, secondName);
+ return createBinPerson(id, name, secondName);
}
/**
@@ -137,10 +103,7 @@ public abstract class
IgniteCacheAbstractSqlDmlQuerySelfTest extends AbstractBin
* @return Cache.
*/
protected IgniteCache cache() {
- if (!isBinaryMarshaller())
- return ignite(0).cache("S2P");
- else
- return ignite(0).cache("S2P-bin").withKeepBinary();
+ return ignite(0).cache("S2P-bin").withKeepBinary();
}
/**
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
index 2a0b6402e20..ec703cac9f9 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
@@ -36,7 +36,6 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
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.util.typedef.F;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
@@ -265,12 +264,10 @@ public class IgniteCacheJoinQueryWithAffinityKeyTest
extends GridCommonAbstractT
Ignite ignite = (Ignite)cache.unwrap(Ignite.class);
- boolean binary = ignite.configuration().getMarshaller() instanceof
BinaryMarshaller;
-
long total = 0;
for (Map.Entry<Object, Integer> e : cnts.entrySet()) {
- Object arg = binary ? ignite.binary().toBinary(e.getKey()) :
e.getKey();
+ Object arg = ignite.binary().toBinary(e.getKey());
qry1.setArgs(arg);