You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2018/04/06 16:22:04 UTC

[geode] 02/02: GEODE_1279: Rename MembershipAttributesAreSerializableRegressionTest

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

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 76dd7e22826a1d51e05e9b451e104e05204188ff
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Wed Apr 4 10:45:18 2018 -0700

    GEODE_1279: Rename MembershipAttributesAreSerializableRegressionTest
---
 ...ipAttributesAreSerializableRegressionTest.java} | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableTest.java b/geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableRegressionTest.java
similarity index 75%
rename from geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableTest.java
rename to geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableRegressionTest.java
index 00fb577..298c7a7 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/MembershipAttributesAreSerializableRegressionTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.cache;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -31,7 +31,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
  * Tests MembershipAttributes and SubscriptionAttributes to make sure they are Serializable
  */
 @Category({UnitTest.class, MembershipTest.class})
-public class MembershipAttributesAreSerializableTest {
+public class MembershipAttributesAreSerializableRegressionTest {
 
   /**
    * Assert that MembershipAttributes are serializable.
@@ -40,16 +40,19 @@ public class MembershipAttributesAreSerializableTest {
   public void testMembershipAttributesAreSerializable() throws Exception {
     String[] roles = {"a", "b", "c"};
     MembershipAttributes outMA = new MembershipAttributes(roles);
+
     ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
-    ObjectOutputStream oos = new ObjectOutputStream(baos);
-    oos.writeObject(outMA);
+    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+      oos.writeObject(outMA);
+    }
 
     byte[] data = baos.toByteArray();
 
     ByteArrayInputStream bais = new ByteArrayInputStream(data);
-    ObjectInputStream ois = new ObjectInputStream(bais);
-    MembershipAttributes inMA = (MembershipAttributes) ois.readObject();
-    assertEquals(outMA, inMA);
+    try (ObjectInputStream ois = new ObjectInputStream(bais)) {
+      MembershipAttributes inMA = (MembershipAttributes) ois.readObject();
+      assertEquals(outMA, inMA);
+    }
   }
 
   /**
@@ -58,15 +61,18 @@ public class MembershipAttributesAreSerializableTest {
   @Test
   public void testSubscriptionAttributesAreSerializable() throws Exception {
     SubscriptionAttributes outSA = new SubscriptionAttributes();
+
     ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
-    ObjectOutputStream oos = new ObjectOutputStream(baos);
-    oos.writeObject(outSA);
+    try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+      oos.writeObject(outSA);
+    }
 
     byte[] data = baos.toByteArray();
 
     ByteArrayInputStream bais = new ByteArrayInputStream(data);
-    ObjectInputStream ois = new ObjectInputStream(bais);
-    SubscriptionAttributes inSA = (SubscriptionAttributes) ois.readObject();
-    assertEquals(outSA, inSA);
+    try (ObjectInputStream ois = new ObjectInputStream(bais)) {
+      SubscriptionAttributes inSA = (SubscriptionAttributes) ois.readObject();
+      assertEquals(outSA, inSA);
+    }
   }
 }

-- 
To stop receiving notification emails like this one, please contact
klund@apache.org.