Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-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 10CB5189C7 for ; Fri, 19 Feb 2016 18:37:07 +0000 (UTC) Received: (qmail 22690 invoked by uid 500); 19 Feb 2016 18:37:04 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 22628 invoked by uid 500); 19 Feb 2016 18:37:03 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 22612 invoked by uid 99); 19 Feb 2016 18:37:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2016 18:37:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 640A9C1920 for ; Fri, 19 Feb 2016 18:37:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.226 X-Spam-Level: X-Spam-Status: No, score=-3.226 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.006] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id JQJ4aBOcw1NG for ; Fri, 19 Feb 2016 18:37:01 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 627685FB7B for ; Fri, 19 Feb 2016 18:36:41 +0000 (UTC) Received: (qmail 19662 invoked by uid 99); 19 Feb 2016 18:36:40 -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; Fri, 19 Feb 2016 18:36:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 446C0E0577; Fri, 19 Feb 2016 18:36:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: upthewaterspout@apache.org To: commits@geode.incubator.apache.org Date: Fri, 19 Feb 2016 18:37:38 -0000 Message-Id: In-Reply-To: <6b97abc8452d42b888de3a2f139a1c3f@git.apache.org> References: <6b97abc8452d42b888de3a2f139a1c3f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [61/63] [abbrv] incubator-geode git commit: Removing a test which tests nothing. Removing a test which tests nothing. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/9beed82e Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/9beed82e Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/9beed82e Branch: refs/heads/develop Commit: 9beed82ef44129452312cdf8021beb4b05804d86 Parents: 0804a13 Author: Dan Smith Authored: Wed Feb 17 12:05:55 2016 -0800 Committer: Dan Smith Committed: Wed Feb 17 18:04:11 2016 -0800 ---------------------------------------------------------------------- .../internal/cache/HABug36773DUnitTest.java | 364 ------------------- 1 file changed, 364 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9beed82e/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java deleted file mode 100755 index 3268b68..0000000 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java +++ /dev/null @@ -1,364 +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 com.gemstone.gemfire.internal.cache; - - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import com.gemstone.gemfire.cache.AttributesFactory; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheException; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionAttributes; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.client.PoolManager; -import com.gemstone.gemfire.cache.client.internal.PoolImpl; -import com.gemstone.gemfire.cache.client.internal.Connection; -import com.gemstone.gemfire.cache.client.internal.ServerRegionProxy; -import com.gemstone.gemfire.cache.server.CacheServer; -import com.gemstone.gemfire.cache30.ClientServerTestCase; -import com.gemstone.gemfire.cache30.CacheSerializableRunnable; -import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.LogWriterUtils; -import com.gemstone.gemfire.test.dunit.NetworkUtils; -import com.gemstone.gemfire.test.dunit.VM; - -/** - * This is the Bug test for the bug 36773. Skipped sequence id causes missing - * entry in client. The test perform following operations in sequence. - * 1. Create Server1 & Server2 - * 2. Create Client1 & Client2 - * 3. Perform put operation from the client1 on key1 & key2 such a way that - * put with lower sequence id reaches primary after the put with greater sequence id. - * 4. Check for the keys on Client2 - * - * @author Girish Thombare - * - */ - -public class HABug36773DUnitTest extends DistributedTestCase -{ - - VM server1 = null; - - VM server2 = null; - - VM client1 = null; - - VM client2 = null; - - private static int PORT1; - - private static int PORT2; - - private static final String REGION_NAME = "HABug36773DUnitTest_region"; - - static final String KEY1 = "key1"; - - static final String KEY2 = "key2"; - - static final String VALUE1 = "newVal1"; - - static final String VALUE2 = "newVal2"; - - static volatile boolean waitFlag = true; - - protected static Cache cache = null; - - /** constructor */ - public HABug36773DUnitTest(String name) { - super(name); - } - - public void setUp() throws Exception { - super.setUp(); - disconnectAllFromDS(); - final Host host = Host.getHost(0); - // Server1 VM - server1 = host.getVM(0); - - // Server2 VM - server2 = host.getVM(1); - - // Client 1 VM - client1 = host.getVM(2); - - // client 2 VM - client2 = host.getVM(3); - - PORT1 = ((Integer)server1.invoke(() -> HABug36773DUnitTest.createServerCache())).intValue(); - PORT2 = ((Integer)server2.invoke(() -> HABug36773DUnitTest.createServerCache())).intValue(); - client1.invoke(() -> HABug36773DUnitTest.disableShufflingOfEndpoints()); - client2.invoke(() -> HABug36773DUnitTest.disableShufflingOfEndpoints()); - client1.invoke(() -> HABug36773DUnitTest.createClientCache( new Integer(PORT1), new Integer(PORT2) )); - client2.invoke(() -> HABug36773DUnitTest.createClientCache( new Integer(PORT1), new Integer(PORT2) )); - - } - - private void createCache(Properties props) throws Exception - { - DistributedSystem ds = getSystem(props); - cache = CacheFactory.create(ds); - assertNotNull(cache); - } - - public static void disableShufflingOfEndpoints() - { - System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "true"); - } - - public void _testBug36773() throws Exception - { - //First create entries on both servers via the two client - client1.invoke(() -> HABug36773DUnitTest.createEntriesK1andK2()); - client2.invoke(() -> HABug36773DUnitTest.createEntriesK1andK2()); - client1.invoke(() -> HABug36773DUnitTest.registerKeysK1andK2()); - client2.invoke(() -> HABug36773DUnitTest.registerKeysK1andK2()); - - server1.invoke(checkSizeRegion(2)); - server2.invoke(checkSizeRegion(2)); - client1.invoke(checkSizeRegion(2)); - client2.invoke(checkSizeRegion(2)); - - server1.invoke(() -> HABug36773DUnitTest.waitOnTheKeyEntry()); - client1.invoke(() -> HABug36773DUnitTest.acquireConnectionsAndPut(new Integer(PORT2))); - client1.invoke(() -> HABug36773DUnitTest.acquireConnectionsAndPut(new Integer(PORT1))); - client2.invoke(() -> HABug36773DUnitTest.verifyEntries(new String(KEY2), new String (VALUE2))); - server1.invoke(() -> HABug36773DUnitTest.notfiyThread()); - client2.invoke(() -> HABug36773DUnitTest.verifyEntries(new String(KEY1), new String (VALUE1))); - - } - - public void testDummyForBug36773() - { - LogWriterUtils.getLogWriter().info(" This is the dummy test for the Bug 36773"); - - } - - - private CacheSerializableRunnable checkSizeRegion(final int size) - { - - CacheSerializableRunnable checkRegion = new CacheSerializableRunnable( - "checkSize") { - - public void run2() throws CacheException - { - Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(region); - LogWriterUtils.getLogWriter().info("Size of the region " + region.size()); - assertEquals(size, region.size()); - } - }; - return checkRegion; - } - - public static void acquireConnectionsAndPut(Integer portNumber) - { - try { - int port = portNumber.intValue(); - Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(r1); - PoolImpl pool = (PoolImpl)PoolManager.find(r1.getAttributes().getPoolName()); - assertNotNull(pool); - Connection conn = pool.acquireConnection(); - final Connection conn1; - ServerRegionProxy srp = new ServerRegionProxy(Region.SEPARATOR + REGION_NAME, pool); - - if (conn.getServer().getPort() != port) { - conn1 = pool.acquireConnection(); // Ensure we have a server - // with the - // proper port - } - else { - conn1 = conn; - } - assertNotNull(conn1); - if (port == PORT2) { - assertEquals(PORT2, conn1.getServer().getPort()); - srp.putOnForTestsOnly(conn1, KEY1, VALUE1, new EventID(new byte[] { 1 }, 2, 1), null); - } - else if (port == PORT1) { - assertEquals(PORT1, conn1.getServer().getPort()); - srp.putOnForTestsOnly(conn1, KEY2, VALUE2, new EventID(new byte[] { 1 }, 2, 2), null); - } - else { - fail("Invalid ports "); - } - } - catch (Exception ex) { - ex.printStackTrace(); - fail("while setting acquireConnections " + ex); - } - } - - - - public static void verifyEntries(String KEY, String VALUE) - { - Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(r1); - long maxWaitTime = 120000; - try { - long start = System.currentTimeMillis(); - while (!r1.getEntry(KEY).getValue().equals(VALUE)) { - assertTrue("Waited over " + maxWaitTime + "entry to get updated", - (System.currentTimeMillis() - start) < maxWaitTime); - try { - Thread.yield(); - Thread.sleep(700); - } - catch (InterruptedException ie) { - Assert.fail("Interrupted while waiting ", ie); - } - } - } - catch (Exception e) { - fail("Exception in trying to get due to " + e); - } - } - - - - public static void createEntriesK1andK2() - { - try { - Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(r1); - if (!r1.containsKey(KEY1)) { - r1.create(KEY1, "key-1"); - } - if (!r1.containsKey(KEY2)) { - r1.create(KEY2, "key-2"); - } - assertEquals(r1.getEntry(KEY1).getValue(), "key-1"); - assertEquals(r1.getEntry(KEY2).getValue(), "key-2"); - } - catch (Exception ex) { - Assert.fail("failed while createEntriesK1andK2()", ex); - } - } - - public static void notfiyThread() - { - waitFlag=false; - } - - public static void createClientCache(Integer port1, Integer port2) - throws Exception - { - PORT1 = port1.intValue(); - PORT2 = port2.intValue(); - Properties props = new Properties(); - props.setProperty("mcast-port", "0"); - props.setProperty("locators", ""); - new HABug36773DUnitTest("temp").createCache(props); - AttributesFactory factory = new AttributesFactory(); - factory.setScope(Scope.DISTRIBUTED_ACK); - ClientServerTestCase.configureConnectionPool(factory, NetworkUtils.getIPLiteral(), new int[] {PORT1,PORT2}, true, -1, 2, null); - RegionAttributes attrs = factory.create(); - cache.createRegion(REGION_NAME, attrs); - } - - public static Integer createServerCache() - throws Exception - { - new HABug36773DUnitTest("temp").createCache(new Properties()); - AttributesFactory factory = new AttributesFactory(); - factory.setScope(Scope.DISTRIBUTED_ACK); - factory.setDataPolicy(DataPolicy.REPLICATE); - factory.setEarlyAck(true); - RegionAttributes attrs = factory.create(); - cache.createRegion(REGION_NAME, attrs); - CacheServer server = cache.addCacheServer(); - assertNotNull(server); - int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - server.setPort(port); - server.setNotifyBySubscription(true); - server.start(); - return new Integer(server.getPort()); - } - - public static void registerKeysK1andK2() - { - try { - Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(r); - List list = new ArrayList(); - list.add(KEY1); - list.add(KEY2); - r.registerInterest(list); - - } - catch (Exception ex) { - Assert.fail("failed while registering interest", ex); - } - } - - - public static void closeCache() - { - if (cache != null && !cache.isClosed()) { - cache.close(); - cache.getDistributedSystem().disconnect(); - } - } - - public static void waitOnTheKeyEntry() - { - Thread thrd = new Thread() { - public void run() - { - LocalRegion region = (LocalRegion)cache.getRegion(Region.SEPARATOR - + REGION_NAME); - RegionEntry regionEntry = region.basicGetEntry(KEY1); - synchronized (regionEntry) { - while (waitFlag) { - try { - Thread.sleep(500); - } - catch (InterruptedException e) { - fail("interrupted"); - } - } - } - } - }; - - thrd.start(); - - } - - @Override - protected final void preTearDown() throws Exception { - //close client - client1.invoke(() -> HABug36773DUnitTest.closeCache()); - client2.invoke(() -> HABug36773DUnitTest.closeCache()); - //close server - server1.invoke(() -> HABug36773DUnitTest.closeCache()); - server2.invoke(() -> HABug36773DUnitTest.closeCache()); - } -} -