[weld-commits] Weld SVN: r6831 - in core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors: generic and 1 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Wed Jul 28 17:33:57 EDT 2010


Author: marius.bogoevici
Date: 2010-07-28 17:33:56 -0400 (Wed, 28 Jul 2010)
New Revision: 6831

Added:
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java
Modified:
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
Log:
More tests for WELD-568

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public abstract class AbstractMessageProcessor<I>
+{
+   void process(I input) {
+      // do nothing; 
+   }
+
+   abstract I generate();
+}

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class IntegerProcessor extends AbstractMessageProcessor<Integer>
+{
+   @Override
+   void process(Integer input)
+   {
+      super.process(input);    //To change body of overridden methods use File | Settings | File Templates.
+   }
+
+   @Override
+   Integer generate()
+   {
+      return 1;
+   }
+}

Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java (from rev 6755, core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.interceptors.generic;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.weld.util.Beans;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Artifact
+public class SimpleWeldClassTest extends AbstractWeldTest
+{
+
+   @Test(groups = "broken")
+   public void testWeldClassForGenericSuperclass()
+   {
+      WeldClass<StringProcessor> weldClass = WeldClassImpl.of(StringProcessor.class, new ClassTransformer(new TypeStore()));
+      Collection methods = weldClass.getWeldMethods();
+      assert methods.size() == 2;
+      List<WeldMethod<?,?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
+      assert interceptableMethods.size() == 4;
+   }
+
+}

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class StringProcessor extends AbstractMessageProcessor<String>
+{
+   @Override
+   void process(String input)
+   {
+      super.process(input);
+   }
+
+   @Override
+   String generate()
+   {
+      return "1";
+   }
+}

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java	2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -28,7 +28,7 @@
       // do nothing
    }
 
-   public void pass()
+   protected void pass()
    {
       
    }

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java	2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -28,9 +28,10 @@
 
    public void receiveInstructions()
    {
-      
+
    }
 
+   @Play
    public Player cloneMe()
    {
       return this;

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java	2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java	2010-07-28 21:33:56 UTC (rev 6831)
@@ -43,7 +43,7 @@
       Collection methods = weldClass.getWeldMethods();
       assert methods.size() == 4;
       List<WeldMethod<?,?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
-      assert methods.size() == 4;
+      assert interceptableMethods.size() == 4;
    }
 
 }



More information about the weld-commits mailing list