[weld-commits] Weld SVN: r4788 - in core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection: annotation and 1 other directory.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sun Nov 8 15:07:44 EST 2009


Author: pete.muir at jboss.org
Date: 2009-11-08 15:07:44 -0500 (Sun, 08 Nov 2009)
New Revision: 4788

Added:
   core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/
   core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java
Log:
gavin is right

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java	2009-11-08 20:07:44 UTC (rev 4788)
@@ -0,0 +1,36 @@
+package org.jboss.weld.tests.unit.reflection.annotation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.testng.annotations.Test;
+
+ at Synchronous
+public class AnnotationTest
+{
+   
+   @Test
+   public void testSerializability() throws Throwable
+   {
+      Synchronous synchronous = AnnotationTest.class.getAnnotation(Synchronous.class);
+      deserialize(serialize(synchronous));
+   }
+
+   protected byte[] serialize(Object instance) throws IOException
+   {
+      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+      ObjectOutputStream out = new ObjectOutputStream(bytes);
+      out.writeObject(instance);
+      return bytes.toByteArray();
+   }
+
+   protected <T> T deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+      return (T) in.readObject();
+   }
+   
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java	2009-11-08 20:07:44 UTC (rev 4788)
@@ -0,0 +1,21 @@
+package org.jboss.weld.tests.unit.reflection.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Synchronous
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native



More information about the weld-commits mailing list