[webbeans-commits] Webbeans SVN: r2407 - ri/trunk/impl.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 19:07:58 -0400 (Tue, 14 Apr 2009)
New Revision: 2407
Modified:
ri/trunk/impl/pom.xml
Log:
dependence on el-ri goes away
Modified: ri/trunk/impl/pom.xml
===================================================================
--- ri/trunk/impl/pom.xml 2009-04-14 22:40:05 UTC (rev 2406)
+++ ri/trunk/impl/pom.xml 2009-04-14 23:07:58 UTC (rev 2407)
@@ -118,12 +118,6 @@
</dependency>
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-ri</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<optional>true</optional>
17 years
[webbeans-commits] Webbeans SVN: r2406 - in ri/trunk: porting-package and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 18:40:05 -0400 (Tue, 14 Apr 2009)
New Revision: 2406
Added:
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/el/
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockConversationManager.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/MockEjbDescriptor.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/el/
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
Modified:
ri/trunk/porting-package/pom.xml
ri/trunk/porting-package/src/main/resources/META-INF/jboss-test-harness.properties
ri/trunk/tests/pom.xml
Log:
WBRI-233
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import org.jboss.webbeans.conversation.ServletConversationManager;
-
-/**
- * Mock of a conversation manager without servlet dependencies
- *
- * @author Nicklas Karlsson
- *
- */
-// TODO dummy
-public class MockConversationManager extends ServletConversationManager
-{
-
-}
Deleted: 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-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.messaging.spi.JmsServices;
-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
-{
-
- private static final TransactionServices MOCK_TRANSACTION_SERVICES = new MockTransactionServices();
-
- public MockEELifecycle()
- {
- super();
- getBootstrap().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
- 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().getServices().add(JmsServices.class, new MockJmsServices());
- getBootstrap().setEnvironment(Environments.EE);
- }
-
-
-
-}
Deleted: 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-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,71 +0,0 @@
-/**
- *
- */
-package org.jboss.webbeans.mock;
-
-import java.lang.reflect.Field;
-import java.util.Collection;
-
-import javax.inject.manager.InjectionPoint;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.ejb.api.SessionObjectReference;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-
-public class MockEjBServices implements EjbServices
-{
-
- private final MockEjbDiscovery ejbDiscovery;
-
- public MockEjBServices(WebBeanDiscovery webBeanDiscovery)
- {
- this.ejbDiscovery = new MockEjbDiscovery(webBeanDiscovery);
- }
-
- public Object resolveEjb(InjectionPoint injectionPoint)
- {
- return null;
- }
-
- public void removeEjb(Collection<Object> instance)
- {
- // No-op
- }
-
- public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
- {
- return null;
- }
-
- public Iterable<EjbDescriptor<?>> discoverEjbs()
- {
- return ejbDiscovery.discoverEjbs();
- }
-
- public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
- {
- return new SessionObjectReference()
- {
-
- public <S> S getBusinessObject(Class<S> businessInterfaceType)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void remove()
- {
- // TODO Auto-generated method stub
-
- }
-
- public Object getFieldValue(Field field)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- };
- }
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-import javax.ejb.Local;
-import javax.ejb.MessageDriven;
-import javax.ejb.Remove;
-import javax.ejb.Singleton;
-import javax.ejb.Stateful;
-import javax.ejb.Stateless;
-
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-public class MockEjbDescriptor<T> implements EjbDescriptor<T>
-{
- private final Class<T> type;
- private final String ejbName;
- private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
- private final HashSet<Method> removeMethods;
-
- public static <T> MockEjbDescriptor<T> of(Class<T> type)
- {
- return new MockEjbDescriptor<T>(type);
- }
-
- private MockEjbDescriptor(final Class<T> type)
- {
- this.type = type;
- this.ejbName = type.getSimpleName();
- this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
-
- Local localAnnotation = type.getAnnotation(Local.class);
- if (localAnnotation != null)
- {
- for (final Class<?> clazz : localAnnotation.value())
- {
- localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
- }
- }
-
- for (final Class<?> clazz : type.getInterfaces())
- {
- if (clazz.isAnnotationPresent(Local.class))
- {
- localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
- }
- }
- // cope with EJB 3.1 style no-interface views
- if (localInterfaces.size() == 0)
- {
- localInterfaces.add(createBusinessInterfaceDescriptor(type));
- }
- this.removeMethods = new HashSet<Method>();
- for (final Method method : type.getMethods())
- {
- if (method.isAnnotationPresent(Remove.class))
- {
- removeMethods.add(method);
- }
- }
- }
-
- private BusinessInterfaceDescriptor<Object> createBusinessInterfaceDescriptor(final Class<?> clazz)
- {
- return new BusinessInterfaceDescriptor<Object>()
- {
-
- @SuppressWarnings("unchecked")
- public Class<Object> getInterface()
- {
- return (Class<Object>) clazz;
- }
-
- public String getJndiName()
- {
- return clazz.getSimpleName() + "/local";
- }
-
- };
- }
-
- public String getEjbName()
- {
- return ejbName;
- }
-
- public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
- {
- return localInterfaces;
- }
-
- public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
- {
- return Collections.emptyList();
- }
-
- public Iterable<Method> getRemoveMethods()
- {
-
- return removeMethods;
- }
-
- public Class<T> getType()
- {
- return type;
- }
-
- public boolean isMessageDriven()
- {
- return type.isAnnotationPresent(MessageDriven.class);
- }
-
- public boolean isSingleton()
- {
- return type.isAnnotationPresent(Singleton.class);
- }
-
- public boolean isStateful()
- {
- return type.isAnnotationPresent(Stateful.class);
- }
-
- public boolean isStateless()
- {
- return type.isAnnotationPresent(Stateless.class);
- }
-
- public String getLocalJndiName()
- {
- return type.getSimpleName() + "/local";
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(getEjbName());
- if (isStateful())
- {
- builder.append(" (SFSB)");
- }
- if (isStateless())
- {
- builder.append(" (SLSB)");
- }
- if (isSingleton())
- {
- builder.append(" (Singleton)");
- }
- if (isMessageDriven())
- {
- builder.append(" (MDB)");
- }
- builder.append("remove methods; " + removeMethods + "; ");
- builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
- return builder.toString();
- }
-
- @Override
- public boolean equals(Object other)
- {
- if (other instanceof EjbDescriptor)
- {
- EjbDescriptor<T> that = (EjbDescriptor<T>) other;
- return this.getEjbName().equals(that.getEjbName());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getEjbName().hashCode();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.MessageDriven;
-import javax.ejb.Singleton;
-import javax.ejb.Stateful;
-import javax.ejb.Stateless;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-public class MockEjbDiscovery
-{
-
- private final WebBeanDiscovery webBeanDiscovery;
-
- public MockEjbDiscovery(WebBeanDiscovery webBeanDiscovery)
- {
- this.webBeanDiscovery = webBeanDiscovery;
- }
-
- public Iterable<EjbDescriptor<?>> discoverEjbs()
- {
- List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
- for (Class<?> ejbClass : discoverEjbs(webBeanDiscovery.discoverWebBeanClasses()))
- {
- ejbs.add(MockEjbDescriptor.of(ejbClass));
- }
- return ejbs;
- }
-
- protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
- {
- Set<Class<?>> ejbs = new HashSet<Class<?>>();
- for (Class<?> clazz : webBeanClasses)
- {
- if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class))
- {
- ejbs.add(clazz);
- }
- }
- return ejbs;
- }
-
-
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import org.jboss.webbeans.messaging.spi.JmsServices;
-
-/**
- * @author Pete Muir
- *
- */
-public class MockJmsServices implements JmsServices
-{
-
- public Object resolveDestination(String jndiName, String mappedName)
- {
- return null;
- }
-
-}
Deleted: 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-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,56 +0,0 @@
-/**
- *
- */
-package org.jboss.webbeans.mock;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-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;
-
-public class MockJpaServices implements JpaServices
-{
-
- private final WebBeanDiscovery webBeanDiscovery;
-
- public MockJpaServices(WebBeanDiscovery webBeanDiscovery)
- {
- this.webBeanDiscovery = webBeanDiscovery;
- }
-
- 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<?>>();
- for (Class<?> clazz : webBeanDiscovery.discoverWebBeanClasses())
- {
- if (clazz.isAnnotationPresent(Entity.class))
- {
- classes.add(clazz);
- }
- }
- return classes;
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,114 +0,0 @@
-/**
- *
- */
-package org.jboss.webbeans.mock;
-
-import javax.naming.Context;
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-
-import org.jboss.webbeans.resources.spi.helpers.AbstractNamingContext;
-
-public class MockNamingContext extends AbstractNamingContext
-{
-
- private final Context context;
-
- public MockNamingContext(Context context)
- {
- this.context = context;
- }
-
- public void bind(String key, Object value)
- {
- if (context != null)
- {
- super.bind(key, value);
- }
- }
-
- public void unbind(String key)
- {
- if (context != null)
- {
- super.unbind(key);
- }
- }
-
- public <T> T lookup(String name, Class<? extends T> expectedType)
- {
- if (context != null)
- {
- T instance = overrideLookup(name, expectedType);
- if (instance == null)
- {
- instance = super.lookup(name, expectedType);
- }
- return instance;
- }
- else
- {
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> T overrideLookup(String name, Class<? extends T> expectedType)
- {
- // JBoss Embedded EJB 3.1 doesn't seem to bind this!
- if (name.equals("java:comp/UserTransaction"))
- {
- final TransactionManager tm = super.lookup("java:/TransactionManager", TransactionManager.class);
- return (T) new UserTransaction()
- {
-
- public void begin() throws NotSupportedException, SystemException
- {
- tm.begin();
- }
-
- public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
- {
- tm.commit();
- }
-
- public int getStatus() throws SystemException
- {
- return tm.getStatus();
- }
-
- public void rollback() throws IllegalStateException, SecurityException, SystemException
- {
- tm.rollback();
- }
-
- public void setRollbackOnly() throws IllegalStateException, SystemException
- {
- tm.setRollbackOnly();
- }
-
- public void setTransactionTimeout(int seconds) throws SystemException
- {
- tm.setTransactionTimeout(seconds);
- }
-
- };
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public Context getContext()
- {
- return context;
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.resources.spi.ResourceLoadingException;
-import org.jboss.webbeans.util.EnumerationIterable;
-
-public class MockResourceLoader implements ResourceLoader
-{
-
- public Class<?> classForName(String name)
- {
- try
- {
- return Thread.currentThread().getContextClassLoader().loadClass(name);
- }
- catch (ClassNotFoundException e)
- {
- throw new ResourceLoadingException(e);
- }
- }
-
- public URL getResource(String name)
- {
- return Thread.currentThread().getContextClassLoader().getResource(name);
- }
-
- public Iterable<URL> getResources(String name)
- {
- try
- {
- return new EnumerationIterable<URL>(Thread.currentThread().getContextClassLoader().getResources(name));
- }
- catch (IOException e)
- {
- throw new ResourceLoadingException(e);
- }
- }
-
-}
Deleted: 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-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import javax.inject.manager.InjectionPoint;
-
-import org.jboss.webbeans.resources.spi.ResourceServices;
-
-/**
- * @author Pete Muir
- *
- */
-public class MockResourceServices implements ResourceServices
-{
-
- public Object resolveResource(InjectionPoint injectionPoint)
- {
- return null;
- }
-
- public Object resolveResource(String jndiName, String mappedName)
- {
- return null;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,88 +0,0 @@
-package org.jboss.webbeans.mock;
-
-import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
-import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.resources.spi.NamingContext;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-
-public class MockServletLifecycle extends ContextLifecycle
-{
- private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
-
- private final WebBeansBootstrap bootstrap;
- private final MockWebBeanDiscovery webBeanDiscovery;
- private final BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
- private final BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
- private final BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
-
- public MockServletLifecycle()
- {
- this.webBeanDiscovery = new MockWebBeanDiscovery();
- if (webBeanDiscovery == null)
- {
- throw new IllegalStateException("No WebBeanDiscovery is available");
- }
- bootstrap = new WebBeansBootstrap();
- bootstrap.setEnvironment(Environments.SERVLET);
- bootstrap.getServices().add(NamingContext.class, new MockNamingContext(null));
- bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
- bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
- bootstrap.setApplicationContext(applicationBeanStore);
- setInstance(this);
- }
-
- public void initialize()
- {
- bootstrap.initialize();
- }
-
- public MockWebBeanDiscovery getWebBeanDiscovery()
- {
- return webBeanDiscovery;
- }
-
- public WebBeansBootstrap getBootstrap()
- {
- return bootstrap;
- }
-
- public void beginApplication()
- {
- bootstrap.boot();
- }
-
- public void endApplication()
- {
- bootstrap.shutdown();
- }
-
- public void resetContexts()
- {
-
- }
-
- public void beginRequest()
- {
- super.beginRequest("Mock", requestBeanStore);
- }
-
- public void endRequest()
- {
- super.endRequest("Mock", requestBeanStore);
- }
-
- public void beginSession()
- {
- super.restoreSession("Mock", sessionBeanStore);
- }
-
- public void endSession()
- {
- // TODO Conversation handling breaks this :-(
- //super.endSession("Mock", sessionBeanStore);
- }
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.mock;
-
-import javax.transaction.Synchronization;
-
-import org.jboss.webbeans.transaction.spi.TransactionServices;
-
-/**
- * A mock version of TransactionServices for RI unit tests. Since
- * no JTA transaction can be active for these unit tests, all
- * methods here are empty.
- *
- * @author David Allen
- *
- */
-public class MockTransactionServices implements TransactionServices
-{
-
- public boolean isTransactionActive()
- {
- return false;
- }
-
- public void registerSynchronization(Synchronization synchronizedObserver)
- {
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.mock;
-
-import java.net.URL;
-import java.util.HashSet;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-
-public class MockWebBeanDiscovery implements WebBeanDiscovery
-{
-
- private Iterable<Class<?>> webBeanClasses = new HashSet<Class<?>>();
-
- private Iterable<URL> webBeansXmlFiles = new HashSet<URL>();
-
- public Iterable<Class<?>> discoverWebBeanClasses()
- {
- return webBeanClasses;
- }
-
- public Iterable<URL> discoverWebBeansXml()
- {
- return webBeansXmlFiles;
- }
-
- public void setWebBeanClasses(Iterable<Class<?>> webBeanClasses)
- {
- this.webBeanClasses = webBeanClasses;
- }
-
- public void setWebBeansXmlFiles(Iterable<URL> webBeansXmlFiles)
- {
- this.webBeansXmlFiles = webBeansXmlFiles;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,13 +0,0 @@
-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;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,31 +0,0 @@
-package org.jboss.webbeans.mock;
-
-import java.net.URL;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.resources.DefaultResourceLoader;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.xml.XmlEnvironment;
-
-public class MockXmlEnvironment extends XmlEnvironment
-{
-
- private static final ServiceRegistry services;
-
- static
- {
- services = new SimpleServiceRegistry();
- services.add(ResourceLoader.class, new DefaultResourceLoader());
- services.add(ClassTransformer.class, new ClassTransformer());
- }
-
- public MockXmlEnvironment(Iterable<URL> beansXmlUrls, EjbDescriptorCache ejbDescriptors)
- {
- super(services, beansXmlUrls, ejbDescriptors, CurrentManager.rootManager());
- }
-
-}
Modified: ri/trunk/porting-package/pom.xml
===================================================================
--- ri/trunk/porting-package/pom.xml 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/porting-package/pom.xml 2009-04-14 22:40:05 UTC (rev 2406)
@@ -33,6 +33,11 @@
<artifactId>el-ri</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-core-test</artifactId>
+ </dependency>
+
</dependencies>
</project>
Deleted: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,79 +0,0 @@
-package org.jboss.webbeans.tck;
-
-import java.lang.annotation.Annotation;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.testharness.api.DeploymentException;
-import org.jboss.testharness.spi.StandaloneContainers;
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.mock.MockEELifecycle;
-import org.jboss.webbeans.mock.MockWebBeanDiscovery;
-
-public class StandaloneContainersImpl implements StandaloneContainers
-{
-
- private MockEELifecycle lifecycle;
-
- public void deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Iterable<Class<?>> classes) throws DeploymentException
- {
- deploy(enabledDeploymentTypes, classes, null);
- }
-
- public void deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
- {
- this.lifecycle = new MockEELifecycle();
- lifecycle.initialize();
- try
- {
- ManagerImpl manager = lifecycle.getBootstrap().getManager();
- if (enabledDeploymentTypes != null)
- {
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
- }
- MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
- discovery.setWebBeanClasses(classes);
- if (beansXml != null)
- {
- discovery.setWebBeansXmlFiles(beansXml);
- }
- lifecycle.beginApplication();
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error deploying beans", e);
- }
- lifecycle.beginSession();
- lifecycle.beginRequest();
- }
-
- public void deploy(Iterable<Class<?>> classes) throws DeploymentException
- {
- deploy(null, classes, null);
- }
-
- public void deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
- {
- deploy(null, classes, beansXml);
- }
-
- public void cleanup()
- {
- // TODO Auto-generated method stub
-
- }
-
- public void setup()
- {
- // No-op
- }
-
- public void undeploy()
- {
- lifecycle.endRequest();
- lifecycle.endSession();
- lifecycle.endApplication();
- lifecycle = null;
- }
-
-}
Modified: ri/trunk/porting-package/src/main/resources/META-INF/jboss-test-harness.properties
===================================================================
--- ri/trunk/porting-package/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/porting-package/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-14 22:40:05 UTC (rev 2406)
@@ -1,5 +1,4 @@
org.jboss.jsr299.tck.spi.Managers=org.jboss.webbeans.tck.ManagersImpl
org.jboss.jsr299.tck.spi.Beans=org.jboss.webbeans.tck.BeansImpl
org.jboss.jsr299.tck.spi.Contexts=org.jboss.webbeans.tck.ContextsImpl
-org.jboss.testharness.spi.StandaloneContainers=org.jboss.webbeans.tck.StandaloneContainersImpl
org.jboss.jsr299.tck.spi.EL=org.jboss.webbeans.tck.ELImpl
\ No newline at end of file
Modified: ri/trunk/tests/pom.xml
===================================================================
--- ri/trunk/tests/pom.xml 2009-04-14 21:27:02 UTC (rev 2405)
+++ ri/trunk/tests/pom.xml 2009-04-14 22:40:05 UTC (rev 2406)
@@ -37,13 +37,11 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-ri</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
@@ -60,7 +58,6 @@
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-api</artifactId>
- <scope>test</scope>
<optional>true</optional>
<exclusions>
<exclusion>
@@ -83,6 +80,16 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+
</dependencies>
<build>
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockConversationManager.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.mock;
+
+import org.jboss.webbeans.conversation.ServletConversationManager;
+
+/**
+ * Mock of a conversation manager without servlet dependencies
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+// TODO dummy
+public class MockConversationManager extends ServletConversationManager
+{
+
+}
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,46 @@
+/*
+ * 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.mock;
+
+import org.jboss.webbeans.bootstrap.api.Environments;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.messaging.spi.JmsServices;
+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
+{
+
+ private static final TransactionServices MOCK_TRANSACTION_SERVICES = new MockTransactionServices();
+
+ public MockEELifecycle()
+ {
+ super();
+ getBootstrap().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
+ 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().getServices().add(JmsServices.class, new MockJmsServices());
+ getBootstrap().setEnvironment(Environments.EE);
+ }
+
+
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.jboss.webbeans.mock;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+
+public class MockEjBServices implements EjbServices
+{
+
+ private final MockEjbDiscovery ejbDiscovery;
+
+ public MockEjBServices(WebBeanDiscovery webBeanDiscovery)
+ {
+ this.ejbDiscovery = new MockEjbDiscovery(webBeanDiscovery);
+ }
+
+ public Object resolveEjb(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public void removeEjb(Collection<Object> instance)
+ {
+ // No-op
+ }
+
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+ {
+ return null;
+ }
+
+ public Iterable<EjbDescriptor<?>> discoverEjbs()
+ {
+ return ejbDiscovery.discoverEjbs();
+ }
+
+ public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
+ {
+ return new SessionObjectReference()
+ {
+
+ public <S> S getBusinessObject(Class<S> businessInterfaceType)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void remove()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object getFieldValue(Field field)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ };
+ }
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java (from rev 2405, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,200 @@
+/*
+ * 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.mock;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.MessageDriven;
+import javax.ejb.Remove;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+public class MockEjbDescriptor<T> implements EjbDescriptor<T>
+{
+ private final Class<T> type;
+ private final String ejbName;
+ private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
+ private final HashSet<Method> removeMethods;
+
+ public static <T> MockEjbDescriptor<T> of(Class<T> type)
+ {
+ return new MockEjbDescriptor<T>(type);
+ }
+
+ private MockEjbDescriptor(final Class<T> type)
+ {
+ this.type = type;
+ this.ejbName = type.getSimpleName();
+ this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+
+ Local localAnnotation = type.getAnnotation(Local.class);
+ if (localAnnotation != null)
+ {
+ for (final Class<?> clazz : localAnnotation.value())
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+
+ for (final Class<?> clazz : type.getInterfaces())
+ {
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+ // cope with EJB 3.1 style no-interface views
+ if (localInterfaces.size() == 0)
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(type));
+ }
+ this.removeMethods = new HashSet<Method>();
+ for (final Method method : type.getMethods())
+ {
+ if (method.isAnnotationPresent(Remove.class))
+ {
+ removeMethods.add(method);
+ }
+ }
+ }
+
+ private BusinessInterfaceDescriptor<Object> createBusinessInterfaceDescriptor(final Class<?> clazz)
+ {
+ return new BusinessInterfaceDescriptor<Object>()
+ {
+
+ @SuppressWarnings("unchecked")
+ public Class<Object> getInterface()
+ {
+ return (Class<Object>) clazz;
+ }
+
+ public String getJndiName()
+ {
+ return clazz.getSimpleName() + "/local";
+ }
+
+ };
+ }
+
+ public String getEjbName()
+ {
+ return ejbName;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+ {
+ return localInterfaces;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
+ {
+ return Collections.emptyList();
+ }
+
+ public Iterable<Method> getRemoveMethods()
+ {
+
+ return removeMethods;
+ }
+
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ public boolean isMessageDriven()
+ {
+ return type.isAnnotationPresent(MessageDriven.class);
+ }
+
+ public boolean isSingleton()
+ {
+ return type.isAnnotationPresent(Singleton.class);
+ }
+
+ public boolean isStateful()
+ {
+ return type.isAnnotationPresent(Stateful.class);
+ }
+
+ public boolean isStateless()
+ {
+ return type.isAnnotationPresent(Stateless.class);
+ }
+
+ public String getLocalJndiName()
+ {
+ return type.getSimpleName() + "/local";
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getEjbName());
+ if (isStateful())
+ {
+ builder.append(" (SFSB)");
+ }
+ if (isStateless())
+ {
+ builder.append(" (SLSB)");
+ }
+ if (isSingleton())
+ {
+ builder.append(" (Singleton)");
+ }
+ if (isMessageDriven())
+ {
+ builder.append(" (MDB)");
+ }
+ builder.append("remove methods; " + removeMethods + "; ");
+ builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+ return builder.toString();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof EjbDescriptor)
+ {
+ EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+ return this.getEjbName().equals(that.getEjbName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getEjbName().hashCode();
+ }
+
+}
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -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.mock;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.MessageDriven;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+public class MockEjbDiscovery
+{
+
+ private final WebBeanDiscovery webBeanDiscovery;
+
+ public MockEjbDiscovery(WebBeanDiscovery webBeanDiscovery)
+ {
+ this.webBeanDiscovery = webBeanDiscovery;
+ }
+
+ public Iterable<EjbDescriptor<?>> discoverEjbs()
+ {
+ List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
+ for (Class<?> ejbClass : discoverEjbs(webBeanDiscovery.discoverWebBeanClasses()))
+ {
+ ejbs.add(MockEjbDescriptor.of(ejbClass));
+ }
+ return ejbs;
+ }
+
+ protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
+ {
+ Set<Class<?>> ejbs = new HashSet<Class<?>>();
+ for (Class<?> clazz : webBeanClasses)
+ {
+ if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class))
+ {
+ ejbs.add(clazz);
+ }
+ }
+ return ejbs;
+ }
+
+
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.mock;
+
+import org.jboss.webbeans.messaging.spi.JmsServices;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class MockJmsServices implements JmsServices
+{
+
+ public Object resolveDestination(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJmsServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package org.jboss.webbeans.mock;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+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;
+
+public class MockJpaServices implements JpaServices
+{
+
+ private final WebBeanDiscovery webBeanDiscovery;
+
+ public MockJpaServices(WebBeanDiscovery webBeanDiscovery)
+ {
+ this.webBeanDiscovery = webBeanDiscovery;
+ }
+
+ 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<?>>();
+ for (Class<?> clazz : webBeanDiscovery.discoverWebBeanClasses())
+ {
+ if (clazz.isAnnotationPresent(Entity.class))
+ {
+ classes.add(clazz);
+ }
+ }
+ return classes;
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,114 @@
+/**
+ *
+ */
+package org.jboss.webbeans.mock;
+
+import javax.naming.Context;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jboss.webbeans.resources.spi.helpers.AbstractNamingContext;
+
+public class MockNamingContext extends AbstractNamingContext
+{
+
+ private final Context context;
+
+ public MockNamingContext(Context context)
+ {
+ this.context = context;
+ }
+
+ public void bind(String key, Object value)
+ {
+ if (context != null)
+ {
+ super.bind(key, value);
+ }
+ }
+
+ public void unbind(String key)
+ {
+ if (context != null)
+ {
+ super.unbind(key);
+ }
+ }
+
+ public <T> T lookup(String name, Class<? extends T> expectedType)
+ {
+ if (context != null)
+ {
+ T instance = overrideLookup(name, expectedType);
+ if (instance == null)
+ {
+ instance = super.lookup(name, expectedType);
+ }
+ return instance;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T overrideLookup(String name, Class<? extends T> expectedType)
+ {
+ // JBoss Embedded EJB 3.1 doesn't seem to bind this!
+ if (name.equals("java:comp/UserTransaction"))
+ {
+ final TransactionManager tm = super.lookup("java:/TransactionManager", TransactionManager.class);
+ return (T) new UserTransaction()
+ {
+
+ public void begin() throws NotSupportedException, SystemException
+ {
+ tm.begin();
+ }
+
+ public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
+ {
+ tm.commit();
+ }
+
+ public int getStatus() throws SystemException
+ {
+ return tm.getStatus();
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException
+ {
+ tm.rollback();
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+ tm.setRollbackOnly();
+ }
+
+ public void setTransactionTimeout(int seconds) throws SystemException
+ {
+ tm.setTransactionTimeout(seconds);
+ }
+
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public Context getContext()
+ {
+ return context;
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,58 @@
+/*
+ * 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.mock;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.webbeans.resources.spi.ResourceLoadingException;
+import org.jboss.webbeans.util.EnumerationIterable;
+
+public class MockResourceLoader implements ResourceLoader
+{
+
+ public Class<?> classForName(String name)
+ {
+ try
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass(name);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+ public URL getResource(String name)
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+
+ public Iterable<URL> getResources(String name)
+ {
+ try
+ {
+ return new EnumerationIterable<URL>(Thread.currentThread().getContextClassLoader().getResources(name));
+ }
+ catch (IOException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.mock;
+
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.resources.spi.ResourceServices;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class MockResourceServices implements ResourceServices
+{
+
+ public Object resolveResource(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockResourceServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,88 @@
+package org.jboss.webbeans.mock;
+
+import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
+import org.jboss.webbeans.bootstrap.api.Environments;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.context.ContextLifecycle;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.resources.spi.NamingContext;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
+
+public class MockServletLifecycle extends ContextLifecycle
+{
+ private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
+
+ private final WebBeansBootstrap bootstrap;
+ private final MockWebBeanDiscovery webBeanDiscovery;
+ private final BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
+ private final BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
+ private final BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+
+ public MockServletLifecycle()
+ {
+ this.webBeanDiscovery = new MockWebBeanDiscovery();
+ if (webBeanDiscovery == null)
+ {
+ throw new IllegalStateException("No WebBeanDiscovery is available");
+ }
+ bootstrap = new WebBeansBootstrap();
+ bootstrap.setEnvironment(Environments.SERVLET);
+ bootstrap.getServices().add(NamingContext.class, new MockNamingContext(null));
+ bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
+ bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
+ bootstrap.setApplicationContext(applicationBeanStore);
+ setInstance(this);
+ }
+
+ public void initialize()
+ {
+ bootstrap.initialize();
+ }
+
+ public MockWebBeanDiscovery getWebBeanDiscovery()
+ {
+ return webBeanDiscovery;
+ }
+
+ public WebBeansBootstrap getBootstrap()
+ {
+ return bootstrap;
+ }
+
+ public void beginApplication()
+ {
+ bootstrap.boot();
+ }
+
+ public void endApplication()
+ {
+ bootstrap.shutdown();
+ }
+
+ public void resetContexts()
+ {
+
+ }
+
+ public void beginRequest()
+ {
+ super.beginRequest("Mock", requestBeanStore);
+ }
+
+ public void endRequest()
+ {
+ super.endRequest("Mock", requestBeanStore);
+ }
+
+ public void beginSession()
+ {
+ super.restoreSession("Mock", sessionBeanStore);
+ }
+
+ public void endSession()
+ {
+ // TODO Conversation handling breaks this :-(
+ //super.endSession("Mock", sessionBeanStore);
+ }
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -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.mock;
+
+import javax.transaction.Synchronization;
+
+import org.jboss.webbeans.transaction.spi.TransactionServices;
+
+/**
+ * A mock version of TransactionServices for RI unit tests. Since
+ * no JTA transaction can be active for these unit tests, all
+ * methods here are empty.
+ *
+ * @author David Allen
+ *
+ */
+public class MockTransactionServices implements TransactionServices
+{
+
+ public boolean isTransactionActive()
+ {
+ return false;
+ }
+
+ public void registerSynchronization(Synchronization synchronizedObserver)
+ {
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,51 @@
+/*
+ * 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.mock;
+
+import java.net.URL;
+import java.util.HashSet;
+
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+
+public class MockWebBeanDiscovery implements WebBeanDiscovery
+{
+
+ private Iterable<Class<?>> webBeanClasses = new HashSet<Class<?>>();
+
+ private Iterable<URL> webBeansXmlFiles = new HashSet<URL>();
+
+ public Iterable<Class<?>> discoverWebBeanClasses()
+ {
+ return webBeanClasses;
+ }
+
+ public Iterable<URL> discoverWebBeansXml()
+ {
+ return webBeansXmlFiles;
+ }
+
+ public void setWebBeanClasses(Iterable<Class<?>> webBeanClasses)
+ {
+ this.webBeanClasses = webBeanClasses;
+ }
+
+ public void setWebBeansXmlFiles(Iterable<URL> webBeansXmlFiles)
+ {
+ this.webBeansXmlFiles = webBeansXmlFiles;
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebServices.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockWebServices.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebServices.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebServices.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -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/tests/src/main/java/org/jboss/webbeans/mock/MockWebServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java 2009-04-14 22:40:05 UTC (rev 2406)
@@ -0,0 +1,31 @@
+package org.jboss.webbeans.mock;
+
+import java.net.URL;
+
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.resources.DefaultResourceLoader;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.webbeans.xml.XmlEnvironment;
+
+public class MockXmlEnvironment extends XmlEnvironment
+{
+
+ private static final ServiceRegistry services;
+
+ static
+ {
+ services = new SimpleServiceRegistry();
+ services.add(ResourceLoader.class, new DefaultResourceLoader());
+ services.add(ClassTransformer.class, new ClassTransformer());
+ }
+
+ public MockXmlEnvironment(Iterable<URL> beansXmlUrls, EjbDescriptorCache ejbDescriptors)
+ {
+ super(services, beansXmlUrls, ejbDescriptors, CurrentManager.rootManager());
+ }
+
+}
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockXmlEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/el (from rev 2398, ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/el)
17 years
[webbeans-commits] Webbeans SVN: r2405 - ri/trunk/impl/src/main/java/org/jboss/webbeans/mock.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 17:27:02 -0400 (Tue, 14 Apr 2009)
New Revision: 2405
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
Log:
WBRI-151 - thanks to Bogdan Mustiata
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-04-14 21:11:33 UTC (rev 2404)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-04-14 21:27:02 UTC (rev 2405)
@@ -1,198 +1,200 @@
-/*
- * 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.mock;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-import javax.ejb.Local;
-import javax.ejb.MessageDriven;
-import javax.ejb.Remove;
-import javax.ejb.Singleton;
-import javax.ejb.Stateful;
-import javax.ejb.Stateless;
-
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-public class MockEjbDescriptor<T> implements EjbDescriptor<T>
-{
- private final Class<T> type;
- private final String ejbName;
- private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
- private final HashSet<Method> removeMethods;
-
- public static <T> MockEjbDescriptor<T> of(Class<T> type)
- {
- return new MockEjbDescriptor<T>(type);
- }
-
- private MockEjbDescriptor(final Class<T> type)
- {
- this.type = type;
- this.ejbName = type.getSimpleName();
- this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
- for (final Class<?> clazz : type.getInterfaces())
- {
- if (clazz.isAnnotationPresent(Local.class))
- {
- localInterfaces.add(new BusinessInterfaceDescriptor<Object>()
- {
-
- @SuppressWarnings("unchecked")
- public Class<Object> getInterface()
- {
- return (Class<Object>) clazz;
- }
-
- public String getJndiName()
- {
- return clazz.getSimpleName() + "/local";
- }
-
- });
- }
- }
- // cope with EJB 3.1 style no-interface views
- if (localInterfaces.size() == 0)
- {
- localInterfaces.add(new BusinessInterfaceDescriptor<Object>()
- {
-
- public Class<Object> getInterface()
- {
- return (Class<Object>) type;
- }
-
- public String getJndiName()
- {
- return type.getSimpleName() +"/local";
- }
-
- });
- }
- this.removeMethods = new HashSet<Method>();
- for (final Method method : type.getMethods())
- {
- if (method.isAnnotationPresent(Remove.class))
- {
- removeMethods.add(method);
- }
- }
- }
-
- public String getEjbName()
- {
- return ejbName;
- }
-
- public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
- {
- return localInterfaces;
- }
-
- public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
- {
- return Collections.emptyList();
- }
-
- public Iterable<Method> getRemoveMethods()
- {
-
- return removeMethods;
- }
-
- public Class<T> getType()
- {
- return type;
- }
-
- public boolean isMessageDriven()
- {
- return type.isAnnotationPresent(MessageDriven.class);
- }
-
- public boolean isSingleton()
- {
- return type.isAnnotationPresent(Singleton.class);
- }
-
- public boolean isStateful()
- {
- return type.isAnnotationPresent(Stateful.class);
- }
-
- public boolean isStateless()
- {
- return type.isAnnotationPresent(Stateless.class);
- }
-
- public String getLocalJndiName()
- {
- return type.getSimpleName() + "/local";
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(getEjbName());
- if (isStateful())
- {
- builder.append(" (SFSB)");
- }
- if (isStateless())
- {
- builder.append(" (SLSB)");
- }
- if (isSingleton())
- {
- builder.append(" (Singleton)");
- }
- if (isMessageDriven())
- {
- builder.append(" (MDB)");
- }
- builder.append("remove methods; " + removeMethods + "; ");
- builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
- return builder.toString();
- }
-
- @Override
- public boolean equals(Object other)
- {
- if (other instanceof EjbDescriptor)
- {
- EjbDescriptor<T> that = (EjbDescriptor<T>) other;
- return this.getEjbName().equals(that.getEjbName());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getEjbName().hashCode();
- }
-
-}
+/*
+ * 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.mock;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.MessageDriven;
+import javax.ejb.Remove;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+public class MockEjbDescriptor<T> implements EjbDescriptor<T>
+{
+ private final Class<T> type;
+ private final String ejbName;
+ private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
+ private final HashSet<Method> removeMethods;
+
+ public static <T> MockEjbDescriptor<T> of(Class<T> type)
+ {
+ return new MockEjbDescriptor<T>(type);
+ }
+
+ private MockEjbDescriptor(final Class<T> type)
+ {
+ this.type = type;
+ this.ejbName = type.getSimpleName();
+ this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+
+ Local localAnnotation = type.getAnnotation(Local.class);
+ if (localAnnotation != null)
+ {
+ for (final Class<?> clazz : localAnnotation.value())
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+
+ for (final Class<?> clazz : type.getInterfaces())
+ {
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+ // cope with EJB 3.1 style no-interface views
+ if (localInterfaces.size() == 0)
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(type));
+ }
+ this.removeMethods = new HashSet<Method>();
+ for (final Method method : type.getMethods())
+ {
+ if (method.isAnnotationPresent(Remove.class))
+ {
+ removeMethods.add(method);
+ }
+ }
+ }
+
+ private BusinessInterfaceDescriptor<Object> createBusinessInterfaceDescriptor(final Class<?> clazz)
+ {
+ return new BusinessInterfaceDescriptor<Object>()
+ {
+
+ @SuppressWarnings("unchecked")
+ public Class<Object> getInterface()
+ {
+ return (Class<Object>) clazz;
+ }
+
+ public String getJndiName()
+ {
+ return clazz.getSimpleName() + "/local";
+ }
+
+ };
+ }
+
+ public String getEjbName()
+ {
+ return ejbName;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+ {
+ return localInterfaces;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
+ {
+ return Collections.emptyList();
+ }
+
+ public Iterable<Method> getRemoveMethods()
+ {
+
+ return removeMethods;
+ }
+
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ public boolean isMessageDriven()
+ {
+ return type.isAnnotationPresent(MessageDriven.class);
+ }
+
+ public boolean isSingleton()
+ {
+ return type.isAnnotationPresent(Singleton.class);
+ }
+
+ public boolean isStateful()
+ {
+ return type.isAnnotationPresent(Stateful.class);
+ }
+
+ public boolean isStateless()
+ {
+ return type.isAnnotationPresent(Stateless.class);
+ }
+
+ public String getLocalJndiName()
+ {
+ return type.getSimpleName() + "/local";
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getEjbName());
+ if (isStateful())
+ {
+ builder.append(" (SFSB)");
+ }
+ if (isStateless())
+ {
+ builder.append(" (SLSB)");
+ }
+ if (isSingleton())
+ {
+ builder.append(" (Singleton)");
+ }
+ if (isMessageDriven())
+ {
+ builder.append(" (MDB)");
+ }
+ builder.append("remove methods; " + removeMethods + "; ");
+ builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+ return builder.toString();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof EjbDescriptor)
+ {
+ EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+ return this.getEjbName().equals(that.getEjbName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getEjbName().hashCode();
+ }
+
+}
17 years
[webbeans-commits] Webbeans SVN: r2404 - ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 17:11:33 -0400 (Tue, 14 Apr 2009)
New Revision: 2404
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
WBRI-85
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java 2009-04-14 21:11:33 UTC (rev 2404)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.webbeans.servlet;
+
+import java.util.Collections;
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore;
+import org.jboss.webbeans.context.beanstore.BeanStoreNamingScheme;
+import org.jboss.webbeans.context.beanstore.PrefixBeanStoreNamingScheme;
+
+/**
+ * Abstracts the servlet API specific session context
+ * as a BeanStore. Actual sessions are created lazily.
+ *
+ * @author Gavin King
+ */
+public class HttpRequestSessionBeanStore extends AbstractAttributeBackedBeanStore
+{
+ // The HTTP session context to use as backing map
+ private final HttpServletRequest request;
+
+ /**
+ * Constructor
+ *
+ * @param session The HTTP session
+ */
+ public HttpRequestSessionBeanStore(HttpServletRequest request)
+ {
+ super();
+ this.request = request;
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
+ */
+ @Override
+ protected Object getAttribute(String key)
+ {
+ HttpSession session = request.getSession(false);
+ return session==null ? null : session.getAttribute( key );
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ HttpSession session = request.getSession(false);
+ if (session != null)
+ {
+ return session.getAttributeNames();
+ }
+ else
+ {
+ return Collections.enumeration(Collections.EMPTY_LIST);
+ }
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
+ */
+ @Override
+ protected void removeAttribute(String key)
+ {
+ HttpSession session = request.getSession(false);
+ if (session != null)
+ {
+ session.removeAttribute( key );
+ }
+ }
+
+ /**
+ * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
+ */
+ @Override
+ protected void setAttribute(String key, Object instance)
+ {
+ HttpSession session = request.getSession(true);
+ session.setAttribute(key, instance);
+ }
+
+ @Override
+ protected BeanStoreNamingScheme getNamingScheme()
+ {
+ return new PrefixBeanStoreNamingScheme(SessionContext.class.getName(), "#");
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-14 17:54:36 UTC (rev 2403)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-14 21:11:33 UTC (rev 2404)
@@ -82,19 +82,24 @@
* @param session
* @return the session bean store
*/
+ protected BeanStore restoreSessionContext(HttpServletRequest request)
+ {
+ BeanStore sessionBeanStore = new HttpRequestSessionBeanStore(request);
+ HttpSession session = request.getSession(false);
+ super.restoreSession(session == null ? "Inactive session" : session.getId(), sessionBeanStore);
+ if (session != null)
+ {
+ CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
+ }
+ return sessionBeanStore;
+ }
+
protected BeanStore restoreSessionContext(HttpSession session)
{
- if (session != null)
- {
- BeanStore sessionBeanStore = new HttpSessionBeanStore(session);
- super.restoreSession(session.getId(), sessionBeanStore);
- CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
- return sessionBeanStore;
- }
- else
- {
- return null;
- }
+ BeanStore beanStore = new HttpSessionBeanStore(session);
+ super.restoreSession(session.getId(), beanStore);
+ CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
+ return beanStore;
}
/**
@@ -111,7 +116,7 @@
BeanStore beanStore = new ConcurrentHashMapBeanStore();
request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
super.beginRequest(request.getRequestURI(), beanStore);
- restoreSessionContext(request.getSession(false));
+ restoreSessionContext(request);
}
}
17 years
[webbeans-commits] Webbeans SVN: r2403 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes and 21 other directories.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-14 13:54:36 -0400 (Tue, 14 Apr 2009)
New Revision: 2403
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/Order.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/another/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/another/AnotherOrder.java
Removed:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/namespace
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestInterceptorBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/bindingtype/multipledeclaration/MultipleDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/multipledeclaration/MultipleDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/notvalidtype/NotValidTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/multipledeclaration/MultipleDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/notvalidtype/NotValidTypeTest.java
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/NotDeploymentTypeTest.java
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/metadata/XmlBasedMetadataTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/Order.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml
Log:
some changes with tests
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-14 15:40:23 UTC (rev 2402)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -35,7 +35,6 @@
import org.jboss.webbeans.xml.checker.bean.ext.SimpleBeanElementChecker;
import org.jboss.webbeans.xml.checker.beanchildren.ext.NotSimpleBeanChildrenChecker;
import org.jboss.webbeans.xml.checker.beanchildren.ext.SimpleBeanChildrenChecker;
-import org.xml.sax.EntityResolver;
public class XmlParser
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -10,6 +10,7 @@
import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestNamed;
import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestScopeType;
import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestStereotype;
+import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
@@ -29,6 +30,7 @@
{
@Test
@SpecAssertions({
+ @SpecAssertion(section="9", id="b"),
@SpecAssertion(section="9.4", id="a"),
@SpecAssertion(section="9.4", id="b"),
@SpecAssertion(section="9.4", id="c"),
@@ -45,6 +47,7 @@
})
public void testAnnotationTypes()
{
+// assert getCurrentManager().resolveByType(Order.class).size() == 1;
assert true;
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/Order.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/Order.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/Order.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes.foo;
+
+import javax.context.RequestScoped;
+
+@RequestScoped
+@TestBindingType
+@TestInterceptorBindingType
+@TestStereotype
+public class Order
+{
+ private int val;
+
+ public Order(int val)
+ {
+ this.val = val;
+ }
+
+ public int getVal()
+ {
+ return this.val;
+ }
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestBindingType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestBindingType.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestBindingType.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,5 +1,8 @@
package org.jboss.jsr299.tck.tests.xml.annotationtypes.foo;
+import javax.inject.BindingType;
+
+@BindingType
public @interface TestBindingType
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestInterceptorBindingType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestInterceptorBindingType.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestInterceptorBindingType.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,5 +1,8 @@
package org.jboss.jsr299.tck.tests.xml.annotationtypes.foo;
+import javax.interceptor.InterceptorBindingType;
+
+@InterceptorBindingType
public @interface TestInterceptorBindingType
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestStereotype.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestStereotype.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,5 +1,8 @@
package org.jboss.jsr299.tck.tests.xml.annotationtypes.foo;
+import javax.annotation.Stereotype;
+
+@Stereotype
public @interface TestStereotype
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/bindingtype/multipledeclaration/MultipleDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/bindingtype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/bindingtype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -26,6 +26,6 @@
})
public void testMultipleDeclaration()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/multipledeclaration/MultipleDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -26,6 +26,6 @@
})
public void testMultipleDeclaration()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/notvalidtype/NotValidTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/notvalidtype/NotValidTypeTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/interceptorbindingtype/notvalidtype/NotValidTypeTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -27,6 +27,6 @@
})
public void testNotValidType()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/multipledeclaration/MultipleDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -26,6 +26,6 @@
})
public void testMultipleDeclaration()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/notvalidtype/NotValidTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/notvalidtype/NotValidTypeTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/notvalidxml/stereotype/notvalidtype/NotValidTypeTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -27,6 +27,6 @@
})
public void testNotValidType()
{
- assert true;
+ assert false;
}
}
Modified: 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 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -24,6 +24,6 @@
})
public void testMultipleDeclaration()
{
- assert true;
+ assert false;
}
}
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-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -24,6 +24,6 @@
})
public void testNotDeploymentType()
{
- assert true;
+ assert false;
}
}
Modified: 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 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -21,6 +21,6 @@
})
public void testNotJavaType()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -5,6 +5,7 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.tests.xml.metadata.foo.AnotherDeploymentType;
import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
+import org.jboss.jsr299.tck.tests.xml.metadata.foo.another.AnotherOrder;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.Resource;
@@ -14,11 +15,11 @@
@Artifact
@Resources({
- @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace"),
@Resource(source="schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd")
})
@Classes({
Order.class,
+ AnotherOrder.class,
AnotherDeploymentType.class
})
@BeansXml("beans.xml")
@@ -30,12 +31,15 @@
@SpecAssertion(section="9", id="b"),
@SpecAssertion(section="9", id="c"),
@SpecAssertion(section="9", id="d"),
+ @SpecAssertion(section="9.1", id="a"),
@SpecAssertion(section="9.1", id="b"),
@SpecAssertion(section="9.1", id="c"),
@SpecAssertion(section="9.1", id="d")
})
public void testXmlBasedMetadata()
{
+// assert getCurrentManager().resolveByType(Order.class).size() == 1;
+// assert getCurrentManager().resolveByType(AnotherOrder.class).size() == 1;
assert true;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/Order.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/Order.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/Order.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,9 +1,17 @@
package org.jboss.jsr299.tck.tests.xml.metadata.foo;
+import javax.context.RequestScoped;
+
+@RequestScoped
public class Order
{
public String str;
+ public Order(String str)
+ {
+ this.str = str;
+ }
+
public String getStr()
{
return str;
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/another/AnotherOrder.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/another/AnotherOrder.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/foo/another/AnotherOrder.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.xml.metadata.foo.another;
+
+public class AnotherOrder
+{
+ public String str;
+
+ public AnotherOrder(String str)
+ {
+ this.str = str;
+ }
+
+ public String getStr()
+ {
+ return str;
+ }
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -23,7 +23,6 @@
@Test
@SpecAssertions({
- @SpecAssertion(section="9.1", id="a"),
@SpecAssertion(section="9.2", id="a"),
@SpecAssertion(section="9.2", id="b"),
@SpecAssertion(section="9.2", id="c"),
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -33,6 +33,7 @@
})
public void testJavaEeNamespace()
{
+// assert getCurrentManager().resolveByType(Order.class).size() == 1;
assert true;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,11 +1,22 @@
package org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo;
+import javax.context.RequestScoped;
+
+@RequestScoped
+@AnotherDeploymentType
public class Order
{
- public Integer val;
+ public int val;
- public Order(Integer val)
+ public String[] strArr;
+
+ public Order(int val)
{
this.val = val;
}
+
+ public int getVal()
+ {
+ return this.val;
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -4,15 +4,16 @@
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")
@ExpectedDeploymentException(DefinitionException.class)
-@BeansXml("beans.xml")
-public class NotDeclaredNamespaceTest
+public class NotDeclaredNamespaceTest extends AbstractJSR299Test
{
@Test
@SpecAssertions({
@@ -20,7 +21,6 @@
})
public void testNotDeclaredNamespace()
{
- assert true;
+ assert false;
}
-
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java 2009-04-14 17:54:36 UTC (rev 2403)
@@ -4,6 +4,7 @@
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.Resource;
@@ -17,7 +18,7 @@
})
@BeansXml("beans.xml")
@ExpectedDeploymentException(DefinitionException.class)
-public class StandardSchemaLocationTest
+public class StandardSchemaLocationTest extends AbstractJSR299Test
{
@Test
@SpecAssertions({
@@ -27,6 +28,6 @@
})
public void testStandardSchemaLocation()
{
- assert true;
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml 2009-04-14 17:54:36 UTC (rev 2403)
@@ -14,4 +14,11 @@
<dd:AnotherTestInterceptorBindingType />
<dd:TestNamed />
</dd:TestStereotype>
+ <dd:Order>
+ <RequestScoped />
+ <dd:TestBindingType />
+ <dd:TestInterceptorBindingType />
+ <dd:TestStereotype />
+ <Integer />
+ </dd:Order>
</Beans>
\ No newline at end of file
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,7 +1,6 @@
<Beans xmlns="urn:java:ee"
- xmlns:dd="urn:java:ee urn:java:org.jboss.jsr299.tck.tests.xml.metadata"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.metadata http://mydomain.com/myapp/schema-1.2.xsd">
+ xmlns:dd="urn:java:org.jboss.jsr299.tck.tests.xml.metadata.foo"
+ xmlns:bb="urn:java:org.jboss.jsr299.tck.tests.xml.metadata.foo.another">
<Deploy>
<Standard />
<Production />
@@ -12,4 +11,9 @@
<dd:str>hello</dd:str>
<dd:getStr />
</dd:Order>
+ <bb:AnotherOrder>
+ <RequestScoped />
+ <bb:str>hello one more time</bb:str>
+ <bb:getStr />
+ </bb:AnotherOrder>
</Beans>
\ No newline at end of file
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/namespace
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/namespace 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/namespace 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,2 +0,0 @@
-org.jboss.jsr299.tck.tests.xml.metadata
-org.jboss.jsr299.tck.tests.xml.metadata.foo
\ No newline at end of file
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-14 17:54:36 UTC (rev 2403)
@@ -7,11 +7,13 @@
</Deploy>
<test:Order>
<RequestScoped />
+ <test:AnotherDeploymentType />
<Integer />
<Array>
<String />
</Array>
<test:val/>
+ <test:getVal />
</test:Order>
<Decorators>
<test:TestDecorator />
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml 2009-04-14 15:40:23 UTC (rev 2402)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml 2009-04-14 17:54:36 UTC (rev 2403)
@@ -1,6 +1,6 @@
<Beans xmlns="urn:java:ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.metadata http://mydomain.com/myapp/schema-1.2.xsd">
+ xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.schema http://mydomain.com/myapp/schema-1.2.xsd">
<Deploy>
<Standard />
<Production />
17 years
[webbeans-commits] Webbeans SVN: r2402 - ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 11:40:23 -0400 (Tue, 14 Apr 2009)
New Revision: 2402
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
minor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-14 14:06:33 UTC (rev 2401)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-04-14 15:40:23 UTC (rev 2402)
@@ -84,10 +84,17 @@
*/
protected BeanStore restoreSessionContext(HttpSession session)
{
- BeanStore sessionBeanStore = new HttpSessionBeanStore(session);
- super.restoreSession(session.getId(), sessionBeanStore);
- CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
- return sessionBeanStore;
+ if (session != null)
+ {
+ BeanStore sessionBeanStore = new HttpSessionBeanStore(session);
+ super.restoreSession(session.getId(), sessionBeanStore);
+ CurrentManager.rootManager().getInstanceByType(HttpSessionManager.class).setSession(session);
+ return sessionBeanStore;
+ }
+ else
+ {
+ return null;
+ }
}
/**
@@ -104,7 +111,7 @@
BeanStore beanStore = new ConcurrentHashMapBeanStore();
request.setAttribute(REQUEST_ATTRIBUTE_NAME, beanStore);
super.beginRequest(request.getRequestURI(), beanStore);
- restoreSessionContext(request.getSession());
+ restoreSessionContext(request.getSession(false));
}
}
17 years
[webbeans-commits] Webbeans SVN: r2401 - ri/trunk/version-matrix.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 10:06:33 -0400 (Tue, 14 Apr 2009)
New Revision: 2401
Modified:
ri/trunk/version-matrix/pom.xml
Log:
add commons-httpclient dep
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-04-14 14:05:57 UTC (rev 2400)
+++ ri/trunk/version-matrix/pom.xml 2009-04-14 14:06:33 UTC (rev 2401)
@@ -379,6 +379,12 @@
<artifactId>jaxws-api</artifactId>
<version>2.1</version>
</dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
17 years
[webbeans-commits] Webbeans SVN: r2400 - extensions/trunk/tomcat/tests.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 10:05:57 -0400 (Tue, 14 Apr 2009)
New Revision: 2400
Modified:
extensions/trunk/tomcat/tests/pom.xml
Log:
add commons-httpclient dep
Modified: extensions/trunk/tomcat/tests/pom.xml
===================================================================
--- extensions/trunk/tomcat/tests/pom.xml 2009-04-14 13:41:06 UTC (rev 2399)
+++ extensions/trunk/tomcat/tests/pom.xml 2009-04-14 14:05:57 UTC (rev 2400)
@@ -85,6 +85,11 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
</dependencies>
17 years
[webbeans-commits] Webbeans SVN: r2399 - in extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment: servlet/resources and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-14 09:41:06 -0400 (Tue, 14 Apr 2009)
New Revision: 2399
Added:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/resources/TomcatResourceServices.java
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/
Log:
Fix compilation errors
Modified: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java
===================================================================
--- extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java 2009-04-13 14:01:22 UTC (rev 2398)
+++ extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/Listener.java 2009-04-14 13:41:06 UTC (rev 2399)
@@ -16,9 +16,6 @@
*/
package org.jboss.webbeans.environment.servlet;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.ServletContextEvent;
import org.jboss.webbeans.bootstrap.api.Bootstrap;
@@ -28,6 +25,7 @@
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.environment.servlet.discovery.TomcatWebBeanDiscovery;
import org.jboss.webbeans.environment.servlet.resources.ReadOnlyNamingContext;
+import org.jboss.webbeans.environment.servlet.resources.TomcatResourceServices;
import org.jboss.webbeans.environment.servlet.util.Reflections;
import org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor;
import org.jboss.webbeans.log.Log;
@@ -35,7 +33,6 @@
import org.jboss.webbeans.manager.api.WebBeansManager;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceServices;
-import org.jboss.webbeans.resources.spi.helpers.AbstractResourceServices;
import org.jboss.webbeans.servlet.api.ServletListener;
import org.jboss.webbeans.servlet.api.helpers.ForwardingServletListener;
@@ -75,12 +72,14 @@
}
}
+ @Override
public void contextDestroyed(ServletContextEvent sce)
{
manager.shutdown();
super.contextDestroyed(sce);
}
+ @Override
public void contextInitialized(ServletContextEvent sce)
{
BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
@@ -88,25 +87,7 @@
bootstrap.setEnvironment(Environments.SERVLET);
bootstrap.getServices().add(WebBeanDiscovery.class, new TomcatWebBeanDiscovery(sce.getServletContext()) {});
bootstrap.getServices().add(NamingContext.class, new ReadOnlyNamingContext() {});
- final Context context;
- try
- {
- context = new InitialContext();
- }
- catch (NamingException e)
- {
- throw new IllegalStateException("Error creating JNDI context", e);
- }
- bootstrap.getServices().add(ResourceServices.class, new AbstractResourceServices()
- {
-
- @Override
- protected Context getContext()
- {
- return context;
- }
-
- });
+ bootstrap.getServices().add(ResourceServices.class, new TomcatResourceServices() {});
bootstrap.setApplicationContext(applicationBeanStore);
bootstrap.initialize();
manager = bootstrap.getManager();
Added: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/resources/TomcatResourceServices.java
===================================================================
--- extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/resources/TomcatResourceServices.java (rev 0)
+++ extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/resources/TomcatResourceServices.java 2009-04-14 13:41:06 UTC (rev 2399)
@@ -0,0 +1,33 @@
+package org.jboss.webbeans.environment.servlet.resources;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.webbeans.resources.spi.ResourceServices;
+import org.jboss.webbeans.resources.spi.helpers.AbstractResourceServices;
+
+public abstract class TomcatResourceServices extends AbstractResourceServices implements ResourceServices
+{
+
+ private Context context;
+
+ public TomcatResourceServices()
+ {
+ try
+ {
+ context = new InitialContext();
+ }
+ catch (NamingException e)
+ {
+ throw new IllegalStateException("Error creating JNDI context", e);
+ }
+ }
+
+ @Override
+ protected Context getContext()
+ {
+ return context;
+ }
+
+}
Property changes on: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/servlet/resources/TomcatResourceServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Property changes on: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat
___________________________________________________________________
Name: svn:ignore
- WebBeansAnnotationProcessor.java
Added: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java
===================================================================
--- extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java (rev 0)
+++ extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java 2009-04-14 13:41:06 UTC (rev 2399)
@@ -0,0 +1,37 @@
+package org.jboss.webbeans.environment.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+
+import org.apache.AnnotationProcessor;
+import org.jboss.webbeans.manager.api.WebBeansManager;
+
+public class WebBeansAnnotationProcessor implements AnnotationProcessor
+{
+
+ private final WebBeansManager manager;
+
+ public WebBeansAnnotationProcessor(WebBeansManager manager)
+ {
+ this.manager = manager;
+ }
+
+ public void processAnnotations(Object instance) throws IllegalAccessException, InvocationTargetException, NamingException
+ {
+ manager.injectNonContextualInstance(instance);
+ }
+
+ public void postConstruct(Object arg0) throws IllegalAccessException, InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void preDestroy(Object arg0) throws IllegalAccessException, InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansAnnotationProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years
[webbeans-commits] Webbeans SVN: r2398 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml and 6 other directories.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-13 10:01:22 -0400 (Mon, 13 Apr 2009)
New Revision: 2398
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/schema.xsd
Modified:
ri/trunk/impl/pom.xml
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
ri/trunk/version-matrix/pom.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
Log:
make 9.3 and its tests
Modified: ri/trunk/impl/pom.xml
===================================================================
--- ri/trunk/impl/pom.xml 2009-04-12 11:56:40 UTC (rev 2397)
+++ ri/trunk/impl/pom.xml 2009-04-13 14:01:22 UTC (rev 2398)
@@ -86,6 +86,26 @@
</dependency>
<dependency>
+ <groupId>msv</groupId>
+ <artifactId>isorelax</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>msv</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>relaxngDatatype</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>xsdlib</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<optional>true</optional>
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-12 11:56:40 UTC (rev 2397)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-13 14:01:22 UTC (rev 2398)
@@ -17,9 +17,15 @@
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.QName;
+import org.iso_relax.verifier.Verifier;
+import org.iso_relax.verifier.VerifierConfigurationException;
+import org.iso_relax.verifier.VerifierFactory;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.resources.spi.ResourceLoadingException;
+import org.xml.sax.SAXException;
+import com.sun.msv.verifier.jarv.TheFactoryImpl;
+
public class ParseXmlHelper
{
public static boolean isJavaEeNamespace(Element element)
@@ -101,7 +107,7 @@
throw new DefinitionException("There are multiple packages containing a Java type with the same name '" + className + "'");
}
- public static void checkRootAttributes(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment)
+ public static void checkRootAttributes(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment, URL xmlUrl)
{
Iterator<?> rootAttrIterator = root.attributeIterator();
while (rootAttrIterator.hasNext())
@@ -124,9 +130,10 @@
}
if (attribute.getName().equalsIgnoreCase(XmlConstants.SCHEMA_LOCATION) && attrVal.startsWith(XmlConstants.HTTP_PREFIX) && urn.trim().length() > 0)
{
- URL schemaFile = environment.loadFileByUrn(urn, XmlConstants.SCHEMA_FILE_NAME);
- if (schemaFile == null)
+ URL schemaUrl = environment.loadFileByUrn(urn, XmlConstants.SCHEMA_FILE_NAME);
+ if (schemaUrl == null)
throw new DefinitionException("Could not find '" + XmlConstants.SCHEMA_FILE_NAME + "' file according to specified URN '" + urn + "'");
+ validateXmlWithXsd(xmlUrl, schemaUrl);
}
}
@@ -134,7 +141,7 @@
}
}
- public static void checkRootDeclaredNamespaces(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment)
+ public static void checkRootDeclaredNamespaces(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment, URL xmlUrl)
{
Iterator<?> namespacesIterator = root.declaredNamespaces().iterator();
while (namespacesIterator.hasNext())
@@ -148,7 +155,9 @@
{
Set<String> packagesSet = new HashSet<String>();
- environment.loadFileByUrn(uri, XmlConstants.SCHEMA_FILE_NAME);
+ URL schemaUrl = environment.loadFileByUrn(uri, XmlConstants.SCHEMA_FILE_NAME);
+ if(schemaUrl != null)
+ validateXmlWithXsd(xmlUrl, schemaUrl);
URL namespaceFile = environment.loadFileByUrn(uri, XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile != null)
@@ -166,6 +175,31 @@
}
}
}
+
+ private static void validateXmlWithXsd(URL xmlUrl, URL schemaUrl)
+ {
+ try
+ {
+ VerifierFactory factory = new TheFactoryImpl();
+ Verifier verifier = factory.newVerifier(schemaUrl.openStream());
+ verifier.verify(xmlUrl.toExternalForm());
+ }
+ catch (VerifierConfigurationException e)
+ {
+ String message = "VerifierConfigurationException while create verifier for " + schemaUrl;
+ throw new DefinitionException(message, e);
+ }
+ catch (SAXException e)
+ {
+ String message = "IOException while validate " + xmlUrl + " with " + schemaUrl;
+ throw new DefinitionException(message, e);
+ }
+ catch (IOException e)
+ {
+ String message = "IOException while validate " + xmlUrl + " with " + schemaUrl;
+ throw new DefinitionException(message, e);
+ }
+ }
public static List<Element> findElementsInEeNamespace(Element elementParent, String elementName)
{
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-12 11:56:40 UTC (rev 2397)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-13 14:01:22 UTC (rev 2398)
@@ -35,6 +35,7 @@
import org.jboss.webbeans.xml.checker.bean.ext.SimpleBeanElementChecker;
import org.jboss.webbeans.xml.checker.beanchildren.ext.NotSimpleBeanChildrenChecker;
import org.jboss.webbeans.xml.checker.beanchildren.ext.SimpleBeanChildrenChecker;
+import org.xml.sax.EntityResolver;
public class XmlParser
{
@@ -186,7 +187,7 @@
}
SAXReader reader = new SAXReader();
Document document = reader.read(xmlStream);
- fullFillPackagesMap(document);
+ fullFillPackagesMap(document, url);
return document;
}
catch (IOException e)
@@ -441,10 +442,10 @@
}
}
- private void fullFillPackagesMap(Document document)
+ private void fullFillPackagesMap(Document document, URL xmlUrl)
{
Element root = document.getRootElement();
- ParseXmlHelper.checkRootAttributes(root, packagesMap, environment);
- ParseXmlHelper.checkRootDeclaredNamespaces(root, packagesMap, environment);
+ ParseXmlHelper.checkRootAttributes(root, packagesMap, environment, xmlUrl);
+ ParseXmlHelper.checkRootDeclaredNamespaces(root, packagesMap, environment, xmlUrl);
}
}
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-04-12 11:56:40 UTC (rev 2397)
+++ ri/trunk/version-matrix/pom.xml 2009-04-13 14:01:22 UTC (rev 2398)
@@ -115,6 +115,30 @@
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>msv</artifactId>
+ <version>20050913</version>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>isorelax</artifactId>
+ <version>20050913</version>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>relaxngDatatype</artifactId>
+ <version>20050913</version>
+ </dependency>
+
+ <dependency>
+ <groupId>msv</groupId>
+ <artifactId>xsdlib</artifactId>
+ <version>20050913</version>
+ </dependency>
<dependency>
<groupId>jaxen</groupId>
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/schema/StandardSchemaLocationTest.java 2009-04-13 14:01:22 UTC (rev 2398)
@@ -0,0 +1,32 @@
+package org.jboss.jsr299.tck.tests.xml.schema;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@Resources({
+ @Resource(source="schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/schema/schema.xsd")
+})
+@BeansXml("beans.xml")
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class StandardSchemaLocationTest
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.3", id="a"),
+ @SpecAssertion(section="9.3", id="b"),
+ @SpecAssertion(section="9.3", id="c")
+ })
+ public void testStandardSchemaLocation()
+ {
+ assert true;
+ }
+}
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-12 11:56:40 UTC (rev 2397)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-13 14:01:22 UTC (rev 2398)
@@ -1,10 +1,10 @@
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="Beans">
- <xs:complexType>
- <xs:sequence>
- <xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:anyAttribute/>
- </xs:complexType>
- </xs:element>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:java:ee">
+ <xs:element name="Beans">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any namespace="##any" processContents="skip" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##any" processContents="skip" />
+ </xs:complexType>
+ </xs:element>
</xs:schema>
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/beans.xml 2009-04-13 14:01:22 UTC (rev 2398)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.metadata http://mydomain.com/myapp/schema-1.2.xsd">
+ <Deploy>
+ <Standard />
+ <Production />
+ </Deploy>
+</Beans>
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/schema.xsd
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/schema.xsd (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/schema/schema.xsd 2009-04-13 14:01:22 UTC (rev 2398)
@@ -0,0 +1,10 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:java:ee">
+ <xs:element name="Beanses">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any namespace="##any" processContents="skip" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##any" processContents="skip" />
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
17 years