[webbeans-commits] Webbeans SVN: r3535 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/decorators/invocation/observer and 7 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Aug 16 15:54:01 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-08-16 15:54:01 -0400 (Sun, 16 Aug 2009)
New Revision: 3535

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/DecoratorInvocationTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Foo.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Observer.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverDecorator.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverImpl.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/DecoratorInvocationTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Foo.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Producer.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/beans.xml
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/beans.xml
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Logger.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/MockLogger.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Group some tests, implement some decorator tests

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -41,15 +41,19 @@
       @SpecAssertion(section="8.5", id="b"),
       @SpecAssertion(section="8.1.3", id="d"),
       @SpecAssertion(section="8.1.2", id="f"),
-      @SpecAssertion(section="8.1.2", id="b")
+      @SpecAssertion(section="8.1.2", id="b"),
+      @SpecAssertion(section="7.2", id="b"),
+      @SpecAssertion(section="7.2", id="ha")
    })
    public void testDecoratorInvocation()
    {
       TimestampLogger.reset();
-      MockLogger.setMessage(null);
+      MockLogger.reset();
       getInstanceByType(CowShed.class).milk();
       assert TimestampLogger.getMessage().equals(CowShed.MESSAGE);
       assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + CowShed.MESSAGE);
+      assert !TimestampLogger.isInitializeCalled();
+      assert MockLogger.isInitializeCalled();
    }
    
    @Test
@@ -60,7 +64,8 @@
       @SpecAssertion(section="8.4", id="a"),
       @SpecAssertion(section="8.1.3", id="d"),
       @SpecAssertion(section="8.1.2", id="f"),
-      @SpecAssertion(section="8.1.2", id="b")
+      @SpecAssertion(section="8.1.2", id="b"),
+      @SpecAssertion(section="7.2", id="kb")
    })
    public void testChainedDecoratorInvocation()
    {

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -43,12 +43,13 @@
       @SpecAssertion(section="8.5", id="b"),
       @SpecAssertion(section="8.1.3", id="d"),
       @SpecAssertion(section="8.1.2", id="f"),
-      @SpecAssertion(section="8.1.2", id="b")
+      @SpecAssertion(section="8.1.2", id="b"),
+      @SpecAssertion(section="7.2", id="d")
    })
    public void testDecoratorInvocation()
    {
       TimestampLogger.reset();
-      MockLogger.setMessage(null);
+      MockLogger.reset();
       getInstanceByType(PigSty.class).clean();
       assert TimestampLogger.getMessage().equals(PigSty.MESSAGE);
       assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + PigSty.MESSAGE);

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Logger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Logger.java	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Logger.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -25,5 +25,7 @@
 {
 
    public void log(String string);
+   
+   public void initialize();
 
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/MockLogger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/MockLogger.java	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/MockLogger.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -16,6 +16,8 @@
  */
 package org.jboss.jsr299.tck.tests.decorators.invocation;
 
+import javax.enterprise.inject.Initializer;
+
 /**
  * @author pmuir
  *
@@ -23,7 +25,15 @@
 public class MockLogger implements Logger
 {
 
+   @Initializer
+   public void initialize()
+   {
+      initializeCalled = true;
+   }
+   
    private static String message = "";
+   
+   private static boolean initializeCalled;
 
    public void log(String string)
    {
@@ -41,9 +51,18 @@
    /**
     * @param log the log to set
     */
-   public static void setMessage(String log)
+   public static void reset()
    {
-      MockLogger.message = log;
+      MockLogger.message = null;
+      initializeCalled = false;
    }
+   
+   /**
+    * @return the initializeCalled
+    */
+   public static boolean isInitializeCalled()
+   {
+      return initializeCalled;
+   }
 
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -32,6 +32,8 @@
    
    private static String message;
    
+   private static boolean initializeCalled;
+   
    @Decorates
    private Logger logger;
    
@@ -41,6 +43,11 @@
       logger.log(PREFIX + message);
    }
    
+   public void initialize()
+   {
+      initializeCalled = true;
+   }
+   
    /**
     * @return the message
     */
@@ -55,7 +62,16 @@
    public static void reset()
    {
       TimestampLogger.message = null;
+      initializeCalled = false;
    }
+   
+   /**
+    * @return the initializeCalled
+    */
+   public static boolean isInitializeCalled()
+   {
+      return initializeCalled;
+   }
 
 
 }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/DecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/DecoratorInvocationTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/DecoratorInvocationTest.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.observer;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Artifact
+ at BeansXml("beans.xml")
+ at SpecVersion("20090625")
+public class DecoratorInvocationTest extends AbstractJSR299Test
+{
+
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section="7.2", id="if")
+   })
+   public void testDecoratorInvocation()
+   {
+      ObserverImpl.reset();
+      getCurrentManager().fireEvent(new Foo("foo!"));
+      assert ObserverImpl.isObservervedCorrectly();
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/DecoratorInvocationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Foo.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Foo.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Foo.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.observer;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+   
+   private String foo;
+   
+   public Foo(String foo)
+   {
+      this.foo = foo;
+   }
+   
+   /**
+    * @return the foo
+    */
+   public String getFoo()
+   {
+      return foo;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Foo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Observer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Observer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Observer.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.observer;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public interface Observer
+{
+   
+   public void observe(Foo foo);
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/Observer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverDecorator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverDecorator.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverDecorator.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.observer;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+
+/**
+ * @author pmuir
+ *
+ */
+ at Decorator
+public class ObserverDecorator
+{
+   
+   @Decorates
+   private Observer observer;
+   
+   public void observe(Foo foo)
+   {
+      observer.observe(new Foo("decorated"));
+   }
+
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverDecorator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverImpl.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverImpl.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverImpl.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.observer;
+
+import javax.enterprise.event.Observes;
+
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class ObserverImpl implements Observer
+{
+   
+   private static boolean observervedCorrectly = false;
+   
+   /**
+    * @param log the log to set
+    */
+   public static void reset()
+   {
+      observervedCorrectly = false;
+   }
+   
+   @Override
+   public void observe(@Observes Foo foo)
+   {
+      observervedCorrectly = foo.getFoo().equals("decorated");
+   }
+   
+   /**
+    * @return the disposedCorrectly
+    */
+   public static boolean isObservervedCorrectly()
+   {
+      return observervedCorrectly;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/observer/ObserverImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/DecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/DecoratorInvocationTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/DecoratorInvocationTest.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Artifact
+ at BeansXml("beans.xml")
+ at SpecVersion("20090625")
+public class DecoratorInvocationTest extends AbstractJSR299Test
+{
+
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section="7.2", id="ib"),
+      @SpecAssertion(section="7.2", id="id")
+   })
+   public void testDecoratorInvocation()
+   {
+      ProducerDecorator.reset();
+      ProducerImpl.reset();
+      Bean<Foo> bean = (Bean<Foo>) getCurrentManager().resolve(getCurrentManager().getBeans(Foo.class));
+      CreationalContext<Foo> creationalContext = getCurrentManager().createCreationalContext(bean);
+      Foo foo = bean.create(creationalContext);
+      assert foo.getFoo().equals("foo!!!");
+      bean.destroy(foo, creationalContext);
+      assert ProducerImpl.isDisposedCorrectly();
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/DecoratorInvocationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Foo.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Foo.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Foo.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.producer.method;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+   
+   private String foo;
+   
+   public Foo(String foo)
+   {
+      this.foo = foo;
+   }
+   
+   /**
+    * @return the foo
+    */
+   public String getFoo()
+   {
+      return foo;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Foo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Producer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Producer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Producer.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.producer.method;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public interface Producer
+{
+   
+   public Foo produce();
+   
+   public void dispose(Foo foo);
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/Producer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.producer.method;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+
+/**
+ * @author pmuir
+ *
+ */
+ at Decorator
+public class ProducerDecorator
+{
+   
+   @Decorates
+   private Producer logger;
+   
+   public Foo produce()
+   {
+      return new Foo(logger.produce().getFoo() + "!!");
+   }
+   
+   /**
+    * @param message the message to set
+    */
+   public static void reset()
+   {
+      
+   }
+   
+   public void dispose(Foo foo)
+   {
+      logger.dispose(new Foo("decorated"));
+   }
+
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.decorators.invocation.producer.method;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class ProducerImpl implements Producer
+{
+   
+   private static boolean disposedCorrectly = false;
+   
+   /**
+    * @param log the log to set
+    */
+   public static void reset()
+   {
+      disposedCorrectly = false;
+   }
+   
+   @Produces
+   public Foo produce()
+   {
+      return new Foo("foo!");
+   }
+   
+   @Override
+   public void dispose(@Disposes Foo foo)
+   {
+      disposedCorrectly = foo.getFoo().equals("decorated");
+   }
+   
+   /**
+    * @return the disposedCorrectly
+    */
+   public static boolean isDisposedCorrectly()
+   {
+      return disposedCorrectly;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/beans.xml	                        (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/beans.xml	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,5 @@
+<beans> 
+   <decorators>
+      <class>org.jboss.jsr299.tck.tests.decorators.invocation.observer.ObserverDecorator</class>
+   </decorators>
+</beans>


Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/observer/beans.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/beans.xml	                        (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/beans.xml	2009-08-16 19:54:01 UTC (rev 3535)
@@ -0,0 +1,5 @@
+<beans> 
+   <decorators>
+      <class>org.jboss.jsr299.tck.tests.decorators.invocation.producer.method.ProducerDecorator</class>
+   </decorators>
+</beans>


Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/beans.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-08-16 18:06:59 UTC (rev 3534)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-08-16 19:54:01 UTC (rev 3535)
@@ -3515,10 +3515,17 @@
       <text>If the invocation is not a business method invocation, it is treated as a normal Java method call and is not intercepted by the container.</text>
     </assertion>
     
-    <assertion id="h">
+    <group>
       <text>Invocations of initializer methods by the container are not business method invocations.</text>
-    </assertion>
+      <assertion id="ha">
+        <text>Check initializer methods aren't decorated</text>
+      </assertion>
+      <assertion id="hb">
+        <text>Check initializer methods aren't intercepted</text>
+      </assertion>
+    </group>
     
+    
     <group>
       <text>Invocations of producer, disposer and observer methods by the container are business method invocations are are intercepted by method interceptors and decorators.</text>
       




More information about the weld-commits mailing list