[webbeans-commits] Webbeans SVN: r2683 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/servlet and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 16:03:08 -0400 (Mon, 11 May 2009)
New Revision: 2683
Added:
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockHttpSession.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/servlet/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/servlet/ServletLifecycleTest.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ConversationAwareViewHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
WBRI-262
WebBeansPhaseListener: only clean up conversation if session is available
ServletLifecycle: don't start/stop a mock request if request is already active
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ConversationAwareViewHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ConversationAwareViewHandler.java 2009-05-11 19:59:27 UTC (rev 2682)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ConversationAwareViewHandler.java 2009-05-11 20:03:08 UTC (rev 2683)
@@ -42,6 +42,8 @@
* long-running, append the conversation id request parameter to the query
* string part of the URL, but only if the request parameter is not already
* present.
+ *
+ * This covers all cases: form actions, link hrefs, Ajax calls, and redirect URLs.
*
* @see {@link ViewHandler#getActionURL(FacesContext, String)}
*/
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-05-11 19:59:27 UTC (rev 2682)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-05-11 20:03:08 UTC (rev 2683)
@@ -30,6 +30,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.ConversationContext;
+import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.conversation.ConversationManager;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -111,9 +112,16 @@
*/
private void afterRenderResponse()
{
- log.trace("Cleaning up the conversation after the Render Response phase");
- CurrentManager.rootManager().getInstanceByType(ConversationManager.class).cleanupConversation();
- ConversationContext.instance().setActive(false);
+ if (SessionContext.instance().isActive())
+ {
+ log.trace("Cleaning up the conversation after the Render Response phase");
+ CurrentManager.rootManager().getInstanceByType(ConversationManager.class).cleanupConversation();
+ ConversationContext.instance().setActive(false);
+ }
+ else
+ {
+ log.trace("Skipping conversation cleanup after the Render Response phase because session has been terminated.");
+ }
}
/**
@@ -121,8 +129,15 @@
*/
private void afterResponseComplete(PhaseId phaseId)
{
- log.trace("Cleaning up the conversation after the " + phaseId + " phase as the response has been marked complete");
- CurrentManager.rootManager().getInstanceByType(ConversationManager.class).cleanupConversation();
+ if (SessionContext.instance().isActive())
+ {
+ log.trace("Cleaning up the conversation after the " + phaseId + " phase as the response has been marked complete");
+ CurrentManager.rootManager().getInstanceByType(ConversationManager.class).cleanupConversation();
+ }
+ else
+ {
+ log.trace("Skipping conversation cleanup after the response has been marked complete because the session has been terminated.");
+ }
}
/**
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-05-11 19:59:27 UTC (rev 2682)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-05-11 20:03:08 UTC (rev 2683)
@@ -27,6 +27,7 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.context.ContextLifecycle;
+import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
@@ -68,16 +69,27 @@
}
/**
- * Ends a session
+ * Ends a session, setting up a mock request if necessary
*
* @param session The HTTP session
*/
public void endSession(HttpSession session)
{
- BeanStore mockRequest = new ConcurrentHashMapBeanStore();
- lifecycle.beginRequest("endSession-" + session.getId(), mockRequest);
- lifecycle.endSession(session.getId(), restoreSessionContext(session));
- lifecycle.endRequest("endSession-" + session.getId(), mockRequest);
+ if (SessionContext.instance().isActive())
+ {
+ lifecycle.endSession(session.getId(), SessionContext.instance().getBeanStore());
+ }
+ else if (RequestContext.instance().isActive())
+ {
+ lifecycle.endSession(session.getId(), restoreSessionContext(session));
+ }
+ else
+ {
+ BeanStore mockRequest = new ConcurrentHashMapBeanStore();
+ lifecycle.beginRequest("endSession-" + session.getId(), mockRequest);
+ lifecycle.endSession(session.getId(), restoreSessionContext(session));
+ lifecycle.endRequest("endSession-" + session.getId(), mockRequest);
+ }
}
/**
Added: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockHttpSession.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockHttpSession.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockHttpSession.java 2009-05-11 20:03:08 UTC (rev 2683)
@@ -0,0 +1,161 @@
+package org.jboss.webbeans.mock;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * A mock implementation of the HttpSession interface for tests.
+ *
+ * @author Dan Allen
+ */
+public class MockHttpSession implements HttpSession
+{
+ private String id;
+
+ private ServletContext servletContext;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ private boolean invalid = false;
+
+ private int maxInactiveInterval = 60;
+
+ private int lastAccessedTime = -1;
+
+ public MockHttpSession() {}
+
+ public MockHttpSession(String id)
+ {
+ this.id = id;
+ }
+
+ public MockHttpSession(String id, ServletContext servletContext)
+ {
+ this(id);
+ this.servletContext = servletContext;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ public Enumeration<String> getAttributeNames()
+ {
+ final Iterator<String> nameIterator = attributes.keySet().iterator();
+ return new Enumeration<String>()
+ {
+
+ public boolean hasMoreElements()
+ {
+ return nameIterator.hasNext();
+ }
+
+ public String nextElement()
+ {
+ return nameIterator.next();
+ }
+ };
+ }
+
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public long getLastAccessedTime()
+ {
+ return lastAccessedTime;
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return maxInactiveInterval;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ @SuppressWarnings("deprecation")
+ public HttpSessionContext getSessionContext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getValue(String name)
+ {
+ return getAttribute(name);
+ }
+
+ public String[] getValueNames()
+ {
+ return attributes.keySet().toArray(new String[0]);
+ }
+
+ public void invalidate()
+ {
+ attributes.clear();
+ invalid = true;
+ }
+
+ public boolean isNew()
+ {
+ return false;
+ }
+
+ public void putValue(String name, Object value)
+ {
+ setAttribute(name, value);
+ }
+
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+ public void removeValue(String name)
+ {
+ removeAttribute(name);
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ if (value == null)
+ {
+ removeAttribute(name);
+ }
+ else
+ {
+ attributes.put(name, value);
+ }
+ }
+
+ public void setMaxInactiveInterval(int seconds)
+ {
+ maxInactiveInterval = seconds;
+ }
+
+ public boolean isInvalid()
+ {
+ return invalid;
+ }
+
+ public void access()
+ {
+ lastAccessedTime = (int) System.currentTimeMillis();
+ }
+
+}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/servlet/ServletLifecycleTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/servlet/ServletLifecycleTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/servlet/ServletLifecycleTest.java 2009-05-11 20:03:08 UTC (rev 2683)
@@ -0,0 +1,80 @@
+package org.jboss.webbeans.test.unit.servlet;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.context.ContextLifecycle;
+import org.jboss.webbeans.context.RequestContext;
+import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.conversation.ConversationManager;
+import org.jboss.webbeans.mock.MockHttpSession;
+import org.jboss.webbeans.servlet.ServletLifecycle;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * A set of tests that validates that the contexts are properly created
+ * and destroyed from the perspective of a servlet environment.
+ *
+ * @author Dan Allen
+ */
+@Artifact
+(a)Classes(ConversationManager.class)
+public class ServletLifecycleTest extends AbstractWebBeansTest
+{
+ @Test(groups = "contexts")
+ public void testEndSessionWithActiveRequestAndSessionContexts()
+ {
+ ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+ BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+ RequestContext.instance().setBeanStore(requestBeanStore);
+ RequestContext.instance().setActive(true);
+
+ BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
+ SessionContext.instance().setBeanStore(sessionBeanStore);
+ SessionContext.instance().setActive(true);
+
+ HttpSession session = new MockHttpSession("99");
+ servletLifecycle.endSession(session);
+ assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+ assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
+ }
+
+ @Test(groups = "contexts")
+ public void testEndSessionWithActiveRequestContextOnly()
+ {
+ ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+ BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+ RequestContext.instance().setBeanStore(requestBeanStore);
+ RequestContext.instance().setActive(true);
+
+ HttpSession session = new MockHttpSession("99");
+ servletLifecycle.endSession(session);
+ assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+ assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
+ }
+
+ @Test(groups = "contexts")
+ public void testEndSessionWithNoActiveRequestOrSessionContexts()
+ {
+ ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+
+ HttpSession session = new MockHttpSession("99");
+ servletLifecycle.endSession(session);
+ assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+ assert Boolean.FALSE.equals(RequestContext.instance().isActive()) : "Temporary request context should have been deactivated";
+ }
+
+ @BeforeMethod(groups = "contexts")
+ public void beforeMethod()
+ {
+ RequestContext.instance().setBeanStore(null);
+ RequestContext.instance().setActive(false);
+ SessionContext.instance().setBeanStore(null);
+ SessionContext.instance().setActive(false);
+ }
+}
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2682 - in ri/trunk: tests/src/test/java/org/jboss/webbeans/test/unit/definition and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 15:59:27 -0400 (Mon, 11 May 2009)
New Revision: 2682
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/Beer.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/BeerProducer.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/ELResolverTest.java
Log:
WBRI-261
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2009-05-11 19:28:07 UTC (rev 2681)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2009-05-11 19:59:27 UTC (rev 2682)
@@ -108,6 +108,11 @@
return namespace.get(propertyString);
}
}
+ else
+ {
+ // let the standard EL resolver chain handle the property
+ return null;
+ }
final String name;
if (namespace != null)
{
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/Beer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/Beer.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/Beer.java 2009-05-11 19:59:27 UTC (rev 2682)
@@ -0,0 +1,30 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import javax.annotation.Named;
+
+public
+@Named
+class Beer
+{
+ private String name = "Chimay Grande Reserve (Blue)";
+
+ private String style = "Belgium Strong Dark Ale";
+
+ public Beer() {}
+
+ public Beer(String name, String style)
+ {
+ this.name = name;
+ this.style = style;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getStyle()
+ {
+ return style;
+ }
+}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/BeerProducer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/BeerProducer.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/BeerProducer.java 2009-05-11 19:59:27 UTC (rev 2682)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import javax.annotation.Named;
+import javax.inject.Produces;
+
+public class BeerProducer
+{
+ public
+ @Produces
+ @Named
+ Beer getBeerOnTap()
+ {
+ return new Beer("Dragon's Breathe", "IPA");
+ }
+
+ public
+ @Produces
+ @Named
+ String getStyle()
+ {
+ return "Bogus!";
+ }
+}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/ELResolverTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/ELResolverTest.java 2009-05-11 19:28:07 UTC (rev 2681)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/ELResolverTest.java 2009-05-11 19:59:27 UTC (rev 2682)
@@ -1,12 +1,21 @@
package org.jboss.webbeans.test.unit.definition;
+import static org.testng.Assert.*;
+
import javax.el.ELContext;
+import javax.el.ExpressionFactory;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.mock.el.EL;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
+/**
+ * Test the WebBeansELResolver and that it collaborates with the standard EL resolver chain.
+ *
+ * @author Pete Muir
+ * @author Dan Allen
+ */
@Artifact
public class ELResolverTest extends AbstractWebBeansTest
{
@@ -18,4 +27,38 @@
assert EL.EXPRESSION_FACTORY.createValueExpression(elContext, "#{foo.bar}", Object.class).getValue(elContext) == null;
}
+ /**
+ * Test that the WebBeansELResolver only works to resolve the base of an EL
+ * expression, in this case a named bean. Once the base is resolved, the
+ * remainder of the expression should be delegated to the standard chain of
+ * property resolvers. If the WebBeansELResolver oversteps its bounds by
+ * trying to resolve the property against the Web Beans namespace, the test
+ * will fail.
+ */
+ @Test
+ public void testResolveBeanPropertyOfNamedBean()
+ {
+ ELContext elContext = EL.createELContext();
+ ExpressionFactory exprFactory = EL.EXPRESSION_FACTORY;
+
+ assertEquals(exprFactory.createValueExpression(elContext, "#{beer.style}", String.class).getValue(elContext), "Belgium Strong Dark Ale");
+ }
+
+ /**
+ * Test that the WebBeansELResolver only works to resolve the base of an EL
+ * expression, in this case from a producer method. Once the base is
+ * resolved, the remainder of the expression should be delegated to the
+ * standard chain of property resolvers. If the WebBeansELResolver oversteps
+ * its bounds by trying to resolve the property against the Web Beans
+ * namespace, the test will fail.
+ */
+ @Test
+ public void testResolveBeanPropertyOfProducerBean()
+ {
+ ELContext elContext = EL.createELContext();
+ ExpressionFactory exprFactory = EL.EXPRESSION_FACTORY;
+
+ assertEquals(exprFactory.createValueExpression(elContext, "#{beerOnTap.style}", String.class).getValue(elContext), "IPA");
+ }
+
}
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2681 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: activities/child and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-05-11 15:28:07 -0400 (Mon, 11 May 2009)
New Revision: 2681
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/
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/declaration/deployment/DeploymentDeclarationTest.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/resource/ejb/DeclarationOfEjbTest.java
Log:
Additional tests and assertion assignments
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.activities.child;
+
+class BeanWithInjection
+{
+ @SpecialBindingType
+ protected MyBean myBean;
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.activities.child;
+
+@SpecialBindingType
+class MyBean
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -0,0 +1,123 @@
+package org.jboss.jsr299.tck.tests.activities.child;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.context.Dependent;
+import javax.inject.AnnotationLiteral;
+import javax.inject.DeploymentException;
+import javax.inject.Production;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.Manager;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class SameBeanTypeInChildActivityTest extends AbstractJSR299Test
+{
+ private static final Set<Annotation> DEFAULT_BINDINGS = new HashSet<Annotation>();
+
+ static
+ {
+ DEFAULT_BINDINGS.add(new CurrentLiteral());
+ }
+
+ private Bean<?> createDummyBean(Manager manager)
+ {
+ final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+ final Set<Type> types = new HashSet<Type>();
+ final Set<Annotation> bindings = new HashSet<Annotation>();
+ bindings.add(new AnnotationLiteral<SpecialBindingType>() {});
+ types.add(Object.class);
+ final Bean<?> bean = new Bean<MyBean>(manager)
+ {
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return bindings;
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Production.class;
+ }
+
+ @Override
+ public Set<? extends InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return false;
+ }
+
+ public MyBean create(CreationalContext<MyBean> creationalContext)
+ {
+ return null;
+ }
+
+ public void destroy(MyBean instance)
+ {
+
+ }
+
+ };
+ return bean;
+ }
+
+ @Test(groups = { "ri-broken" }, expectedExceptions = { DeploymentException.class })
+ @SpecAssertion(section="11.6", id="t")
+ public void testSameBeanTypeInChildAsParentInjection()
+ {
+ Manager childActivity = getCurrentManager().createActivity();
+ Bean<?> anotherMyBean = createDummyBean(childActivity);
+ childActivity.addBean(anotherMyBean);
+ }
+
+ @Test(groups = { "ri-broken" }, expectedExceptions = { DeploymentException.class })
+ @SpecAssertion(section="11.6", id="u")
+ public void testSameBeanTypeInChildAsIndirectParentInjection()
+ {
+ Manager childActivity = getCurrentManager().createActivity();
+ Manager grandChildActivity = childActivity.createActivity();
+ Bean<?> anotherMyBean = createDummyBean(grandChildActivity);
+ grandChildActivity.addBean(anotherMyBean);
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.activities.child;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@BindingType
+@interface SpecialBindingType
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-05-11 19:16:40 UTC (rev 2680)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -65,13 +65,13 @@
assert interceptor instanceof AnotherTestInterceptor : "Incorrect return type";
}
- @Test(groups = { "ri-broken", "xml" })
+ @Test(groups = { "xml" })
@SpecAssertions({
@SpecAssertion(section="9.4", id="e")
})
public void testBindingAnnotationOverridenByXML()
{
- assert getCurrentManager().getInstanceByType(BeanWithBindingAnnotation.class, new AnnotationLiteral<TestBindingType>(){}) != null;
+ assert getCurrentManager().getInstanceByType(BeanWithBindingAnnotation.class, new AnnotationLiteral<AnotherTestBindingType>(){}) != null;
}
@Test(groups = { "ri-broken", "xml" })
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java 2009-05-11 19:16:40 UTC (rev 2680)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -23,14 +23,15 @@
@Test
@SpecAssertions({
@SpecAssertion(section="9.12", id="a"),
- @SpecAssertion(section="9.12.1", id="a")
+ @SpecAssertion(section="9.12.1", id="a"),
+ @SpecAssertion(section="11.2", id = "a")
})
public void testDeploymentDeclaration()
{
Manager manager = getCurrentManager();
Set<Bean<Order>> beans = manager.resolveByType(Order.class);
- assert beans.size() == 1 : "There is no one or more than one registered beans with type '" + Order.class + "'";
- assert beans.iterator().next().getDeploymentType().equals(TestDeploymentType.class) : "Deployment type of bean '" + Order.class + "' is not '" + TestDeploymentType.class + "'";
+ assert !beans.isEmpty() : "There are no registered beans of type '" + Order.class + "'";
+ assert beans.iterator().next().getDeploymentType().equals(TestDeploymentType.class) : "Deployment type of bean '" + Order.class.getName() + "' is not '" + TestDeploymentType.class.getName() + "'";
}
}
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-05-11 19:16:40 UTC (rev 2680)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -14,7 +14,7 @@
@Artifact
@Resources({
- @Resource(source="schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd")
+ @Resource(source="foo/schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd")
})
@Classes({
Order.class,
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/resource/ejb/DeclarationOfEjbTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/resource/ejb/DeclarationOfEjbTest.java 2009-05-11 19:16:40 UTC (rev 2680)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/resource/ejb/DeclarationOfEjbTest.java 2009-05-11 19:28:07 UTC (rev 2681)
@@ -51,7 +51,9 @@
@SpecAssertion(section = "6.9", id = "i"),
@SpecAssertion(section = "3.6", id = "d"),
@SpecAssertion(section = "3.6.1", id = "d"),
- @SpecAssertion(section = "3.6.1", id = "i")
+ @SpecAssertion(section = "3.6.1", id = "i"),
+ @SpecAssertion(section = "11.2", id = "e"),
+ @SpecAssertion(section = "11.2", id = "g")
})
public void testXMLDeclarationOfEjb()
{
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2679 - extensions/trunk/servlet/build.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 15:16:09 -0400 (Mon, 11 May 2009)
New Revision: 2679
Modified:
extensions/trunk/servlet/build/pom.xml
Log:
need to switch to snapshot to grab critical changes
Modified: extensions/trunk/servlet/build/pom.xml
===================================================================
--- extensions/trunk/servlet/build/pom.xml 2009-05-11 19:15:18 UTC (rev 2678)
+++ extensions/trunk/servlet/build/pom.xml 2009-05-11 19:16:09 UTC (rev 2679)
@@ -26,6 +26,7 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core</artifactId>
<optional>true</optional>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2678 - examples/trunk/servlet-numberguess.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 15:15:18 -0400 (Mon, 11 May 2009)
New Revision: 2678
Modified:
examples/trunk/servlet-numberguess/pom.xml
Log:
reduce refresh commands into a single explode command
Modified: examples/trunk/servlet-numberguess/pom.xml
===================================================================
--- examples/trunk/servlet-numberguess/pom.xml 2009-05-10 19:53:05 UTC (rev 2677)
+++ examples/trunk/servlet-numberguess/pom.xml 2009-05-11 19:15:18 UTC (rev 2678)
@@ -103,8 +103,7 @@
<userAliases>
<runjetty>compile org.apache.maven.plugins:maven-war-plugin:inplace org.mortbay.jetty:maven-jetty-plugin:run</runjetty>
<runtomcat>compile org.apache.maven.plugins:maven-war-plugin:inplace org.codehaus.mojo:tomcat-maven-plugin:run</runtomcat>
- <refresh-all>compile org.apache.maven.plugins:maven-war-plugin:inplace -o</refresh-all>
- <refresh-web>org.apache.maven.plugins:maven-war-plugin:inplace -o</refresh-web>
+ <explode>compile org.apache.maven.plugins:maven-war-plugin:inplace -o</explode>
</userAliases>
</configuration>
</plugin>
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2677 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2 and 6 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-05-10 15:53:05 -0400 (Sun, 10 May 2009)
New Revision: 2677
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccess.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccessAuthorizationDecorator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DisabledBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/Interceptor1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InterceptorType1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/NotAuthorizedException.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/User.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ManagerObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ObserverFailureInDefinitionPhaseTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ManagerObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ObserverFailureInDeploymentPhaseTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/BindingNotRuntime.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/NotABindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/AnotherFooObserver.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ManagerObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/AfterInitFailureTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/binding/ResolvingChecksBindingTypeMembersTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Some new tests for Section 11 and minor mods to event tests
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/AnotherDeploymentType.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/AnotherDeploymentType.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/AnotherDeploymentType.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccess.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccess.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccess.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+interface DataAccess {
+ public Object load(Object id);
+ public Object getId();
+ public void save();
+ public void delete();
+ public Class<?> getDataType();
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccess.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccessAuthorizationDecorator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccessAuthorizationDecorator.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccessAuthorizationDecorator.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,58 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+import javax.inject.Current;
+
+@Decorator
+class DataAccessAuthorizationDecorator implements DataAccess
+{
+ @Decorates
+ DataAccess delegate;
+
+ @Current
+ User user;
+
+ public void save()
+ {
+ authorize("save");
+ delegate.save();
+ }
+
+ public void delete()
+ {
+ authorize("delete");
+ delegate.delete();
+ }
+
+ private void authorize(String action)
+ {
+ Object id = delegate.getId();
+ Class<?> type = delegate.getDataType();
+ if (user.hasPermission(action, type, id))
+ {
+ System.out.println("Authorized for " + action);
+ }
+ else
+ {
+ System.out.println("Not authorized for " + action);
+ throw new NotAuthorizedException(action);
+ }
+ }
+
+ public Class<?> getDataType()
+ {
+ return delegate.getDataType();
+ }
+
+ public Object getId()
+ {
+ return delegate.getId();
+ }
+
+ public Object load(Object id)
+ {
+ return delegate.load(id);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DataAccessAuthorizationDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -34,10 +34,36 @@
{
@Test
@SpecAssertions({
- @SpecAssertion(section = "11.1", id = "d")
+ @SpecAssertion(section = "11.1", id = "d"),
+ @SpecAssertion(section = "11.1", id = "e"),
+ @SpecAssertion(section = "11.5", id = "b")
})
public void testDeployedManagerEvent()
{
assert ManagerObserver.isManagerDeployed();
+ getCurrentManager().fireEvent("event");
+ assert !getCurrentManager().resolveObservers(getCurrentManager(), new InitializedBinding()).isEmpty();
}
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5", id = "d")
+ })
+ public void testScopesActive()
+ {
+ assert ManagerObserver.isApplicationContextActive();
+ assert ManagerObserver.isRequestContextActive();
+ }
+
+ @Test(groups = { "ri-broken" })
+ @SpecAssertions({
+ @SpecAssertion(section = "11.2", id = "ac")
+ })
+ public void testOnlyEnabledBeansDeployed()
+ {
+ assert !getCurrentManager().resolveByType(User.class).isEmpty();
+ assert getCurrentManager().resolveByType(DisabledBean.class).isEmpty();
+ assert getCurrentManager().resolveByType(Interceptor1.class).isEmpty();
+ assert getCurrentManager().resolveByType(DataAccessAuthorizationDecorator.class).isEmpty();
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DisabledBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DisabledBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DisabledBean.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+@AnotherDeploymentType
+class DisabledBean
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DisabledBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import javax.inject.AnnotationLiteral;
+import javax.inject.manager.Initialized;
+
+class InitializedBinding extends AnnotationLiteral<Initialized> implements Initialized
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/Interceptor1.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/Interceptor1.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/Interceptor1.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+@InterceptorType1
+class Interceptor1
+{
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ return ctx.proceed();
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InterceptorType1.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InterceptorType1.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InterceptorType1.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.Interceptor;
+
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+@Interceptor
+@interface InterceptorType1
+{
+
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ManagerObserver.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ManagerObserver.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ManagerObserver.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -1,5 +1,7 @@
package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+import javax.context.ApplicationScoped;
+import javax.context.RequestScoped;
import javax.event.Observes;
import javax.inject.manager.Deployed;
import javax.inject.manager.Initialized;
@@ -9,16 +11,22 @@
{
private static boolean managerInitialized = false;
private static boolean managerDeployed = false;
+ private static boolean requestContextActive = false;
+ private static boolean applicationContextActive = false;
public void managerInitialized(@Observes @Initialized Manager manager)
{
managerInitialized = true;
+ requestContextActive = manager.getContext(RequestScoped.class).isActive();
+ applicationContextActive = manager.getContext(ApplicationScoped.class).isActive();
}
public void managerDeployed(@Observes @Deployed Manager manager)
{
assert managerInitialized : "Manager should have been initialized before deployed";
managerDeployed = true;
+ requestContextActive &= manager.getContext(RequestScoped.class).isActive();
+ applicationContextActive &= manager.getContext(ApplicationScoped.class).isActive();
}
public static boolean isManagerInitialized()
@@ -40,4 +48,24 @@
{
ManagerObserver.managerDeployed = managerDeployed;
}
+
+ public static boolean isRequestContextActive()
+ {
+ return requestContextActive;
+ }
+
+ public static void setRequestContextActive(boolean requestContextActive)
+ {
+ ManagerObserver.requestContextActive = requestContextActive;
+ }
+
+ public static boolean isApplicationContextActive()
+ {
+ return applicationContextActive;
+ }
+
+ public static void setApplicationContextActive(boolean applicationContextActive)
+ {
+ ManagerObserver.applicationContextActive = applicationContextActive;
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/NotAuthorizedException.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/NotAuthorizedException.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/NotAuthorizedException.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+class NotAuthorizedException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public NotAuthorizedException(String message, Throwable cause)
+ {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public NotAuthorizedException(String message)
+ {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/NotAuthorizedException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/User.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/User.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/User.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+class User
+{
+
+ public boolean hasPermission(String action, Class<?> type, Object id)
+ {
+ return false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/User.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/AfterInitFailureTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/AfterInitFailureTest.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/AfterInitFailureTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -40,7 +40,8 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "11.1", id = "b"),
- @SpecAssertion(section = "11.1", id = "c")
+ @SpecAssertion(section = "11.1", id = "c"),
+ @SpecAssertion(section = "11.5", id = "a")
})
public void testDeploymentFailsAfterInitialization()
{
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ManagerObserver.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail/ManagerObserver.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ManagerObserver.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ManagerObserver.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.fail3;
+
+import javax.event.Observes;
+import javax.inject.manager.Initialized;
+import javax.inject.manager.Manager;
+
+class ManagerObserver
+{
+ public void managerInitialized(@Observes @Initialized Manager manager)
+ {
+ assert false : "This error should be turned into a DefinitionException";
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ObserverFailureInDefinitionPhaseTest.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail/DeploymentFailureTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ObserverFailureInDefinitionPhaseTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail3/ObserverFailureInDefinitionPhaseTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.fail3;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.testng.annotations.Test;
+
+/**
+ * Tests that any failure in an observer observing the @AfterBeanDiscovery
+ * event results in a DefinitionException.
+
+ * @author David Allen
+ *
+ */
+@Artifact
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class ObserverFailureInDefinitionPhaseTest extends AbstractJSR299Test
+{
+ @Test(groups = { "ri-broken" })
+ @SpecAssertion(section = "11.5", id = "aa")
+ public void testObserverFailureRaisesDefinitionException()
+ {
+ assert false;
+ }
+
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ManagerObserver.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/ManagerObserver.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ManagerObserver.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ManagerObserver.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.fail4;
+
+import javax.event.Observes;
+import javax.inject.manager.Deployed;
+import javax.inject.manager.Manager;
+
+class ManagerObserver
+{
+ public void managerDeployed(@Observes @Deployed Manager manager)
+ {
+ assert false : "This error should result in a DeploymentException";
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ObserverFailureInDeploymentPhaseTest.java (from rev 2664, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail2/AfterInitFailureTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ObserverFailureInDeploymentPhaseTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ObserverFailureInDeploymentPhaseTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.fail4;
+
+import javax.inject.DeploymentException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.testng.annotations.Test;
+
+/**
+ * Tests that any failure in an observer observing the @AfterDependencyValidation
+ * event results in a DeploymentException.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+(a)ExpectedDeploymentException(DeploymentException.class)
+public class ObserverFailureInDeploymentPhaseTest extends AbstractJSR299Test
+{
+ @Test(groups = { "ri-broken" })
+ @SpecAssertion(section = "11.5", id = "ba")
+ public void testDeploymentFailsAfterInitialization()
+ {
+ assert false;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/fail4/ObserverFailureInDeploymentPhaseTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/BindingNotRuntime.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/BindingNotRuntime.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/BindingNotRuntime.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { FIELD, PARAMETER })
+@BindingType
+@interface BindingNotRuntime
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/BindingNotRuntime.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -7,6 +7,7 @@
import javax.context.Dependent;
import javax.event.Event;
import javax.event.Observer;
+import javax.inject.AnnotationLiteral;
import javax.inject.DuplicateBindingTypeException;
import javax.inject.Standard;
import javax.inject.TypeLiteral;
@@ -89,11 +90,11 @@
*
* @Retention(RUNTIME)~
*/
- @Test(groups = { "events", "stub" })
+ @Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "d") })
public void testEventBindingTypeTargetMostAndRuntime()
{
- assert false;
+ getCurrentManager().fireEvent("event", new TameAnnotationLiteral());
}
/**
@@ -102,32 +103,31 @@
*
* @Retention(RUNTIME)~
*/
- @Test(groups = { "events", "stub" })
+ @Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "e") })
public void testEventBindingTypeTargetsFieldParameterAndRuntime()
{
- assert false;
+ getCurrentManager().fireEvent("event", new RoleBinding("Admin"));
}
/**
* An event binding type is a Java annotation defined as ~@Target({FIELD,
* PARAMETER}) or @Target({METHOD, FIELD, PARAMETER, TYPE}) and
- * ~@Retention(RUNTIME) TODO If the binding does not have RUNTIME retention,
- * it cannot be tested
+ * ~@Retention(RUNTIME)
*/
- @Test(groups = { "events", "stub" })
+ @Test(groups = { "events", "ri-broken" }, expectedExceptions = { IllegalArgumentException.class } )
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "f") })
public void testEventBindingTypeNotRuntime()
{
- assert false;
+ //TODO This should throw an exception since by definition this is not an event binding type
+ getCurrentManager().fireEvent("event", new AnnotationLiteral<BindingNotRuntime>(){});
}
- // TODO How to test all annotations w/o BindingType are not event bindings
- @Test(groups = { "events", "underInvestigation" })
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class } )
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "g") })
public void testEventBindingTypesSpecifyBinding()
{
- assert false;
+ getCurrentManager().fireEvent("event", new AnnotationLiteral<NotABindingType>(){});
}
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@@ -142,8 +142,6 @@
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "b"), @SpecAssertion(section = "7.2", id = "c") })
public void testManagerFireEventWithEventTypeWildcardsFails()
{
- // Although the above test is really the same as with a wildcard,
- // we will test it anyhow since the specification calls it out separately.
ATemplatedEventType<?> anEventOnAnyType = new ATemplatedEventType<String>();
getCurrentManager().fireEvent(anEventOnAnyType);
}
@@ -253,7 +251,11 @@
}
@Test(groups = { "events" })
- @SpecAssertions( { @SpecAssertion(section = "7.5", id = "a"), @SpecAssertion(section = "7.5.2", id = "a")} )
+ @SpecAssertions( {
+ @SpecAssertion(section = "7.5", id = "a"),
+ @SpecAssertion(section = "7.5.2", id = "a"),
+ @SpecAssertion(section = "11.2", id = "af")
+ })
public void testObserverMethodAutomaticallyRegistered()
{
assert !getCurrentManager().resolveObservers("event").isEmpty();
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/NotABindingType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/NotABindingType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/NotABindingType.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target( { FIELD, PARAMETER })
+@Retention(RUNTIME)
+@interface NotABindingType
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/NotABindingType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/binding/ResolvingChecksBindingTypeMembersTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/binding/ResolvingChecksBindingTypeMembersTest.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/binding/ResolvingChecksBindingTypeMembersTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -36,5 +36,7 @@
getCurrentManager().addObserver(anotherObserver, AnEventType.class, new BindingTypeCBinding("second-observer"));
Set<Observer<AnEventType>> resolvedObservers = getCurrentManager().resolveObservers(new AnEventType(), new BindingTypeCBinding("first-observer"));
assert resolvedObservers.size() == 1;
+ resolvedObservers = getCurrentManager().resolveObservers(new AnEventType(), new BindingTypeCBinding("second-observer"));
+ assert resolvedObservers.size() == 1;
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/AnotherFooObserver.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/AnotherFooObserver.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/AnotherFooObserver.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.event.resolve.type;
+
+import javax.event.Observes;
+
+public class AnotherFooObserver
+{
+
+ public void observe(@Observes Foo<Integer> foo)
+ {
+ foo.setObserved(true);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/AnotherFooObserver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -16,11 +16,13 @@
public static class AList extends ArrayList<String>
{
+ private static final long serialVersionUID = 1L;
}
public static class AnotherList extends ArrayList<Integer>
{
+ private static final long serialVersionUID = 1L;
}
@@ -50,12 +52,8 @@
{
AListObserver observer = new AListObserver();
AnotherListObserver anotherObserver = new AnotherListObserver();
- getCurrentManager().addObserver(observer, new TypeLiteral<ArrayList<String>>()
- {
- });
- getCurrentManager().addObserver(anotherObserver, new TypeLiteral<ArrayList<Integer>>()
- {
- });
+ getCurrentManager().addObserver(observer, new TypeLiteral<ArrayList<String>>(){});
+ getCurrentManager().addObserver(anotherObserver, new TypeLiteral<ArrayList<Integer>>(){});
assert getCurrentManager().resolveObservers(new AList()).size() == 1;
assert getCurrentManager().resolveObservers(new AList()).iterator().next().getClass().equals(AListObserver.class);
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java 2009-05-10 19:53:05 UTC (rev 2677)
@@ -12,6 +12,7 @@
public void setObserved(boolean observed)
{
+ assert !this.observed : "Event should only be observed once";
this.observed = observed;
}
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-05-10 10:50:03 UTC (rev 2676)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-05-10 19:53:05 UTC (rev 2677)
@@ -3352,9 +3352,8 @@
<text>An event binding type is a Java annotation defined as ~|@Target({FIELD, PARAMETER})| or~ |@Target({METHOD, FIELD, PARAMETER, TYPE})| ~and |@Retention(RUNTIME)|~</text>
</assertion>
- <assertion id="f" testable="false">
+ <assertion id="f">
<text>An event binding type is a Java annotation defined as ~|@Target({FIELD, PARAMETER})| or |@Target({METHOD, FIELD, PARAMETER, TYPE})| and ~|@Retention(RUNTIME)|</text>
- <note>The compiler discards non-runtime-retention annotation</note>
</assertion>
<assertion id="g">
@@ -4843,8 +4842,30 @@
</assertion>
</section>
- <section id="11.4" title="Providing additional XML based metadata">
-
+ <section id="11.5" title="Initialization and Deployment Events">
+ <assertion id="a">
+ <text>Container fires event of type Manager with binding type @Initialized after bean discovery but before deployment problems are detected.</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>The container must fire a second event of type Manager with binding type @Deployed after it has validated that there are no deployment problems and before the deployment begins processing requests.</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>The container must not allow any request to be processed by the deployment until all observers of this event return.</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>The request and application contexts are active when these events are fired.</text>
+ </assertion>
+
+ <assertion id="aa">
+ <text>If any observer method of the @Initialized event throws an exception, the exception is treated as a definition error by the container.</text>
+ </assertion>
+
+ <assertion id="ba">
+ <text> f any observer method of the @Deployed event throws an exception, the exception is treated as a deployment problem by the container.</text>
+ </assertion>
</section>
<section id="11.6" title="Activities">
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2676 - doc/trunk/reference/it-IT.
by webbeans-commits@lists.jboss.org
Author: nico.ben
Date: 2009-05-10 06:50:03 -0400 (Sun, 10 May 2009)
New Revision: 2676
Modified:
doc/trunk/reference/it-IT/gettingstarted.po
doc/trunk/reference/it-IT/viewlayers.po
Log:
Italian translation
Modified: doc/trunk/reference/it-IT/gettingstarted.po
===================================================================
--- doc/trunk/reference/it-IT/gettingstarted.po 2009-05-09 03:16:05 UTC (rev 2675)
+++ doc/trunk/reference/it-IT/gettingstarted.po 2009-05-10 10:50:03 UTC (rev 2676)
@@ -6,7 +6,7 @@
"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-05-05 20:42+0000\n"
-"PO-Revision-Date: 2009-05-05 22:50+0100\n"
+"PO-Revision-Date: 2009-05-10 12:48+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -1010,7 +1010,7 @@
#: gettingstarted.xml:541
#, no-c-format
msgid "Running the example from the command line in JBoss AS or Tomcat"
-msgstr ""
+msgstr "Eseguire l'esempio da linea di comando in JBoss AS o Tomcat"
#. Tag: para
#: gettingstarted.xml:543
@@ -1088,7 +1088,7 @@
#: gettingstarted.xml:602
#, no-c-format
msgid "The <literal>Game</literal> bean is can then be used, for example, by the code for submitting a guess:"
-msgstr ""
+msgstr "Il bean <literal>Game</literal> può essere usato, per esempio, da codice per inviare un tentativo:"
#. Tag: programlisting
#: gettingstarted.xml:607
@@ -1124,7 +1124,7 @@
#: gettingstarted.xml:634
#, no-c-format
msgid "In order to activate wicket for this webapp, the Wicket filter is added to web.xml, and our application class is specified:"
-msgstr ""
+msgstr "Per attivare wicket per questa webapp, il filtro Wicket viene aggiunto a web.xml, e viene specificata la classe di applicazione:"
#. Tag: programlisting
#: gettingstarted.xml:639
@@ -1182,7 +1182,7 @@
#: gettingstarted.xml:655
#, no-c-format
msgid "This example can be found in the <literal>examples/se/numberguess</literal> folder of the Web Beans distribution."
-msgstr ""
+msgstr "Quest'esempio può essere trovato nella cartella <literal>examples/se/numberguess</literal> della distribuzione Web Beans."
#. Tag: para
#: gettingstarted.xml:662
@@ -1194,19 +1194,19 @@
#: gettingstarted.xml:668
#, no-c-format
msgid "Open a command line/terminal window in the <literal>examples/se/numberguess</literal> directory"
-msgstr ""
+msgstr "Aprire una finestra di terminale/linea di comando nella directory <literal>examples/se/numberguess</literal>"
#. Tag: para
#: gettingstarted.xml:674
#, no-c-format
msgid "Ensure that Maven 2 is installed and in your PATH"
-msgstr ""
+msgstr "Assicurarsi che Maven 2 sia installato e presente nel PATH"
#. Tag: para
#: gettingstarted.xml:679
#, no-c-format
msgid "Ensure that the <literal>JAVA_HOME</literal> environment variable is pointing to your JDK installation"
-msgstr ""
+msgstr "Assicurarsi che la variabile d'ambiente <literal>JAVA_HOME</literal> punti alla propria installazione JDK"
#. Tag: para
#: gettingstarted.xml:685
Modified: doc/trunk/reference/it-IT/viewlayers.po
===================================================================
--- doc/trunk/reference/it-IT/viewlayers.po 2009-05-09 03:16:05 UTC (rev 2675)
+++ doc/trunk/reference/it-IT/viewlayers.po 2009-05-10 10:50:03 UTC (rev 2676)
@@ -6,7 +6,7 @@
"Project-Id-Version: Web_Beans:_Java_Contexts_and_Dependency_Injection VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-04-19 20:36+0000\n"
-"PO-Revision-Date: 2009-05-05 22:40+0100\n"
+"PO-Revision-Date: 2009-05-10 12:43+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -35,13 +35,13 @@
#: viewlayers.xml:12
#, no-c-format
msgid "Each wicket application must have a <literal>WebApplication</literal> subclass; Web Beans provides, for your utility, a subclass of this which sets up the Wicket/JSR-299 integration. You should subclass <literal>org.jboss.webbeans.wicket.WebBeansApplication</literal>."
-msgstr ""
+msgstr "Ogni applicazione wicket deve avere una sottoclasse <literal>WebApplication</literal>; Web Beans fornisce un sottoclasse che imposta l'integrazione Wicket/JSR-299. Occorre estendere <literal>org.jboss.webbeans.wicket.WebBeansApplication</literal>."
#. Tag: para
#: viewlayers.xml:21
#, no-c-format
msgid "If you would prefer not to subclass <literal>WebBeansApplication</literal>, you can manually add a (small!) number of overrides and listeners to your own <literal>WebApplication</literal> subclass. The javadocs of <literal>WebBeansApplication</literal>detail this."
-msgstr ""
+msgstr "Se si preferisce non estendere <literal>WebBeansApplication</literal>, si può aggiungere manualmente un (piccolo!) numero di override e listener alla propria sottoclasse <literal>WebApplication</literal>. Il Javadoc di <literal>WebBeansApplication</literal> illustra questo."
#. Tag: para
#: viewlayers.xml:30
@@ -77,31 +77,31 @@
#: viewlayers.xml:38
#, no-c-format
msgid "The conversation scope can be used in Web Beans with the Apache Wicket web framework, through the <literal>webbeans-wicket</literal> module. This module takes care of:"
-msgstr ""
+msgstr "In Web Beans lo scope conversazione può essere usato assieme al framework web Apache Wicket attraverso il modulo <literal>webbeans-wicket</literal>. Questo modulo si preoccupa di:"
#. Tag: para
#: viewlayers.xml:45
#, no-c-format
msgid "Setting up the conversation context at the beginning of a Wicket request, and tearing it down afterwards"
-msgstr ""
+msgstr "Impostare il contesto conversazione all'inizio di una richiesta Wicket, e distruggerlo più avanti"
#. Tag: para
#: viewlayers.xml:51
#, no-c-format
msgid "Storing the id of any long-running conversation in Wicket's metadata when the page response is complete"
-msgstr ""
+msgstr "Memorizzare l'id di qualsiasi conversazione long-running nei metadati Wicket quando è completa la risposta della pagina"
#. Tag: para
#: viewlayers.xml:57
#, no-c-format
msgid "Activating the correct long-running conversation based upon which page is being accessed"
-msgstr ""
+msgstr "Attivare la corretta conversazione long-running in base a quale pagine viene acceduta"
#. Tag: para
#: viewlayers.xml:63
#, no-c-format
msgid "Propagating the conversation context for any long-running conversation to new pages"
-msgstr ""
+msgstr "Propagare il contesto conversazione per ogni conversazione long-running nelle nuove pagine"
#. Tag: title
#: viewlayers.xml:70
@@ -113,7 +113,7 @@
#: viewlayers.xml:71
#, no-c-format
msgid "As JSF applications, a conversation <emphasis>always</emphasis> exists for any request, but its lifetime is only that of the current request unless it is marked as <emphasis>long-running</emphasis>. For Wicket applications this is accomplished as in JSF applications, by injecting the <literal>@Current Conversation</literal> and then invoking <literal>conversation.begin()</literal>. Likewise, conversations are ended with <literal>conversation.end()</literal>"
-msgstr ""
+msgstr "Come per le applicazioni JSF, esiste <emphasis>sempre</emphasis> una conversazione per ogni richiesta, ma il suo ciclo di vita è solo quello della richiesta corrente amenoché sia marcata come <emphasis>long-running</emphasis>. Per le applicazioni Wicket questo viene attuato come nelle applicazioni JSF, iniettando <literal>@Current Conversation</literal> e poi invocando <literal>conversation.begin()</literal>. Similmente le conversazioni vengono terminate con <literal>conversation.end()</literal>."
#. Tag: title
#: viewlayers.xml:85
@@ -125,5 +125,5 @@
#: viewlayers.xml:86
#, no-c-format
msgid "When a conversation is marked as long-running, the id of that conversation will be stored in Wicket's metadata for the current page. If a new page is created and set as the response target through <literal>setResponsePage</literal>, this new page will also participate in this conversation. This occurs for both directly instantiated pages (<literal>setResponsePage(new OtherPage())</literal>), as well as for bookmarkable pages created with <literal>setResponsePage(OtherPage.class)</literal> where <literal>OtherPage.class</literal> is mounted as bookmarkable from your <literal>WebApplication</literal> subclass (or through annotations). In the latter case, because the new page instance is not created until after a redirect, the conversation id will be propagated through a request parameter, and then stored in page metadata after the redirect."
-msgstr ""
+msgstr "Quando una conversazione è marcata come long-running, l'id di tale conversazione verrà memorizzato nei metadati di Wicket per la pagina corrente. Se viene creatauna nuova pagina ed impostato il target della risposta attraverso <literal>setResponsePage</literal>, anche questa nuova pagina parteciperà alla conversazione. Questo avviene per entrambe le pagine istanziate direttamente (<literal>setResponsePage(new OtherPage())</literal>), come pure per le pagine segnalibro create con <literal>setResponsePage(OtherPage.class)</literal> dove <literal>OtherPage.class</literal> è messa come bookmarkable dalla sottoclasse (o tramite annotazioni) <literal>WebApplication</literal>. Nell'ultimo caso, l'id della conversazione verrà propagato attraverso un parametro di richiesta, e poi memorizzato nei metadati della pagina dopo il redirect."
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2675 - extensions/trunk/logger.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-08 23:16:05 -0400 (Fri, 08 May 2009)
New Revision: 2675
Modified:
extensions/trunk/logger/pom.xml
Log:
299 API should be marked as provided
Modified: extensions/trunk/logger/pom.xml
===================================================================
--- extensions/trunk/logger/pom.xml 2009-05-08 15:13:24 UTC (rev 2674)
+++ extensions/trunk/logger/pom.xml 2009-05-09 03:16:05 UTC (rev 2675)
@@ -33,6 +33,7 @@
<dependency>
<groupId>org.jboss.webbeans</groupId>
<artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2674 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-05-08 11:13:24 -0400 (Fri, 08 May 2009)
New Revision: 2674
Modified:
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/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/schema/foo/Order.java
ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/parser/user-defined-beans.xml
Log:
implement <Array> for method parameters
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-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-05-08 15:13:24 UTC (rev 2674)
@@ -324,7 +324,7 @@
return result;
}
- public static AnnotatedClass<?> obtainArrayType(Element arrayElement, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
+ private static AnnotatedClass<?> obtainArrayType(Element arrayElement, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
{
AnnotatedClass<?> arrayType = null;
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-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-05-08 15:13:24 UTC (rev 2674)
@@ -76,7 +76,6 @@
Document document = createDocument(url);
if (document != null)
{
- parseForArrays(document);
parseForAnnotationTypes(document);
parseForDeploy(document);
parseForBeans(document);
@@ -84,26 +83,6 @@
}
}
- private void parseForArrays(Document document)
- {
- Element root = document.getRootElement();
- checkChildrenForArray(root);
- }
-
- private void checkChildrenForArray(Element element)
- {
- Iterator<?> childIterator = element.elementIterator();
- while (childIterator.hasNext())
- {
- Element child = (Element) childIterator.next();
-
- if (XmlConstants.ARRAY.equalsIgnoreCase(child.getName()))
- ParseXmlHelper.obtainArrayType(child, environment, packagesMap);
- else
- checkChildrenForArray(child);
- }
- }
-
private void parseForAnnotationTypes(Document document)
{
Element root = document.getRootElement();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java 2009-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/AbstractBeanChildrenChecker.java 2009-05-08 15:13:24 UTC (rev 2674)
@@ -18,7 +18,6 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -45,6 +44,9 @@
import org.dom4j.Namespace;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
import org.jboss.webbeans.xml.ParseXmlHelper;
import org.jboss.webbeans.xml.XmlConstants;
import org.jboss.webbeans.xml.XmlEnvironment;
@@ -55,7 +57,7 @@
private Set<AnnotatedField<?>> beanFields;
- private List<Method> beanMethods;
+ private List<AnnotatedMethod<?>> beanMethods;
private boolean haveBeanDeploymentTypeDeclaration = false;
@@ -87,7 +89,11 @@
public void checkChildren(Element beanElement, AnnotatedClass<?> beanClass)
{
beanFields = beanClass.getFields();
- beanMethods = Arrays.asList(beanClass.getRawType().getDeclaredMethods());
+ beanMethods = new ArrayList<AnnotatedMethod<?>>();
+ for (Method method : beanClass.getRawType().getDeclaredMethods())
+ {
+ beanMethods.add(AnnotatedMethodImpl.of(method, beanClass));
+ }
checkForInterceptorChild(beanElement);
checkForDecoratorChild(beanElement);
@@ -108,7 +114,8 @@
private void checkBeanChild(Element beanChildElement, AnnotatedClass<?> beanClass)
{
- if (XmlConstants.ARRAY.equalsIgnoreCase(beanChildElement.getName()))
+ if (ParseXmlHelper.isJavaEeNamespace(beanChildElement) &&
+ XmlConstants.ARRAY.equalsIgnoreCase(beanChildElement.getName()))
{
// bean child element declaring an array parameter of the bean constructor
AnnotatedClass<?> array = ParseXmlHelper.obtainArray(beanChildElement, environment, packagesMap);
@@ -215,10 +222,14 @@
}
}
- for (Method method : beanMethods)
+ AnnotatedMethod<?> beanMethod = null;
+ for (AnnotatedMethod<?> method : beanMethods)
{
if (method.getName().equalsIgnoreCase(beanChildElement.getName()))
+ {
isMethod = true;
+ beanMethod = method;
+ }
}
if (isField && isMethod)
@@ -233,7 +244,7 @@
if (isMethod)
{
- checkMethodChild(beanChildElement, beanClass);
+ checkMethodChild(beanChildElement, beanMethod, beanClass);
return;
}
@@ -259,8 +270,52 @@
}
- private void checkMethodChild(Element beanChildElement, AnnotatedClass<?> beanClass)
- {
- // TODO: not finished
+ private void checkMethodChild(Element methodElement, AnnotatedMethod<?> beanMethod, AnnotatedClass<?> beanClass)
+ {// TODO: not finished
+ List<AnnotatedClass<?>> methodParameters = new ArrayList<AnnotatedClass<?>>();
+
+ Iterator<?> elIterator = methodElement.elementIterator();
+ while (elIterator.hasNext())
+ {
+ Element methodChildElement = (Element)elIterator.next();
+
+ if (ParseXmlHelper.isJavaEeNamespace(methodChildElement) &&
+ XmlConstants.ARRAY.equalsIgnoreCase(methodChildElement.getName()))
+ {
+ // method child element declaring an array parameter of the method
+ AnnotatedClass<?> array = ParseXmlHelper.obtainArray(methodChildElement, environment, packagesMap);
+ methodParameters.add(array);
+ }
+ else{
+ AnnotatedClass<?> methodChildClass = ParseXmlHelper.loadElementClass(methodChildElement, Object.class, environment, packagesMap);
+ Class<?> methodChildType = methodChildClass.getRawType();
+ boolean isJavaClass = !methodChildType.isEnum() && !methodChildType.isPrimitive() && !methodChildType.isInterface();
+ boolean isInterface = methodChildType.isInterface() && !methodChildType.isAnnotation();
+ if(isJavaClass || isInterface)
+ {
+ // method child element declaring a parameter of the method
+ methodParameters.add(methodChildClass);
+ }
+ }
+ }
+
+ List<? extends AnnotatedParameter<?>> parameters = beanMethod.getParameters();
+ if (methodParameters.size() != parameters.size())
+ throw new DefinitionException("Bean '" + beanClass.getName() + "' don't have metod with the same number of parameters as declared");
+
+ for (int i = 0; i < parameters.size(); i++)
+ {
+ if (!parameters.get(i).isAssignableFrom(methodParameters.get(i)))
+ throw new DefinitionException("Bean '" + beanClass.getName() + "' don't have metod with same types of parameters as declared");
+ }
}
+
+
+
+
+
+
+
+
+
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java 2009-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java 2009-05-08 15:13:24 UTC (rev 2674)
@@ -35,7 +35,7 @@
)
public class XmlParserImplTest extends AbstractWebBeansTest
{
- //@Test
+// @Test
public void testParse()
{
XmlEnvironment parserEnv = new MockXmlEnvironment(getResources("beans.xml"), new EjbDescriptorCache());
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/schema/foo/Order.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/schema/foo/Order.java 2009-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/schema/foo/Order.java 2009-05-08 15:13:24 UTC (rev 2674)
@@ -29,4 +29,9 @@
{
return this.strArr;
}
+
+ public void setStrArr(String[] strArr)
+ {
+ this.strArr = strArr;
+ }
}
Modified: ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/parser/user-defined-beans.xml
===================================================================
--- ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/parser/user-defined-beans.xml 2009-05-08 05:54:32 UTC (rev 2673)
+++ ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/parser/user-defined-beans.xml 2009-05-08 15:13:24 UTC (rev 2674)
@@ -35,6 +35,11 @@
<Array>
<String />
</Array>
+ <myapp:setStrArr>
+ <Array>
+ <String />
+ </Array>
+ </myapp:setStrArr>
</myapp:Order>
<!--
<myapp:PaymentService>
15 years, 9 months