[webbeans-commits] Webbeans SVN: r3530 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Aug 16 13:08:31 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-08-16 13:08:30 -0400 (Sun, 16 Aug 2009)
New Revision: 3530

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBeanLocal.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBeanLocal.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBeanLocal.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBeanLocal.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/JndiBeanManagerInjected.java
Removed:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBeanLocal.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/UserTransactionBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
   tck/trunk/impl/pom.xml
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/SingletonWithRequestScopeTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/SingletonWithSessionScopeTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java
Log:
Add in support for Principal, Validator, ValidatorFactory (not yet supported in JBoss AS)

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.bean.builtin;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.Validator;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.webbeans.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class DefaultValidatorBean extends AbstractBuiltInBean<Validator>
+{
+
+   private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, Validator.class);
+   
+   public DefaultValidatorBean(BeanManagerImpl manager)
+   {
+      super(manager);
+   }
+
+   @Override
+   public Class<Validator> getType()
+   {
+      return Validator.class;
+   }
+
+   public Set<Type> getTypes()
+   {
+      return TYPES;
+   }
+
+   public Validator create(CreationalContext<Validator> creationalContext)
+   {
+      if (getManager().getServices().contains(ValidationServices.class))
+      {
+         return getManager().getServices().get(ValidationServices.class).getDefaultValidatorFactory().getValidator();
+      }
+      else
+      {
+         throw new IllegalStateException("ValidationServices not available");
+      }
+   }
+
+   public void destroy(Validator instance, CreationalContext<Validator> creationalContext)
+   {
+      // No-op      
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.bean.builtin;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.webbeans.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class DefaultValidatorFactoryBean extends AbstractBuiltInBean<ValidatorFactory>
+{
+
+   private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, ValidatorFactory.class);
+   
+   public DefaultValidatorFactoryBean(BeanManagerImpl manager)
+   {
+      super(manager);
+   }
+
+   @Override
+   public Class<ValidatorFactory> getType()
+   {
+      return ValidatorFactory.class;
+   }
+
+   public Set<Type> getTypes()
+   {
+      return TYPES;
+   }
+
+   public ValidatorFactory create(CreationalContext<ValidatorFactory> creationalContext)
+   {
+      if (getManager().getServices().contains(ValidationServices.class))
+      {
+         return getManager().getServices().get(ValidationServices.class).getDefaultValidatorFactory();
+      }
+      else
+      {
+         throw new IllegalStateException("ValidationServices not available");
+      }
+   }
+
+   public void destroy(ValidatorFactory instance, CreationalContext<ValidatorFactory> creationalContext)
+   {
+      // No-op      
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.bean.builtin;
+
+import java.lang.reflect.Type;
+import java.security.Principal;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.security.spi.SecurityServices;
+import org.jboss.webbeans.util.collections.Arrays2;
+
+/**
+ * @author pmuir
+ *
+ */
+public class PrincipalBean extends AbstractBuiltInBean<Principal>
+{
+
+   private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, Principal.class);
+   
+   public PrincipalBean(BeanManagerImpl manager)
+   {
+      super(manager);
+   }
+
+   @Override
+   public Class<Principal> getType()
+   {
+      return Principal.class;
+   }
+
+   public Set<Type> getTypes()
+   {
+      return TYPES;
+   }
+
+   public Principal create(CreationalContext<Principal> creationalContext)
+   {
+      if (getManager().getServices().contains(SecurityServices.class))
+      {
+         return getManager().getServices().get(SecurityServices.class).getPrincipal();
+      }
+      else
+      {
+         throw new IllegalStateException("SecurityServices not available");
+      }
+   }
+
+   public void destroy(Principal instance, CreationalContext<Principal> creationalContext)
+   {
+      // No-op      
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/UserTransactionBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/UserTransactionBean.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/UserTransactionBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -53,7 +53,14 @@
 
    public UserTransaction create(CreationalContext<UserTransaction> creationalContext)
    {
-      return getManager().getServices().get(TransactionServices.class).getUserTransaction();
+      if (getManager().getServices().contains(TransactionServices.class))
+      {
+         return getManager().getServices().get(TransactionServices.class).getUserTransaction();
+      }
+      else
+      {
+         throw new IllegalStateException("TransactionServices not available");
+      }
    }
 
    public void destroy(UserTransaction instance, CreationalContext<UserTransaction> creationalContext)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -29,8 +29,11 @@
 import org.jboss.webbeans.DefinitionException;
 import org.jboss.webbeans.DeploymentException;
 import org.jboss.webbeans.Validator;
+import org.jboss.webbeans.bean.builtin.DefaultValidatorBean;
+import org.jboss.webbeans.bean.builtin.DefaultValidatorFactoryBean;
 import org.jboss.webbeans.bean.builtin.InjectionPointBean;
 import org.jboss.webbeans.bean.builtin.ManagerBean;
+import org.jboss.webbeans.bean.builtin.PrincipalBean;
 import org.jboss.webbeans.bean.builtin.UserTransactionBean;
 import org.jboss.webbeans.bean.builtin.facade.EventBean;
 import org.jboss.webbeans.bean.builtin.facade.InstanceBean;
@@ -67,10 +70,12 @@
 import org.jboss.webbeans.resources.DefaultResourceLoader;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.resources.spi.ResourceServices;
+import org.jboss.webbeans.security.spi.SecurityServices;
 import org.jboss.webbeans.servlet.HttpSessionManager;
 import org.jboss.webbeans.servlet.ServletApiAbstraction;
 import org.jboss.webbeans.transaction.spi.TransactionServices;
 import org.jboss.webbeans.util.serviceProvider.ServiceLoader;
+import org.jboss.webbeans.validation.spi.ValidationServices;
 import org.jboss.webbeans.xml.BeansXmlParser;
 
 /**
@@ -280,6 +285,15 @@
          {
             beanDeployer.getEnvironment().addBean(new UserTransactionBean(manager));
          }
+         if (getServices().contains(SecurityServices.class))
+         {
+            beanDeployer.getEnvironment().addBean(new PrincipalBean(manager));
+         }
+         if (getServices().contains(ValidationServices.class))
+         {
+            beanDeployer.getEnvironment().addBean(new DefaultValidatorBean(manager));
+            beanDeployer.getEnvironment().addBean(new DefaultValidatorFactoryBean(manager));
+         }
          beanDeployer.createBeans().deploy();
          fireAfterBeanDiscoveryEvent();
          log.debug("Web Beans initialized. Validating beans.");

Modified: tck/trunk/impl/pom.xml
===================================================================
--- tck/trunk/impl/pom.xml	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/pom.xml	2009-08-16 17:08:30 UTC (rev 3530)
@@ -49,6 +49,11 @@
       </dependency>
       
       <dependency>
+         <groupId>javax.validation</groupId>
+         <artifactId>validation-api</artifactId>
+      </dependency>
+      
+      <dependency>
         <groupId>org.jboss.test-audit</groupId>
         <artifactId>jboss-test-audit-api</artifactId>
      </dependency>

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,7 +1,11 @@
 package org.jboss.jsr299.tck.tests.implementation.builtin;
 
+import java.security.Principal;
+
 import javax.transaction.SystemException;
 import javax.transaction.UserTransaction;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
 
 import org.jboss.jsr299.tck.AbstractJSR299Test;
 import org.jboss.test.audit.annotations.SpecAssertion;
@@ -32,10 +36,46 @@
    })
    public void testUserTransactionBean() throws SystemException
    {
-      UserTransaction userTransaction = getInstanceByType(InjectedBeanLocal.class).getUserTransaction(); 
+      UserTransaction userTransaction = getInstanceByType(UserTransactionInjectedBeanLocal.class).getUserTransaction(); 
       assert userTransaction != null;
       // Check that the UserTransaction is at least queryable
       userTransaction.getStatus();
    }
    
+   @Test(groups="jboss-as-broken")
+   @SpecAssertions({
+      @SpecAssertion(section="3.6", id="c")
+   })
+   public void testDefaultValidatorFactoryBean() throws SystemException
+   {
+      ValidatorFactory defaultValidatorFactory = getInstanceByType(DefaultValidatorFactoryInjectedBeanLocal.class).getDefaultValidatorFactory(); 
+      assert defaultValidatorFactory != null;
+      // Check that the ValidatorFactory is at least queryable
+      defaultValidatorFactory.getValidator();
+   }
+   
+   @Test(groups="jboss-as-broken")
+   @SpecAssertions({
+      @SpecAssertion(section="3.6", id="d")
+   })
+   public void testDefaultValidatorBean() throws SystemException
+   {
+      Validator defaultValidator = getInstanceByType(DefaultValidatorInjectedBeanLocal.class).getDefaultValidator(); 
+      assert defaultValidator != null;
+      // Check that the ValidatorFactory is at least queryable
+      defaultValidator.getConstraintsForClass(BuiltInBeansTest.class);
+   }
+   
+   @Test(groups="jboss-as-broken")
+   @SpecAssertions({
+      @SpecAssertion(section="3.6", id="c")
+   })
+   public void testPrincipalBean() throws SystemException
+   {
+      Principal principal = getInstanceByType(PrincipalInjectedBeanLocal.class).getPrincipal(); 
+      assert principal != null;
+      // Check that the Principal is at least queryable
+      principal.getName();
+   }
+   
 }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,38 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Current;
+import javax.validation.ValidatorFactory;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Stateful
+public class DefaultValidatorFactoryInjectedBean implements DefaultValidatorFactoryInjectedBeanLocal
+{
+
+   @Current transient ValidatorFactory defaultValidatorFactory;
+   
+   public ValidatorFactory getDefaultValidatorFactory()
+   {
+      return defaultValidatorFactory;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBeanLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBeanLocal.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorFactoryInjectedBeanLocal.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,32 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Local;
+import javax.validation.ValidatorFactory;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Local
+public interface DefaultValidatorFactoryInjectedBeanLocal
+{
+   
+   public ValidatorFactory getDefaultValidatorFactory();
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,38 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Current;
+import javax.validation.Validator;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Stateful
+public class DefaultValidatorInjectedBean implements DefaultValidatorInjectedBeanLocal
+{
+
+   @Current transient Validator defaultValidator;
+   
+   public Validator getDefaultValidator()
+   {
+      return defaultValidator;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBeanLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBeanLocal.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/DefaultValidatorInjectedBeanLocal.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,32 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Local;
+import javax.validation.Validator;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Local
+public interface DefaultValidatorInjectedBeanLocal
+{
+   
+   public Validator getDefaultValidator();
+
+}


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

Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBean.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,38 +0,0 @@
-/*
- * 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.implementation.builtin;
-
-import javax.ejb.Stateful;
-import javax.enterprise.inject.Current;
-import javax.transaction.UserTransaction;
-
-/**
- * @author pmuir
- *
- */
- at Stateful
-public class InjectedBean implements InjectedBeanLocal
-{
-
-   @Current transient UserTransaction userTransaction;
-   
-   public UserTransaction getUserTransaction()
-   {
-      return userTransaction;
-   }
-
-}

Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBeanLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBeanLocal.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBeanLocal.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,30 +0,0 @@
-/*
- * 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.implementation.builtin;
-
-import javax.transaction.UserTransaction;
-
-/**
- * @author pmuir
- *
- */
-public interface InjectedBeanLocal
-{
-   
-   public UserTransaction getUserTransaction();
-
-}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -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.implementation.builtin;
+
+import java.security.Principal;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Current;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Stateful
+public class PrincipalInjectedBean implements PrincipalInjectedBeanLocal
+{
+
+   @Current transient Principal principal;
+   
+   @Override
+   public Principal getPrincipal()
+   {
+      return principal;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBeanLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBeanLocal.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/PrincipalInjectedBeanLocal.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,33 @@
+/*
+ * 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.implementation.builtin;
+
+import java.security.Principal;
+
+import javax.ejb.Local;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Local
+public interface PrincipalInjectedBeanLocal
+{
+   
+   public Principal getPrincipal();
+
+}


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

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBean.java (from rev 3528, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBean.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBean.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,38 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Current;
+import javax.transaction.UserTransaction;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Stateful
+public class UserTransactionInjectedBean implements UserTransactionInjectedBeanLocal
+{
+
+   @Current transient UserTransaction userTransaction;
+   
+   public UserTransaction getUserTransaction()
+   {
+      return userTransaction;
+   }
+
+}


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

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBeanLocal.java (from rev 3528, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/InjectedBeanLocal.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBeanLocal.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/UserTransactionInjectedBeanLocal.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,32 @@
+/*
+ * 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.implementation.builtin;
+
+import javax.ejb.Local;
+import javax.transaction.UserTransaction;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Local
+public interface UserTransactionInjectedBeanLocal
+{
+   
+   public UserTransaction getUserTransaction();
+
+}


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

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/SingletonWithRequestScopeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/SingletonWithRequestScopeTest.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/SingletonWithRequestScopeTest.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,10 +1,10 @@
 package org.jboss.jsr299.tck.tests.implementation.enterprise.broken.singletonWithRequestScope;
 
 
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DefinitionError;
 import org.jboss.test.audit.annotations.SpecAssertion;
 import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.DefinitionError;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
 import org.jboss.testharness.impl.packaging.Packaging;
@@ -17,7 +17,7 @@
 @SpecVersion("20090625")
 public class SingletonWithRequestScopeTest extends AbstractJSR299Test
 {
-   @Test(groups = { "incontainer-broken" })
+   @Test(groups = { "jboss-as-broken" })
    @SpecAssertion(section = "3.2", id = "da")
    public void testSingletonWithRequestScopeFails()
    {

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/SingletonWithSessionScopeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/SingletonWithSessionScopeTest.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/SingletonWithSessionScopeTest.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,10 +1,10 @@
 package org.jboss.jsr299.tck.tests.implementation.enterprise.broken.singletonWithSessionScope;
 
 
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DefinitionError;
 import org.jboss.test.audit.annotations.SpecAssertion;
 import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.DefinitionError;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
 import org.jboss.testharness.impl.packaging.Packaging;
@@ -17,7 +17,7 @@
 @SpecVersion("20090625")
 public class SingletonWithSessionScopeTest extends AbstractJSR299Test
 {
-   @Test(groups = { "incontainer-broken" })
+   @Test(groups = { "jboss-as-broken" })
    @SpecAssertion(section = "3.2", id = "da")
    public void testSingletonWithSessionScopeFails()
    {

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/JndiBeanManagerInjected.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/JndiBeanManagerInjected.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/JndiBeanManagerInjected.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -0,0 +1,36 @@
+/*
+ * 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.lookup.manager.jndi;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author pmuir
+ *
+ */
+public class JndiBeanManagerInjected
+{
+   
+   public BeanManager getManagerFromJndi() throws NamingException
+   {
+      InitialContext ctx = new InitialContext();
+      return (BeanManager) ctx.lookup("java:comp/BeanManager");
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/JndiBeanManagerInjected.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java	2009-08-16 17:06:31 UTC (rev 3529)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java	2009-08-16 17:08:30 UTC (rev 3530)
@@ -1,7 +1,6 @@
 package org.jboss.jsr299.tck.tests.lookup.manager.jndi;
 
 import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
 
 import org.jboss.jsr299.tck.AbstractJSR299Test;
 import org.jboss.test.audit.annotations.SpecAssertion;
@@ -15,13 +14,12 @@
 @SpecVersion("20090625")
 public class ManagerTest extends AbstractJSR299Test
 {
-   @Test(groups = { "manager", "ejb3", "integration", "rewrite", "jboss-as-broken" })
-   //TODO This test needs to use an EJB component that looks up the JNDI manager (java:comp)
+   @Test(groups = { "manager", "ejb3", "integration", "jboss-as-broken" })
    @SpecAssertion(section = "11.3", id = "da")
    public void testManagerLookupInJndi() throws Exception
    {
-      InitialContext ctx = new InitialContext();
-      BeanManager beanManager = (BeanManager) ctx.lookup("java:comp/BeanManager");
+      BeanManager beanManager = getInstanceByType(JndiBeanManagerInjected.class).getManagerFromJndi();
       assert beanManager != null;
+      assert beanManager.equals(getCurrentManager());
    }
 }




More information about the weld-commits mailing list