[webbeans-commits] Webbeans SVN: r3117 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: decorators/definition and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Jul 21 12:24:02 EDT 2009


Author: dallen6
Date: 2009-07-21 12:24:01 -0400 (Tue, 21 Jul 2009)
New Revision: 3117

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Interceptor1.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorType1.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Acorn.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java
Log:
Added interceptor tests and fixed older tests related to deployment types

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -140,7 +140,16 @@
       assert decorators.size() == 0;
    }
 
+   @Test
+   @SpecAssertion(section="11.1.1", id="d")
+   public void testInstanceOfDecoratorForEachEnabled()
+   {
+      assert !getCurrentManager().resolveDecorators(MockLogger.TYPES).isEmpty();
+      assert !getCurrentManager().resolveDecorators(FooBar.TYPES).isEmpty();
+      assert !getCurrentManager().resolveDecorators(Logger.TYPES).isEmpty();
+      assert getCurrentManager().resolveDecorators(Bazt.TYPES).size() == 2;
+      assert !getCurrentManager().resolveDecorators(Field.TYPES).isEmpty();
+   }
 
 
-
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -156,4 +156,10 @@
       assert !getBeans(Tarantula.class).isEmpty();
    }
    
+   @Test
+   @SpecAssertion(section = "11.1", id = "bb")
+   public void testBeanClassOnSimpleBean()
+   {
+      assert getBeans(Spider.class).iterator().next().getBeanClass().equals(Spider.class);
+   }
 }
\ No newline at end of file

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Acorn.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Acorn.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Acorn.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -2,5 +2,8 @@
 
 class Acorn
 {
-
+   public Acorn(int size)
+   {
+      
+   }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -2,5 +2,12 @@
 
 class DefangedTarantula extends Tarantula
 {
-   @Override public int getDeathsCaused() { return 0; }
+   private int deaths;
+   
+   public DefangedTarantula(int deaths)
+   {
+      this.deaths = deaths;
+   }
+
+   @Override public int getDeathsCaused() { return deaths; }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -163,8 +163,8 @@
    })
    public void testScopeType() throws Exception
    {
-      assert getBeans(DaddyLongLegs.class).size() == 1;
-      Bean<DaddyLongLegs> daddyLongLegs = getBeans(DaddyLongLegs.class).iterator().next();
+      assert getBeans(DaddyLongLegs.class, TAME_LITERAL).size() == 1;
+      Bean<DaddyLongLegs> daddyLongLegs = getBeans(DaddyLongLegs.class, TAME_LITERAL).iterator().next();
       assert daddyLongLegs.getScopeType().equals(RequestScoped.class);
    }
 
@@ -175,7 +175,7 @@
    })
    public void testDeploymentType() throws Exception
    {
-      assert getBeans(LadybirdSpider.class).size() == 1;
+      assert getBeans(LadybirdSpider.class, TAME_LITERAL).size() == 1;
       Bean<LadybirdSpider> ladybirdSpider = getBeans(LadybirdSpider.class).iterator().next();
    }
 
@@ -186,8 +186,8 @@
    })
    public void testNamedMethod() throws Exception
    {
-      assert getBeans(BlackWidow.class).size() == 1;
-      Bean<BlackWidow> blackWidowSpider = getBeans(BlackWidow.class).iterator().next();
+      assert getBeans(BlackWidow.class, TAME_LITERAL).size() == 1;
+      Bean<BlackWidow> blackWidowSpider = getBeans(BlackWidow.class, TAME_LITERAL).iterator().next();
       assert blackWidowSpider.getName().equals("blackWidow");
    }
 
@@ -199,8 +199,8 @@
    })
    public void testDefaultNamedMethod() throws Exception
    {
-      assert getBeans(DaddyLongLegs.class).size() == 1;
-      Bean<DaddyLongLegs> daddyLongLegsSpider = getBeans(DaddyLongLegs.class).iterator().next();
+      assert getBeans(DaddyLongLegs.class, TAME_LITERAL).size() == 1;
+      Bean<DaddyLongLegs> daddyLongLegsSpider = getBeans(DaddyLongLegs.class, TAME_LITERAL).iterator().next();
       assert daddyLongLegsSpider.getName().equals("produceDaddyLongLegs");
    }
 
@@ -217,8 +217,8 @@
    })
    public void testStereotypeSpecifiesScope() throws Exception
    {
-      assert getBeans(WolfSpider.class).size() == 1;
-      Bean<WolfSpider> wolfSpider = getBeans(WolfSpider.class).iterator().next();
+      assert getBeans(WolfSpider.class, TAME_LITERAL).size() == 1;
+      Bean<WolfSpider> wolfSpider = getBeans(WolfSpider.class, TAME_LITERAL).iterator().next();
       assert wolfSpider.getScopeType().equals(RequestScoped.class);
    }
 

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -12,7 +12,7 @@
    
    @Produces @Tame public Tarantula produceTameTarantula()
    {
-      return new DefangedTarantula();
+      return new DefangedTarantula(0);
    }
    
    @Produces @Deadliest public Tarantula producesDeadliestTarantula(@Tame Tarantula tameTarantula, 
@@ -22,11 +22,6 @@
             tameTarantula : tarantula;
    }
    
-   @Produces public Tarantula produceTarantula()
-   {
-      return new Tarantula();
-   }
-   
    @Produces public Spider getNullSpider()
    {
       return null;
@@ -52,22 +47,22 @@
       return ALL_SPIDERS;
    }
    
-   @Produces @Named @RequestScoped public DaddyLongLegs produceDaddyLongLegs()
+   @Produces @Named @RequestScoped @Tame public DaddyLongLegs produceDaddyLongLegs()
    {
       return new DaddyLongLegs();
    }
 
-   @Produces @Named public LadybirdSpider getLadybirdSpider()
+   @Produces @Named @Tame public LadybirdSpider getLadybirdSpider()
    {
       return new LadybirdSpider();
    }
 
-   @Produces @Named("blackWidow") public BlackWidow produceBlackWidow()
+   @Produces @Named("blackWidow") @Tame public BlackWidow produceBlackWidow()
    {
       return new BlackWidow();
    }
    
-   @Produces @AnimalStereotype public WolfSpider produceWolfSpider()
+   @Produces @AnimalStereotype @Tame public WolfSpider produceWolfSpider()
    {
       return new WolfSpider();
    }

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Interceptor1.java (from rev 3094, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/Interceptor1.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Interceptor1.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Interceptor1.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+ at InterceptorType1
+class Interceptor1
+{
+   @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+   {
+      return ctx.proceed();
+   }
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -0,0 +1,104 @@
+/*
+ * 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.interceptors.definition;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Tests related to the definition of interceptors, but not necessarily
+ * their execution.
+ * 
+ * Spec version: 20090625
+ *
+ * @author David Allen
+ *
+ */
+ at Artifact
+public class InterceptorDefinitionTest extends AbstractJSR299Test
+{
+   @Test(groups = "ri-broken")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "a")
+   })
+   public void testInterceptorsImplementInterceptorInterface()
+   {
+      boolean interfaceFound = false;
+      for (Type type : getBeans(Interceptor1.class).iterator().next().getTypes())
+      {
+         if (type.equals(Interceptor.class))
+         {
+            interfaceFound = true;
+            break;
+         }
+      }
+      assert interfaceFound;
+   }
+   
+   @Test(groups = "stub")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "b")
+   })
+   public void testGetInterceptorBindingTypes()
+   {
+      assert false;
+   }
+   
+   @Test(groups = "stub")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "c")
+   })
+   public void testInterceptsOnInterceptorBean()
+   {
+      assert false;
+   }
+   
+   @Test(groups = "stub")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "d")
+   })
+   public void testInterceptInvokesInstance()
+   {
+      assert false;
+   }
+   
+   @Test(groups = "stub")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "e")
+   })
+   public void testInterceptionTypeIdentifiesCallbackOrMethod()
+   {
+      assert false;
+   }
+   
+   @Test(groups = "stub")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.1.2", id = "f")
+   })
+   public void testInstanceOfInterceptorForEveryEnabledInterceptor()
+   {
+      assert false;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorType1.java (from rev 3094, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InterceptorType1.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorType1.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorType1.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.Interceptor;
+
+ at Target({TYPE, METHOD})
+ at Retention(RUNTIME)
+ at Interceptor
+ at interface InterceptorType1
+{
+
+}

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java	2009-07-21 16:17:35 UTC (rev 3116)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java	2009-07-21 16:24:01 UTC (rev 3117)
@@ -32,7 +32,7 @@
       assert false;
    }
    
-   @Test
+   @Test(groups = "ri-broken")
    @SpecAssertion(section="5.8", id="c")
    public void testQualifiedNameLookup()
    {




More information about the weld-commits mailing list