[weld-commits] Weld SVN: r6147 - in cdi-tck/branches/1.0/impl/src/main: java/org/jboss/jsr299/tck/tests/extensions/beanManager and 2 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Thu Apr 22 04:09:32 EDT 2010


Author: dallen6
Date: 2010-04-22 04:09:31 -0400 (Thu, 22 Apr 2010)
New Revision: 6147

Added:
   cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/AfterBeanDiscoveryObserver.java
   cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/CowBean.java
   cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/PassivationIdTest.java
   cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/beanManager/
   cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/beanManager/javax.enterprise.inject.spi.Extension
Modified:
   cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken/decoratorWithNonPassivatingInitializerMethod/UnderwaterCity.java
Log:
CDITCK-134 CDITCK-121

Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken/decoratorWithNonPassivatingInitializerMethod/UnderwaterCity.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken/decoratorWithNonPassivatingInitializerMethod/UnderwaterCity.java	2010-04-22 08:06:25 UTC (rev 6146)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken/decoratorWithNonPassivatingInitializerMethod/UnderwaterCity.java	2010-04-22 08:09:31 UTC (rev 6147)
@@ -18,9 +18,9 @@
 
 import java.io.Serializable;
 
-import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
 
- at RequestScoped
+ at SessionScoped
 class UnderwaterCity implements CityInterface, Serializable
 {
 

Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/AfterBeanDiscoveryObserver.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/AfterBeanDiscoveryObserver.java	                        (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/AfterBeanDiscoveryObserver.java	2010-04-22 08:09:31 UTC (rev 6147)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.extensions.beanManager;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+public class AfterBeanDiscoveryObserver implements Extension
+{
+   
+   public void addABean(@Observes AfterBeanDiscovery afterBeanDiscovery)
+   {
+      afterBeanDiscovery.addBean(new CowBean());
+   }
+
+}

Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/CowBean.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/CowBean.java	                        (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/CowBean.java	2010-04-22 08:09:31 UTC (rev 6147)
@@ -0,0 +1,85 @@
+package org.jboss.jsr299.tck.tests.extensions.beanManager;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.jboss.jsr299.tck.literals.DefaultLiteral;
+
+public class CowBean implements Bean<Cow>, PassivationCapable, Serializable
+{
+   private static final long serialVersionUID = 6249623250272328272L;
+   public static final String PASSIVATION_ID = "Cow-6249623250272328272L";
+   private final Set<Annotation> qualifiers = new HashSet<Annotation>(Arrays.asList(new DefaultLiteral()));
+   private final Set<Type> types = new HashSet<Type>(Arrays.<Type>asList(Cow.class));
+
+   public Class<?> getBeanClass()
+   {
+      return Cow.class;
+   }
+
+   public Set<InjectionPoint> getInjectionPoints()
+   {
+      return Collections.emptySet();
+   }
+
+   public String getName()
+   {
+      return "cow";
+   }
+
+   public Set<Annotation> getQualifiers()
+   {
+      return qualifiers;
+   }
+
+   public Class<? extends Annotation> getScope()
+   {
+      return Dependent.class;
+   }
+
+   public Set<Class<? extends Annotation>> getStereotypes()
+   {
+      return Collections.emptySet();
+   }
+
+   public Set<Type> getTypes()
+   {
+      return types;
+   }
+
+   public boolean isAlternative()
+   {
+      return false;
+   }
+
+   public boolean isNullable()
+   {
+      return false;
+   }
+
+   public Cow create(CreationalContext<Cow> creationalContext)
+   {
+      return new Cow("Betsy");
+   }
+
+   public void destroy(Cow instance, CreationalContext<Cow> creationalContext)
+   {
+   }
+
+   public String getId()
+   {
+      return PASSIVATION_ID;
+   }
+
+}

Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/PassivationIdTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/PassivationIdTest.java	                        (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/PassivationIdTest.java	2010-04-22 08:09:31 UTC (rev 6147)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jsr299.tck.tests.extensions.beanManager;
+
+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.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
+import org.testng.annotations.Test;
+
+/**
+ * Tests retrieving beans with the BeanManager by the ID for a passivation-capable
+ * bean.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at IntegrationTest
+ at Extension("javax.enterprise.inject.spi.Extension")
+ at SpecVersion(spec="cdi", version="20091101")
+public class PassivationIdTest extends AbstractJSR299Test
+{
+   @Test
+   @SpecAssertion(section = "11.3.6", id = "a")
+   public void testGetPassivationCapableBeanById()
+   {
+      Bean<?> passivatingBean = getCurrentManager().getPassivationCapableBean(CowBean.PASSIVATION_ID);
+      assert passivatingBean.getBeanClass().equals(Cow.class);
+   }
+}

Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/beanManager/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/beanManager/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/beanManager/javax.enterprise.inject.spi.Extension	2010-04-22 08:09:31 UTC (rev 6147)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.beanManager.AfterBeanDiscoveryObserver
\ No newline at end of file



More information about the weld-commits mailing list