Author: thobbs
Date: Tue Nov 23 12:52:44 2010
New Revision: 1038090

URL: http://svn.apache.org/viewvc?rev=1038090&view=rev
Log:
Fixed Java 6/5 bug

Modified:
    incubator/river/jtsk/trunk/test/src/net/jini/core/event/RemoteEventTest.java

Modified: 
incubator/river/jtsk/trunk/test/src/net/jini/core/event/RemoteEventTest.java
URL: 
http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/test/src/net/jini/core/event/RemoteEventTest.java?rev=1038090&r1=1038089&r2=1038090&view=diff
==============================================================================
--- 
incubator/river/jtsk/trunk/test/src/net/jini/core/event/RemoteEventTest.java 
(original)
+++ 
incubator/river/jtsk/trunk/test/src/net/jini/core/event/RemoteEventTest.java 
Tue Nov 23 12:52:44 2010
@@ -18,6 +18,8 @@
 
 package net.jini.core.event;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -26,10 +28,9 @@ import java.io.ObjectOutputStream;
 import java.rmi.MarshalledObject;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import net.jini.io.MarshalledInstance;
+
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 /**
  *
@@ -41,19 +42,19 @@ public class RemoteEventTest {
     }
     String s = "happy";
     Object source = "source";
-    MarshalledObject<String> m = null;
+    MarshalledObject m = null;
     RemoteEvent e = null;
-    MarshalledObject<String> mo = null;
+    MarshalledObject mo = null;
 
     @Before
     @SuppressWarnings("deprecation")
     public void setUp() {
-       try {
-           m = new MarshalledObject<String>(s);
-       } catch (IOException ex) {
-           Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, 
null, ex);
-       }
-       e = new RemoteEvent(source, 10L, 25L,m);
+        try {
+            this.m = new MarshalledObject(this.s);
+        } catch (IOException ex) {
+            
Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        this.e = new RemoteEvent(this.source, 10L, 25L,this.m);
     }
 
     /**
@@ -61,11 +62,11 @@ public class RemoteEventTest {
      */
     @Test
     public void getID() {
-       System.out.println("getID");
-       RemoteEvent instance = e;
-       long expResult = 10L;
-       long result = instance.getID();
-       assertEquals(expResult, result);
+        System.out.println("getID");
+        RemoteEvent instance = this.e;
+        long expResult = 10L;
+        long result = instance.getID();
+        assertEquals(expResult, result);
     }
 
     /**
@@ -73,11 +74,11 @@ public class RemoteEventTest {
      */
     @Test
     public void getSequenceNumber() {
-       System.out.println("getSequenceNumber");
-       RemoteEvent instance = e;
-       long expResult = 25L;
-       long result = instance.getSequenceNumber();
-       assertEquals(expResult, result);
+        System.out.println("getSequenceNumber");
+        RemoteEvent instance = this.e;
+        long expResult = 25L;
+        long result = instance.getSequenceNumber();
+        assertEquals(expResult, result);
     }
 
     /**
@@ -85,47 +86,47 @@ public class RemoteEventTest {
      */
     @Test
     public void getRegistrationObject() {
-       System.out.println("getRegistrationObject");
-       RemoteEvent instance = e;
-       MarshalledObject expResult = m;
-       @SuppressWarnings("deprecation")
-       MarshalledObject result = instance.getRegistrationObject();
-       assertEquals(expResult, result);
+        System.out.println("getRegistrationObject");
+        RemoteEvent instance = this.e;
+        MarshalledObject expResult = this.m;
+        @SuppressWarnings("deprecation")
+        MarshalledObject result = instance.getRegistrationObject();
+        assertEquals(expResult, result);
     }
-    
+
     @Test
     public void testSerialization() {
-       ObjectOutputStream oos = null;
-       System.out.println("test serialization");
-       MarshalledObject expResult = m;
-       try {
-           ByteArrayOutputStream baos = new ByteArrayOutputStream();
-           oos = new ObjectOutputStream(baos);
-           oos.writeObject(e);
-           oos.flush();
-           byte[] bytes = baos.toByteArray();
-           ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-           ObjectInputStream ois = new ObjectInputStream(bais);
-           RemoteEvent result = (RemoteEvent) ois.readObject();
-           MarshalledObject moResult = result.getRegistrationObject();
-           Object srcResult = result.getSource();
-           long iDResult = result.getID();
-           long seqResult = result.getSequenceNumber();
-           assertEquals(expResult, moResult);
-           assertEquals(source, srcResult);
-           assertEquals(10L, iDResult);
-           assertEquals(25L, seqResult);
-       } catch (IOException ex) {
-           Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, 
null, ex);
-       } catch (ClassNotFoundException ex) {
-           Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, 
null, ex);
-       } finally {
-           try {
-               oos.close();
-           } catch (IOException ex) {
-               
Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, null, ex);
-           }
-       }
+        ObjectOutputStream oos = null;
+        System.out.println("test serialization");
+        MarshalledObject expResult = this.m;
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            oos = new ObjectOutputStream(baos);
+            oos.writeObject(this.e);
+            oos.flush();
+            byte[] bytes = baos.toByteArray();
+            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            RemoteEvent result = (RemoteEvent) ois.readObject();
+            MarshalledObject moResult = result.getRegistrationObject();
+            Object srcResult = result.getSource();
+            long iDResult = result.getID();
+            long seqResult = result.getSequenceNumber();
+            assertEquals(expResult, moResult);
+            assertEquals(this.source, srcResult);
+            assertEquals(10L, iDResult);
+            assertEquals(25L, seqResult);
+        } catch (IOException ex) {
+            
Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (ClassNotFoundException ex) {
+            
Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, null, ex);
+        } finally {
+            try {
+                oos.close();
+            } catch (IOException ex) {
+                
Logger.getLogger(RemoteEventTest.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
     }
 
 }
\ No newline at end of file


Reply via email to