Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D710617CCB for ; Wed, 4 Mar 2015 03:11:18 +0000 (UTC) Received: (qmail 16883 invoked by uid 500); 4 Mar 2015 03:11:12 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 16849 invoked by uid 500); 4 Mar 2015 03:11:12 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 16840 invoked by uid 99); 4 Mar 2015 03:11:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2015 03:11:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 04 Mar 2015 03:10:41 +0000 Received: (qmail 14440 invoked by uid 99); 4 Mar 2015 03:10:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2015 03:10:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 870B3E1072; Wed, 4 Mar 2015 03:10:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 04 Mar 2015 03:11:00 -0000 Message-Id: <23cb163547b3465c83d5b381645a464f@git.apache.org> In-Reply-To: <6d72d03139a14f04a3160539cd887301@git.apache.org> References: <6d72d03139a14f04a3160539cd887301@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/50] incubator-ignite git commit: #ignite-237: remove test for consistent hash replicaCount. X-Virus-Checked: Checked by ClamAV on apache.org #ignite-237: remove test for consistent hash replicaCount. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5a76d70f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5a76d70f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5a76d70f Branch: refs/heads/ignite-185 Commit: 5a76d70f99c276f95cfdb4ae97c09341fefc468a Parents: 5f620d6 Author: ivasilinets Authored: Mon Mar 2 12:49:56 2015 +0300 Committer: ivasilinets Committed: Mon Mar 2 12:49:56 2015 +0300 ---------------------------------------------------------------------- .../impl/ClientPartitionAffinitySelfTest.java | 323 ------------------- .../client/suite/IgniteClientTestSuite.java | 1 - 2 files changed, 324 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a76d70f/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPartitionAffinitySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPartitionAffinitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPartitionAffinitySelfTest.java deleted file mode 100644 index 6af1c4c..0000000 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPartitionAffinitySelfTest.java +++ /dev/null @@ -1,323 +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.internal.client.impl; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.client.*; -import org.apache.ignite.testframework.*; -import org.apache.ignite.testframework.junits.common.*; - -import java.util.*; - -/** - * Client's partitioned affinity tests. - */ -public class ClientPartitionAffinitySelfTest extends GridCommonAbstractTest { - /** Hash ID resolver. */ - private static final GridClientPartitionAffinity.HashIdResolver HASH_ID_RSLVR = - new GridClientPartitionAffinity.HashIdResolver() { - @Override public Object getHashId(GridClientNode node) { - return node.nodeId(); - } - }; - - /** - * Test predefined affinity - must be ported to other clients. - */ - @SuppressWarnings("UnaryPlus") - public void testPredefined() throws Exception { - // Use Md5 hasher for this test. - GridClientPartitionAffinity aff = new GridClientPartitionAffinity(); - - getTestResources().inject(aff); - - aff.setHashIdResolver(HASH_ID_RSLVR); - - List nodes = new ArrayList<>(); - - nodes.add(createNode("000ea4cd-f449-4dcb-869a-5317c63bd619", 50)); - nodes.add(createNode("010ea4cd-f449-4dcb-869a-5317c63bd62a", 60)); - nodes.add(createNode("0209ec54-ff53-4fdb-8239-5a3ac1fb31bd", 70)); - nodes.add(createNode("0309ec54-ff53-4fdb-8239-5a3ac1fb31ef", 80)); - nodes.add(createNode("040c9b94-02ae-45a6-9d5c-a066dbdf2636", 90)); - nodes.add(createNode("050c9b94-02ae-45a6-9d5c-a066dbdf2747", 100)); - nodes.add(createNode("0601f916-4357-4cfe-a7df-49d4721690bf", 110)); - nodes.add(createNode("0702f916-4357-4cfe-a7df-49d4721691c0", 120)); - - Map data = new LinkedHashMap<>(); - - data.put("", 4); - data.put("asdf", 4); - data.put("224ea4cd-f449-4dcb-869a-5317c63bd619", 5); - data.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", 2); - data.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", 2); - data.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", 7); - data.put("c77ffeae-78a1-4ee6-a0fd-8d197a794412", 3); - data.put("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", 1); - data.put("d67eb652-4e76-47fb-ad4e-cd902d9b868a", 7); - - data.put(0, 4); - data.put(1, 7); - data.put(12, 5); - data.put(123, 6); - data.put(1234, 4); - data.put(12345, 6); - data.put(123456, 6); - data.put(1234567, 6); - data.put(12345678, 0); - data.put(123456789, 7); - data.put(1234567890, 7); - data.put(1234567890L, 7); - data.put(12345678901L, 2); - data.put(123456789012L, 1); - data.put(1234567890123L, 0); - data.put(12345678901234L, 1); - data.put(123456789012345L, 6); - data.put(1234567890123456L, 7); - data.put(-23456789012345L, 4); - data.put(-2345678901234L, 1); - data.put(-234567890123L, 5); - data.put(-23456789012L, 5); - data.put(-2345678901L, 7); - data.put(-234567890L, 4); - data.put(-234567890, 7); - data.put(-23456789, 7); - data.put(-2345678, 0); - data.put(-234567, 6); - data.put(-23456, 6); - data.put(-2345, 6); - data.put(-234, 7); - data.put(-23, 5); - data.put(-2, 4); - - data.put(0x80000000, 4); - data.put(0x7fffffff, 7); - data.put(0x8000000000000000L, 4); - data.put(0x7fffffffffffffffL, 4); - - data.put(+1.1, 3); - data.put(-10.01, 4); - data.put(+100.001, 4); - data.put(-1000.0001, 4); - data.put(+1.7976931348623157E+308, 6); - data.put(-1.7976931348623157E+308, 6); - data.put(+4.9E-324, 7); - data.put(-4.9E-324, 7); - - boolean ok = true; - - for (Map.Entry entry : data.entrySet()) { - UUID exp = nodes.get(entry.getValue()).nodeId(); - UUID act = aff.node(entry.getKey(), nodes).nodeId(); - - if (exp.equals(act)) - continue; - - ok = false; - - info("Failed to validate affinity for key '" + entry.getKey() + "' [expected=" + exp + - ", actual=" + act + "."); - } - - if (ok) - return; - - fail("Client partitioned affinity validation fails."); - } - - /** - * Test predefined affinity - must be ported to other clients. - */ - @SuppressWarnings("UnaryPlus") - public void testPredefinedHashIdResolver() throws Exception { - // Use Md5 hasher for this test. - GridClientPartitionAffinity aff = new GridClientPartitionAffinity(); - - getTestResources().inject(aff); - - aff.setHashIdResolver(new GridClientPartitionAffinity.HashIdResolver() { - @Override public Object getHashId(GridClientNode node) { - return 1; - } - }); - - List nodes = new ArrayList<>(); - - nodes.add(createNode("000ea4cd-f449-4dcb-869a-5317c63bd619", 50)); - nodes.add(createNode("010ea4cd-f449-4dcb-869a-5317c63bd62a", 60)); - nodes.add(createNode("0209ec54-ff53-4fdb-8239-5a3ac1fb31bd", 70)); - nodes.add(createNode("0309ec54-ff53-4fdb-8239-5a3ac1fb31ef", 80)); - nodes.add(createNode("040c9b94-02ae-45a6-9d5c-a066dbdf2636", 90)); - nodes.add(createNode("050c9b94-02ae-45a6-9d5c-a066dbdf2747", 100)); - nodes.add(createNode("0601f916-4357-4cfe-a7df-49d4721690bf", 110)); - nodes.add(createNode("0702f916-4357-4cfe-a7df-49d4721691c0", 120)); - - Map data = new LinkedHashMap<>(); - - data.put("", 4); - data.put("asdf", 3); - data.put("224ea4cd-f449-4dcb-869a-5317c63bd619", 5); - data.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", 2); - data.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", 2); - data.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", 4); - data.put("c77ffeae-78a1-4ee6-a0fd-8d197a794412", 3); - data.put("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", 4); - data.put("d67eb652-4e76-47fb-ad4e-cd902d9b868a", 2); - - data.put(0, 4); - data.put(1, 1); - data.put(12, 7); - data.put(123, 1); - data.put(1234, 6); - data.put(12345, 2); - data.put(123456, 5); - data.put(1234567, 4); - data.put(12345678, 6); - data.put(123456789, 3); - data.put(1234567890, 3); - data.put(1234567890L, 3); - data.put(12345678901L, 0); - data.put(123456789012L, 1); - data.put(1234567890123L, 3); - data.put(12345678901234L, 5); - data.put(123456789012345L, 5); - data.put(1234567890123456L, 7); - data.put(-23456789012345L, 6); - data.put(-2345678901234L, 4); - data.put(-234567890123L, 3); - data.put(-23456789012L, 0); - data.put(-2345678901L, 4); - data.put(-234567890L, 5); - data.put(-234567890, 3); - data.put(-23456789, 3); - data.put(-2345678, 6); - data.put(-234567, 4); - data.put(-23456, 5); - data.put(-2345, 2); - data.put(-234, 7); - data.put(-23, 6); - data.put(-2, 6); - - data.put(0x80000000, 7); - data.put(0x7fffffff, 1); - data.put(0x8000000000000000L, 7); - data.put(0x7fffffffffffffffL, 7); - - data.put(+1.1, 2); - data.put(-10.01, 0); - data.put(+100.001, 2); - data.put(-1000.0001, 0); - data.put(+1.7976931348623157E+308, 6); - data.put(-1.7976931348623157E+308, 1); - data.put(+4.9E-324, 1); - data.put(-4.9E-324, 1); - - boolean ok = true; - - for (Map.Entry entry : data.entrySet()) { - UUID exp = nodes.get(entry.getValue()).nodeId(); - UUID act = aff.node(entry.getKey(), nodes).nodeId(); - - if (exp.equals(act)) - continue; - - ok = false; - - info("Failed to validate affinity for key '" + entry.getKey() + "' [expected=" + exp + - ", actual=" + act + "."); - } - - if (ok) - return; - - fail("Client partitioned affinity validation fails."); - } - - /** - * Create node with specified node id and replica count. - * - * @param nodeId Node id. - * @param replicaCnt Node partitioned affinity replica count. - * @return New node with specified node id and replica count. - */ - private GridClientNode createNode(String nodeId, int replicaCnt) { - return GridClientNodeImpl.builder() - .nodeId(UUID.fromString(nodeId)) - .build(); - } - - /** - * Add {@code cnt} nodes into emulated topology. - * - * @param cnt Number of nodes to add into emulated topology. - * @param nodes Client topology. - * @param srvNodes Server topology. - */ - private void addNodes(int cnt, Collection nodes, Collection srvNodes) { - while (cnt-- > 0) { - UUID nodeId = UUID.randomUUID(); - int replicaCnt = (int)Math.round(Math.random() * 500) + 1; - - nodes.add(GridClientNodeImpl.builder() - .nodeId(nodeId) - .build()); - - ClusterNode srvNode = new TestRichNode(nodeId); - - srvNodes.add(srvNode); - } - } - - /** - * Rich node stub to use in emulated server topology. - */ - private static class TestRichNode extends GridTestNode { - /** - * Node id. - */ - private final UUID nodeId; - - - /** - * Externalizable class requires public no-arg constructor. - */ - @SuppressWarnings("UnusedDeclaration") - public TestRichNode() { - this(UUID.randomUUID()); - } - - /** - * Constructs rich node stub to use in emulated server topology. - * - * @param nodeId Node id. - */ - private TestRichNode(UUID nodeId) { - this.nodeId = nodeId; - } - - /** {@inheritDoc} */ - @Override public UUID id() { - return nodeId; - } - - /** {@inheritDoc} */ - @Override public T attribute(String name) { - return super.attribute(name); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a76d70f/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java index d89a960..4785248 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java @@ -95,7 +95,6 @@ public class IgniteClientTestSuite extends TestSuite { suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class)); suite.addTestSuite(ClientFutureAdapterSelfTest.class); - suite.addTestSuite(ClientPartitionAffinitySelfTest.class); suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class); suite.addTestSuite(ClientConsistentHashSelfTest.class); suite.addTestSuite(ClientJavaHasherSelfTest.class);