[webbeans-commits] Webbeans SVN: r2387 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean/ee and 15 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-10 11:51:47 -0400 (Fri, 10 Apr 2009)
New Revision: 2387
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/WebServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/ForwardingWebServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockWebServices.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyProvider.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/JpaServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockResourceServices.java
Log:
Add bean structures and lifecycle for enterprise resources
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -92,7 +92,7 @@
}
// Logger
- private LogProvider log = Logging.getLogProvider(AbstractBean.class);
+ private final LogProvider log = Logging.getLogProvider(AbstractBean.class);
// The binding types
protected Set<Annotation> bindings;
// The name
@@ -139,6 +139,7 @@
/**
* Initializes the bean and its metadata
*/
+ @Override
public void initialize(BeanDeployerEnvironment environment)
{
mergedStereotypes = new MergedStereotypes<T, E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class), manager);
@@ -372,6 +373,7 @@
*
* @see javax.inject.manager.Bean#getBindings()
*/
+ @Override
public Set<Annotation> getBindings()
{
return bindings;
@@ -384,6 +386,7 @@
*/
protected abstract String getDefaultName();
+ @Override
public abstract AbstractBean<?, ?> getSpecializedBean();
/**
@@ -393,11 +396,13 @@
*
* @see javax.inject.manager.Bean#getDeploymentType()
*/
+ @Override
public Class<? extends Annotation> getDeploymentType()
{
return deploymentType;
}
+ @Override
public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
{
return injectionPoints;
@@ -420,6 +425,7 @@
*
* @see javax.inject.manager.Bean#getName()
*/
+ @Override
public String getName()
{
return name;
@@ -432,6 +438,7 @@
*
* @see javax.inject.manager.Bean#getScopeType()
*/
+ @Override
public Class<? extends Annotation> getScopeType()
{
return scopeType;
@@ -442,6 +449,7 @@
*
* @return The type
*/
+ @Override
public Class<T> getType()
{
return type;
@@ -490,6 +498,7 @@
*
* @return True if primitive, false otherwise
*/
+ @Override
public boolean isPrimitive()
{
return primitive;
@@ -517,16 +526,19 @@
return "AbstractBean " + getName();
}
+ @Override
public boolean isProxyable()
{
return proxyable;
}
+ @Override
public boolean isDependent()
{
return Dependent.class.equals(getScopeType());
}
+ @Override
public boolean isSpecializing()
{
return getAnnotatedItem().isAnnotationPresent(Specializes.class);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.bean;
-import java.beans.BeanDescriptor;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
@@ -42,14 +41,13 @@
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.ejb.api.SessionObjectReference;
import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Proxies;
@@ -62,7 +60,7 @@
*/
public class EnterpriseBean<T> extends AbstractClassBean<T>
{
- private LogProvider log = Logging.getLogProvider(EnterpriseBean.class);
+ private final Log log = Logging.getLog(EnterpriseBean.class);
// The EJB descriptor
private InternalEjbDescriptor<T> ejbDescriptor;
@@ -131,6 +129,7 @@
}
}
+ @Override
protected void initTypes()
{
Set<Type> types = new HashSet<Type>();
@@ -232,8 +231,7 @@
T instance = proxyClass.newInstance();
creationalContext.push(instance);
((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler(this));
- if (log.isTraceEnabled())
- log.trace("Enterprise bean instance created for bean " + this);
+ log.trace("Enterprise bean instance created for bean {0}", this);
return instance;
}
catch (InstantiationException e)
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,198 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+import javax.context.CreationalContext;
+import javax.context.Dependent;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
+import org.jboss.webbeans.util.Proxies;
+
+/**
+ * Representation of a Java EE Resource bean
+ *
+ * @author Pete Muir
+ *
+ */
+public abstract class AbstractJavaEEResourceBean<T> extends RIBean<T>
+{
+
+ private final Class<? extends Annotation> deploymentType;
+ private final Set<Annotation> bindings;
+ private final Class<T> type;
+ private final Set<Type> types;
+ private final Class<T> proxyClass;
+
+ /**
+ * @param manager the manager used to create this bean
+ * @param deploymentType the deployment type of the bean
+ * @param bindings the bindings of bean
+ * @param type the concrete type of the bean
+ */
+ public AbstractJavaEEResourceBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type)
+ {
+ super(manager);
+ this.deploymentType = deploymentType;
+ this.bindings = bindings;
+ this.type = type;
+ this.types = new HashSet<Type>();
+ types.add(type);
+
+ ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
+
+ @SuppressWarnings("unchecked")
+ Class<T> proxyClass = proxyFactory.createClass();
+
+ this.proxyClass = proxyClass;
+ }
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return bindings;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return deploymentType;
+ }
+
+ @Override
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ @Override
+ public Set<? extends Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ public RIBean<?> getSpecializedBean()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isDependent()
+ {
+ return true;
+ }
+
+ @Override
+ public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isPrimitive()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return false;
+ }
+
+ protected Class<T> getProxyClass()
+ {
+ return proxyClass;
+ }
+
+ public T create(CreationalContext<T> creationalContext)
+ {
+ T instance;
+ try
+ {
+ instance = getProxyClass().newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Error creating proxy for " + this, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Error creating proxy for " + this, e);
+ }
+ ((ProxyObject) instance).setHandler(newMethodHandler());
+ return instance;
+ }
+
+ protected abstract MethodHandler newMethodHandler();
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void destroy(T instance)
+ {
+
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,74 @@
+/*
+ * 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.ee;
+
+import java.lang.reflect.Method;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * Abstract method handler which invokes the a method on a proxied instance
+ *
+ * @author Pete Muir
+ *
+ */
+public abstract class AbstractJavaEEResourceMethodHandler implements MethodHandler
+{
+
+ private static final transient Log log = Logging.getLog(AbstractJavaEEResourceMethodHandler.class);
+
+ /**
+ *
+ */
+ public AbstractJavaEEResourceMethodHandler()
+ {
+ super();
+ }
+
+ /**
+ * Lookup the execute the method on the proxied instance obtained from the
+ * container
+ *
+ * @param self the proxy instance.
+ * @param method the overridden method declared in the super class or
+ * interface.
+ * @param proceed the forwarder method for invoking the overridden method. It
+ * is null if the overridden method is abstract or declared in the
+ * interface.
+ * @param args an array of objects containing the values of the arguments
+ * passed in the method invocation on the proxy instance. If a
+ * parameter type is a primitive type, the type of the array
+ * element is a wrapper class.
+ * @return the resulting value of the method invocation.
+ *
+ * @throws Throwable if the method invocation fails.
+ */
+ public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
+ {
+ Object proxiedInstance = getProxiedInstance();
+ Object returnValue = Reflections.invokeAndWrap(method, proxiedInstance, args);
+ log.trace("Executed {0} on {1} with parameters {2} and got return value {3}", method, proxiedInstance, args, returnValue);
+ return returnValue;
+ }
+
+ protected abstract Object getProxiedInstance();
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,62 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.webbeans.ManagerImpl;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class PersistenceContextBean extends AbstractJavaEEResourceBean<EntityManager>
+{
+
+ private final String id;
+ private final String unitName;
+
+ public PersistenceContextBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, String unitName)
+ {
+ super(manager, deploymentType, bindings, EntityManager.class);
+ this.unitName = unitName;
+ this.id = createId("PersistenceContext - " + unitName);
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getUnitName()
+ {
+ return unitName;
+ }
+
+ @Override
+ protected MethodHandler newMethodHandler()
+ {
+ return new PersistenceContextMethodHandler(getUnitName());
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,44 @@
+/*
+ * 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.ee;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.persistence.spi.JpaServices;
+
+/**
+ * Proxy for persistence context Java EE resources
+ *
+ * @author Pete Muir
+ *
+ */
+public class PersistenceContextMethodHandler extends AbstractJavaEEResourceMethodHandler
+{
+
+ private final String unitName;
+
+ public PersistenceContextMethodHandler(String unitName)
+ {
+ this.unitName = unitName;
+ }
+
+ @Override
+ protected Object getProxiedInstance()
+ {
+ return CurrentManager.rootManager().getServices().get(JpaServices.class).resolvePersistenceContext(unitName);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,62 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.jboss.webbeans.ManagerImpl;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class PersistenceUnitBean extends AbstractJavaEEResourceBean<EntityManagerFactory>
+{
+
+ private final String id;
+ private final String unitName;
+
+ public PersistenceUnitBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, String unitName)
+ {
+ super(manager, deploymentType, bindings, EntityManagerFactory.class);
+ this.unitName = unitName;
+ this.id = createId("PersistenceUnit - " + unitName);
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getUnitName()
+ {
+ return unitName;
+ }
+
+ @Override
+ protected MethodHandler newMethodHandler()
+ {
+ return new PersistenceUnitMethodHandler(getUnitName());
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,45 @@
+/*
+ * 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.ee;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.persistence.spi.JpaServices;
+
+
+/**
+ * Proxy for persistence unit Java EE resources
+ *
+ * @author Pete Muir
+ *
+ */
+public class PersistenceUnitMethodHandler extends AbstractJavaEEResourceMethodHandler
+{
+
+ private final String unitName;
+
+ public PersistenceUnitMethodHandler(String unitName)
+ {
+ this.unitName = unitName;
+ }
+
+ @Override
+ protected Object getProxiedInstance()
+ {
+ return CurrentManager.rootManager().getServices().get(JpaServices.class).resolvePersistenceUnit(unitName);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,74 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.webbeans.ManagerImpl;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class RemoteEjbBean<T> extends AbstractJavaEEResourceBean<T>
+{
+
+ private final String id;
+ private final String jndiName;
+ private final String mappedName;
+ private final String ejbLink;
+
+ public RemoteEjbBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String jndiName, String mappedName, String ejbLink)
+ {
+ super(manager, deploymentType, bindings, type);
+ this.jndiName = jndiName;
+ this.mappedName = mappedName;
+ this.ejbLink = ejbLink;
+ this.id = createId("RemoteEjb - " );
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public String getMappedName()
+ {
+ return mappedName;
+ }
+
+ public String getEjbLink()
+ {
+ return ejbLink;
+ }
+
+ @Override
+ protected MethodHandler newMethodHandler()
+ {
+ return new RemoteEjbMethodHandler(getMappedName(), getJndiName(), getEjbLink());
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,49 @@
+/*
+ * 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.ee;
+
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+
+/**
+ * Proxy for persistence unit Java EE resources
+ *
+ * @author Pete Muir
+ *
+ */
+public class RemoteEjbMethodHandler extends AbstractJavaEEResourceMethodHandler
+{
+
+ private final String mappedName;
+ private final String jndiName;
+ private final String ejbLink;
+
+ public RemoteEjbMethodHandler(String mappedName, String jndiName, String ejbLink)
+ {
+ this.mappedName = mappedName;
+ this.jndiName = jndiName;
+ this.ejbLink = ejbLink;
+ }
+
+ @Override
+ protected Object getProxiedInstance()
+ {
+ return CurrentManager.rootManager().getServices().get(EjbServices.class).resolveRemoteEjb(jndiName, mappedName, ejbLink);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,67 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.webbeans.ManagerImpl;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class ResourceBean<T> extends AbstractJavaEEResourceBean<T>
+{
+
+ private final String id;
+ private final String mappedName;
+ private final String jndiName;
+
+ public ResourceBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String mappedName, String jndiName)
+ {
+ super(manager, deploymentType, bindings, type);
+ this.mappedName = mappedName;
+ this.jndiName = jndiName;
+ this.id = createId("WebService - " );
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getMappedName()
+ {
+ return mappedName;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ @Override
+ protected MethodHandler newMethodHandler()
+ {
+ return new ResourceMethodHandler(getMappedName(), getJndiName());
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,47 @@
+/*
+ * 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.ee;
+
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.resources.spi.ResourceServices;
+
+/**
+ * Proxy for persistence unit Java EE resources
+ *
+ * @author Pete Muir
+ *
+ */
+public class ResourceMethodHandler extends AbstractJavaEEResourceMethodHandler
+{
+
+ private final String mappedName;
+ private final String jndiName;
+
+ public ResourceMethodHandler(String mappedName, String jndiName)
+ {
+ this.mappedName = mappedName;
+ this.jndiName = jndiName;
+ }
+
+ @Override
+ protected Object getProxiedInstance()
+ {
+ return CurrentManager.rootManager().getServices().get(ResourceServices.class).resolveResource(jndiName, mappedName);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,74 @@
+/*
+ * 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.ee;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.webbeans.ManagerImpl;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class WebServiceBean<T> extends AbstractJavaEEResourceBean<T>
+{
+
+ private final String id;
+ private final String mappedName;
+ private final String jndiName;
+ private final String wsdlLocation;
+
+ public WebServiceBean(ManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String mappedName, String jndiName, String wsdlLocation)
+ {
+ super(manager, deploymentType, bindings, type);
+ this.mappedName = mappedName;
+ this.jndiName = jndiName;
+ this.wsdlLocation = wsdlLocation;
+ this.id = createId("WebService - " );
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getMappedName()
+ {
+ return mappedName;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public String getWsdlLocation()
+ {
+ return wsdlLocation;
+ }
+
+ @Override
+ protected MethodHandler newMethodHandler()
+ {
+ return new WebServiceMethodHandler(getMappedName(), getJndiName());
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,47 @@
+/*
+ * 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.ee;
+
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ws.spi.WebServices;
+
+/**
+ * Proxy for persistence unit Java EE web services
+ *
+ * @author Pete Muir
+ *
+ */
+public class WebServiceMethodHandler extends AbstractJavaEEResourceMethodHandler
+{
+
+ private final String mappedName;
+ private final String jndiName;
+
+ public WebServiceMethodHandler(String mappedName, String jndiName)
+ {
+ this.mappedName = mappedName;
+ this.jndiName = jndiName;
+ }
+
+ @Override
+ protected Object getProxiedInstance()
+ {
+ return CurrentManager.rootManager().getServices().get(WebServices.class).resolveResource(jndiName, mappedName);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyProvider.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyProvider.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyProvider.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -48,7 +48,7 @@
*
* @author Nicklas Karlsson
*/
- private ConcurrentCache<Bean<? extends Object>, Object> pool;
+ private final ConcurrentCache<Bean<? extends Object>, Object> pool;
/**
* Constructor
@@ -105,11 +105,8 @@
* the pool if the create argument is true.
*
* @param bean The bean to get a proxy to
- * @param create Flag indicating if the proxy should be created if it does
- * not already exist
* @return the client proxy for the bean
*/
- // TODO: What is this create parameter? Something obsolete?
public <T> T getClientProxy(final ManagerImpl manager, final Bean<T> bean)
{
return pool.putIfAbsent(bean, new Callable<T>()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -17,13 +17,14 @@
package org.jboss.webbeans.bean.proxy;
+
import java.lang.reflect.Method;
import javassist.util.proxy.MethodHandler;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.ejb.api.SessionObjectReference;
-import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -37,7 +38,7 @@
public class EnterpriseBeanProxyMethodHandler implements MethodHandler
{
// The log provider
- private static final transient LogProvider log = Logging.getLogProvider(EnterpriseBeanProxyMethodHandler.class);
+ static final transient Log log = Logging.getLog(EnterpriseBeanProxyMethodHandler.class);
private static final ThreadLocal<EnterpriseBean<?>> enterpriseBean;
@@ -57,9 +58,9 @@
enterpriseBean.set(bean);
}
- private final SessionObjectReference reference;
- private final Class<?> objectInterface;
- private boolean destroyed;
+ final SessionObjectReference reference;
+ final Class<?> objectInterface;
+ boolean destroyed;
/**
* Constructor
@@ -83,7 +84,7 @@
}
log.trace("Created enterprise bean proxy method handler for " + bean);
}
-
+
/**
* Lookups the EJB in the container and executes the method on it
*
@@ -139,6 +140,4 @@
}
-
-
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -21,6 +21,7 @@
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.webbeans.ws.spi.WebServices;
public class MockEELifecycle extends MockServletLifecycle
{
@@ -34,6 +35,7 @@
getBootstrap().getServices().add(EjbServices.class, new MockEjBServices(getWebBeanDiscovery()));
getBootstrap().getServices().add(JpaServices.class, new MockJpaServices(getWebBeanDiscovery()));
getBootstrap().getServices().add(ResourceServices.class, new MockResourceServices());
+ getBootstrap().getServices().add(WebServices.class, new MockWebServices());
getBootstrap().setEnvironment(Environments.EE);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -33,6 +33,11 @@
// No-op
}
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+ {
+ return null;
+ }
+
public Iterable<EjbDescriptor<?>> discoverEjbs()
{
return ejbDiscovery.discoverEjbs();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -9,6 +9,8 @@
import javax.inject.manager.InjectionPoint;
import javax.persistence.Entity;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -23,11 +25,21 @@
this.webBeanDiscovery = webBeanDiscovery;
}
- public Object resolvePersistenceContext(InjectionPoint injectionPoint)
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
{
return null;
}
+ public EntityManager resolvePersistenceContext(String unitName)
+ {
+ return null;
+ }
+
+ public EntityManagerFactory resolvePersistenceUnit(String unitName)
+ {
+ return null;
+ }
+
public Collection<Class<?>> discoverEntities()
{
Set<Class<?>> classes = new HashSet<Class<?>>();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -32,4 +32,9 @@
return null;
}
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.mock;
+
+import org.jboss.webbeans.ws.spi.WebServices;
+
+public class MockWebServices implements WebServices
+{
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -28,6 +28,7 @@
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.webbeans.ws.spi.WebServices;
/**
* Various well known environments.
@@ -41,7 +42,7 @@
/**
* Java EE5 or Java EE6
*/
- EE(WebBeanDiscovery.class, EjbServices.class, JpaServices.class, EntityDiscovery.class, ResourceServices.class, TransactionServices.class, NamingContext.class, ResourceLoader.class),
+ EE(WebBeanDiscovery.class, EjbServices.class, JpaServices.class, WebServices.class, EntityDiscovery.class, ResourceServices.class, TransactionServices.class, NamingContext.class, ResourceLoader.class),
/**
* Java EE6 Web Profile
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -12,6 +12,7 @@
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.webbeans.ws.spi.WebServices;
/**
* A bean version of bootstrap that delegates to the underlying bootstrap impl
@@ -104,6 +105,16 @@
return bootstrap.getServices().get(ResourceLoader.class);
}
+ public WebServices getWebServices()
+ {
+ return bootstrap.getServices().get(WebServices.class);
+ }
+
+ public void setWebServices(WebServices webServices)
+ {
+ bootstrap.getServices().add(WebServices.class, webServices);
+ }
+
public void boot()
{
bootstrap.boot();
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -42,8 +42,7 @@
* if the injection point is not annotated with @EJB, or, if the
* injection point is a method that doesn't follow JavaBean
* conventions
- * @throws IllegalStateException
- * if no EJBs can be resolved for injection
+
*/
public Object resolveEjb(InjectionPoint injectionPoint);
@@ -58,6 +57,21 @@
public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor);
/**
+ * Resolve a remote EJB reference. At least one of the parameters will not be
+ * null.
+ *
+ * @param jndiName the JNDI name
+ * @param mappedName the mapped name
+ * @param ejbLink the EJB link name
+ * @return the remote EJB reference
+ * @throws IllegalStateException
+ * if no EJBs can be resolved for injection
+ * @throws IllegalArgumentException
+ * if jndiName, mappedName and ejbLink are null
+ */
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink);
+
+ /**
* Gets a descriptor for each EJB in the application
*
* @return the EJB descriptors
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -46,6 +46,11 @@
{
return delegate().resolveEjb(ejbDescriptor);
}
+
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+ {
+ return delegate().resolveRemoteEjb(jndiName, mappedName, ejbLink);
+ }
public Iterable<EjbDescriptor<?>> discoverEjbs()
{
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -16,9 +16,9 @@
*/
package org.jboss.webbeans.jpa.spi.helpers;
-import java.util.Collection;
-
import javax.inject.manager.InjectionPoint;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -37,11 +37,21 @@
protected abstract JpaServices delegate();
- public Object resolvePersistenceContext(InjectionPoint injectionPoint)
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
{
return delegate().resolvePersistenceContext(injectionPoint);
}
+ public EntityManager resolvePersistenceContext(String unitName)
+ {
+ return delegate().resolvePersistenceContext(unitName);
+ }
+
+ public EntityManagerFactory resolvePersistenceUnit(String unitName)
+ {
+ return delegate().resolvePersistenceUnit(unitName);
+ }
+
@Override
public String toString()
{
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/JpaServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/JpaServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/JpaServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -17,6 +17,8 @@
package org.jboss.webbeans.persistence.spi;
import javax.inject.manager.InjectionPoint;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
import org.jboss.webbeans.bootstrap.api.Service;
@@ -35,14 +37,36 @@
*
* @param injectionPoint
* the injection point metadata
- * @return an instance of the persistence unit
+ * @return an instance of the entity manager
* @throws IllegalArgumentException
- * if the injection point is not annotated with
- * @PersistenceContext, or, if the injection point is a method that doesn't
- * follow JavaBean conventions
+ * if the injection point is not annotated with
+ * @PersistenceContext, or, if the injection point is a method
+ * that doesn't follow JavaBean conventions
* @throws IllegalStateException
* if no suitable persistence units can be resolved for injection
*/
- public Object resolvePersistenceContext(InjectionPoint injectionPoint);
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint);
+ /**
+ * Resolve a persistence context for a given persistence unit name
+ *
+ * @param unitName the unit name
+ * @return an instance of the entity manager
+ * @throws IllegalStateException
+ * if no suitable persistence units can be resolved for injection
+ */
+ public EntityManager resolvePersistenceContext(String unitName);
+
+ /**
+ * Resolve a persistence unit for a given persistence unit name
+ *
+ * @param unitName the unit name
+ * @return an instance of the entity manager factory
+ * @throws IllegalStateException
+ * if no suitable persistence units can be resolved for injection
+ * @throws IllegalArgumentException
+ * if unitName is null
+ */
+ public EntityManagerFactory resolvePersistenceUnit(String unitName);
+
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -45,4 +45,17 @@
*/
public Object resolveResource(InjectionPoint injectionPoint);
+ /**
+ * Resolve the value for the given JNDI name and mapped name
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the resource
+ * @throws IllegalStateException
+ * if no resource can be resolved for injection
+ * @throws IllegalArgumentException
+ * if both jndiName and mappedName are null
+ */
+ public Object resolveResource(String jndiName, String mappedName);
+
}
\ No newline at end of file
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -11,8 +11,9 @@
import javax.naming.NamingException;
import org.jboss.webbeans.resources.spi.ResourceServices;
+import org.jboss.webbeans.ws.spi.WebServices;
-public abstract class AbstractResourceServices implements ResourceServices
+public abstract class AbstractResourceServices implements ResourceServices, WebServices
{
private static final String RESOURCE_LOOKUP_PREFIX = "java:/comp/env";
@@ -41,9 +42,38 @@
}
}
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ String name = getResourceName(jndiName, mappedName);
+ try
+ {
+ return getContext().lookup(name);
+ }
+ catch (NamingException e)
+ {
+ throw new ExecutionException("Error looking up " + name + " in JNDI", e);
+ }
+ }
+
+ protected String getResourceName(String jndiName, String mappedName)
+ {
+ if (mappedName != null)
+ {
+ return mappedName;
+ }
+ else if (jndiName != null)
+ {
+ return jndiName;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Both jndiName and mappedName are null");
+ }
+ }
+
protected abstract Context getContext();
- private static String getResourceName(InjectionPoint injectionPoint)
+ protected String getResourceName(InjectionPoint injectionPoint)
{
Resource resource = injectionPoint.getAnnotation(Resource.class);
String mappedName = resource.mappedName();
Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.resources.spi.helpers;
+
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.resources.spi.ResourceServices;
+
+public abstract class ForwardingResourceServices implements ResourceServices
+{
+
+ protected abstract ResourceServices delegate();
+
+ public Object resolveResource(InjectionPoint injectionPoint)
+ {
+ return delegate().resolveResource(injectionPoint);
+ }
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return delegate().resolveResource(jndiName, mappedName);
+ }
+
+}
Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/WebServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/WebServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/WebServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.ws.spi;
+
+
+import org.jboss.webbeans.bootstrap.api.Service;
+
+/**
+ * A container should implement this interface to allow Web Beans to resolve Web
+ * Services
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WebServices extends Service
+{
+
+ /**
+ * Resolve the value for the given JNDI name and mapped name
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the resource
+ * @throws IllegalStateException
+ * if no resource can be resolved for injection
+ */
+ public Object resolveResource(String jndiName, String mappedName);
+
+}
\ No newline at end of file
Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/WebServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/ForwardingWebServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/ForwardingWebServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/ForwardingWebServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.ws.spi.helpers;
+
+import org.jboss.webbeans.ws.spi.WebServices;
+
+public abstract class ForwardingWebServices implements WebServices
+{
+
+ protected abstract WebServices delegate();
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return delegate().resolveResource(jndiName, mappedName);
+ }
+
+}
Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/spi/helpers/ForwardingWebServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -11,6 +11,7 @@
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.webbeans.ws.spi.WebServices;
import org.testng.annotations.Test;
public class BootstrapTest
@@ -40,6 +41,7 @@
bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
bootstrap.getServices().add(EntityDiscovery.class, new MockEntityDiscovery());
bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
+ bootstrap.getServices().add(WebServices.class, new MockWebServices());
bootstrap.initialize();
}
@@ -56,10 +58,28 @@
bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
bootstrap.getServices().add(EntityDiscovery.class, new MockEntityDiscovery());
bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
+ bootstrap.getServices().add(WebServices.class, new MockWebServices());
bootstrap.initialize();
}
@Test(expectedExceptions=IllegalStateException.class)
+ public void testMissingWebServices()
+ {
+ AbstractBootstrap bootstrap = new MockBootstrap();
+ bootstrap.setEnvironment(Environments.EE);
+ bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
+ bootstrap.getServices().add(NamingContext.class, new MockNamingContext());
+ bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
+ bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
+ bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+ bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
+ bootstrap.getServices().add(EntityDiscovery.class, new MockEntityDiscovery());
+ bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
+ bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
+ bootstrap.initialize();
+ }
+
+ @Test(expectedExceptions=IllegalStateException.class)
public void testMissingEntityDiscovery()
{
AbstractBootstrap bootstrap = new MockBootstrap();
@@ -72,6 +92,7 @@
bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
+ bootstrap.getServices().add(WebServices.class, new MockWebServices());
bootstrap.initialize();
}
@@ -90,6 +111,7 @@
bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
bootstrap.getServices().add(EntityDiscovery.class, new MockEntityDiscovery());
bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
+ bootstrap.getServices().add(WebServices.class, new MockWebServices());
bootstrap.initialize();
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -24,4 +24,9 @@
return null;
}
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+ {
+ return null;
+ }
+
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -3,6 +3,8 @@
import java.util.Collection;
import javax.inject.manager.InjectionPoint;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -14,9 +16,19 @@
return null;
}
- public Object resolvePersistenceContext(InjectionPoint injectionPoint)
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
{
return null;
}
+ public EntityManager resolvePersistenceContext(String unitName)
+ {
+ return null;
+ }
+
+ public EntityManagerFactory resolvePersistenceUnit(String unitName)
+ {
+ return null;
+ }
+
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockResourceServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockResourceServices.java 2009-04-10 13:14:38 UTC (rev 2386)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockResourceServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -12,4 +12,9 @@
return null;
}
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
}
Added: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockWebServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockWebServices.java (rev 0)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockWebServices.java 2009-04-10 15:51:47 UTC (rev 2387)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.bootstrap.api.test;
+
+import org.jboss.webbeans.ws.spi.WebServices;
+
+public class MockWebServices implements WebServices
+{
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
+}
Property changes on: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockWebServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years
[webbeans-commits] Webbeans SVN: r2386 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-10 09:14:38 -0400 (Fri, 10 Apr 2009)
New Revision: 2386
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
minor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-10 12:08:49 UTC (rev 2385)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-10 13:14:38 UTC (rev 2386)
@@ -83,11 +83,22 @@
if(child.getName().equalsIgnoreCase(XmlConstants.ARRAY))
{
- if(child.elements().size() != 1)
- throw new DefinitionException("<Array> element must have only one child");
-
- Element arrayChild = (Element)child.elements().get(0);
- ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap);
+ boolean haveNotAnnotation = false;
+ Iterator<?> arrayIterator = child.elementIterator();
+ while(arrayIterator.hasNext())
+ {
+ Element arrayChild = (Element)arrayIterator.next();
+ AnnotatedClass<?> arrayChildType = ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap);
+ boolean isAnnotation = arrayChildType.getRawType().isAnnotation();
+ if(!isAnnotation)
+ {
+ if(haveNotAnnotation)
+ throw new DefinitionException("<Array> element have second child which is not annotation, it is '" + arrayChild.getName() + "'");
+ haveNotAnnotation = true;
+ }
+ }
+ if(!haveNotAnnotation)
+ throw new DefinitionException("<Array> element must have one child elemen which is not annotation");
}
else
checkChildrenForArray(child);
17 years
[webbeans-commits] Webbeans SVN: r2385 - ri/trunk/impl/src/main/java/org/jboss/webbeans/resources.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-10 08:08:49 -0400 (Fri, 10 Apr 2009)
New Revision: 2385
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
Log:
Cache creation of annotated classes
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-04-10 10:59:44 UTC (rev 2384)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-04-10 12:08:49 UTC (rev 2385)
@@ -1,24 +1,55 @@
package org.jboss.webbeans.resources;
import java.lang.annotation.Annotation;
+import java.util.concurrent.Callable;
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.introspector.AnnotatedAnnotation;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.jlr.AnnotatedAnnotationImpl;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.util.collections.ConcurrentCache;
public class ClassTransformer implements Service
{
- public <T> AnnotatedClass<T> classForName(Class<T> clazz)
+ private final ConcurrentCache<Class<?>, AnnotatedClass<?>> classes;
+ private final ConcurrentCache<Class<?>, AnnotatedAnnotation<?>> annotations;
+ private final ClassTransformer transformer = this;
+
+ /**
+ *
+ */
+ public ClassTransformer()
{
- return AnnotatedClassImpl.of(clazz, this);
+ classes = new ConcurrentCache<Class<?>, AnnotatedClass<?>>();
+ annotations = new ConcurrentCache<Class<?>, AnnotatedAnnotation<?>>();
}
- public <T extends Annotation> AnnotatedAnnotation<T> classForName(Class<T> clazz)
+ public <T> AnnotatedClass<T> classForName(final Class<T> clazz)
{
- return AnnotatedAnnotationImpl.of(clazz, this);
+ return classes.putIfAbsent(clazz, new Callable<AnnotatedClass<T>>()
+ {
+
+ public AnnotatedClass<T> call() throws Exception
+ {
+ return AnnotatedClassImpl.of(clazz, transformer);
+ }
+
+ });
}
+
+ public <T extends Annotation> AnnotatedAnnotation<T> classForName(final Class<T> clazz)
+ {
+ return annotations.putIfAbsent(clazz, new Callable<AnnotatedAnnotation<T>>()
+ {
+ public AnnotatedAnnotation<T> call() throws Exception
+ {
+ return AnnotatedAnnotationImpl.of(clazz, transformer);
+ }
+
+ });
+ }
+
}
17 years
[webbeans-commits] Webbeans SVN: r2384 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-10 06:59:44 -0400 (Fri, 10 Apr 2009)
New Revision: 2384
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
Log:
minor
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java 2009-04-10 09:53:32 UTC (rev 2383)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java 2009-04-10 10:59:44 UTC (rev 2384)
@@ -22,7 +22,7 @@
@SpecAssertions({
@SpecAssertion(section="9.12.1", id="b")
})
- public void testNotJavaType()
+ public void testNotDeploymentType()
{
assert true;
}
17 years
[webbeans-commits] Webbeans SVN: r2383 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration and 13 other directories.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-10 05:53:32 -0400 (Fri, 10 Apr 2009)
New Revision: 2383
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
add some tests for 9.12.1
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-09 23:54:39 UTC (rev 2382)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -7,7 +7,6 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -271,30 +270,33 @@
return true;
}
- @SuppressWarnings("unchecked")
// TODO Make this object orientated
private List<Class<? extends Annotation>> obtainDeploymentTypes(Element element)
{
if (haveAnyDeployElement)
throw new DefinitionException("<Deploy> element is specified more than once");
- List<Element> deployElements = element.elements();
- Set<Element> deployElementsSet = new HashSet<Element>(deployElements);
- if(deployElements.size() - deployElementsSet.size() != 0)
- throw new DefinitionException("The same deployment type is declared more than once");
-
List<Element> standardElements = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.STANDARD);
if (standardElements.size() == 0)
- throw new DeploymentException("The @Standard deployment type must be declared");
+ throw new DeploymentException("The @Standard deployment type must be declared");
List<Class<? extends Annotation>> deploymentClasses = new ArrayList<Class<? extends Annotation>>();
- List<Element> children = element.elements();
- for (Element child : children)
- {
- Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(child, Annotation.class, environment, packagesMap);
+ Iterator<?> deployIterator = element.elementIterator();
+ while(deployIterator.hasNext())
+ {
+ Element deploymentElement = (Element)deployIterator.next();
+ String elementName = deploymentElement.getName();
+ String elementPrefix = deploymentElement.getNamespacePrefix();
+ String elementUri = deploymentElement.getNamespaceURI();
+ List<Element> deploymentElements = ParseXmlHelper.findElements(element, elementName, elementPrefix, elementUri);
+ if(deploymentElements.size() != 1)
+ throw new DefinitionException("The same deployment type '" + deploymentElement.getName() + "' is declared more than once");
+
+ Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(deploymentElement, Annotation.class, environment, packagesMap);
+
if(!deploymentClass.isAnnotationPresent(DeploymentType.class))
- throw new DefinitionException("<Deploy> child <" + child.getName() + "> must be a deployment type");
+ throw new DefinitionException("<Deploy> child '" + deploymentElement.getName() + "' must be a deployment type");
deploymentClasses.add(deploymentClass);
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.TestDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Classes({TestDeploymentType.class})
+@BeansXml("beans.xml")
+public class DeploymentDeclarationTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.12", id="a"),
+ @SpecAssertion(section="9.12.1", id="a")
+ })
+ public void testDeploymentDeclaration()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo;
+
+public @interface NotDeploymentType
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo;
+
+import static java.lang.annotation.ElementType.FIELD;
+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.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+public @interface TestDeploymentType
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.multipledeclaration;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.TestDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Classes({TestDeploymentType.class })
+@BeansXml("beans.xml")
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class MultipleDeclarationTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="c")
+ })
+ public void testMultipleDeclaration()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.notdeploymenttype;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.NotDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Classes({NotDeploymentType.class})
+@BeansXml("beans.xml")
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class NotDeploymentTypeTest extends AbstractJSR299Test
+{
+ @Test(groups="ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="b")
+ })
+ public void testNotJavaType()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.notjavatype;
+
+import javax.inject.DefinitionException;
+
+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.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@BeansXml("beans.xml")
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class NotJavaTypeTest extends AbstractJSR299Test
+{
+ @Test(groups="ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="b")
+ })
+ public void testNotJavaType()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:TestDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,9 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:TestDeploymentType />
+ <test:TestDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:NotDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:NotJavaType />
+ </Deploy>
+</Beans>
17 years
[webbeans-commits] Webbeans SVN: r2382 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:54:39 -0400 (Thu, 09 Apr 2009)
New Revision: 2382
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java
Log:
minor
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java 2009-04-09 23:53:02 UTC (rev 2381)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java 2009-04-09 23:54:39 UTC (rev 2382)
@@ -96,7 +96,7 @@
* parameterized type, the set of bean types contains the bean class and all
* superclasses.
*/
- @Test(groups = { "enterpriseBeans", "ri-broken" })
+ @Test(groups = { "ejb 3.1", "ri-broken" })
@SpecAssertion(section = "3.3.3", id = "b")
public void testEnterpriseBeanWithLocalViewAndNotParameterizedTypeHasClassAndSuperclassesAsBeanTypes()
{
17 years
[webbeans-commits] Webbeans SVN: r2381 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating: integration and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:53:02 -0400 (Thu, 09 Apr 2009)
New Revision: 2381
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/British.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Cow.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/CowProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/MaarianHaminaLocal_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Maarianhamina_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/PassivatingContextIntegrationTest.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/MaarianHaminaLocal_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Maarianhamina_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextIntegrationTest.java
Log:
Fix broken test
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/MaarianHaminaLocal_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/MaarianHaminaLocal_Broken.java 2009-04-09 23:39:19 UTC (rev 2380)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/MaarianHaminaLocal_Broken.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import javax.ejb.Local;
-
-@Local
-public interface MaarianHaminaLocal_Broken
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Maarianhamina_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Maarianhamina_Broken.java 2009-04-09 23:39:19 UTC (rev 2380)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Maarianhamina_Broken.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -1,19 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import javax.context.SessionScoped;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.inject.Current;
-
-@Stateful
-@SessionScoped
-class Maarianhamina_Broken implements MaarianHaminaLocal_Broken
-{
- @SuppressWarnings("unused")
- @Current
- private Violation reference;
-
- @Remove
- public void bye() {
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextIntegrationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextIntegrationTest.java 2009-04-09 23:39:19 UTC (rev 2380)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextIntegrationTest.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -1,54 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.IOException;
-
-import javax.inject.IllegalProductException;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.testng.annotations.Test;
-
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-public class PassivatingContextIntegrationTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "stub", "contexts", "passivation", "jms" })
- @SpecAssertion(section = "8.4", id = "u")
- public void testJMSEndpointProxyIsSerializable()
- {
- assert false;
- }
-
- @Test(groups = { "contexts", "passivation", "integration", "ri-broken" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "8.4", id = "p")
- public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanFails() throws SecurityException, NoSuchMethodException
- {
- getCurrentManager().getInstanceByType(MaarianHaminaLocal_Broken.class);
- }
-
- /**
- * the Web Bean is an EJB stateful session bean, and it is passivated by the
- * EJB container.
- */
- // TODO requires an EJB instance
- @Test(groups = { "contexts", "passivation", "stub", "integration" })
- @SpecAssertion(section = "8.4", id = "g")
- public void testStatefulEJBIsSerializedWhenPassivatedByEJBContainer() throws IOException, ClassNotFoundException
- {
- assert false;
- }
-
- @Test(groups = { "contexts", "passivation", "stub", "integration" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "8.4", id = "p")
- public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanFails() throws Exception
- {
- assert false;
- }
-
-}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/British.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/British.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/British.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+import static java.lang.annotation.ElementType.FIELD;
+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.inject.BindingType;
+
+
+@BindingType
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+@interface British
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/British.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Cow.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Cow.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Cow.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+class Cow
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Cow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/CowProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/CowProducer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/CowProducer.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+import javax.inject.Produces;
+
+public class CowProducer
+{
+
+ @Produces @British
+ public Cow produce()
+ {
+ return new Cow();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/CowProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/MaarianHaminaLocal_Broken.java (from rev 2378, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/MaarianHaminaLocal_Broken.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/MaarianHaminaLocal_Broken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/MaarianHaminaLocal_Broken.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+import javax.ejb.Local;
+
+@Local
+public interface MaarianHaminaLocal_Broken
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/MaarianHaminaLocal_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Maarianhamina_Broken.java (from rev 2378, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Maarianhamina_Broken.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Maarianhamina_Broken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/Maarianhamina_Broken.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+@Stateful
+public class Maarianhamina_Broken implements MaarianHaminaLocal_Broken
+{
+ @SuppressWarnings("unused")
+ @British Cow cow;
+
+ @Remove
+ public void bye() {
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/PassivatingContextIntegrationTest.java (from rev 2378, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextIntegrationTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/PassivatingContextIntegrationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/PassivatingContextIntegrationTest.java 2009-04-09 23:53:02 UTC (rev 2381)
@@ -0,0 +1,69 @@
+package org.jboss.jsr299.tck.tests.context.passivating.integration;
+
+import java.io.IOException;
+
+import javax.inject.IllegalProductException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
+public class PassivatingContextIntegrationTest extends AbstractJSR299Test
+{
+
+ @Test(groups = { "stub", "contexts", "passivation", "jms" })
+ @SpecAssertion(section = "8.4", id = "u")
+ public void testJMSEndpointProxyIsSerializable()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "contexts", "passivation", "integration"})
+ @SpecAssertion(section = "8.4", id = "p")
+ public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanFails() throws SecurityException, NoSuchMethodException
+ {
+ try
+ {
+ getCurrentManager().getInstanceByType(MaarianHaminaLocal_Broken.class);
+ }
+ catch (Throwable e)
+ {
+ while (!e.getClass().equals(Throwable.class))
+ {
+ if (e.getClass().equals(IllegalProductException.class))
+ {
+ return;
+ }
+ e = e.getCause();
+ }
+ assert false;
+ }
+ }
+
+ /**
+ * the Web Bean is an EJB stateful session bean, and it is passivated by the
+ * EJB container.
+ */
+ // TODO requires an EJB instance
+ @Test(groups = { "contexts", "passivation", "stub", "integration" })
+ @SpecAssertion(section = "8.4", id = "g")
+ public void testStatefulEJBIsSerializedWhenPassivatedByEJBContainer() throws IOException, ClassNotFoundException
+ {
+ assert false;
+ }
+
+ @Test(groups = { "contexts", "passivation", "stub", "integration" }, expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "8.4", id = "p")
+ public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanFails() throws Exception
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/integration/PassivatingContextIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years
[webbeans-commits] Webbeans SVN: r2380 - in tck/trunk/impl/src/main: resources and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:39:19 -0400 (Thu, 09 Apr 2009)
New Revision: 2380
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ejb/EJBRequestContextTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
slip ejb timeouts to ejb 3.1
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ejb/EJBRequestContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ejb/EJBRequestContextTest.java 2009-04-09 23:28:30 UTC (rev 2379)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ejb/EJBRequestContextTest.java 2009-04-09 23:39:19 UTC (rev 2380)
@@ -25,7 +25,7 @@
* bean, during any call to an EJB timeout method and during message delivery
* to any EJB message driven bean.
*/
- @Test(groups = { "ri-broken", "contexts", "ejb3", "integration" })
+ @Test(groups = { "ri-broken", "contexts", "ejb3.1", "integration" })
@SpecAssertion(section = "8.5.1", id = "i")
public void testRequestScopeActiveDuringCallToEjbTimeoutMethod() throws Exception
{
@@ -39,7 +39,7 @@
* The request context is destroyed after the remote method invocation,
* timeout or message delivery completes.
*/
- @Test(groups = { "ri-broken", "contexts", "ejb3", "integration" })
+ @Test(groups = { "ri-broken", "contexts", "ejb3.1", "integration" })
@SpecAssertion(section = "8.5.1", id = "l")
public void testRequestScopeDestroyedAfterCallToEjbTimeoutMethod() throws Exception
{
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-04-09 23:28:30 UTC (rev 2379)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-04-09 23:39:19 UTC (rev 2380)
@@ -4842,6 +4842,7 @@
<assertion id="i">
<text>The request scope is active during any call to an EJB timeout method</text>
+ <note>Only applicable in EJB 3.1 environments</note>
</assertion>
<assertion id="j">
@@ -4854,6 +4855,7 @@
<assertion id="l">
<text>The request context is destroyed after the invocation of an EJB timeout method</text>
+ <note>Only applicable in EJB 3.1 environments</note>
</assertion>
<assertion id="m">
17 years
[webbeans-commits] Webbeans SVN: r2379 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:28:30 -0400 (Thu, 09 Apr 2009)
New Revision: 2379
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayProducer.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/InjectionPointBean_Broken.java
Log:
Fix broken test
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayProducer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayProducer.java 2009-04-09 23:28:30 UTC (rev 2379)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy.array;
+
+import javax.context.RequestScoped;
+import javax.inject.Produces;
+
+public class ArrayProducer
+{
+
+ @Produces @RequestScoped
+ public String[] produce()
+ {
+ return new String[0];
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayTest.java 2009-04-09 23:17:00 UTC (rev 2378)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/ArrayTest.java 2009-04-09 23:28:30 UTC (rev 2379)
@@ -12,7 +12,7 @@
@ExpectedDeploymentException(UnproxyableDependencyException.class)
public class ArrayTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "5.4.1", id = "d")
public void testInjectionPointWithArrayType()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/InjectionPointBean_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/InjectionPointBean_Broken.java 2009-04-09 23:17:00 UTC (rev 2378)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/array/InjectionPointBean_Broken.java 2009-04-09 23:28:30 UTC (rev 2379)
@@ -1,9 +1,8 @@
package org.jboss.jsr299.tck.tests.lookup.clientProxy.array;
-import javax.inject.Instance;
-import javax.inject.Obtains;
+import javax.inject.Current;
public class InjectionPointBean_Broken
{
- @Obtains Instance<String[]> foo;
+ @Current String[] array;
}
17 years
[webbeans-commits] Webbeans SVN: r2378 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:17:00 -0400 (Thu, 09 Apr 2009)
New Revision: 2378
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanViaXmlTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/ejb-jar.xml
Log:
enable test
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-04-09 23:12:44 UTC (rev 2377)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-04-09 23:17:00 UTC (rev 2378)
@@ -5,6 +5,7 @@
import javax.context.Context;
import javax.context.ContextNotActiveException;
+import javax.context.CreationalContext;
import javax.context.Dependent;
import javax.inject.AnnotationLiteral;
import javax.inject.manager.Bean;
@@ -192,21 +193,28 @@
assert Tarantula.isDependentContextActive();
}
- @Test(groups = { "broken", "contexts", "disposalMethod" })
+ @Test(groups = { "contexts", "disposalMethod" })
@SpecAssertions({
@SpecAssertion(section = "8.3", id = "g"),
@SpecAssertion(section = "8.3", id = "j")
})
public void testContextIsActiveWhenInvokingDisposalMethod()
{
-// deployBeans(SpiderProducer.class);
-// Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
-// Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
-// assert tarantula != null;
-// SpiderProducer.setDependentContextActive(false);
-// tarantulaBean.destroy(tarantula);
-// assert SpiderProducer.isDependentContextActive();
- assert false;
+ Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
+ Tarantula tarantula = tarantulaBean.create(new CreationalContext<Tarantula>()
+ {
+
+ public void push(Tarantula incompleteInstance)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+ assert tarantula != null;
+ SpiderProducer.setDependentContextActive(false);
+ tarantulaBean.destroy(tarantula);
+ assert SpiderProducer.isDependentContextActive();
}
@Test(groups = { "contexts", "observerMethod" })
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanViaXmlTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanViaXmlTest.java 2009-04-09 23:12:44 UTC (rev 2377)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanViaXmlTest.java 2009-04-09 23:17:00 UTC (rev 2378)
@@ -26,7 +26,7 @@
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.ear.EjbJarXml;
import org.testng.annotations.Test;
/**
@@ -37,12 +37,11 @@
@Artifact
@Packaging(PackagingType.EAR)
@IntegrationTest
-@Resource(source="ejb-jar.xml", destination="META-INF/ejb-jar.xml")
+@EjbJarXml("ejb-jar.xml")
public class EnterpriseBeanViaXmlTest extends AbstractJSR299Test
{
-
- //TODO Once EJBs can be deployed in a WAR (3.1), this test should work
- @Test(groups = { "enterpriseBeans", "broken" })
+
+ @Test(groups = { "enterpriseBeans" })
@SpecAssertions( { @SpecAssertion(section = "3.2.1", id = "n") })
public void testEjbDeclaredInXmlNotSimpleBean()
{
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/ejb-jar.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/ejb-jar.xml 2009-04-09 23:12:44 UTC (rev 2377)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/ejb-jar.xml 2009-04-09 23:17:00 UTC (rev 2378)
@@ -8,9 +8,10 @@
<description>JSR-299 Enterprise Bean Definition Test</description>
<display-name>JSR-299 Enterprise Bean Definition Test</display-name>
<enterprise-beans>
+
<session>
<ejb-name>Elephant</ejb-name>
- <local>org.jboss.jsr299.tck.tests.implementation.enterprise.definition.ElephantLocal</local>
+ <business-local>org.jboss.jsr299.tck.tests.implementation.enterprise.definition.ElephantLocal</business-local>
<ejb-class>org.jboss.jsr299.tck.tests.implementation.enterprise.definition.Elephant</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
17 years