mx4j/src/test/test/javax/management/compliance/serialization/support Comparator.java,1.4,1.5 Instantiator.java,1.8,1.9 SerializationVerifier.java,1.1,1.2 Serializer.java,1.1,1.2

Simone Bordet <[email protected]>
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management/compliance/serialization/support
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30262/src/test/test/javax/management/compliance/serialization/support

Modified Files:
	Comparator.java Instantiator.java SerializationVerifier.java 
	Serializer.java 
Log Message:
Added copyright notice and author information

Index: Instantiator.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/compliance/serialization/support/Instantiator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Instantiator.java	24 Jan 2003 16:51:08 -0000	1.8
--- Instantiator.java	10 Aug 2004 09:15:17 -0000	1.9
***************
*** 1,7 ****
  package test.javax.management.compliance.serialization.support;
  
  import java.lang.reflect.Constructor;
  import java.util.ArrayList;
- 
  import javax.management.Attribute;
  import javax.management.AttributeChangeNotification;
--- 1,14 ----
+ /*
+  * Copyright (C) MX4J.
[...1399 lines suppressed...]
!       // First try MX4J version
!       try
!       {
!          Constructor ctor = TimerNotification.class.getDeclaredConstructor(new Class[]{String.class, Object.class, String.class, Integer.class});
!          ctor.setAccessible(true);
!          TimerNotification notification = (TimerNotification)ctor.newInstance(new Object[]{"type", "source", "message", new Integer(13)});
!          notification.setUserData("user");
!          return notification;
!       }
!       catch (NoSuchMethodException x)
!       {
!          // Then try JMX RI version
!          Constructor ctor = TimerNotification.class.getDeclaredConstructor(new Class[]{String.class, Object.class, long.class, long.class, String.class, Integer.class});
!          ctor.setAccessible(true);
!          TimerNotification notification = (TimerNotification)ctor.newInstance(new Object[]{"type", "source", new Long(0), new Long(0), "message", new Integer(13)});
!          notification.setUserData("user");
!          return notification;
!       }
!    }
  }

Index: Serializer.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/compliance/serialization/support/Serializer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Serializer.java	5 Aug 2002 16:14:52 -0000	1.1
--- Serializer.java	10 Aug 2004 09:15:17 -0000	1.2
***************
*** 1,33 ****
  package test.javax.management.compliance.serialization.support;
  
- import java.io.IOException;
- import java.io.ByteArrayOutputStream;
- import java.io.ObjectOutputStream;
  import java.io.ByteArrayInputStream;
  import java.io.ObjectInputStream;
  
  /**
!  *
   * @version $Revision$
   */
  public class Serializer
  {
! 	public byte[] serialize(Object object) throws IOException
! 	{
! 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
! 		ObjectOutputStream oos = new ObjectOutputStream(baos);
! 		oos.writeObject(object);
! 		oos.close();
! 		byte[] bytes = baos.toByteArray();
! 		return bytes;
! 	}
  
! 	public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
! 	{
! 		ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
! 		ObjectInputStream ois = new ObjectInputStream(bais);
! 		Object object = ois.readObject();
! 		ois.close();
! 		return object;
! 	}
  }
--- 1,41 ----
+ /*
+  * Copyright (C) MX4J.
+  * All rights reserved.
+  *
+  * This software is distributed under the terms of the MX4J License version 1.0.
+  * See the terms of the MX4J License in the documentation provided with this software.
+  */
+ 
  package test.javax.management.compliance.serialization.support;
  
  import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.io.IOException;
  import java.io.ObjectInputStream;
+ import java.io.ObjectOutputStream;
  
  /**
!  * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
   */
  public class Serializer
  {
!    public byte[] serialize(Object object) throws IOException
!    {
!       ByteArrayOutputStream baos = new ByteArrayOutputStream();
!       ObjectOutputStream oos = new ObjectOutputStream(baos);
!       oos.writeObject(object);
!       oos.close();
!       byte[] bytes = baos.toByteArray();
!       return bytes;
!    }
  
!    public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
!    {
!       ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
!       ObjectInputStream ois = new ObjectInputStream(bais);
!       Object object = ois.readObject();
!       ois.close();
!       return object;
!    }
  }

Index: SerializationVerifier.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/compliance/serialization/support/SerializationVerifier.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SerializationVerifier.java	3 Aug 2003 16:02:33 -0000	1.1
--- SerializationVerifier.java	10 Aug 2004 09:15:17 -0000	1.2
***************
*** 1,9 ****
  package test.javax.management.compliance.serialization.support;
  
- import java.lang.reflect.Method;
  import java.lang.reflect.InvocationTargetException;
  
  /**
!  *
   * @version $Revision$
   */
--- 1,17 ----
+ /*
+  * Copyright (C) MX4J.
+  * All rights reserved.
+  *
+  * This software is distributed under the terms of the MX4J License version 1.0.
+  * See the terms of the MX4J License in the documentation provided with this software.
+  */
+ 
  package test.javax.management.compliance.serialization.support;
  
  import java.lang.reflect.InvocationTargetException;
+ import java.lang.reflect.Method;
  
  /**
!  * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
   */

Index: Comparator.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/compliance/serialization/support/Comparator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Comparator.java	24 Jan 2003 16:51:08 -0000	1.4
--- Comparator.java	10 Aug 2004 09:15:17 -0000	1.5
***************
*** 1,2 ****
--- 1,10 ----
+ /*
+  * Copyright (C) MX4J.
+  * All rights reserved.
+  *
+  * This software is distributed under the terms of the MX4J License version 1.0.
+  * See the terms of the MX4J License in the documentation provided with this software.
+  */
+ 
  package test.javax.management.compliance.serialization.support;
[...1572 lines suppressed...]
!       RoleUnresolvedList l2 = (RoleUnresolvedList)o2;
  
!       // RoleUnresolved does not override equals() so List.equals() fails; just use size() here
!       if (l1.size() != l2.size()) throw new RuntimeException();
!    }
  
  
!    //
!    // TIMER package
!    //
!    public void compareTimerNotification(Object o1, Object o2)
!    {
!       compareNotification(o1, o2);
  
!       TimerNotification n1 = (TimerNotification)o1;
!       TimerNotification n2 = (TimerNotification)o2;
  
!       if (!n1.getNotificationID().equals(n2.getNotificationID())) throw new RuntimeException();
!    }
  }



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.