You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2019/10/18 17:01:41 UTC

[geode] branch feature/GEODE-7321 created (now 3065023)

This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a change to branch feature/GEODE-7321
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 3065023  GEODE-7321: Move and Rename ConnectionDUnitTest

This branch includes the following new commits:

     new 3065023  GEODE-7321: Move and Rename ConnectionDUnitTest

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[geode] 01/01: GEODE-7321: Move and Rename ConnectionDUnitTest

Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-7321
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 3065023070b46cc60f615a47abeabba06fed6335
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Fri Oct 18 09:58:52 2019 -0700

    GEODE-7321: Move and Rename ConnectionDUnitTest
    
    Moving this to be an integration test instead of a distributed test.
    
    It ought to be a regular unit test but capturing Geode log output with
    SystemOutRule doesn't seem to work anymore.
---
 .../internal/tcp/ConnectionIntegrationTest.java}   | 27 +++++++---------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionDUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/tcp/ConnectionIntegrationTest.java
similarity index 86%
rename from geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionDUnitTest.java
rename to geode-core/src/integrationTest/java/org/apache/geode/internal/tcp/ConnectionIntegrationTest.java
index a51723a..1a0db82 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionDUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/tcp/ConnectionIntegrationTest.java
@@ -26,7 +26,6 @@ import java.net.Socket;
 import java.nio.ByteBuffer;
 import java.util.Properties;
 
-import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -35,22 +34,17 @@ import org.mockito.junit.MockitoJUnit;
 import org.mockito.junit.MockitoRule;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.net.SocketCloser;
 import org.apache.geode.test.assertj.LogFileAssert;
 import org.apache.geode.test.dunit.IgnoredException;
-import org.apache.geode.test.dunit.internal.DUnitLauncher;
-import org.apache.geode.test.dunit.rules.DistributedRule;
+import org.apache.geode.test.dunit.rules.CacheRule;
 import org.apache.geode.test.junit.categories.MembershipTest;
 
 @Category({MembershipTest.class})
-public class ConnectionDUnitTest {
-
-  @Rule
-  public final DistributedRule distributedRule = DistributedRule.builder().withVMCount(0).build();
+public class ConnectionIntegrationTest {
 
   @Rule
   public final MockitoRule mockitoRule = MockitoJUnit.rule().strictness(STRICT_STUBS);
@@ -58,21 +52,17 @@ public class ConnectionDUnitTest {
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
-  private Cache cache;
-
-  @After
-  public void teardown() {
-    if (cache != null) {
-      cache.close();
-    }
-  }
+  @Rule
+  public CacheRule cacheRule = new CacheRule();
 
   @Test
   public void badHeaderMessageIsCorrectlyLogged() throws Exception {
-    Properties properties = DUnitLauncher.getDistributedSystemProperties();
+    Properties properties = new Properties();
+    properties.put(ConfigurationProperties.LOCATORS, ""); // loner system
     File logFile = temporaryFolder.newFile();
     properties.put(ConfigurationProperties.LOG_FILE, logFile.getAbsolutePath());
-    cache = new CacheFactory(properties).create();
+    cacheRule.createCache(properties);
+    Cache cache = cacheRule.getCache();
 
     final String expectedException = "Unknown handshake reply code: 99 messageLength: 0";
 
@@ -95,7 +85,6 @@ public class ConnectionDUnitTest {
     DataInputStream inputStream = new DataInputStream(byteArrayInputStream);
     connection.readHandshakeForSender(inputStream, peerDataBuffer);
     cache.close();
-    cache = null;
     LogFileAssert.assertThat(logFile).contains(expectedException);
   }
 }