You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/04/06 12:19:32 UTC
[1/3] ignite git commit: IGNITE-2947 BinaryContext doesn't honor
custom loader set through IgniteConfiguration.classLoader
Repository: ignite
Updated Branches:
refs/heads/ignite-2004 194455ad0 -> 3e449b0be
IGNITE-2947
BinaryContext doesn't honor custom loader set through IgniteConfiguration.classLoader
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f94b2fc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f94b2fc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f94b2fc
Branch: refs/heads/ignite-2004
Commit: 7f94b2fc31e797e7a55ee7ebb45ccd7ed80f2d5d
Parents: fcfbf2c
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Apr 6 11:35:36 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Apr 6 11:40:14 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 2 +-
...acheBinaryObjectUserClassloaderSelfTest.java | 147 +++++++++++++++++++
.../IgniteBinaryObjectsTestSuite.java | 5 +-
3 files changed, 152 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f94b2fc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 4d8c293..9a9ef10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -992,7 +992,7 @@ public class BinaryContext {
Class<?> cls = null;
try {
- cls = Class.forName(clsName);
+ cls = U.resolveClassLoader(configuration()).loadClass(clsName);
}
catch (ClassNotFoundException | NoClassDefFoundError ignored) {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f94b2fc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
new file mode 100644
index 0000000..ca09e4c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.binary;
+
+import java.util.Collections;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinarySerializer;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+import org.apache.ignite.binary.BinaryWriter;
+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.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.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class GridCacheBinaryObjectUserClassloaderSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static volatile boolean customBinaryConf = false;
+
+ /** */
+ private static volatile boolean deserialized = false;
+
+ /** */
+ private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setCacheConfiguration(cacheConfiguration(gridName));
+
+ cfg.setMarshaller(new BinaryMarshaller());
+
+ cfg.setClassLoader(getExternalClassLoader());
+
+ if (customBinaryConf) {
+ BinaryTypeConfiguration btcfg = new BinaryTypeConfiguration();
+
+ btcfg.setTypeName("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3");
+
+ btcfg.setSerializer(new BinarySerializer() {
+ /** {@inheritDoc} */
+ @Override public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
+ //No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
+ deserialized = true;
+ }
+ });
+
+ BinaryConfiguration bcfg = new BinaryConfiguration();
+
+ bcfg.setTypeConfigurations(Collections.singletonList(btcfg));
+
+ cfg.setBinaryConfiguration(bcfg);
+ }
+
+ return cfg;
+ }
+
+ /**
+ * Gets cache configuration for grid with specified name.
+ *
+ * @param gridName Grid name.
+ * @return Cache configuration.
+ */
+ CacheConfiguration cacheConfiguration(String gridName) {
+ CacheConfiguration cacheCfg = defaultCacheConfiguration();
+
+ cacheCfg.setCacheMode(REPLICATED);
+ cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ return cacheCfg;
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testConfigurationRegistration() throws Exception {
+ try {
+ customBinaryConf = true;
+
+ Ignite i1 = startGrid(1);
+ Ignite i2 = startGrid(2);
+
+ IgniteCache<Integer, Object> cache1 = i1.cache(null);
+ IgniteCache<Integer, Object> cache2 = i2.cache(null);
+
+ ClassLoader ldr = i1.configuration().getClassLoader();
+
+ Object v1 = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3").newInstance();
+
+ cache1.put(1, v1);
+
+ deserialized = false;
+
+ cache2.get(1);
+
+ assertTrue(deserialized);
+ }
+ finally {
+ customBinaryConf = false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f94b2fc/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
index 3ec55d0..043ea06 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
@@ -44,6 +44,7 @@ import org.apache.ignite.internal.binary.noncompact.BinaryMarshallerNonCompactSe
import org.apache.ignite.internal.binary.noncompact.BinaryObjectBuilderAdditionalNonCompactSelfTest;
import org.apache.ignite.internal.binary.noncompact.BinaryObjectBuilderNonCompactDefaultMappersSelfTest;
import org.apache.ignite.internal.binary.noncompact.BinaryObjectBuilderNonCompactSimpleNameLowerCaseMappersSelfTest;
+import org.apache.ignite.internal.processors.cache.binary.GridCacheBinaryObjectUserClassloaderSelfTest;
import org.apache.ignite.internal.processors.cache.binary.GridCacheBinaryStoreBinariesDefaultMappersSelfTest;
import org.apache.ignite.internal.processors.cache.binary.GridCacheBinaryStoreBinariesSimpleNameMappersSelfTest;
import org.apache.ignite.internal.binary.streams.BinaryHeapStreamByteOrderSelfTest;
@@ -79,7 +80,7 @@ public class IgniteBinaryObjectsTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Binary Objects Test Suite");
suite.addTestSuite(BinarySimpleNameTestPropertySelfTest.class);
-
+
suite.addTestSuite(BinaryBasicIdMapperSelfTest.class);
suite.addTestSuite(BinaryBasicNameMapperSelfTest.class);
@@ -138,6 +139,8 @@ public class IgniteBinaryObjectsTestSuite extends TestSuite {
suite.addTestSuite(BinaryHeapStreamByteOrderSelfTest.class);
suite.addTestSuite(BinaryOffheapStreamByteOrderSelfTest.class);
+ suite.addTestSuite(GridCacheBinaryObjectUserClassloaderSelfTest.class);
+
return suite;
}
}
[3/3] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2004
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2004
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e449b0b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e449b0b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e449b0b
Branch: refs/heads/ignite-2004
Commit: 3e449b0be77343056246fc4450b8c87c1ddb4f3b
Parents: 194455a b9cf586
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 6 13:19:10 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 6 13:19:10 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 2 +-
...ReadThroughEvictionOffheapTiredSelfTest.java | 30 ++++
.../IgniteCacheReadThroughEvictionSelfTest.java | 7 +
...acheBinaryObjectUserClassloaderSelfTest.java | 147 +++++++++++++++++++
.../IgniteBinaryObjectsTestSuite.java | 5 +-
5 files changed, 189 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[2/3] ignite git commit: Improved tests for cache read throug with
evictions
Posted by sb...@apache.org.
Improved tests for cache read throug with evictions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b9cf586f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b9cf586f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b9cf586f
Branch: refs/heads/ignite-2004
Commit: b9cf586f58ea3dfe87bdef7d8013dd6c5bbd453f
Parents: 7f94b2f
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Apr 6 12:26:24 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Apr 6 12:26:24 2016 +0300
----------------------------------------------------------------------
...ReadThroughEvictionOffheapTiredSelfTest.java | 30 ++++++++++++++++++++
.../IgniteCacheReadThroughEvictionSelfTest.java | 7 +++++
2 files changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9cf586f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionOffheapTiredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionOffheapTiredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionOffheapTiredSelfTest.java
new file mode 100644
index 0000000..a8ad4ee
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionOffheapTiredSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheMemoryMode;
+
+/**
+ *
+ */
+public class IgniteCacheReadThroughEvictionOffheapTiredSelfTest extends IgniteCacheReadThroughEvictionSelfTest {
+ /** {@inheritDoc} */
+ @Override protected CacheMemoryMode cacheMemoryMode() {
+ return CacheMemoryMode.OFFHEAP_TIERED;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9cf586f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
index d8768eb..1d8de74 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
import org.apache.ignite.cache.store.CacheStore;
@@ -103,6 +104,7 @@ public class IgniteCacheReadThroughEvictionSelfTest extends GridCommonAbstractTe
cc.setAtomicityMode(atomicityMode());
cc.setLoadPreviousValue(false);
cc.setCacheMode(cacheMode());
+ cc.setMemoryMode(cacheMemoryMode());
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setBackups(1);
@@ -122,6 +124,11 @@ public class IgniteCacheReadThroughEvictionSelfTest extends GridCommonAbstractTe
return PARTITIONED;
}
+ /** {@inheritDoc} */
+ protected CacheMemoryMode cacheMemoryMode() {
+ return CacheMemoryMode.ONHEAP_TIERED;
+ }
+
/**
* @throws Exception if failed.
*/