# ignite-797 fixed test to do not start near cache on client
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bc2269d2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bc2269d2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bc2269d2 Branch: refs/heads/ignite-23 Commit: bc2269d2284e90c8097195233e0340c264204b71 Parents: c35537d Author: sboikov <sboi...@gridgain.com> Authored: Wed May 20 17:28:57 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Wed May 20 17:28:57 2015 +0300 ---------------------------------------------------------------------- .../IgniteCacheP2pUnmarshallingErrorTest.java | 29 +++++++++----- ...gniteCacheP2pUnmarshallingNearErrorTest.java | 13 ++++--- .../ignite/testsuites/IgniteBasicTestSuite.java | 2 +- ...gniteCacheP2pUnmarshallingErrorTestSuit.java | 41 -------------------- ...niteCacheP2pUnmarshallingErrorTestSuite.java | 41 ++++++++++++++++++++ 5 files changed, 70 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc2269d2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java index 5aa0ac8..ce68b17 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java @@ -65,27 +65,33 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - if (gridName.endsWith("0")) + if (getTestGridName(0).equals(gridName)) { cfg.setClientMode(true); + cfg.setCacheConfiguration(); + } + return cfg; } /** Test key 1. */ public static class TestKey implements Externalizable { - /** Test key 1. */ + /** Field. */ + @QuerySqlField(index = true) + private String field; + + /** + * @param field Test key 1. + */ public TestKey(String field) { this.field = field; } /** Test key 1. */ public TestKey() { + // No-op. } - /** Field. */ - @QuerySqlField(index = true) - private String field; - /** {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) @@ -112,14 +118,15 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { field = (String)in.readObject(); - if (readCnt.decrementAndGet() <= 0) { - throw new IOException("Class can not be unmarshalled"); - } + if (readCnt.decrementAndGet() <= 0) + throw new IOException("Class can not be unmarshalled."); } } /** * Sends put atomically and handles fail. + * + * @param k Key. */ protected void failAtomicPut(int k) { try { @@ -136,6 +143,8 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes /** * Sends get atomically and handles fail. + * + * @param k Key. */ protected void failAtomicGet(int k) { try { @@ -150,6 +159,8 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes /** * Tests that correct response will be sent to client node in case of unmarshalling failed. + * + * @throws Exception If failed. */ public void testResponseMessageOnUnmarshallingFailed() throws Exception { //GridNearAtomicUpdateRequest unmarshalling failed test http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc2269d2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java index 732d12d..3462d71 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingNearErrorTest.java @@ -33,10 +33,12 @@ public class IgniteCacheP2pUnmarshallingNearErrorTest extends IgniteCacheP2pUnma @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - cfg.getCacheConfiguration()[0].setEvictMaxOverflowRatio(0); - cfg.getCacheConfiguration()[0].setEvictSynchronized(true); - cfg.getCacheConfiguration()[0].setEvictSynchronizedKeyBufferSize(1); - cfg.getCacheConfiguration()[0].setEvictionPolicy(new FifoEvictionPolicy(1)); + if (cfg.isClientMode() == null || !cfg.isClientMode()) { + cfg.getCacheConfiguration()[0].setEvictMaxOverflowRatio(0); + cfg.getCacheConfiguration()[0].setEvictSynchronized(true); + cfg.getCacheConfiguration()[0].setEvictSynchronizedKeyBufferSize(1); + cfg.getCacheConfiguration()[0].setEvictionPolicy(new FifoEvictionPolicy(1)); + } return cfg; } @@ -51,6 +53,7 @@ public class IgniteCacheP2pUnmarshallingNearErrorTest extends IgniteCacheP2pUnma //Eviction request unmarshalling failed but ioManager does not hangs up. - Thread.sleep(1000); //todo: wait for eviction complete + // Wait for eviction complete. + Thread.sleep(1000); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc2269d2/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java index 56ff951..189ba55 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java @@ -47,7 +47,7 @@ public class IgniteBasicTestSuite extends TestSuite { suite.addTest(IgniteStartUpTestSuite.suite()); suite.addTest(IgniteExternalizableSelfTestSuite.suite()); suite.addTest(IgniteP2PSelfTestSuite.suite()); - suite.addTest(IgniteCacheP2pUnmarshallingErrorTestSuit.suite()); + suite.addTest(IgniteCacheP2pUnmarshallingErrorTestSuite.suite()); suite.addTest(new TestSuite(GridSelfTest.class)); suite.addTest(new TestSuite(GridProjectionSelfTest.class)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc2269d2/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java deleted file mode 100644 index 9b40280..0000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java +++ /dev/null @@ -1,41 +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 junit.framework.*; -import org.apache.ignite.internal.processors.cache.*; - -/** - * Checks behavior on exception while unmarshalling key. - */ -public class IgniteCacheP2pUnmarshallingErrorTestSuit extends TestSuite { - /** - * @return Suite. - * @throws Exception If failed. - */ - public static TestSuite suite() throws Exception { - TestSuite suite = new TestSuite("P2p Unmarshalling Test Suite"); - - suite.addTestSuite(IgniteCacheP2pUnmarshallingErrorTest.class); - suite.addTestSuite(IgniteCacheP2pUnmarshallingNearErrorTest.class); - suite.addTestSuite(IgniteCacheP2pUnmarshallingRebalanceErrorTest.class); - suite.addTestSuite(IgniteCacheP2pUnmarshallingTxErrorTest.class); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc2269d2/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java new file mode 100644 index 0000000..f54f85a --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.*; +import org.apache.ignite.internal.processors.cache.*; + +/** + * Checks behavior on exception while unmarshalling key. + */ +public class IgniteCacheP2pUnmarshallingErrorTestSuite extends TestSuite { + /** + * @return Suite. + * @throws Exception If failed. + */ + public static TestSuite suite() throws Exception { + TestSuite suite = new TestSuite("P2p Unmarshalling Test Suite"); + + suite.addTestSuite(IgniteCacheP2pUnmarshallingErrorTest.class); + suite.addTestSuite(IgniteCacheP2pUnmarshallingNearErrorTest.class); + suite.addTestSuite(IgniteCacheP2pUnmarshallingRebalanceErrorTest.class); + suite.addTestSuite(IgniteCacheP2pUnmarshallingTxErrorTest.class); + + return suite; + } +}