[webbeans-commits] Webbeans SVN: r1391 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck: integration/implementation/enterprise and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-02 17:23:54 -0500 (Mon, 02 Feb 2009)
New Revision: 1391
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/SpecVersion.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/MyCreationalContext.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java
Log:
Updated some enterprise bean and dependent context tests to match assertions in PRD2.
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/SpecVersion.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/SpecVersion.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/SpecVersion.java 2009-02-02 22:23:54 UTC (rev 1391)
@@ -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.tck.impl;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Documented
+(a)Target(ElementType.TYPE)
+public @interface SpecVersion
+{
+ String value();
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/SpecVersion.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-02-02 21:23:55 UTC (rev 1390)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-02-02 22:23:54 UTC (rev 1391)
@@ -2,20 +2,22 @@
import org.jboss.webbeans.tck.AbstractTest;
import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
import org.testng.annotations.Test;
/**
* Sections
*
- * 6.5. Lifecycle of stateful session beans 6.6. Lifecycle of stateless session
- * and singleton beans 6.11. Lifecycle of EJBs
+ * 6.5. Lifecycle of stateful session beans
+ * 6.6. Lifecycle of stateless session and singleton beans
+ * 6.11. Lifecycle of EJBs
*
* Mostly overlapping with other tests...
*
* @author Nicklas Karlsson
*
- * Spec version: PRD2
*/
+@SpecVersion("PRD2")
public class EnterpriseBeanLifecycleTest extends AbstractTest
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java 2009-02-02 21:23:55 UTC (rev 1390)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/DependentContextTest.java 2009-02-02 22:23:54 UTC (rev 1391)
@@ -2,8 +2,6 @@
import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.Set;
import javax.context.Context;
@@ -13,17 +11,15 @@
import org.jboss.webbeans.tck.AbstractTest;
import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.util.MockCreationalContext;
+import org.jboss.webbeans.tck.impl.SpecVersion;
import org.testng.annotations.Test;
-/**
- * Spec version: PRD2
- */
+@SpecVersion("PRD2")
public class DependentContextTest extends AbstractTest
{
/**
- * No injected instance of the (@Dependent-scoped) Web Bean is ever shared between multiple
- * injection points.
+ * No injected instance of the (@Dependent-scoped) Web Bean is ever shared
+ * between multiple injection points.
*/
@Test(groups = { "contexts", "injection" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -37,21 +33,32 @@
assert foxRunBeans.size() == 1;
Bean<FoxRun> foxRunBean = foxRunBeans.iterator().next();
manager.addBean(foxBean);
- FoxRun foxRun = foxRunBean.create(new MockCreationalContext<FoxRun>());
+ FoxRun foxRun = foxRunBean.create(new MyCreationalContext<FoxRun>());
assert !foxRun.fox.equals(foxRun.anotherFox);
}
/**
- * Any instance of the (@Dependent-scoped) Web Bean that is used to evaluate a Unified EL
- * expression exists to service that evaluation only.
+ * Any injected instance of the (@Dependent scoped) bean is bound to the
+ * lifecycle of the bean, servlet or EJB into which it is injected.
*/
- @Test(groups = { "contexts", "el"})
+ @Test(groups = { "contexts", "el", "stub" })
@SpecAssertion(section = "8.3", id = "unknown")
+ public void testDependentBeansBoundToLifecycleOfContainingBean()
+ {
+ assert false;
+ }
+
+ /**
+ * Any instance of the (@Dependent scoped) bean that is used to evaluate a
+ * Unified EL expression exists to service that evaluation only.
+ */
+ @Test(groups = { "contexts", "el" })
+ @SpecAssertion(section = "8.3", id = "unknown")
public void testInstanceUsedForElEvaluationNotShared() throws Exception
- {
+ {
deployBeans(Fox.class);
new RunInDependentContext()
- {
+ {
@Override
protected void execute() throws Exception
{
@@ -64,13 +71,13 @@
Fox fox2 = configuration().getContainers().evaluateValueExpression("#{fox}", Fox.class);
assert !fox1.equals(fox2);
}
- }.run();
+ }.run();
}
/**
- * Any instance of the (@Dependent-scoped) Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
+ * Any instance of the (@Dependent scoped) bean that receives a producer
+ * method, producer field, disposal method or observer method invocation
+ * exists to service that invocation only.
*/
@Test(groups = { "contexts", "producerMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -78,17 +85,17 @@
{
deployBeans(SpiderProducer.class);
Bean<Tarantula> tarantulaBean = manager.resolveByType(Tarantula.class).iterator().next();
- Tarantula tarantula = tarantulaBean.create(new MockCreationalContext<Tarantula>());
- Tarantula tarantula2 = tarantulaBean.create(new MockCreationalContext<Tarantula>());
+ Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
+ Tarantula tarantula2 = tarantulaBean.create(new MyCreationalContext<Tarantula>());
assert tarantula != null;
assert tarantula2 != null;
assert tarantula != tarantula2;
}
/**
- * Any instance of the (@Dependent-scoped) Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
+ * Any instance of the (@Dependent-scoped) Web Bean that receives a producer
+ * method, producer field, disposal method or observer method invocation
+ * exists to service that invocation only
*/
@Test(groups = { "contexts", "producerMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -96,17 +103,17 @@
{
deployBeans(OtherSpiderProducer.class);
Bean<Tarantula> tarantulaBean = manager.resolveByType(Tarantula.class).iterator().next();
- Tarantula tarantula = tarantulaBean.create(new MockCreationalContext<Tarantula>());
- Tarantula tarantula2 = tarantulaBean.create(new MockCreationalContext<Tarantula>());
+ Tarantula tarantula = tarantulaBean.create(new MyCreationalContext<Tarantula>());
+ Tarantula tarantula2 = tarantulaBean.create(new MyCreationalContext<Tarantula>());
assert tarantula != null;
assert tarantula2 != null;
assert tarantula != tarantula2;
}
/**
- * Any instance of the (@Dependent-scoped) Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
+ * Any instance of the (@Dependent-scoped) Web Bean that receives a producer
+ * method, producer field, disposal method or observer method invocation
+ * exists to service that invocation only
*/
@Test(groups = { "stub", "contexts", "disposalMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -116,9 +123,9 @@
}
/**
- * Any instance of the (@Dependent-scoped) Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
+ * Any instance of the (@Dependent-scoped) Web Bean that receives a producer
+ * method, producer field, disposal method or observer method invocation
+ * exists to service that invocation only
*/
@Test(groups = { "stub", "contexts", "observerMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -129,17 +136,16 @@
/**
* Every invocation of the get() operation of the Context object for the @Dependent
- * scope with the value true for the create parameter returns a new instance
- * of the given Web Bean
+ * scope with a CreationalContext re- turns a new instance of the given bean.
*/
@Test(groups = "contexts")
@SpecAssertion(section = "8.3", id = "unknown")
- public void testContextGetWithCreateTrueReturnsNewInstance() throws Exception
+ public void testContextGetWithCreateTrueReturnsNewInstance() throws Exception
{
deployBeans(Fox.class);
new RunInDependentContext()
{
-
+
@Override
protected void execute() throws Exception
{
@@ -147,16 +153,16 @@
assert foxBeans.size() == 1;
Bean<Fox> foxBean = foxBeans.iterator().next();
Context context = manager.getContext(Dependent.class);
- assert context.get(foxBean, new MockCreationalContext<Fox>()) != null;
- assert context.get(foxBean, new MockCreationalContext<Fox>()) instanceof Fox;
+ assert context.get(foxBean, new MyCreationalContext<Fox>()) != null;
+ assert context.get(foxBean, new MyCreationalContext<Fox>()) instanceof Fox;
}
-
+
}.run();
}
/**
* Every invocation of the get() operation of the Context object for the @Dependent
- * scope with the value false for the create parameter returns a null value
+ * scope with no CreationalContext re- turns a null value.
*/
@Test(groups = "contexts")
@SpecAssertion(section = "8.3", id = "unknown")
@@ -165,7 +171,7 @@
deployBeans(Fox.class);
new RunInDependentContext()
{
-
+
@Override
protected void execute() throws Exception
{
@@ -175,14 +181,14 @@
Context context = manager.getContext(Dependent.class);
assert context.get(foxBean, null) == null;
}
-
+
}.run();
}
/**
* The @Dependent scope is inactive except:
*/
- @Test(groups = {"contexts"}, expectedExceptions = ContextNotActiveException.class)
+ @Test(groups = { "contexts" }, expectedExceptions = ContextNotActiveException.class)
@SpecAssertion(section = "8.3", id = "unknown")
public void testContextIsInactive()
{
@@ -190,9 +196,9 @@
}
/**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
+ * when an instance of a bean with scope @Dependent is created by the
+ * container to receive a producer method, producer field, disposal method or
+ * observer method invocation, or
*/
@Test(groups = { "stub", "contexts", "producerMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -202,22 +208,22 @@
}
/**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
+ * when an instance of a bean with scope @Dependent is created by the
+ * container to receive a producer method, producer field, disposal method or
+ * observer method invocation, or
*/
@Test(groups = { "stub", "contexts", "producerField" })
@SpecAssertion(section = "8.3", id = "unknown")
public void testContextIsActiveWhenInvokingProducerField()
{
assert false;
- //assert manager.getContext(Dependent.class).isActive();
+ // assert manager.getContext(Dependent.class).isActive();
}
/**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
+ * when an instance of a bean with scope @Dependent is created by the
+ * container to receive a producer method, producer field, disposal method or
+ * observer method invocation, or
*/
@Test(groups = { "stub", "contexts", "disposalMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -227,9 +233,9 @@
}
/**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
+ * when an instance of a bean with scope @Dependent is created by the
+ * container to receive a producer method, producer field, disposal method or
+ * observer method invocation, or
*/
@Test(groups = { "stub", "contexts", "observerMethod" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -249,9 +255,19 @@
}
/**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
+ * while an observer method is invoked, or
*/
+ @Test(groups = { "stub", "contexts", "el" })
+ @SpecAssertion(section = "8.3", id = "unknown")
+ public void testContextIsActiveWhenInvokingObserver()
+ {
+ assert false;
+ }
+
+ /**
+ * when the container is creating or destroying a contextual instance of a
+ * bean or injecting its dependencies, or
+ */
@Test(groups = { "contexts", "beanLifecycle" })
@SpecAssertion(section = "8.3", id = "unknown")
public void testContextIsActiveDuringBeanCreation()
@@ -259,13 +275,13 @@
// Slightly roundabout, but I can't see a better way to test atm
deployBeans(FoxRun.class, Fox.class);
Bean<FoxRun> foxRunBean = manager.resolveByType(FoxRun.class).iterator().next();
- FoxRun foxRun = foxRunBean.create(new MockCreationalContext<FoxRun>());
+ FoxRun foxRun = foxRunBean.create(new MyCreationalContext<FoxRun>());
assert foxRun.fox != null;
}
/**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
+ * when the container is creating or destroying a contextual instance of a
+ * bean or injecting its dependencies, or
*/
@Test(groups = { "stub", "contexts", "beanDestruction" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -275,8 +291,8 @@
}
/**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
+ * when the container is creating or destroying a contextual instance of a
+ * bean or injecting its dependencies, or
*/
@Test(groups = { "contexts", "injection" })
@SpecAssertion(section = "8.4", id = "unknown")
@@ -284,16 +300,15 @@
{
deployBeans(FoxRun.class, Fox.class);
Bean<FoxRun> foxRunBean = manager.resolveByType(FoxRun.class).iterator().next();
- FoxRun foxRun = foxRunBean.create(new MockCreationalContext<FoxRun>());
+ FoxRun foxRun = foxRunBean.create(new MyCreationalContext<FoxRun>());
assert foxRun.fox != null;
}
/**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
+ * when the container is injecting dependencies of an EJB or servlet or when
+ * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
*/
- @Test(groups = { "contexts", "injection", "stub", "ejb3" })
+ @Test(groups = { "contexts", "injection", "stub", "ejb3", "integration" })
@SpecAssertion(section = "8.3", id = "unknown")
public void testContextIsActiveDuringEJBDependencyInjection()
{
@@ -301,9 +316,8 @@
}
/**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
+ * when the container is injecting dependencies of an EJB or servlet or when
+ * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
*/
@Test(groups = { "contexts", "injection", "stub", "servlet" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -313,9 +327,8 @@
}
/**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
+ * when the container is injecting dependencies of an EJB or servlet or when
+ * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
*/
@Test(groups = { "contexts", "postconstruct", "stub", "ejb3" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -325,9 +338,8 @@
}
/**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
+ * when the container is injecting dependencies of an EJB or servlet or when
+ * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
*/
@Test(groups = { "contexts", "predestroy", "stub", "ejb3" })
@SpecAssertion(section = "8.3", id = "unknown")
@@ -337,197 +349,34 @@
}
/**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
+ * A bean, EJB or servlet may obtain an instance of a bean with scope @Dependent
+ * via dependency injection or by calling Manager.getInstance(),
+ * Manager.getInstanceByType() or Instance.get() when the @Dependent scope is
+ * active.
*/
- @Test(groups = { "stub", "contexts", "constructor" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromConstructor()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "removeMethod" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromRemoveMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "initalizerMethod" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromInitializerMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "producerMethod" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromProducerMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "disposalMethod" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromDisposalMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "preDestroy" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromPreDestroy()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "postConstruct" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromPostConstruct()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "interceptor" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromInterceptorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "decorator" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testWebBeanMayCreateInstanceFromDecoratorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
@Test(groups = { "stub", "contexts", "ejb3", "initializerMethod" })
@SpecAssertion(section = "8.3.1", id = "unknown")
- public void testEjbBeanMayCreateInstanceFromInitializer()
+ public void testEjbBeanMayCreateInstanceWheneverScopeActive()
{
assert false;
}
/**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
+ * A bean, EJB or servlet may obtain an instance of a bean with scope @Dependent
+ * via dependency injection or by calling Manager.getInstance(),
+ * Manager.getInstanceByType() or Instance.get() when the @Dependent scope is
+ * active.
*/
- @Test(groups = { "stub", "contexts", "ejb3", "postConstruct" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testEjbBeanMayCreateInstanceFromPostConstruct()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3", "preDestroy" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testEjbBeanMayCreateInstanceFromPreDestroy()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3", "interceptor" })
- @SpecAssertion(section = "8.3.1", id = "unknown")
- public void testEjbBeanMayCreateInstanceFromInterceptorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * A Servlet may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods
- */
@Test(groups = { "stub", "contexts", "servlet", "initializerMethod" })
@SpecAssertion(section = "8.3.1", id = "unknown")
- public void testServletBeanMayCreateInstanceFromInitializer()
+ public void testServletBeanMayCreateInstanceWheneverScopeIsActive()
{
assert false;
}
/**
- * destroy all dependent objects of a Web Bean instance when the instance is
- * destroyed,
+ * destroy all dependent objects of a contextual bean instance when the
+ * instance is destroyed,
*/
@Test(groups = { "broken", "contexts", "beanDestruction" })
@SpecAssertion(section = "8.3.2", id = "unknown")
@@ -548,7 +397,7 @@
* destroy all dependent objects of an EJB bean or Servlet when the EJB bean
* or Servlet is destroyed,
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.3.2", id = "unknown")
public void testDestroyingEjbDestroysDependents()
{
@@ -559,7 +408,7 @@
* destroy all dependent objects of an EJB bean or Servlet when the EJB bean
* or Servlet is destroyed,
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.3.2", id = "unknown")
public void testDestroyingServletDestroysDependents()
{
@@ -588,7 +437,7 @@
{
assert false;
}
-
+
/**
* destroy any @Dependent scoped contextual instance created to receive a
* producer method, producer field, disposal method or observer method
@@ -612,7 +461,7 @@
{
assert false;
}
-
+
/**
* destroy any @Dependent scoped contextual instance created to receive a
* producer method, producer field, disposal method or observer method
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/MyCreationalContext.java (from rev 1383, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/util/MockCreationalContext.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/MyCreationalContext.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/MyCreationalContext.java 2009-02-02 22:23:54 UTC (rev 1391)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.tck.unit.context.dependent;
+
+import javax.context.CreationalContext;
+
+public class MyCreationalContext<T> implements CreationalContext<T>
+{
+
+ public void push(T incompleteInstance)
+ {
+
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/dependent/MyCreationalContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1390 - tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-02 16:23:55 -0500 (Mon, 02 Feb 2009)
New Revision: 1390
Added:
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/ArtifactTest.java
Removed:
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java
Log:
Finish test
Copied: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/ArtifactTest.java (from rev 1389, tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java)
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/ArtifactTest.java (rev 0)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/ArtifactTest.java 2009-02-02 21:23:55 UTC (rev 1390)
@@ -0,0 +1,107 @@
+package org.jboss.webbeans.tck.impl.test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.webbeans.tck.impl.packaging.standard.war.WarArtifact;
+import org.testng.annotations.Test;
+
+public class ArtifactTest
+{
+
+ protected static final FilenameFilter WEB_INF_FILTER = new FilenameFilter()
+ {
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("WEB-INF");
+ }
+ };
+
+ protected static final FilenameFilter BEANS_XML_FILTER = new FilenameFilter()
+ {
+
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("beans.xml");
+ }
+
+ };
+
+
+
+ protected static final FilenameFilter WEB_XML_FILTER = new FilenameFilter()
+ {
+
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("web.xml");
+ }
+
+ };
+
+
+ @Test
+ public void testDefaultWar() throws Exception
+ {
+ WarArtifact war = new WarArtifact();
+ war.getClasses().add(Cow.class);
+ File root = war.create();
+ assert root.listFiles().length == 2;
+ assert root.isDirectory();
+ assert root.listFiles(WEB_INF_FILTER).length == 1;
+ File webInf = root.listFiles(WEB_INF_FILTER)[0];
+ assert webInf.getName().equals("WEB-INF");
+ assert webInf.isDirectory();
+ assert webInf.listFiles().length == 2;
+ assert webInf.listFiles(BEANS_XML_FILTER).length == 1;
+ File beansXml = webInf.listFiles(BEANS_XML_FILTER)[0];
+ assert beansXml.isFile();
+ assert beansXml.getName().equals("beans.xml");
+ assert beansXml.length() == 0;
+ assert webInf.listFiles(WEB_XML_FILTER).length == 1;
+ File webXml = webInf.listFiles(WEB_XML_FILTER)[0];
+ assert webXml.isFile();
+ assert webXml.getName().equals("web.xml");
+ assert webXml.length() != 0;
+ File currentPackage = getCurrentPackageAsFile(root);
+ File[] cowClasses = currentPackage.listFiles(new FilenameFilter()
+ {
+
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("Cow.class");
+ }
+
+ });
+ assert cowClasses.length == 1;
+ assert cowClasses[0].getName().equals("Cow.class");
+ assert cowClasses[0].isFile();
+ }
+
+ private File getCurrentPackageAsFile(File root)
+ {
+ String[] packageHierarchy = getClass().getPackage().getName().split("\\.");
+ for (final String packageName : packageHierarchy)
+ {
+ File[] files = root.listFiles(new FilenameFilter()
+ {
+
+ public boolean accept(File dir, String name)
+ {
+ return name.equals(packageName);
+ }
+
+ });
+ if (files.length == 1)
+ {
+ root = files[0];
+ }
+ else
+ {
+ throw new IllegalStateException("Unable to traverse package hierarchy " + packageHierarchy);
+ }
+ }
+ return root;
+ }
+
+}
Property changes on: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/ArtifactTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java 2009-02-02 21:10:50 UTC (rev 1389)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java 2009-02-02 21:23:55 UTC (rev 1390)
@@ -1,50 +0,0 @@
-package org.jboss.webbeans.tck.impl.test;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import org.jboss.webbeans.tck.impl.packaging.standard.war.WarArtifact;
-import org.testng.annotations.Test;
-
-public class WarArtifactTest
-{
-
- protected static final FilenameFilter WEB_INF_FILTER = new FilenameFilter()
- {
- public boolean accept(File dir, String name)
- {
- return name.equals("WEB-INF");
- }
- };
-
- protected static final FilenameFilter BEANS_XML_FILTER = new FilenameFilter()
- {
-
- public boolean accept(File dir, String name)
- {
- return name.equals("beans.xml");
- }
-
- };
-
- @Test
- public void testSimpleWar() throws Exception
- {
- WarArtifact war = new WarArtifact();
- war.getClasses().add(Cow.class);
- File root = war.create();
- assert root.listFiles().length == 2;
- assert root.isDirectory();
- assert root.listFiles(WEB_INF_FILTER).length == 1;
- File webInf = root.listFiles(WEB_INF_FILTER)[0];
- assert webInf.getName().equals("WEB-INF");
- assert webInf.isDirectory();
- assert webInf.listFiles().length == 2;
- assert webInf.listFiles(BEANS_XML_FILTER).length == 1;
- File beansXml = webInf.listFiles(BEANS_XML_FILTER)[0];
- assert beansXml.isFile();
- assert beansXml.getName().equals("beans.xml");
- assert beansXml.length() == 0;
- }
-
-}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1389 - in tck/trunk: api/src/main/java/org/jboss/webbeans/tck/api and 26 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-02 16:10:50 -0500 (Mon, 02 Feb 2009)
New Revision: 1389
Added:
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Beans.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Contexts.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Managers.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/StandaloneContainers.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingContainers.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingStandaloneContainers.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/IntegratedContainers.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/Artifact.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ResourceDescriptor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/WarArtifact.java
tck/trunk/impl/src/main/resources/org/
tck/trunk/impl/src/main/resources/org/jboss/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml
tck/trunk/impl/src/test/java/org/
tck/trunk/impl/src/test/java/org/jboss/
tck/trunk/impl/src/test/java/org/jboss/webbeans/
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/Cow.java
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java
Removed:
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Containers.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Contexts.java
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Managers.java
Modified:
tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/WebBeansTCKImpl.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/deployment/BrokenDeploymentTypeTest.java
tck/trunk/impl/tck-audit.xml
tck/trunk/impl/tck-audit.xsd
Log:
Initial work on deployment infra
Deleted: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -1,107 +0,0 @@
-package org.jboss.webbeans.tck.api;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.inject.manager.Bean;
-
-/**
- * Provides Bean related operations.
- *
- * @author Shane Bryzak
- * @author Pete Muir
- * @author David Allen
- *
- */
-@Deprecated
-public interface Beans
-{
-
- public static final String PROPERTY_NAME = Beans.class.getName();
-
- /**
- * Create a new simple bean from the given class
- *
- * @param <T> The type of the bean
- * @param clazz the class to create the bean
- * @return the created bean
- */
- @Deprecated
- public <T> Bean<T> createSimpleBean(Class<T> clazz);
-
- /**
- * Create a new enterprise bean from the given class. The given class should
- * represent an EJB declared using annotions or XML.
- *
- * @param <T> The type of the bean
- * @param clazz the class to create the bean
- * @return the created bean
- */
-
- @Deprecated
- public <T> Bean<T> createEnterpriseBean(Class<T> clazz);
-
- /**
- * Create a new producer method bean from the given method. The simple or
- * enterprise bean on which the method is declared is provided.
- *
- * The declaringBean is a simple or enterprise bean that has been created by
- * calling {@link #createSimpleBean(Class)} or
- * {@link #createEnterpriseBean(Class)}.
- *
- * @param <T> the type of the bean
- * @param method the producer method
- * @param declaringBean the simple or enterprise bean which declares this
- * producer method
- * @return the producer bean
- */
- @Deprecated
- public <T> Bean<T> createProducerMethodBean(Method method, Bean<?> declaringBean);
-
- /**
- * Tests whether the given class is declaring an Enterprise Bean.
- *
- * @param clazz the type of bean being tested
- *
- * @return true only if class declares an Enterprise Bean
- */
- public boolean isEnterpriseBean(Class<?> clazz);
-
- /**
- * Tests whether the given class is declaring a stateful session bean.
- *
- * @param clazz the type being tested
- * @return true only if class declares a stateful session bean
- */
- public boolean isStatefulBean(Class<?> clazz);
-
- /**
- * Tests whether the given class is declaring a stateless session bean.
- *
- * @param clazz the type being tested
- * @return true only if class declares a stateless session bean
- */
- public boolean isStatelessBean(Class<?> clazz);
-
- /**
- * Tests whether the given class is declaring an entity bean.
- *
- * @param clazz the type being tested
- * @return true only if class declares an entity bean
- */
- public boolean isEntityBean(Class<?> clazz);
-
- /**
- * Create a new producer field bean from the given method.
- *
- * @param <T> The type of the bean
- * @param field the producer field
- * @param declaringBean
- * @return the producer bean
- */
- @Deprecated
- public <T> Bean<T> createProducerFieldBean(Field field, Bean<?> declaringBean);
-
- public boolean isProxy(Object instance);
-
-}
Deleted: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Containers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Containers.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Containers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -1,62 +0,0 @@
-package org.jboss.webbeans.tck.api;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import javax.inject.manager.Manager;
-
-/**
- * Container related operations
- *
- * @author Pete Muir
- *
- */
-public interface Containers
-{
-
- public static final String PROPERTY_NAME = Containers.class.getName();
-
- /**
- * <p>Bootstrap the container by registering Beans and Observers, raising
- * @Initialized event, validating the deployment, and raising the
- * @Deployed event.</p>
- *
- * <p>Any classes passed in should be fully deployed. This includes:</p>
- *
- * <ul>
- * <li>Simple beans</li>
- * <li>Session beans</li>
- * <li>Producer methods and producer fields</li>
- * <li>Observer methods</li>
- * <li>support for Event and Instance injection points</li>
- * </ul>
- *
- * The container should be in an fully initialized state when the
- * method returns
- *
- * @param classes the classes to deploy
- * @return the manager created as a result of initializing the container
- */
- public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>...classes);
-
- public Manager deploy(Class<?>...classes);
-
- /**
- *
- * @param <T>
- * @param expression
- * @param expectedType
- * @return
- */
- <T> T evaluateValueExpression(String expression, Class<T> expectedType);
-
- /**
- *
- * @param <T>
- * @param expression
- * @param expectedType
- * @param expectedParamTypes
- * @return
- */
- <T> T evaluateMethodExpression(String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams);
-}
Deleted: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Contexts.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Contexts.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Contexts.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -1,54 +0,0 @@
-package org.jboss.webbeans.tck.api;
-
-import javax.context.Context;
-
-
-/**
- * Context related operations
- *
- * @author Shane Bryzak
- * @author Pete Muir
- *
- */
-public interface Contexts<T extends Context>
-{
-
- public static final String PROPERTY_NAME = Contexts.class.getName();
-
- /**
- * Sets the specified context as active
- *
- * @param context The context to set active
- */
- public void setActive(T context);
-
- /**
- * Sets the specified context as inactive
- *
- * @param context The context to set inactive
- */
- public void setInactive(T context);
-
- /**
- * Creates a new request context
- *
- * @return The new request context
- */
- public T getRequestContext();
-
- /**
- * Returns the default dependent context
- *
- * @return the dependent context
- */
- public T getDependentContext();
-
- /**
- * Destroy the context. This operation is not well defined by the Web Beans
- * specification and is implementation dependent.
- *
- * @param context
- */
- public void destroyContext(T context);
-
-}
Deleted: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Managers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Managers.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Managers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -1,41 +0,0 @@
-package org.jboss.webbeans.tck.api;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import javax.inject.manager.Manager;
-
-/**
- * This interface provides operations relating to a Web Beans Manager.
- *
- * The TCK porting package must provide an implementation of this interface which is
- * suitable for the target Web Beans implementation.
- *
- * @author Shane Bryzak
- */
-public interface Managers
-{
-
- public static final String PROPERTY_NAME = Managers.class.getName();
-
- /**
- * Get a new Manager instance
- *
- * @return the Manager
- */
- Manager createManager(List<Class<? extends Annotation>> enabledDeploymentTypes);
-
- /**
- * Get a new Manager instance
- *
- * @return the Manager
- */
- Manager createManager();
-
- /**
- * Returns a list of the enabled deployment types for the current manager
- *
- * @return
- */
- List<Class<? extends Annotation>> getEnabledDeploymentTypes();
-}
Modified: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -2,13 +2,18 @@
import javax.context.Context;
+import org.jboss.webbeans.tck.spi.Beans;
+import org.jboss.webbeans.tck.spi.Containers;
+import org.jboss.webbeans.tck.spi.Contexts;
+import org.jboss.webbeans.tck.spi.Managers;
+
public class TCKConfiguration
{
- public static final TCKConfiguration newInstance(Beans beans, Contexts<?> contexts, Managers managers, Containers containers, TestSuite testSuite)
+ public static final TCKConfiguration newInstance(Beans beans, Contexts<?> contexts, Managers managers, Containers standaloneContainers, TestSuite testSuite)
{
- return new TCKConfiguration(beans, contexts, managers, containers, testSuite);
+ return new TCKConfiguration(beans, contexts, managers, standaloneContainers, testSuite);
}
private Beans beans;
@@ -63,5 +68,5 @@
{
return containers;
}
-
+
}
Copied: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Beans.java (from rev 1381, tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java)
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Beans.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Beans.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,106 @@
+package org.jboss.webbeans.tck.spi;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.inject.manager.Bean;
+
+/**
+ * Provides Bean related operations.
+ *
+ * @author Shane Bryzak
+ * @author Pete Muir
+ * @author David Allen
+ *
+ */
+public interface Beans
+{
+
+ public static final String PROPERTY_NAME = Beans.class.getName();
+
+ /**
+ * Create a new simple bean from the given class
+ *
+ * @param <T> The type of the bean
+ * @param clazz the class to create the bean
+ * @return the created bean
+ */
+ @Deprecated
+ public <T> Bean<T> createSimpleBean(Class<T> clazz);
+
+ /**
+ * Create a new enterprise bean from the given class. The given class should
+ * represent an EJB declared using annotions or XML.
+ *
+ * @param <T> The type of the bean
+ * @param clazz the class to create the bean
+ * @return the created bean
+ */
+
+ @Deprecated
+ public <T> Bean<T> createEnterpriseBean(Class<T> clazz);
+
+ /**
+ * Create a new producer method bean from the given method. The simple or
+ * enterprise bean on which the method is declared is provided.
+ *
+ * The declaringBean is a simple or enterprise bean that has been created by
+ * calling {@link #createSimpleBean(Class)} or
+ * {@link #createEnterpriseBean(Class)}.
+ *
+ * @param <T> the type of the bean
+ * @param method the producer method
+ * @param declaringBean the simple or enterprise bean which declares this
+ * producer method
+ * @return the producer bean
+ */
+ @Deprecated
+ public <T> Bean<T> createProducerMethodBean(Method method, Bean<?> declaringBean);
+
+ /**
+ * Tests whether the given class is declaring an Enterprise Bean.
+ *
+ * @param clazz the type of bean being tested
+ *
+ * @return true only if class declares an Enterprise Bean
+ */
+ public boolean isEnterpriseBean(Class<?> clazz);
+
+ /**
+ * Tests whether the given class is declaring a stateful session bean.
+ *
+ * @param clazz the type being tested
+ * @return true only if class declares a stateful session bean
+ */
+ public boolean isStatefulBean(Class<?> clazz);
+
+ /**
+ * Tests whether the given class is declaring a stateless session bean.
+ *
+ * @param clazz the type being tested
+ * @return true only if class declares a stateless session bean
+ */
+ public boolean isStatelessBean(Class<?> clazz);
+
+ /**
+ * Tests whether the given class is declaring an entity bean.
+ *
+ * @param clazz the type being tested
+ * @return true only if class declares an entity bean
+ */
+ public boolean isEntityBean(Class<?> clazz);
+
+ /**
+ * Create a new producer field bean from the given method.
+ *
+ * @param <T> The type of the bean
+ * @param field the producer field
+ * @param declaringBean
+ * @return the producer bean
+ */
+ @Deprecated
+ public <T> Bean<T> createProducerFieldBean(Field field, Bean<?> declaringBean);
+
+ public boolean isProxy(Object instance);
+
+}
Added: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,37 @@
+package org.jboss.webbeans.tck.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.jar.JarInputStream;
+
+import javax.inject.manager.Manager;
+
+public interface Containers
+{
+
+ public static final String PROPERTY_NAME = Containers.class.getName();
+
+ /**
+ *
+ * @param <T>
+ * @param expression
+ * @param expectedType
+ * @return
+ */
+ public <T> T evaluateValueExpression(String expression, Class<T> expectedType);
+
+ /**
+ *
+ * @param <T>
+ * @param expression
+ * @param expectedType
+ * @param expectedParamTypes
+ * @return
+ */
+ public <T> T evaluateMethodExpression(String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams);
+
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive);
+
+ public Manager deploy(JarInputStream archive);
+
+}
\ No newline at end of file
Property changes on: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Contexts.java (from rev 1381, tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Contexts.java)
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Contexts.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Contexts.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,54 @@
+package org.jboss.webbeans.tck.spi;
+
+import javax.context.Context;
+
+
+/**
+ * Context related operations
+ *
+ * @author Shane Bryzak
+ * @author Pete Muir
+ *
+ */
+public interface Contexts<T extends Context>
+{
+
+ public static final String PROPERTY_NAME = Contexts.class.getName();
+
+ /**
+ * Sets the specified context as active
+ *
+ * @param context The context to set active
+ */
+ public void setActive(T context);
+
+ /**
+ * Sets the specified context as inactive
+ *
+ * @param context The context to set inactive
+ */
+ public void setInactive(T context);
+
+ /**
+ * Creates a new request context
+ *
+ * @return The new request context
+ */
+ public T getRequestContext();
+
+ /**
+ * Returns the default dependent context
+ *
+ * @return the dependent context
+ */
+ public T getDependentContext();
+
+ /**
+ * Destroy the context. This operation is not well defined by the Web Beans
+ * specification and is implementation dependent.
+ *
+ * @param context
+ */
+ public void destroyContext(T context);
+
+}
Copied: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Managers.java (from rev 1381, tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Managers.java)
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Managers.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Managers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,41 @@
+package org.jboss.webbeans.tck.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.inject.manager.Manager;
+
+/**
+ * This interface provides operations relating to a Web Beans Manager.
+ *
+ * The TCK porting package must provide an implementation of this interface which is
+ * suitable for the target Web Beans implementation.
+ *
+ * @author Shane Bryzak
+ */
+public interface Managers
+{
+
+ public static final String PROPERTY_NAME = Managers.class.getName();
+
+ /**
+ * Get a new Manager instance
+ *
+ * @return the Manager
+ */
+ Manager createManager(List<Class<? extends Annotation>> enabledDeploymentTypes);
+
+ /**
+ * Get a new Manager instance
+ *
+ * @return the Manager
+ */
+ Manager createManager();
+
+ /**
+ * Returns a list of the enabled deployment types for the current manager
+ *
+ * @return
+ */
+ List<Class<? extends Annotation>> getEnabledDeploymentTypes();
+}
Copied: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/StandaloneContainers.java (from rev 1381, tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Containers.java)
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/StandaloneContainers.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/StandaloneContainers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,43 @@
+package org.jboss.webbeans.tck.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.inject.manager.Manager;
+
+/**
+ * Container related operations
+ *
+ * @author Pete Muir
+ *
+ */
+public interface StandaloneContainers extends Containers
+{
+
+ public static final String PROPERTY_NAME = Containers.class.getName();
+
+ /**
+ * <p>Bootstrap the container by registering Beans and Observers, raising
+ * @Initialized event, validating the deployment, and raising the
+ * @Deployed event.</p>
+ *
+ * <p>Any classes passed in should be fully deployed. This includes:</p>
+ *
+ * <ul>
+ * <li>Simple beans</li>
+ * <li>Session beans</li>
+ * <li>Producer methods and producer fields</li>
+ * <li>Observer methods</li>
+ * <li>support for Event and Instance injection points</li>
+ * </ul>
+ *
+ * The container should be in an fully initialized state when the
+ * method returns
+ *
+ * @param classes the classes to deploy
+ * @return the manager created as a result of initializing the container
+ */
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>...classes);
+
+ public Manager deploy(Class<?>...classes);
+}
Property changes on: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/StandaloneContainers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingContainers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingContainers.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingContainers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,36 @@
+package org.jboss.webbeans.tck.spi.helpers;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.jar.JarInputStream;
+
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.tck.spi.Containers;
+
+public abstract class ForwardingContainers implements Containers
+{
+
+ protected abstract Containers delegate();
+
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive)
+ {
+ return delegate().deploy(enabledDeploymentTypes, archive);
+ }
+
+ public <T> T evaluateMethodExpression(String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams)
+ {
+ return delegate().evaluateMethodExpression(expression, expectedType, expectedParamTypes, expectedParams);
+ }
+
+ public <T> T evaluateValueExpression(String expression, Class<T> expectedType)
+ {
+ return delegate().evaluateValueExpression(expression, expectedType);
+ }
+
+ public Manager deploy(JarInputStream archive)
+ {
+ return delegate().deploy(archive);
+ }
+
+}
Property changes on: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingContainers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingStandaloneContainers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingStandaloneContainers.java (rev 0)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingStandaloneContainers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,26 @@
+package org.jboss.webbeans.tck.spi.helpers;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.tck.spi.StandaloneContainers;
+
+public abstract class ForwardingStandaloneContainers extends ForwardingContainers implements StandaloneContainers
+{
+
+ @Override
+ protected abstract StandaloneContainers delegate();
+
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>... classes)
+ {
+ return delegate().deploy(enabledDeploymentTypes, classes);
+ }
+
+ public Manager deploy(Class<?>... classes)
+ {
+ return delegate().deploy(classes);
+ }
+
+}
Property changes on: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/helpers/ForwardingStandaloneContainers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -22,7 +22,9 @@
import javax.inject.manager.Bean;
import javax.inject.manager.Manager;
+import org.jboss.webbeans.tck.impl.IntegratedContainers;
import org.jboss.webbeans.tck.impl.util.MockCreationalContext;
+import org.jboss.webbeans.tck.spi.StandaloneContainers;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -65,6 +67,7 @@
protected static final int BUILT_IN_BEANS = 3;
protected Manager manager;
+ private StandaloneContainers containers;
public static boolean visited = false;
@@ -79,6 +82,7 @@
{
manager = configuration().getManagers().createManager();
}
+ containers = IntegratedContainers.of(configuration().getContainers());
}
@AfterMethod
@@ -120,11 +124,11 @@
{
if (getEnabledDeploymentTypes().size() > 0)
{
- manager = configuration().getContainers().deploy(getEnabledDeploymentTypes(), classes);
+ manager = containers.deploy(getEnabledDeploymentTypes(), classes);
}
else
{
- manager = configuration().getContainers().deploy(classes);
+ manager = containers.deploy(classes);
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/IntegratedContainers.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/IntegratedContainers.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/IntegratedContainers.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,62 @@
+package org.jboss.webbeans.tck.impl;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.tck.impl.packaging.standard.war.WarArtifact;
+import org.jboss.webbeans.tck.spi.Containers;
+import org.jboss.webbeans.tck.spi.StandaloneContainers;
+import org.jboss.webbeans.tck.spi.helpers.ForwardingContainers;
+
+public abstract class IntegratedContainers extends ForwardingContainers implements StandaloneContainers
+{
+
+ public static StandaloneContainers of(final Containers containers)
+ {
+ if (containers instanceof StandaloneContainers)
+ {
+ return (StandaloneContainers) containers;
+ }
+ else
+ {
+ return new IntegratedContainers()
+ {
+
+ @Override
+ protected Containers delegate()
+ {
+ return containers;
+ }
+
+ };
+ }
+ }
+
+ public Manager deploy(java.lang.Class<?>... classes)
+ {
+ try
+ {
+ return deploy(WarArtifact.of(classes).asJar());
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Error building war from " + classes, e);
+ }
+ }
+
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>... classes)
+ {
+ try
+ {
+ return deploy(enabledDeploymentTypes, WarArtifact.of(classes).asJar());
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Error building war from " + classes, e);
+ }
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/IntegratedContainers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/WebBeansTCKImpl.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/WebBeansTCKImpl.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/WebBeansTCKImpl.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -8,14 +8,14 @@
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.webbeans.tck.api.Beans;
-import org.jboss.webbeans.tck.api.Containers;
-import org.jboss.webbeans.tck.api.Contexts;
-import org.jboss.webbeans.tck.api.Managers;
import org.jboss.webbeans.tck.api.TCKConfiguration;
import org.jboss.webbeans.tck.api.TestSuite;
import org.jboss.webbeans.tck.api.WebBeansTCK;
import org.jboss.webbeans.tck.impl.util.DeploymentProperties;
+import org.jboss.webbeans.tck.spi.Beans;
+import org.jboss.webbeans.tck.spi.Containers;
+import org.jboss.webbeans.tck.spi.Contexts;
+import org.jboss.webbeans.tck.spi.Managers;
import org.testng.TestNG;
import org.testng.xml.Parser;
import org.testng.xml.XmlSuite;
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/Artifact.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/Artifact.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/Artifact.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,145 @@
+package org.jboss.webbeans.tck.impl.packaging;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+import java.util.jar.JarInputStream;
+
+public class Artifact
+{
+
+ public static final Random random = new Random(System.currentTimeMillis());
+
+ private Set<Class<?>> classes;
+ private Set<ResourceDescriptor> resources;
+
+ public Artifact()
+ {
+ classes = new HashSet<Class<?>>();
+ resources = new HashSet<ResourceDescriptor>();
+ }
+
+ public JarInputStream asJar() throws IOException
+ {
+ return new JarInputStream(create().toURL().openStream());
+ }
+
+ public File create() throws IOException
+ {
+ File root = new File(System.getProperty("java.io.tmpdir") + "/" + getClass().getName() + "." + random.nextInt());
+ root.mkdir();
+ root.deleteOnExit();
+ for (Class<?> clazz : getClasses())
+ {
+ String classFilePathName = getClassFileName(clazz.getName());
+ String directoryName = classFilePathName.substring(0, classFilePathName.lastIndexOf("/"));
+ String classFileName = classFilePathName.substring(classFilePathName.lastIndexOf("/") + 1);
+ File packageDirectory = makeDirectoryStructure(root, directoryName);
+ File classFile = new File(packageDirectory, classFileName);
+ classFile.createNewFile();
+ classFile.deleteOnExit();
+ copy(loadResourceAsStream(classFilePathName), classFile);
+ }
+ for (ResourceDescriptor resourceDescriptor : getResources())
+ {
+ String directoryName = resourceDescriptor.getName().substring(0, resourceDescriptor.getName().lastIndexOf("/"));
+ String fileName = resourceDescriptor.getName().substring(resourceDescriptor.getName().lastIndexOf("/") + 1);
+ File directory = makeDirectoryStructure(root, directoryName);
+ File file = new File(directory, fileName);
+ file.createNewFile();
+ file.deleteOnExit();
+ copy(resourceDescriptor.getSource().openStream(), file);
+ }
+ return root;
+ }
+
+ private static File makeDirectoryStructure(File root, String directoryName)
+ {
+ for (String directory : directoryName.split("\\/"))
+ {
+ root = new File(root, directory);
+ root.mkdir();
+ root.deleteOnExit();
+ }
+ return root;
+ }
+
+ private static String getClassFileName(String className)
+ {
+ return className.replace('.', '/') + ".class";
+ }
+
+ private static void copy(InputStream inputStream, File file) throws IOException
+ {
+ OutputStream os = new FileOutputStream(file);
+ try
+ {
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ((i = inputStream.read(buf)) != -1)
+ {
+ os.write(buf, 0, i);
+ }
+ }
+ finally
+ {
+ os.close();
+ }
+
+ }
+
+ protected static InputStream loadResourceAsStream(String name)
+ {
+ InputStream is = null;
+ if (Thread.currentThread().getContextClassLoader() != null)
+ {
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+ }
+ if (is == null)
+ {
+ is = Artifact.class.getResourceAsStream(name);
+ }
+ return is;
+ }
+
+ protected static URL loadResource(String name)
+ {
+ URL url = null;
+ if (Thread.currentThread().getContextClassLoader() != null)
+ {
+ url = Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+ if (url == null)
+ {
+ url = Artifact.class.getResource(name);
+ }
+ return url;
+ }
+
+ public void setClasses(Set<Class<?>> classes)
+ {
+ this.classes = classes;
+ }
+
+ public Set<Class<?>> getClasses()
+ {
+ return classes;
+ }
+
+ public Set<ResourceDescriptor> getResources()
+ {
+ return resources;
+ }
+
+ public void setResources(Set<ResourceDescriptor> resources)
+ {
+ this.resources = resources;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/Artifact.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ResourceDescriptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ResourceDescriptor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ResourceDescriptor.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.tck.impl.packaging;
+
+import java.net.URL;
+
+public class ResourceDescriptor
+{
+
+ private String name;
+ private URL source;
+
+ public ResourceDescriptor(String name, URL source)
+ {
+ this.name = name;
+ this.source = source;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public URL getSource()
+ {
+ return source;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ResourceDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/WarArtifact.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/WarArtifact.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/WarArtifact.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,47 @@
+package org.jboss.webbeans.tck.impl.packaging.standard.war;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.tck.impl.packaging.Artifact;
+import org.jboss.webbeans.tck.impl.packaging.ResourceDescriptor;
+
+public class WarArtifact extends Artifact
+{
+
+ public static final String WEB_XML_DESTINATION = "WEB-INF/web.xml";
+ public static final String STANDARD_WEB_XML_FILE_NAME = "org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml";
+
+ public static final String BEANS_XML_DESTINATION = "WEB-INF/beans.xml";
+ public static final String STANDARD_BEANS_XML_FILE_NAME = "org/jboss/webbeans/tck/impl/packaging/standard/war/beans.xml";
+
+ public static WarArtifact of(Class<?>... classes)
+ {
+ WarArtifact war = new WarArtifact();
+ war.setClasses(new HashSet<Class<?>>(Arrays.asList(classes)));
+ return war;
+ }
+
+ public WarArtifact()
+ {
+ Set<ResourceDescriptor> standardResources = new HashSet<ResourceDescriptor>();
+ standardResources.add(new ResourceDescriptor(BEANS_XML_DESTINATION, getBeansXmlSource()));
+ standardResources.add(new ResourceDescriptor(WEB_XML_DESTINATION, getWebXmlSource()));
+ setResources(standardResources);
+ }
+
+ public URL getBeansXmlSource()
+ {
+ return loadResource(STANDARD_BEANS_XML_FILE_NAME);
+ }
+
+ public URL getWebXmlSource()
+ {
+ return loadResource(STANDARD_WEB_XML_FILE_NAME);
+ }
+
+
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/standard/war/WarArtifact.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -75,7 +75,6 @@
return true;
}
- @Override
public MySessionBean create(CreationalContext<MySessionBean> creationalContext)
{
createCalled = true;
@@ -85,7 +84,6 @@
return new MySessionBean();
}
- @Override
public void destroy(MySessionBean instance)
{
destroyCalled = true;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -4,8 +4,7 @@
class MyCreationalContext<T> implements CreationalContext<T>
{
-
- @Override
+
public void push(T incompleteInstance)
{
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/deployment/BrokenDeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/deployment/BrokenDeploymentTypeTest.java 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/deployment/BrokenDeploymentTypeTest.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -1,9 +1,5 @@
package org.jboss.webbeans.tck.unit.definition.deployment;
-import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
-
-import java.util.Arrays;
-
import javax.inject.DeploymentException;
import org.jboss.webbeans.tck.AbstractTest;
@@ -18,12 +14,12 @@
{
@SuppressWarnings("unchecked")
- @Test(expectedExceptions=DeploymentException.class)
+ @Test(expectedExceptions=DeploymentException.class, groups="broken")
@SpecAssertion(section="2.5.6", id = "unknown")
public void testStandardMustBeDeclared()
{
- manager = configuration().getContainers().deploy(Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class), Dog.class);
+ //manager = configuration().getContainers().deploy(Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class), Dog.class);
}
Added: tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/beans.xml
===================================================================
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>JSR-299 TCK</display-name>
+
+</web-app>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/webbeans/tck/impl/packaging/standard/war/web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/Cow.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/Cow.java (rev 0)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/Cow.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.impl.test;
+
+class Cow
+{
+
+}
Property changes on: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/Cow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java (rev 0)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java 2009-02-02 21:10:50 UTC (rev 1389)
@@ -0,0 +1,50 @@
+package org.jboss.webbeans.tck.impl.test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.webbeans.tck.impl.packaging.standard.war.WarArtifact;
+import org.testng.annotations.Test;
+
+public class WarArtifactTest
+{
+
+ protected static final FilenameFilter WEB_INF_FILTER = new FilenameFilter()
+ {
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("WEB-INF");
+ }
+ };
+
+ protected static final FilenameFilter BEANS_XML_FILTER = new FilenameFilter()
+ {
+
+ public boolean accept(File dir, String name)
+ {
+ return name.equals("beans.xml");
+ }
+
+ };
+
+ @Test
+ public void testSimpleWar() throws Exception
+ {
+ WarArtifact war = new WarArtifact();
+ war.getClasses().add(Cow.class);
+ File root = war.create();
+ assert root.listFiles().length == 2;
+ assert root.isDirectory();
+ assert root.listFiles(WEB_INF_FILTER).length == 1;
+ File webInf = root.listFiles(WEB_INF_FILTER)[0];
+ assert webInf.getName().equals("WEB-INF");
+ assert webInf.isDirectory();
+ assert webInf.listFiles().length == 2;
+ assert webInf.listFiles(BEANS_XML_FILTER).length == 1;
+ File beansXml = webInf.listFiles(BEANS_XML_FILTER)[0];
+ assert beansXml.isFile();
+ assert beansXml.getName().equals("beans.xml");
+ assert beansXml.length() == 0;
+ }
+
+}
Property changes on: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/WarArtifactTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/tck-audit.xml
===================================================================
--- tck/trunk/impl/tck-audit.xml 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/tck-audit.xml 2009-02-02 21:10:50 UTC (rev 1389)
@@ -756,7 +756,7 @@
<section id="3.6.1" title="Declaring a resource using XML">
<assertion id="a">
- <text>A resource may be declared in beans.xml using an element that represents the Java type of the resource. For a Java EE resource, the EE resource type must be specified�for example javax.sql.Datasource for a JDBC datasource. The bean type of the resource is this specified type</text>
+ <text>A resource may be declared in beans.xml using an element that represents the Java type of the resource. For a Java EE resource, the EE resource type must be specified - for example javax.sql.Datasource for a JDBC datasource. The bean type of the resource is this specified type</text>
</assertion>
<assertion id="b">
Modified: tck/trunk/impl/tck-audit.xsd
===================================================================
--- tck/trunk/impl/tck-audit.xsd 2009-02-02 20:33:35 UTC (rev 1388)
+++ tck/trunk/impl/tck-audit.xsd 2009-02-02 21:10:50 UTC (rev 1389)
@@ -47,7 +47,7 @@
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
- </xs:simpleContent"
+ </xs:simpleContent>
</xs:complexType>
</xs:element>
@@ -55,7 +55,7 @@
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
- </xs:simpleContent"
+ </xs:simpleContent>
</xs:complexType>
</xs:element>
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1388 - in ri/trunk/webbeans-ri/src/test: resources/META-INF and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-02 15:33:35 -0500 (Mon, 02 Feb 2009)
New Revision: 1388
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContextsImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ManagersImpl.java
ri/trunk/webbeans-ri/src/test/resources/META-INF/web-beans-tck.properties
Log:
add vincent for translations
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java 2009-02-02 17:46:01 UTC (rev 1387)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java 2009-02-02 20:33:35 UTC (rev 1388)
@@ -12,7 +12,7 @@
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.tck.api.Beans;
+import org.jboss.webbeans.tck.spi.Beans;
import org.jboss.webbeans.test.mock.MockEjbDescriptor;
import org.jboss.webbeans.util.Reflections;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java 2009-02-02 17:46:01 UTC (rev 1387)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java 2009-02-02 20:33:35 UTC (rev 1388)
@@ -2,17 +2,18 @@
import java.lang.annotation.Annotation;
import java.util.List;
+import java.util.jar.JarInputStream;
import javax.el.ELContext;
import javax.inject.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.tck.api.Containers;
+import org.jboss.webbeans.tck.spi.StandaloneContainers;
import org.jboss.webbeans.test.mock.MockBootstrap;
import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
import org.jboss.webbeans.test.mock.el.EL;
-public class ContainersImpl implements Containers
+public class ContainersImpl implements StandaloneContainers
{
public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>... classes)
@@ -33,6 +34,16 @@
return deploy(null, classes);
}
+ public Manager deploy(JarInputStream archive)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive)
+ {
+ throw new UnsupportedOperationException();
+ }
+
@SuppressWarnings("unchecked")
public <T> T evaluateValueExpression(String expression, Class<T> expectedType)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContextsImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContextsImpl.java 2009-02-02 17:46:01 UTC (rev 1387)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContextsImpl.java 2009-02-02 20:33:35 UTC (rev 1388)
@@ -4,7 +4,7 @@
import org.jboss.webbeans.context.AbstractContext;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.RequestContext;
-import org.jboss.webbeans.tck.api.Contexts;
+import org.jboss.webbeans.tck.spi.Contexts;
public class ContextsImpl implements Contexts<AbstractContext>
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ManagersImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ManagersImpl.java 2009-02-02 17:46:01 UTC (rev 1387)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ManagersImpl.java 2009-02-02 20:33:35 UTC (rev 1388)
@@ -6,7 +6,7 @@
import javax.inject.manager.Manager;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.tck.api.Managers;
+import org.jboss.webbeans.tck.spi.Managers;
import org.jboss.webbeans.test.mock.MockBootstrap;
public class ManagersImpl implements Managers
Modified: ri/trunk/webbeans-ri/src/test/resources/META-INF/web-beans-tck.properties
===================================================================
--- ri/trunk/webbeans-ri/src/test/resources/META-INF/web-beans-tck.properties 2009-02-02 17:46:01 UTC (rev 1387)
+++ ri/trunk/webbeans-ri/src/test/resources/META-INF/web-beans-tck.properties 2009-02-02 20:33:35 UTC (rev 1388)
@@ -1,4 +1,4 @@
-org.jboss.webbeans.tck.api.Managers=org.jboss.webbeans.test.tck.ManagersImpl
-org.jboss.webbeans.tck.api.Beans=org.jboss.webbeans.test.tck.BeansImpl
-org.jboss.webbeans.tck.api.Contexts=org.jboss.webbeans.test.tck.ContextsImpl
-org.jboss.webbeans.tck.api.Containers=org.jboss.webbeans.test.tck.ContainersImpl
\ No newline at end of file
+org.jboss.webbeans.tck.spi.Managers=org.jboss.webbeans.test.tck.ManagersImpl
+org.jboss.webbeans.tck.spi.Beans=org.jboss.webbeans.test.tck.BeansImpl
+org.jboss.webbeans.tck.spi.Contexts=org.jboss.webbeans.test.tck.ContextsImpl
+org.jboss.webbeans.tck.spi.Containers=org.jboss.webbeans.test.tck.ContainersImpl
\ No newline at end of file
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1386 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-02 12:45:03 -0500 (Mon, 02 Feb 2009)
New Revision: 1386
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
Log:
Added new deployEjbBeans() method for EE 5 EJB container bean deployments.
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 17:16:52 UTC (rev 1385)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 17:45:03 UTC (rev 1386)
@@ -111,6 +111,11 @@
return configuration().getBeans().createProducerFieldBean(field, producerBean);
}
+ /**
+ * Used to deploy simple beans in a Web container.
+ *
+ * @param classes A list of classes representing the beans to deploy
+ */
protected void deployBeans(Class<?>... classes)
{
if (getEnabledDeploymentTypes().size() > 0)
@@ -123,6 +128,17 @@
}
}
+ /**
+ * Used to deploy any EJB 3.1 beans to the appropriate container. TODO This
+ * needs to use a different container in EE 5 for deployment.
+ *
+ * @param classes A list of classes representing the beans to deploy
+ */
+ protected void deployEjbBeans(Class<?>... classes)
+ {
+ deployBeans(classes);
+ }
+
protected final List<Class<? extends Annotation>> getStandardDeploymentTypes()
{
return new ArrayList<Class<? extends Annotation>>(STANDARD_DEPLOYMENT_TYPES);
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1385 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck: integration/implementation and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-02 12:16:52 -0500 (Mon, 02 Feb 2009)
New Revision: 1385
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/EnterpriseBeanLifecycleTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
Log:
Minor changes; moved some integration tests for EJBs.
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java (from rev 1383, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/EnterpriseBeanLifecycleTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-02-02 17:16:52 UTC (rev 1385)
@@ -0,0 +1,146 @@
+package org.jboss.webbeans.tck.integration.implementation.enterprise;
+
+import org.jboss.webbeans.tck.AbstractTest;
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.testng.annotations.Test;
+
+/**
+ * Sections
+ *
+ * 6.5. Lifecycle of stateful session beans 6.6. Lifecycle of stateless session
+ * and singleton beans 6.11. Lifecycle of EJBs
+ *
+ * Mostly overlapping with other tests...
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+public class EnterpriseBeanLifecycleTest extends AbstractTest
+{
+
+ /**
+ * When the create() method of a Bean object that represents a stateful
+ * session bean that is called, the container creates and returns a session
+ * bean proxy, as defined in Section 3.3.9, “Session bean proxies”.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.5", id = "unknown")
+ public void testProxyCreated()
+ {
+ assert false;
+ }
+
+ /**
+ * When the destroy() method is called, the container removes the stateful
+ * session bean. The @PreDestroy callback must be invoked by the container.
+ */
+ @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.5", id = "unknown")
+ public void testDestroyMethodCalled() throws Exception
+ {
+ // GoodDoggie.destructorCalled = false;
+ // deployBeans(GoodDoggie.class);
+ // new RunInDependentContext()
+ // {
+ //
+ // @Override
+ // protected void execute() throws Exception
+ // {
+ // Set<Bean<LocalGoodDoggie>> goodDoggieBeans =
+ // manager.resolveByType(LocalGoodDoggie.class);
+ // assert goodDoggieBeans.size() == 1;
+ // Bean<LocalGoodDoggie> bean = goodDoggieBeans.iterator().next();
+ // LocalGoodDoggie doggie = manager.getInstance(bean);
+ // bean.destroy(doggie);
+ // // TODO Need to verify that the remove method has been called
+ // }
+ //
+ // }.run();
+ assert false;
+ }
+
+ /**
+ * If the underlying EJB was already removed by direct invocation of a remove
+ * method by the application, the container ig- nores the instance.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.5", id = "unknown")
+ public void testRemovedEjbIgnored()
+ {
+ assert false;
+ }
+
+ /**
+ * First, the container initializes the values of all injected fields. For
+ * each injected field, the container sets the value to the object returned
+ * by Manager.getInstanceToInject().
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testFieldInjectionsOnNonContextualEjbs()
+ {
+ assert false;
+ }
+
+ /**
+ * Next, if the EJB instance is a contextual instance of a bean, the
+ * container initializes the values of any fields with initial values
+ * specified in XML, as defined in Section 9.5.5, “Field initial value
+ * declarations”.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testInitXMLDefinedValuesOnWebWeanEnterpriseBeans()
+ {
+ assert false;
+ }
+
+ /**
+ * Next, the container calls all initializer methods. For each initializer
+ * method parameter, the container passes the object returned by
+ * Manager.getInstanceToInject().
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "integration", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testInitializerMethodsCalledWithCurrentParameterValues()
+ {
+ assert false;
+ }
+
+ /**
+ * Finally, the container builds the interceptor and decorator stacks for the
+ * instance as defined in Section A.3.10, “Interceptor stack creation” and
+ * Section A.5.8, “Decorator stack creation” and binds them to the instance.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "interceptors", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testInterceptorStackIsBuilt()
+ {
+ assert false;
+ }
+
+ /**
+ * Finally, the container builds the interceptor and decorator stacks for the
+ * instance as defined in Section A.3.10, “Interceptor stack creation” and
+ * Section A.5.8, “Decorator stack creation” and binds them to the instance.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "decorators", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testDecoratorStackIsBuilt()
+ {
+ assert false;
+ }
+
+ /**
+ * When the EJB container removes an instance of an EJB, the container
+ * destroys all dependent objects, after the @PreDestroy callback completes.
+ */
+ @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
+ @SpecAssertion(section = "6.11", id = "unknown")
+ public void testDependentObjectsDestroyed()
+ {
+ assert false;
+ }
+
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-02 16:27:27 UTC (rev 1384)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-02 17:16:52 UTC (rev 1385)
@@ -185,7 +185,7 @@
* UnserializableDependencyException must be thrown by the Web Bean manager
* at initialization time.
*/
- @Test(groups = { "stub", "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "unknown")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoStatefulSessionBeanFails()
{
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/EnterpriseBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-02-02 16:27:27 UTC (rev 1384)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-02-02 17:16:52 UTC (rev 1385)
@@ -1,168 +0,0 @@
-package org.jboss.webbeans.tck.unit.implementation.enterprise;
-
-import java.util.Set;
-
-import javax.inject.manager.Bean;
-
-import org.jboss.webbeans.tck.AbstractTest;
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.testng.annotations.Test;
-
-/**
- * Sections
- *
- * 6.5. Lifecycle of stateful session beans
- * 6.6. Lifecycle of stateless session and singleton beans
- * 6.11. Lifecycle of EJBs
- *
- * Mostly overlapping with other tests...
- *
- * @author Nicklas Karlsson
- *
- * Spec version: PRD2
- */
-public class EnterpriseBeanLifecycleTest extends AbstractTest
-{
-
- /**
- * When the create() method is called, the Web Bean manager creates and
- * returns an enterprise bean proxy
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
- @SpecAssertion(section = "6.5", id = "unknown")
- public void testProxyCreated()
- {
- assert false;
- }
-
- /**
- * When the destroy() method is called, the Web Bean manager calls the Web
- * Bean remove method upon the proxy
- */
- @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "stub"})
- @SpecAssertion(section = "6.5", id = "unknown")
- public void testRemoveMethodCalled() throws Exception
- {
- GoodDoggie.destructorCalled = false;
- deployBeans(GoodDoggie.class);
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Set<Bean<LocalGoodDoggie>> goodDoggieBeans = manager.resolveByType(LocalGoodDoggie.class);
- assert goodDoggieBeans.size() == 1;
- Bean<LocalGoodDoggie> bean = goodDoggieBeans.iterator().next();
- LocalGoodDoggie doggie = manager.getInstance(bean);
- bean.destroy(doggie);
- }
-
- }.run();
- }
-
- /**
- * For each remove method parameter, the Web Bean manager passes the object
- * returned by Manager.getInstanceByType()
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "removeMethod", "stub" })
- @SpecAssertion(section = "6.5", id = "unknown")
- public void testFieldInjections()
- {
- assert false;
- }
-
- /**
- * If the underlying EJB was already destroyed by direct invocation of a
- * remove method by the application, the Web Bean manager ignores the
- * instance, and is not required to call any remove method
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "removeMethod", "stub" })
- @SpecAssertion(section = "6.5", id = "unknown")
- public void testNoRemoveMethodsCalledIfEnterpriseBeanAlreadyRemoved()
- {
- assert false;
- }
-
- /**
- * When the destroy() method is called, the Web Bean manager simply discards
- * the proxy and all EJB local object references.
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "removeMethod", "stub" })
- @SpecAssertion(section = "6.6", id = "unknown")
- public void testProxyAndLocalObjectReferencesDiscardedForStatelessEnterpriseBeans()
- {
- assert false;
- }
-
- /**
- * The Web Bean manager initializes the values of all injected fields. For
- * each injected field, the Web Bean manager sets the value to the object
- * returned by Manager.getInstanceByType().
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testFieldInjectionsOnRemoveMethods()
- {
- assert false;
- }
-
- /**
- * Next, if the EJB bean instance is an instance of a Web Bean, the Web Bean
- * manager initializes the values of any fields with initial values specified
- * in XML,
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testInitXMLDefinedValuesOnWebWeanEnterpriseBeans()
- {
- assert false;
- }
-
- /**
- * Next, the Web Bean manager calls all initializer methods. For each
- * initializer method parameter, the Web Bean manager passes the object
- * returned by Manager.getInstanceByType().
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testInitializerMethodsCalledWithCurrentParameterValues()
- {
- assert false;
- }
-
- /**
- * Finally, the Web Bean manager builds the interceptor and decorator stacks
- * for the instance
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "interceptors", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testInterceptorStackIsBuilt()
- {
- assert false;
- }
-
- /**
- * Finally, the Web Bean manager builds the interceptor and decorator stacks
- * for the instance
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "decorators", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testDecoratorStackIsBuilt()
- {
- assert false;
- }
-
- /**
- * When the EJB container destroys an instance of an EJB bean, the Web Bean
- * manager intercepts the @PreDestroy callback and destroys all dependent
- * objects, after the callback returns from the bean instance
- */
- @Test(groups = { "enterpriseBeans", "lifecycle", "stub" })
- @SpecAssertion(section = "6.11", id = "unknown")
- public void testDependentObjectsDestroyed()
- {
- assert false;
- }
-
-}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1384 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-02 11:27:27 -0500 (Mon, 02 Feb 2009)
New Revision: 1384
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
Log:
Changed stubs to always fail (commented out code that is not testing the correct scenario).
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-02 14:02:20 UTC (rev 1383)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-02 16:27:27 UTC (rev 1384)
@@ -45,7 +45,9 @@
@SpecAssertion(section = "8.4", id = "unknown")
public void testSimpleWebBeanWithSerializableImplementationClassOK()
{
- createSimpleBean(Jyvaskyla.class);
+ deployBeans(Jyvaskyla.class);
+ Set<Bean<Jyvaskyla>> beans = manager.resolveByType(Jyvaskyla.class);
+ assert !beans.isEmpty();
}
@Test @SpecAssertion(section="8.4", id = "unknown")
@@ -107,11 +109,12 @@
* Bean with a passivating scope must be serialized and deserialized along
* with their owner
*/
- @Test(groups = { "stub", "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation", "stub" }, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "unknown")
public void testDependentInterceptorsOfStatefulEnterpriseBeanMustBeSerializable()
{
- deployBeans(Kaarina_Broken.class);
+ //deployBeans(Kaarina_Broken.class);
+ assert false;
}
/**
@@ -120,11 +123,12 @@
* Bean with a passivating scope must be serialized and deserialized along
* with their owner
*/
- @Test(groups = { "stub", "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation", "stub" }, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "unknown")
public void testDependentDecoratorsOfStatefulEnterpriseBeanMustBeSerializable()
{
- deployBeans(Porvoo_Broken.class);
+ //deployBeans(Porvoo_Broken.class);
+ assert false;
}
/**
@@ -133,11 +137,12 @@
* Bean with a passivating scope must be serialized and deserialized along
* with their owner
*/
- @Test(groups = { "stub", "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation", "stub" }, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "unknown")
public void testDependentInterceptorsOfWebBeanWithPassivatingScopeMustBeSerializable()
{
- deployBeans(Kotka_Broken.class);
+ //deployBeans(Kotka_Broken.class);
+ assert false;
}
/**
@@ -146,11 +151,12 @@
* Bean with a passivating scope must be serialized and deserialized along
* with their owner
*/
- @Test(groups = { "stub", "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation", "stub" }, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "unknown")
public void testDependentDecoratorsOfWebBeansWithPassivatingScopeMustBeSerializable()
{
- deployBeans(Raisio_Broken.class);
+ //deployBeans(Raisio_Broken.class);
+ assert false;
}
/**
@@ -212,11 +218,13 @@
* UnserializableDependencyException must be thrown by the Web Bean manager
* at initialization time.
*/
- @Test(groups = { "contexts", "passivation" })
+ @Test(groups = { "contexts", "passivation", "broken" })
@SpecAssertion(section = "8.4", id = "unknown")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoTransientFieldOK()
{
- createSimpleBean(Joensuu.class);
+ deployBeans(Joensuu.class, Violation.class);
+ Set<Bean<Joensuu>> beans = manager.resolveByType(Joensuu.class);
+ assert !beans.isEmpty();
}
/**
@@ -314,8 +322,9 @@
@SpecAssertion(section = "8.4", id = "unknown")
public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoTransientFieldOfWebBeanWithPassivatingScopeOK()
{
- createSimpleBean(CityProducer2.class);
- createSimpleBean(Hyvinkaa.class);
+ deployBeans(CityProducer2.class, Hyvinkaa.class);
+ Set<Bean<Hyvinkaa>> beans = manager.resolveByType(Hyvinkaa.class);
+ assert !beans.isEmpty();
}
/**
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1383 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: servlet and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-02 09:02:20 -0500 (Mon, 02 Feb 2009)
New Revision: 1383
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/DefaultConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
context destruction refactorings
destroying all conversations when session ends
interfaces for destroying all conversations
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-02-02 13:37:02 UTC (rev 1382)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-02-02 14:02:20 UTC (rev 1383)
@@ -92,6 +92,6 @@
public void setLongRunning(boolean longRunning)
{
- this.longRunning = true;
+ this.longRunning = longRunning;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java 2009-02-02 13:37:02 UTC (rev 1382)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java 2009-02-02 14:02:20 UTC (rev 1383)
@@ -20,4 +20,5 @@
{
public abstract void beginConversation(String cid);
public abstract void endConversation();
+ public abstract void destroyAllConversations();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/DefaultConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/DefaultConversationManager.java 2009-02-02 13:37:02 UTC (rev 1382)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/DefaultConversationManager.java 2009-02-02 14:02:20 UTC (rev 1383)
@@ -118,11 +118,24 @@
public void run()
{
log.trace("Conversation " + cid + " timed out and was terminated");
- ConversationContext terminationContext = new ConversationContext();
- terminationContext.setBeanMap(new ConversationBeanMap(session, cid));
- terminationContext.destroy();
- longRunningConversations.remove(cid);
+ destroyConversation(cid, session);
}
}
+
+ public void destroyAllConversations()
+ {
+ for (Map.Entry<String, Future<?>> entry : longRunningConversations.entrySet()) {
+ entry.getValue().cancel(false);
+ destroyConversation(entry.getKey(), session);
+ }
+ }
+ private void destroyConversation(String cid, HttpSession session)
+ {
+ ConversationContext terminationContext = new ConversationContext();
+ terminationContext.setBeanMap(new ConversationBeanMap(session, cid));
+ terminationContext.destroy();
+ longRunningConversations.remove(cid);
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-02-02 13:37:02 UTC (rev 1382)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-02-02 14:02:20 UTC (rev 1383)
@@ -18,7 +18,6 @@
package org.jboss.webbeans.servlet;
import javax.context.Conversation;
-import javax.inject.Current;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -84,6 +83,8 @@
SessionContext.INSTANCE.setBeanMap(new SessionBeanMap(session));
SessionContext.INSTANCE.destroy();
SessionContext.INSTANCE.setBeanMap(null);
+ ConversationManager conversationManager = CurrentManager.rootManager().getInstanceByType(ConversationManager.class);
+ conversationManager.destroyAllConversations();
}
/**
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1382 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 11 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-02-02 08:37:02 -0500 (Mon, 02 Feb 2009)
New Revision: 1382
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Resolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/LogImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java
Log:
Bit more tidy up
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -203,7 +203,6 @@
*/
public <T> Set<AnnotatedMethod<?>> resolveDisposalMethods(Class<T> apiType, Annotation... bindings)
{
- // TODO Implement disposal methods
return Collections.emptySet();
}
@@ -792,7 +791,7 @@
*/
public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindings)
{
- return resolver.resolveDecorators(types, bindings);
+ throw new UnsupportedOperationException();
}
/**
@@ -808,7 +807,7 @@
*/
public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
{
- return resolver.resolveInterceptors(type, interceptorBindings);
+ throw new UnsupportedOperationException();
}
/**
@@ -846,20 +845,17 @@
public Manager parse(InputStream xmlStream)
{
- // TODO Implement XML parsing
- return this;
+ throw new UnsupportedOperationException();
}
public Manager createActivity()
{
- // TODO Implement hierarchical managers
- return this;
+ throw new UnsupportedOperationException();
}
public Manager setCurrent(Class<? extends Annotation> scopeType)
{
- // TODO Implement hierarchical managers
- return this;
+ throw new UnsupportedOperationException();
}
public NamingContext getNaming()
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -353,22 +353,6 @@
}
/**
- * Binds the decorators to the proxy
- */
- protected void bindDecorators()
- {
- // TODO Implement decorators
- }
-
- /**
- * Binds the interceptors to the proxy
- */
- protected void bindInterceptors()
- {
- // TODO Implement interceptors
- }
-
- /**
* Returns the annotated time the bean represents
*
* @return The annotated item
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -86,7 +86,6 @@
super.init();
checkScopeAllowed();
checkBeanImplementation();
- // TODO Interceptors
initInitializerMethods();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -226,10 +226,6 @@
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope");
}
- else
- {
- // TODO: possible case?
- }
}
}
@@ -342,15 +338,14 @@
public void destroy(T instance)
{
- try
+ /*try
{
DependentContext.INSTANCE.setActive(true);
- // TODO Implement any cleanup needed
}
finally
{
DependentContext.INSTANCE.setActive(false);
- }
+ }*/
}
protected abstract T produceInstance(CreationalContext<T> creationalContext);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -293,8 +293,6 @@
};
DependentContext.INSTANCE.startCollecting(instance);
DependentContext.INSTANCE.setActive(true);
- bindDecorators();
- bindInterceptors();
injectBoundFields(instance, creationalContext);
callInitializers(instance, creationalContext);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -131,8 +131,7 @@
{
clazz = Class.class.cast(getAnnotatedItem().getActualTypeArguments()[0]);
}
- // TODO should be able to move this up into annotated item?!
-
+ // TODO should be able to move this up into annotated item?!
@SuppressWarnings("unchecked")
Class<T> eventType = (Class<T>) clazz;
@@ -146,15 +145,14 @@
public void destroy(Event<T> instance)
{
- try
+ /*try
{
DependentContext.INSTANCE.setActive(true);
- // TODO Implement any EventBean destruction needed
}
finally
{
DependentContext.INSTANCE.setActive(false);
- }
+ }*/
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -81,15 +81,14 @@
public void destroy(Instance<T> instance)
{
- try
+ /*try
{
DependentContext.INSTANCE.setActive(true);
- // TODO Implement any cleanup needed
}
finally
{
DependentContext.INSTANCE.setActive(false);
- }
+ }*/
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -89,7 +89,7 @@
{
super.init();
checkProducerMethod();
- initDisposalMethod();
+ //initDisposalMethod();
initInjectionPoints();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -131,8 +131,6 @@
instance = constructor.newInstance(manager, creationalContext);
creationalContext.push(instance);
DependentContext.INSTANCE.startCollecting(instance);
- bindDecorators();
- bindInterceptors();
injectEjbAndCommonFields(instance);
injectBoundFields(instance, creationalContext);
callInitializers(instance, creationalContext);
@@ -302,7 +300,6 @@
initEjbInjectionPoints();
initPersistenceUnitInjectionPoints();
initResourceInjectionPoints();
- // TODO Interceptors
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -86,7 +86,6 @@
*/
public Object invoke(Object self, Method proxiedMethod, Method proceed, Object[] args) throws Throwable
{
- // TODO account for child managers
if (bean == null)
{
bean = CurrentManager.rootManager().getBeans().get(beanIndex);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -2,9 +2,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -48,8 +46,6 @@
private static final LogProvider log = Logging.getLogProvider(BeanDeployer.class);
- private static final Set<Annotation> EMPTY_BINDINGS = Collections.emptySet();
-
private final Set<RIBean<?>> beans;
private final Set<AnnotatedClass<?>> deferredClasses;
private final ManagerImpl manager;
@@ -238,7 +234,7 @@
{
// TODO FIx this
@SuppressWarnings("unchecked")
- InstanceBean<Object, Field> bean = InstanceBean.of((AnnotatedItem) injectionPoint, manager);
+ InstanceBean<Object, ?> bean = InstanceBean.of((AnnotatedItem) injectionPoint, manager);
beans.add(bean);
log.info("Web Bean: " + bean);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Resolver.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Resolver.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -18,7 +18,6 @@
package org.jboss.webbeans.injection;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -30,9 +29,6 @@
import javax.inject.TypeLiteral;
import javax.inject.manager.Bean;
-import javax.inject.manager.Decorator;
-import javax.inject.manager.InterceptionType;
-import javax.inject.manager.Interceptor;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -336,32 +332,6 @@
}
/**
- * Resolves decorators according to binding criteria
- *
- * @param types The set of API types to match
- * @param bindings The binding types to match
- * @return The set of matching decorators
- */
- public List<Decorator> resolveDecorators(Set<Type> types, Annotation[] bindings)
- {
- // TODO Implement decorators
- return Collections.emptyList();
- }
-
- /**
- * Resolves interceptors according to binding criteria
- *
- * @param types The set of API types to match
- * @param bindings The binding types to match
- * @return The set of matching interceptors
- */
- public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation[] interceptorBindings)
- {
- // TODO Implement interceptors
- return null;
- }
-
- /**
* Gets a string representation
*
* @return A string representation
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -587,7 +587,7 @@
public AnnotatedMethod<?> getMethod(Method methodDescriptor)
{
- // TODO Cache?
+ // TODO Should be cached
for (AnnotatedMethod<?> annotatedMethod : methods)
{
if (annotatedMethod.getName().equals(methodDescriptor.getName()) && Arrays.equals(annotatedMethod.getParameterTypesAsArray(), methodDescriptor.getParameterTypes()))
@@ -600,7 +600,7 @@
public AnnotatedMethod<?> getDeclaredMethod(Method method)
{
- // TODO Cache?
+ // TODO Should be cached
for (AnnotatedMethod<?> annotatedMethod : declaredMethods)
{
if (annotatedMethod.getName().equals(method.getName()) && Arrays.equals(annotatedMethod.getParameterTypesAsArray(), method.getParameterTypes()))
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/LogImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/LogImpl.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/LogImpl.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -169,17 +169,11 @@
private Object interpolate(Object object, Object... params)
{
- if (object instanceof String)
+ if (params.length > 0)
{
- return object;
- // TODO: interpolation
- // return Interpolator.instance().interpolate( (String) object, params
- // );
+ throw new UnsupportedOperationException("Parameter interpolation not supported");
}
- else
- {
- return object;
- }
+ return object;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -89,8 +89,6 @@
{
interfaces.add(clazz);
}
- // TODO Check the class type much more carefully, many things need
- // excluding!
else
{
classes.add(clazz);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -28,10 +28,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.inject.BindingType;
@@ -166,17 +163,6 @@
}
/**
- * Checks if class is a static inner one
- *
- * @param clazz Class to check
- * @return True if static, false otherwise
- */
- public static boolean isStaticInnerClass(Class<?> clazz)
- {
- return clazz.isMemberClass() && isStatic(clazz);
- }
-
- /**
* Checks if class is a non-static inner one
*
* @param clazz Class to Check
@@ -212,161 +198,6 @@
}
/**
- * Gets all methods with a given annotation
- *
- * @param clazz The class the examine
- * @param annotationType The annotation type to search for
- * @return A list of matching methods. An empty list is returned if no
- * matches are found
- */
- public static List<Method> getMethods(Class<?> clazz, Class<? extends Annotation> annotationType)
- {
- List<Method> methods = new ArrayList<Method>();
- for (Method method : clazz.getMethods())
- {
- if (method.isAnnotationPresent(annotationType))
- {
- methods.add(method);
- }
- }
- return methods;
- }
-
- /**
- * Gets all constructors with a given annotation
- *
- * @param <T> The type of the class
- * @param clazz The class
- * @param annotationType The annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getAnnotatedConstructors(Class<? extends T> clazz, Class<? extends Annotation> annotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- if (constructor.isAnnotationPresent(annotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- return constructors;
- }
-
- /**
- * Gets constructors with a given annotated parameter
- *
- * @param <T> The type
- * @param clazz The class
- * @param parameterAnnotationType The parameter annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getConstructorsForAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> parameterAnnotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- for (Annotation[] annotations : constructor.getParameterAnnotations())
- {
- for (Annotation annotation : annotations)
- {
- if (annotation.annotationType().equals(parameterAnnotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- }
- }
- return constructors;
- }
-
- /**
- * Gets constructors with a given meta-annotated parameter
- *
- * @param <T> The type
- * @param clazz The class
- * @param metaAnnotationType The parameter meta-annotation type
- * @return A list of matching constructors. An empty list is returned if no
- * matches are found
- */
- public static <T> List<Constructor<T>> getConstructorsForMetaAnnotatedParameter(Class<? extends T> clazz, Class<? extends Annotation> metaAnnotationType)
- {
- List<Constructor<T>> constructors = new ArrayList<Constructor<T>>();
- for (Constructor<?> constructor : clazz.getConstructors())
- {
- for (Annotation[] annotations : constructor.getParameterAnnotations())
- {
- for (Annotation annotation : annotations)
- {
- if (annotation.annotationType().isAnnotationPresent(metaAnnotationType))
- {
- @SuppressWarnings("unchecked")
- Constructor<T> c = (Constructor<T>) constructor;
- constructors.add(c);
- }
- }
- }
- }
- return constructors;
- }
-
- /**
- * Checks if all annotations types are in a given set of annotations
- *
- * @param annotations The annotation set
- * @param annotationTypes The annotation types to match
- * @return True if match, false otherwise
- */
- public static boolean annotationTypeSetMatches(Set<Class<? extends Annotation>> annotations, Class<? extends Annotation>... annotationTypes)
- {
- List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
- annotationTypeList.addAll(Arrays.asList(annotationTypes));
- for (Class<? extends Annotation> annotation : annotations)
- {
- if (annotationTypeList.contains(annotation))
- {
- annotationTypeList.remove(annotation);
- }
- else
- {
- return false;
- }
- }
- return annotationTypeList.size() == 0;
- }
-
- /**
- * Checks if all annotations are in a given set of annotations
- *
- * @param annotations The annotation set
- * @param annotationTypes The annotations to match
- * @return True if match, false otherwise
- */
- public static boolean annotationSetMatches(Set<Annotation> annotations, Class<? extends Annotation>... annotationTypes)
- {
- List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
- annotationTypeList.addAll(Arrays.asList(annotationTypes));
- for (Annotation annotation : annotations)
- {
- if (annotationTypeList.contains(annotation.annotationType()))
- {
- annotationTypeList.remove(annotation.annotationType());
- }
- else
- {
- return false;
- }
- }
- return annotationTypeList.size() == 0;
- }
-
- /**
* Gets the actual type arguments of a class
*
* @param clazz The class to examine
@@ -544,7 +375,7 @@
* @return true only if the annotation is really a binding type
*/
@Deprecated
- // TODO Move this method
+ // TODO Replace usage of this with metadatacache
public static boolean isBindings(Annotation binding)
{
boolean isBindingAnnotation = false;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -135,13 +135,11 @@
public Object resolveEjb(InjectionPoint injectionPoint, NamingContext namingContext)
{
- // TODO Implement EJB resolution for Unit tests
return null;
}
public Object resolvePersistenceContext(InjectionPoint injectionPoint, NamingContext namingContext)
{
- // TODO Implement PU resolution for Unit tests
return null;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/BeansImpl.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -24,6 +24,7 @@
* @author David Allen
*
*/
+@Deprecated
public class BeansImpl implements Beans
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -7,10 +7,6 @@
import javax.event.Observes;
import javax.inject.Standard;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
-import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
import org.jboss.webbeans.test.unit.AbstractTest;
import org.testng.annotations.Test;
@@ -54,28 +50,27 @@
@Test(groups={"deferredEvent", "broken"})
public final void testBeforeCompletion() throws Exception
{
- // When the transaction is committed, the beforeCompletion() method is
- // invoked which in turn invokes the observer. Here the mock observer
- // is used to keep track of the event being fired.
- SimpleBean<Tuna> tuna;
- AnnotatedMethod<Object> om;
-
-
- // Create an observer with known binding types
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
- // TODO This should test a real class
- tuna = createSimpleBean(Tuna.class);
- om = AnnotatedMethodImpl.of(AnObserver.class.getMethod("observe", new Class[] { Event.class }), AnnotatedClassImpl.of(AnObserver.class));
-
- AnObserver observerInstance = new AnObserver();
- // TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
- //((MockObserverImpl<Event>) observer).setInstance(observerInstance);
- Event event = new Event();
- //DeferredEventNotification<Event> deferredNotification = new DeferredEventNotification<Event>(event, observer);
- //deferredNotification.beforeCompletion();
- assert observerInstance.notified;
+// // When the transaction is committed, the beforeCompletion() method is
+// // invoked which in turn invokes the observer. Here the mock observer
+// // is used to keep track of the event being fired.
+// //SimpleBean<Tuna> tuna;
+// AnnotatedMethod<Object> om;
+//
+//
+// // Create an observer with known binding types
+// //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+// //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+// //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+// tuna = createSimpleBean(Tuna.class);
+// om = AnnotatedMethodImpl.of(AnObserver.class.getMethod("observe", new Class[] { Event.class }), AnnotatedClassImpl.of(AnObserver.class));
+//
+// AnObserver observerInstance = new AnObserver();
+// // Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
+// //((MockObserverImpl<Event>) observer).setInstance(observerInstance);
+// Event event = new Event();
+// //DeferredEventNotification<Event> deferredNotification = new DeferredEventNotification<Event>(event, observer);
+// //deferredNotification.beforeCompletion();
+// assert observerInstance.notified;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -264,7 +264,7 @@
* types declared by annotations that appear on the implementation class, and
* � has no decorators.
*/
- @Test(groups = { "new" })
+ @Test(groups = { "new", "broken" })
@SpecAssertion(section = "3.3.6", id = "unknown")
public void testNewBeanHasNoDecorators()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java 2009-02-02 12:17:11 UTC (rev 1381)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java 2009-02-02 13:37:02 UTC (rev 1382)
@@ -217,7 +217,7 @@
* types declared by annotations that appear on the implementation class, and
* � has no decorators.
*/
- @Test(groups = { "new" })
+ @Test(groups = { "new" , "broken"})
@SpecAssertion(section = "3.2.5", id = "unknown")
public void testNewBeanHasNoDecorators()
{
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1381 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck and 8 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-02 07:17:11 -0500 (Mon, 02 Feb 2009)
New Revision: 1381
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyContext.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyScoped.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyApplicationBean.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MySessionBean.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/application/ApplicationContextTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/request/RequestContextTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/session/SessionContextTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/manager/ManagerTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/non/contextual/NonContextualInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/ContextTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/NormalContextTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/method/DisposalMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/SimpleBeanDefinitionTest.java
Log:
Additional test changes including new impls for normal context tests.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/AbstractBeanMapContext.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -73,7 +73,10 @@
else if (creationalContext != null)
{
instance = contextual.create(creationalContext);
- getBeanMap().put(contextual, instance);
+ if (instance != null)
+ {
+ getBeanMap().put(contextual, instance);
+ }
return instance;
}
else
@@ -81,7 +84,7 @@
return null;
}
}
-
+
public <T> T get(Contextual<T> contextual)
{
return get(contextual, null);
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -15,6 +15,7 @@
import java.util.Collections;
import java.util.List;
+import javax.context.Context;
import javax.context.CreationalContext;
import javax.inject.Production;
import javax.inject.Standard;
@@ -161,7 +162,22 @@
{
configuration().getContexts().setInactive(configuration().getContexts().getDependentContext());
}
-
+
+ protected static void setContextActive(Context context)
+ {
+ configuration().getContexts().setActive(context);
+ }
+
+ protected static void setContextInactive(Context context)
+ {
+ configuration().getContexts().setInactive(context);
+ }
+
+ protected static void destroyContext(Context context)
+ {
+ configuration().getContexts().destroyContext(context);
+ }
+
@Deprecated
public static final <T> CreationalContext<T> mockCreationalContext(Class<T> expectedType)
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/application/ApplicationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/application/ApplicationContextTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/application/ApplicationContextTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -15,7 +15,7 @@
* The application scope is active during the service() method of any servlet
* in the web application.
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeActiveDuringServiceMethod()
{
@@ -25,7 +25,7 @@
/**
* The application scope is active during any Java EE web service invocation.
*/
- @Test(groups = { "stub", "contexts", "webservice" })
+ @Test(groups = { "stub", "contexts", "webservice", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeActiveDuringWebSericeInvocation()
{
@@ -37,7 +37,7 @@
* of any EJB bean, during any call to an EJB timeout method and during
* message delivery to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeActiveDuringRemoteMethodInvocationOfEjb()
{
@@ -49,7 +49,7 @@
* of any EJB bean, during any call to an EJB timeout method and during
* message delivery to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeActiveDuringCallToEjbTimeoutMethod()
{
@@ -61,7 +61,7 @@
* of any EJB bean, during any call to an EJB timeout method and during
* message delivery to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeActiveDuringEjbMessageDelivery()
{
@@ -74,7 +74,7 @@
* message deliveries to message driven beans that execute within the same
* application
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationContextSharedBetweenInvokationsInApplication()
{
@@ -84,7 +84,7 @@
/**
* The application context is destroyed when the application is undeployed.
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "integration" })
@SpecAssertion(section = "8.5.3", id = "unknown")
public void testApplicationScopeDestroyedWhenApplicationIsUndeployed()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/request/RequestContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/request/RequestContextTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/request/RequestContextTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -15,7 +15,7 @@
* The request scope is active during the service() method of any Servlet in
* the web application.
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeActiveDuringServiceMethod()
{
@@ -26,7 +26,7 @@
* The request context is destroyed at the end of the servlet request, after
* the Servlet service() method returns.
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeIsDestroyedAfterServiceMethod()
{
@@ -36,7 +36,7 @@
/**
* The request scope is active during any Java EE web service invocation.
*/
- @Test(groups = { "stub", "contexts", "webservice" })
+ @Test(groups = { "stub", "contexts", "webservice", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeActiveDuringWebSericeInvocation()
{
@@ -47,7 +47,7 @@
* The request context is destroyed after the web service invocation
* completes
*/
- @Test(groups = { "stub", "contexts", "webservice" })
+ @Test(groups = { "stub", "contexts", "webservice", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeIsDestroyedAfterWebServiceInvocation()
{
@@ -59,7 +59,7 @@
* bean, during any call to an EJB timeout method and during message delivery
* to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeActiveDuringRemoteMethodInvocationOfEjb()
{
@@ -71,7 +71,7 @@
* bean, during any call to an EJB timeout method and during message delivery
* to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeActiveDuringCallToEjbTimeoutMethod()
{
@@ -83,7 +83,7 @@
* bean, during any call to an EJB timeout method and during message delivery
* to any EJB message driven bean.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeActiveDuringEjbMessageDelivery()
{
@@ -94,7 +94,7 @@
* The request context is destroyed after the remote method invocation,
* timeout or message delivery completes.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeDestroyedAfterRemoteMethodInvocationOfEjb()
{
@@ -105,7 +105,7 @@
* The request context is destroyed after the remote method invocation,
* timeout or message delivery completes.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeDestroyedAfterCallToEjbTimeoutMethod()
{
@@ -116,7 +116,7 @@
* The request context is destroyed after the remote method invocation,
* timeout or message delivery completes.
*/
- @Test(groups = { "stub", "contexts", "ejb3" })
+ @Test(groups = { "stub", "contexts", "ejb3", "integration" })
@SpecAssertion(section = "8.5.1", id = "unknown")
public void testRequestScopeDestroyedAfterEjbMessageDelivery()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/session/SessionContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/session/SessionContextTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/context/session/SessionContextTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -15,7 +15,7 @@
* The session scope is active during the service() method of any servlet in
* the web application
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "unknown")
public void testSessionScopeActiveDuringServiceMethod()
{
@@ -26,7 +26,7 @@
* The session context is shared between all servlet requests that occur in
* the same HTTP servlet session
*/
- @Test(groups = { "stub", "contexts", "servlet" })
+ @Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "unknown")
public void testSessionContextSharedBetweenServletRequestsInSameHttpSession()
{
@@ -37,7 +37,7 @@
* The session context is destroyed when the HTTPSession is invalidated or
* times out.
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "integration" })
@SpecAssertion(section = "8.5.2", id = "unknown")
public void testSessionContextDestroyedWhenHttpSessionInvalidatedOrTimesOut()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/manager/ManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/manager/ManagerTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/manager/ManagerTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -6,7 +6,8 @@
public class ManagerTest extends AbstractTest
{
- @Test(groups={"stub", "manager", "ejb3"}) @SpecAssertion(section="5.8", id = "unknown")
+ @Test(groups = { "stub", "manager", "ejb3", "integration" })
+ @SpecAssertion(section = "5.8", id = "unknown")
public void testManagerLookupInJndi()
{
assert false;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/non/contextual/NonContextualInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/non/contextual/NonContextualInjectionTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/lookup/non/contextual/NonContextualInjectionTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -1,44 +1,86 @@
package org.jboss.webbeans.tck.integration.lookup.non.contextual;
import org.jboss.webbeans.tck.AbstractTest;
+import org.jboss.webbeans.tck.impl.SpecAssertion;
import org.testng.annotations.Test;
/**
*
* Spec version: PRD2
- *
+ *
*/
public class NonContextualInjectionTest extends AbstractTest
{
-
- @Test(groups="stub")
+
+ /**
+ * For the purposes of dependency injection and interceptor/decorator stack
+ * creation, the container must treat non-contextual instances of session
+ * beans as instances of the most specialized bean that specializes the bean
+ * with binding @New and de- ployment type @Standard defined in Section
+ * 3.3.6, “Session beans with the @New binding”.
+ */
+ @Test(groups = { "stub", "integration" })
+ @SpecAssertion(section = "5.12.1", id = "unknown")
public void testNonContextualSessionBeanSpecializesNewBeanForInjection()
{
-
+ assert false;
}
-
- @Test(groups="stub")
+
+ /**
+ * Session bean instances obtained directly from JNDI, injected using @EJB or
+ * @Resource, or created by the container to re- ceive remote method calls or
+ * timeouts are not contextual instances. However, the container is still
+ * required to perform de- pendency injection and create interceptor and
+ * decorator stacks for these instances.
+ */
+ @Test(groups = { "stub", "integration" })
+ @SpecAssertion(section = "5.12.1", id = "unknown")
public void testNonContextualSessionBeanSpecializesNewBeanForInterceptorStack()
{
-
+ assert false;
}
-
- @Test(groups="stub")
+
+ /**
+ * Session bean instances obtained directly from JNDI, injected using @EJB or
+ * @Resource, or created by the container to re- ceive remote method calls or
+ * timeouts are not contextual instances. However, the container is still
+ * required to perform de- pendency injection and create interceptor and
+ * decorator stacks for these instances.
+ */
+ @Test(groups = { "stub", "integration" })
+ @SpecAssertion(section = "5.12.1", id = "unknown")
public void testNonContextualSessionBeanSpecializesNewBeanForDecoratorStack()
{
-
+ assert false;
}
-
- @Test(groups="stub")
+
+ /**
+ * Message-driven beans do not have contextual instances. However, the
+ * container is still required to perform dependency in- jection and create
+ * interceptor and decorator stacks.
+ *
+ * The container performs dependency injection and creates interceptor and
+ * decorator stacks for message-driven bean in- stances according to the bean
+ * class annotations.
+ */
+ @Test(groups = { "stub", "integration" })
+ @SpecAssertion(section = "5.12.2", id = "unknown")
public void testInjectionIntoMessageDrivenBean()
{
-
+ assert false;
}
-
- @Test(groups="stub")
+
+ /**
+ * Servlets do not have contextual instances. However, the container is still
+ * required to perform dependency injection. The container performs
+ * dependency injection for servlets according to the servlet class
+ * annotations.
+ */
+ @Test(groups = { "stub", "integration" })
+ @SpecAssertion(section = "5.12.3", id = "unknown")
public void testInjectionIntoServlet()
{
-
+ assert false;
}
-
+
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/ContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/ContextTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/ContextTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -92,7 +92,7 @@
* For each of the built-in normal scopes, contexts propagate across any Java
* method call, including invocation of EJB local business methods.
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "underInvestigation" })
@SpecAssertion(section = "8.5", id = "unknown")
public void testBuiltInNormalScopedContextsPropagateAcrossAnyJavaMethodCall()
{
@@ -104,7 +104,7 @@
* to asynchronous processes such as JMS message listeners or EJB timer
* service timeouts
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "integration" })
@SpecAssertion(section = "8.5", id = "unknown")
public void testBuiltInNormalScopedContextsDoNotPropagateAcrossRemoteMethodInvocations()
{
@@ -116,7 +116,7 @@
* to asynchronous processes such as JMS message listeners or EJB timer
* service timeouts
*/
- @Test(groups = { "stub", "contexts" })
+ @Test(groups = { "stub", "contexts", "integration" })
@SpecAssertion(section = "8.5", id = "unknown")
public void testBuiltInNormalScopedContextsDoNotPropagateAcrossAsynchronousMethodInvocations()
{
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyContext.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyContext.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyContext.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,30 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import java.lang.annotation.Annotation;
+
+import javax.context.Context;
+import javax.context.Contextual;
+import javax.context.CreationalContext;
+
+class DummyContext implements Context
+{
+ public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> T get(Contextual<T> contextual)
+ {
+ return get(contextual, null);
+ }
+
+ public Class<? extends Annotation> getScopeType()
+ {
+ return DummyScoped.class;
+ }
+
+ public boolean isActive()
+ {
+ return true;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyScoped.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyScoped.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyScoped.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.context.ScopeType;
+
+@ScopeType
+(a)Retention(RetentionPolicy.RUNTIME)
+@interface DummyScoped
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/DummyScoped.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyApplicationBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyApplicationBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyApplicationBean.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import java.io.Serializable;
+
+import javax.context.ApplicationScoped;
+
+@ApplicationScoped
+class MyApplicationBean implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyApplicationBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,109 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.context.SessionScoped;
+import javax.inject.Standard;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.Manager;
+
+class MyContextual extends Bean<MySessionBean>
+{
+ private boolean createCalled = false;
+ private boolean destroyCalled = false;
+ private boolean shouldReturnNullInstances = false;
+
+ protected MyContextual(Manager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public Set<? extends InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public String getName()
+ {
+ return "my-session-bean";
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return SessionScoped.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<Type> getTypes()
+ {
+ return new HashSet<Type>(Arrays.asList(Object.class, MySessionBean.class, Serializable.class));
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ @Override
+ public MySessionBean create(CreationalContext<MySessionBean> creationalContext)
+ {
+ createCalled = true;
+ if (shouldReturnNullInstances)
+ return null;
+ else
+ return new MySessionBean();
+ }
+
+ @Override
+ public void destroy(MySessionBean instance)
+ {
+ destroyCalled = true;
+ }
+
+ public boolean isCreateCalled()
+ {
+ return createCalled;
+ }
+
+ public boolean isDestroyCalled()
+ {
+ return destroyCalled;
+ }
+
+ public void setShouldReturnNullInstances(boolean shouldReturnNullInstances)
+ {
+ this.shouldReturnNullInstances = shouldReturnNullInstances;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyContextual.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import javax.context.CreationalContext;
+
+class MyCreationalContext<T> implements CreationalContext<T>
+{
+
+ @Override
+ public void push(T incompleteInstance)
+ {
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MyCreationalContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MySessionBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MySessionBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MySessionBean.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.unit.context;
+
+import java.io.Serializable;
+
+@DummyScoped
+class MySessionBean implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/MySessionBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/NormalContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/NormalContextTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/context/NormalContextTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -1,13 +1,11 @@
package org.jboss.webbeans.tck.unit.context;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
+import javax.context.ApplicationScoped;
import javax.context.Context;
+import javax.context.ContextNotActiveException;
import javax.context.Contextual;
import javax.context.CreationalContext;
-import javax.context.ScopeType;
+import javax.context.SessionScoped;
import org.jboss.webbeans.tck.AbstractTest;
import org.jboss.webbeans.tck.impl.SpecAssertion;
@@ -18,104 +16,112 @@
*
* @author Nicklas Karlsson
* @author Pete Muir
+ * @author David Allen
*
* This class tests a basic context against section 8 of the
* specification
*
- * Spec version: PRD2
+ * Spec version: PRD2
*/
public class NormalContextTest extends AbstractTest
{
-
- @ScopeType
- @Retention(RetentionPolicy.RUNTIME)
- private @interface Dummy {}
-
- private static class DummyContext implements Context
- {
- public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)
- {
- throw new UnsupportedOperationException();
- }
-
- public <T> T get(Contextual<T> contextual)
- {
- return get(contextual, null);
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return Dummy.class;
- }
-
- public boolean isActive()
- {
- return true;
- }
-
- }
-
Context context;
@BeforeMethod
public void initContext()
{
context = new DummyContext();
+ manager.addContext(context);
}
/**
* return an existing instance of the given contextual type, or
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts", "broken" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testGetReturnsExistingInstace()
+ public void testGetReturnsExistingInstance()
{
- assert false;
+ deployBeans(MySessionBean.class);
+ MySessionBean beanInstance = manager.getInstanceByType(MySessionBean.class);
+
+ Contextual<MySessionBean> mySessionBean = manager.resolveByType(MySessionBean.class).iterator().next();
+ MySessionBean beanInstanceFromGet = manager.getContext(SessionScoped.class).get(mySessionBean);
+ assert beanInstanceFromGet.equals(beanInstance);
}
/**
- * if the value of the create parameter is false, return a null value, or
+ * if no CreationalContext is given, return a null value, or
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testGetWithCreateFalseReturnsNull()
+ public void testGetWithoutCreationalContextReturnsNull()
{
- assert false;
+ deployBeans(MySessionBean.class);
+
+ Contextual<MySessionBean> mySessionBean = manager.resolveByType(MySessionBean.class).iterator().next();
+ assert manager.getContext(SessionScoped.class).get(mySessionBean) == null;
}
/**
- * if the value of the create parameter is true, create a new instance of the
- * given contextual type by calling Bean.create() and return the new
+ * if a CreationalContext is given, create a new instance of the given
+ * contextual type by calling Contextual.create() and return the new
* instance.
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testGetWithCreateTrueReturnsNewInstance()
+ public void testGetWithCreationalContextReturnsNewInstance()
{
- assert false;
+ MyContextual bean = new MyContextual(manager);
+ bean.setShouldReturnNullInstances(false);
+ manager.addBean(bean);
+
+ CreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
+ assert manager.getContext(SessionScoped.class).get(bean, myCreationalContext) != null;
+ assert bean.isCreateCalled();
}
/**
- * The get() method may not return a null value unless the create parameter
- * is false or Contextual.create() returns a null value
+ * The get() method may not return a null value unless no CreationalContext
+ * is given, or Contextual.create() returns a null value.
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testGetMayNotReturnNullUnlessCreateIsFalseOrContextualCreateReturnsNull()
+ public void testGetMayNotReturnNullUnlessNoCreationalContextOrContextualCreateReturnsNull()
{
- assert false;
+ // The case of no creational context is already tested where a null is
+ // returned. Here we just test that the contextual create can return null.
+ MyContextual bean = new MyContextual(manager);
+ bean.setShouldReturnNullInstances(true);
+ manager.addBean(bean);
+
+ CreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
+ assert manager.getContext(SessionScoped.class).get(bean, myCreationalContext) == null;
+ assert bean.isCreateCalled();
}
/**
* The get() method may not create a new instance of the given contextual
- * type unless the create parameter is true
+ * type unless a CreationalContext is given.
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testGetMayNotCreateNewInstanceUnlessCreateIsTrue()
+ public void testGetMayNotCreateNewInstanceUnlessCreationalContextGiven()
{
- assert false;
+ deployBeans(MySessionBean.class, MyApplicationBean.class);
+
+ Contextual<MySessionBean> mySessionBean = manager.resolveByType(MySessionBean.class).iterator().next();
+ assert manager.getContext(SessionScoped.class).get(mySessionBean) == null;
+
+ Contextual<MyApplicationBean> myApplicationBean = manager.resolveByType(MyApplicationBean.class).iterator().next();
+ assert manager.getContext(ApplicationScoped.class).get(myApplicationBean) == null;
+
+ // Now try same operation with a CreationalContext
+ CreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
+ assert manager.getContext(SessionScoped.class).get(mySessionBean, myCreationalContext) != null;
+
+ CreationalContext<MyApplicationBean> myOtherCreationalContext = new MyCreationalContext<MyApplicationBean>();
+ assert manager.getContext(ApplicationScoped.class).get(myApplicationBean, myOtherCreationalContext) != null;
}
/**
@@ -123,19 +129,32 @@
* instance it creates by passing the instance to the destroy() method of the
* Contextual object representing the contextual type.
*/
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.1", id = "unknown")
public void testContextDestroysBeansWhenDestroyed()
{
- assert false;
+ MyContextual bean = new MyContextual(manager);
+ bean.setShouldReturnNullInstances(false);
+ manager.addBean(bean);
+
+ CreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
+ Context sessionContext = manager.getContext(SessionScoped.class);
+ assert sessionContext.get(bean, myCreationalContext) != null;
+ assert bean.isCreateCalled();
+
+ destroyContext(sessionContext);
+ assert bean.isDestroyCalled();
}
/**
* A destroyed instance must not subsequently be returned by the get()
* method.
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts", "stub", "underInvestigation" })
@SpecAssertion(section = "8.1", id = "unknown")
public void testDestroyedInstanceMustNotBeReturnedByGet()
{
+ //TODO How is an instance destroyed such that the context is not and could later return the same instance
assert false;
}
@@ -144,20 +163,26 @@
* thread upon the Context object for that scope results in a
* ContextNotActiveException.
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts" }, expectedExceptions = { ContextNotActiveException.class })
@SpecAssertion(section = "8.1", id = "unknown")
public void testInvokingGetOnInactiveContextFails()
{
- assert false;
+ deployBeans(MySessionBean.class);
+ Context sessionContext = manager.getContext(SessionScoped.class);
+ assert sessionContext.isActive();
+ setContextInactive(sessionContext);
+
+ Contextual<MySessionBean> mySessionBean = manager.resolveByType(MySessionBean.class).iterator().next();
+ sessionContext.get(mySessionBean);
}
/**
* There may be no more than one mapped instance per contextual type per
* thread
*/
- @Test(groups = { "contexts", "stub" })
+ @Test(groups = { "contexts", "stub", "underInvestigation" })
@SpecAssertion(section = "8.1", id = "unknown")
- public void testOnlyMappedInstancePerContextualTypePerThread()
+ public void testOnlyOneMappedInstancePerContextualTypePerThread()
{
assert false;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/method/DisposalMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/method/DisposalMethodDefinitionTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/method/DisposalMethodDefinitionTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -14,7 +14,7 @@
@Test(groups="stub") @SpecAssertion(section="4.2", id = "unknown")
public void testNonStaticDisposalMethodNotInherited()
{
-
+ assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/SimpleBeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/SimpleBeanDefinitionTest.java 2009-02-02 11:18:04 UTC (rev 1380)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/SimpleBeanDefinitionTest.java 2009-02-02 12:17:11 UTC (rev 1381)
@@ -101,7 +101,7 @@
@Test(groups="stub")
public void testEjbsNotDiscoveredAsSimpleBean()
{
-
+ assert false;
}
@Test(groups={"stub", "producerMethod", "webbeansxml"})
17 years, 2 months