[webbeans-commits] Webbeans SVN: r1483 - ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-11 06:54:02 -0500 (Wed, 11 Feb 2009)
New Revision: 1483
Modified:
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java
Log:
unbreak build from @WebBean refactor
Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java 2009-02-11 11:41:05 UTC (rev 1482)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java 2009-02-11 11:54:02 UTC (rev 1483)
@@ -8,7 +8,7 @@
import org.jboss.jsr299.tck.spi.Managers;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
public class ManagersImpl implements Managers
{
@@ -26,7 +26,7 @@
public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
List<Class<? extends Annotation>> deploymentTypes = new ArrayList<Class<? extends Annotation>>(CurrentManager.rootManager().getEnabledDeploymentTypes());
- deploymentTypes.remove(WebBeans.class);
+ deploymentTypes.remove(WebBean.class);
return deploymentTypes;
}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1482 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: conversation and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-11 06:41:05 -0500 (Wed, 11 Feb 2009)
New Revision: 1482
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBean.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBeans.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/NumericConversationIdGenerator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
Log:
minor stuff
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-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -176,9 +176,9 @@
protected void addWebBeansDeploymentTypes()
{
- if (!this.enabledDeploymentTypes.contains(WebBeans.class))
+ if (!this.enabledDeploymentTypes.contains(WebBean.class))
{
- this.enabledDeploymentTypes.add(1, WebBeans.class);
+ this.enabledDeploymentTypes.add(1, WebBean.class);
}
}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBean.java (from rev 1477, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBeans.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBean.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -0,0 +1,26 @@
+package org.jboss.webbeans;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+/**
+ * Deployment type for Web Beans beans
+ *
+ * @author Pete Muir
+ *
+ */
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+public @interface WebBean
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBeans.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBeans.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/WebBeans.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -1,26 +0,0 @@
-package org.jboss.webbeans;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.DeploymentType;
-
-/**
- * Deployment type for Web Beans beans
- *
- * @author Pete Muir
- *
- */
-@Target( { TYPE, METHOD })
-@Retention(RUNTIME)
-@Documented
-@DeploymentType
-public @interface WebBeans
-{
-
-}
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-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -22,7 +22,7 @@
import javax.context.RequestScoped;
import javax.inject.Initializer;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
/**
@@ -33,7 +33,7 @@
*/
@RequestScoped
@Named("conversation")
-@WebBeans
+@WebBean
public class ConversationImpl implements Conversation
{
// The conversation ID
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -24,7 +24,7 @@
import javax.context.SessionScoped;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
/**
* A ConversationTerminator implementation using Java SE scheduling
@@ -33,7 +33,7 @@
* @see org.jboss.webbeans.conversation.ConversationTerminator
*/
@SessionScoped
-@WebBeans
+@WebBean
public class JavaSEConversationTerminator implements ConversationTerminator, Serializable
{
private ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/NumericConversationIdGenerator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/NumericConversationIdGenerator.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/NumericConversationIdGenerator.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -21,7 +21,7 @@
import javax.context.SessionScoped;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
/**
* A ConversationIdGenerator implementation using running numerical values
@@ -30,7 +30,7 @@
*
*/
@SessionScoped
-@WebBeans
+@WebBean
public class NumericConversationIdGenerator implements ConversationIdGenerator, Serializable
{
// The next conversation ID
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -26,7 +26,7 @@
import javax.inject.Produces;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.conversation.bindings.ConversationConcurrentAccessTimeout;
@@ -41,7 +41,7 @@
*
*/
@SessionScoped
-@WebBeans
+@WebBean
public class ServletConversationManager implements ConversationManager, Serializable
{
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
@@ -83,7 +83,7 @@
@Produces
@ConversationInactivityTimeout
- @WebBeans
+ @WebBean
public long getConversationTimeoutInMilliseconds()
{
return CONVERSATION_TIMEOUT_IN_MS;
@@ -91,7 +91,7 @@
@Produces
@ConversationConcurrentAccessTimeout
- @WebBeans
+ @WebBean
public long getConversationConcurrentAccessTimeout()
{
return CONVERSATION_CONCURRENT_ACCESS_TIMEOUT_IN_MS;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionManager.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/HttpSessionManager.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -4,10 +4,10 @@
import javax.inject.Produces;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.WebBeans;
+import org.jboss.webbeans.WebBean;
@RequestScoped
-@WebBeans
+@WebBean
public class HttpSessionManager
{
private HttpSession session;
@@ -19,7 +19,7 @@
@Produces
@RequestScoped
- @WebBeans
+ @WebBean
HttpSession produceSession()
{
return session;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-11 10:44:19 UTC (rev 1481)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansServletFilter.java 2009-02-11 11:41:05 UTC (rev 1482)
@@ -35,12 +35,45 @@
* Filter for handling conversation propagation over redirects
*
* @author Nicklas Karlsson
- *
+ *
*/
// TODO: Quick and dirty, not for actual usage yet ;-)
public class WebBeansServletFilter implements Filter
{
+ private class RedirectUrl
+ {
+ private String URL;
+ private FacesContext context;
+
+ public RedirectUrl(String URL)
+ {
+ this.URL = URL;
+ context = FacesContext.getCurrentInstance();
+ }
+
+ public RedirectUrl appendCid(String cid)
+ {
+ return new RedirectUrl(URL + (URL.indexOf("?") > 0 ? "&" : "?") + "cid=" + cid);
+ }
+
+ public RedirectUrl getRedirectView()
+ {
+ String requestPath = context.getExternalContext().getRequestContextPath();
+ return new RedirectUrl(URL.substring(URL.indexOf(requestPath) + requestPath.length()));
+ }
+
+ public RedirectUrl getActionUrl()
+ {
+ return new RedirectUrl(context.getApplication().getViewHandler().getActionURL(context, URL));
+ }
+
+ public String encode()
+ {
+ return context.getExternalContext().encodeActionURL(URL);
+ }
+ }
+
public void destroy()
{
}
@@ -55,17 +88,14 @@
return new HttpServletResponseWrapper(response)
{
@Override
- public void sendRedirect(String location) throws IOException
+ public void sendRedirect(String path) throws IOException
{
- FacesContext context = FacesContext.getCurrentInstance();
Conversation conversation = CurrentManager.rootManager().getInstanceByType(Conversation.class);
if (conversation.isLongRunning())
{
- location = context.getApplication().getViewHandler().getActionURL(context, location);
- String appendedConversation = "?cid=" + conversation.getId();
- location = context.getExternalContext().encodeActionURL(location + appendedConversation);
+ path = new RedirectUrl(path).getRedirectView().getActionUrl().appendCid(conversation.getId()).encode();
}
- super.sendRedirect(location);
+ super.sendRedirect(path);
}
};
}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1481 - in tck/trunk/impl: src/main/java/org/jboss/jsr299/tck/unit/definition/deployment and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-02-11 05:44:19 -0500 (Wed, 11 Feb 2009)
New Revision: 1481
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/deployment/DeploymentTypeDefinitionTest.java
tck/trunk/impl/tck-audit.xml
Log:
more assertion mappings
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/deployment/DeploymentTypeDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/deployment/DeploymentTypeDefinitionTest.java 2009-02-11 01:57:42 UTC (rev 1480)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/deployment/DeploymentTypeDefinitionTest.java 2009-02-11 10:44:19 UTC (rev 1481)
@@ -34,65 +34,48 @@
return deploymentTypes;
}
- /**
- * No bean may be declared with the (@Standard-bean) deployment type unless
- * explicitly required by this specification.
- */
@Test(groups = { "deploymentType" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.5.1", id = "unknown")
+ @SpecAssertion(section = "2.5.1", id = "b")
public void testNonBuiltInComponentUsesStandard()
{
deployBeans(Gazelle_Broken.class);
}
/**
- * A deployment type is a Java annotation defined as @Target({TYPE, METHOD,
- * FIELD}) and @Retention(RUNTIME).
*
* TODO This text is not really a testable assertion
*/
@Test(groups = { "underInvestigation", "annotationDefinition", "deploymentType" })
- @SpecAssertion(section = "2.5.2", id = "unknown")
+ @SpecAssertion(section = "2.5.2", id = "a")
public void testDeploymentTypeHasCorrectTarget()
{
assert false;
}
/**
- * A deployment type is a Java annotation defined as @Target({TYPE, METHOD,
- * FIELD}) and @Retention(RUNTIME).
*
* TODO This text is not really a testable assertion
*/
@Test(groups = { "underInvestigation", "annotationDefinition", "deploymentType" })
- @SpecAssertion(section = "2.5.2", id = "unknown")
+ @SpecAssertion(section = "2.5.2", id = "b")
public void testDeploymentTypeHasCorrectRetention()
{
assert false;
}
/**
- * All de- ployment types must also specify the @javax.inject.DeploymentType
- * meta-annotation.
*
* TODO This text is not really a testable assertion
*/
@Test(groups = { "underInvestigation", "annotationDefinition", "deploymentType" })
- @SpecAssertion(section = "2.5.2", id = "unknown")
+ @SpecAssertion(section = "2.5.2", id = "c")
public void testDeploymentTypeDeclaresDeploymentTypeAnnotation()
{
assert false;
}
- /**
- * By default, if no deployment type annotation is explicitly specified, a
- * producer method or field inherits the deployment type of the bean in which
- * it is defined.
- *
- * @throws Exception
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "2.5.3", id = "unknown")
+ @SpecAssertion(section = "2.5.3", id = "c")
public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
{
deployBeans(SpiderProducer.class);
@@ -101,14 +84,12 @@
}
/**
- * When a bean is declared in beans.xml, the deployment type may be specified
- * using a tag with the annotation type name:
*
* TODO Section 2.5.4 does not claim that XML overrides Java for deployment
* types
*/
@Test(groups = { "stub", "webbeansxml", "deploymentType" })
- @SpecAssertion(section = "2.5.4", id = "unknown")
+ @SpecAssertion(section = "2.5.4", id = "a")
public void testXmlDeploymentTypeElement()
{
// Map<Class<? extends Annotation>, Annotation>
@@ -128,16 +109,8 @@
assert false;
}
- /**
- * The default deployment type for a bean which does not explicitly declare a
- * deployment type depends upon its declared stereotypes:
- *
- * • If a bean does not declare any stereotype with a declared default
- * deployment type, then the default deployment type is (@Production-bean).
- *
- */
@Test(groups = { "webbeansxml", "deploymentType" })
- @SpecAssertion(section = "2.5.5", id = "unknown")
+ @SpecAssertion(section = "2.5.5", id = "a")
public void testDefaultDeploymentType()
{
deployBeans(BlackWidow.class);
@@ -145,13 +118,8 @@
assert bean.getDeploymentType().equals(Production.class);
}
- /**
- * • Otherwise, the default deployment type for the bean is the
- * highest-precedence default deployment type declared by any stereotype
- * declared by the bean.
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "2.5.5", id = "unknown")
+ @SpecAssertion(section = "2.5.5", id = "b")
public void testHighestPrecedenceDeploymentTypeFromStereotype()
{
deployBeans(Rhinoceros.class);
@@ -159,25 +127,16 @@
assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
}
- /**
- * If the deployment type is enabled, an instance of the bean may be obtained
- * by lookup, injection or EL resolution. Otherwise, the bean is never
- * instantiated by the container.
- */
@Test(groups = { "beanLifecycle", "deploymentType" }, expectedExceptions = UnsatisfiedDependencyException.class)
- @SpecAssertion(section = "2.5.6", id = "unknown")
+ @SpecAssertion(section = "2.5.6", id = "a")
public void testBeanWithDisabledDeploymentTypeNotInstantiated()
{
deployBeans(RedSnapper.class);
manager.getInstanceByType(RedSnapper.class);
}
- /**
- * If more than one deployment type is specified in XML, a
- * DefinitionException is thrown by the container at deployment time.
- */
@Test(groups = { "stub", "webbeansxml", "deploymentType" }, expectedExceptions = DeploymentException.class)
- @SpecAssertion(section = "2.5.4", id = "unknown")
+ @SpecAssertion(section = "2.5.4", id = "b")
public void testMultipleDeployElementsCannotBeDefined()
{
@@ -188,7 +147,9 @@
* type declared by stereotypes are ignored.
*/
@Test(groups = { "deploymentType" })
- @SpecAssertions( { @SpecAssertion(section = "2.5.5", id = "unknown"), @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "4.1", id = "unknown") })
+ @SpecAssertions( { @SpecAssertion(section = "2.5.5", id = "unknown"),
+ @SpecAssertion(section = "2.7.2", id = "unknown"),
+ @SpecAssertion(section = "4.1", id = "d") })
public void testWebBeanDeploymentTypeOverridesStereotype()
{
deployBeans(Reindeer.class);
@@ -196,58 +157,32 @@
assert bean.getDeploymentType().equals(Production.class);
}
- /**
- * If X is annotated with a deployment type Z then Y inherits the annotation
- * if and only if Z declares the @Inherited meta-annotation and neither Y nor
- * any intermediate class that is a subclass of X and a superclass of Y
- * declares a deployment type.
- *
- * @throws Exception
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "4.1", id = "unknown")
+ @SpecAssertion(section = "4.1", id = "c")
public void testDeploymentTypeDeclaredInheritedIsInherited() throws Exception
{
deployBeans(BorderCollie.class);
assert manager.resolveByType(BorderCollie.class).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
}
- /**
- * If X is annotated with a deployment type Z then Y inherits the annotation
- * if and only if Z declares the @Inherited meta-annotation and neither Y nor
- * any intermediate class that is a subclass of X and a superclass of Y
- * declares a deployment type.
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "4.1", id = "unknown")
+ @SpecAssertion(section = "4.1", id = "c")
public void testDeploymentTypeNotDeclaredInheritedIsNotInherited()
{
deployBeans(ShetlandPony.class);
assert manager.resolveByType(ShetlandPony.class).iterator().next().getDeploymentType().equals(Production.class);
}
- /**
- * If X is annotated with a deployment type Z then Y inherits the annotation
- * if and only if Z declares the @Inherited meta-annotation and neither Y nor
- * any intermediate class that is a subclass of X and a superclass of Y
- * declares a deployment type.
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "4.1", id = "unknown")
+ @SpecAssertion(section = "4.1", id = "c")
public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeNotMarkedInherited()
{
deployBeans(GoldenRetriever.class);
assert manager.resolveByType(GoldenRetriever.class).iterator().next().getDeploymentType().equals(Production.class);
}
- /**
- * If X is annotated with a deployment type Z then Y inherits the annotation
- * if and only if Z declares the @Inherited meta-annotation and neither Y nor
- * any intermediate class that is a subclass of X and a superclass of Y
- * declares a deployment type.
- */
@Test(groups = { "deploymentType" })
- @SpecAssertion(section = "4.1", id = "unknown")
+ @SpecAssertion(section = "4.1", id = "c")
public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeMarkedInherited()
{
deployBeans(GoldenLabrador.class);
Modified: tck/trunk/impl/tck-audit.xml
===================================================================
--- tck/trunk/impl/tck-audit.xml 2009-02-11 01:57:42 UTC (rev 1480)
+++ tck/trunk/impl/tck-audit.xml 2009-02-11 10:44:19 UTC (rev 1481)
@@ -165,6 +165,117 @@
<text>When the bindings of a parameter are specified using XML, any binding annotations of the parameter are ignored</text>
</assertion>
</section>
+
+ <section id="2.4" title="Scopes">
+
+ <assertion id="a">
+ <text>All beans have a scope</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>A scope type is represented by an annotation type.</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>The set of scope types is extensible</text>
+ </assertion>
+
+ </section>
+
+ <section id="2.5.1" title="Built-in deployment types">
+
+ <assertion id="a">
+ <text>All standard beans defined by this specification, and provided by the container, are defined using the @Standard deployment type</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>No bean may be declared with the @Standard deployment type unless explicitly required by this specification</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>Application beans may be defined using the @Production deployment type</text>
+ </assertion>
+
+ </section>
+
+ <section id="2.5.2" title="Defining new deployment types">
+
+ <assertion id="a">
+ <text>A deployment type is a Java annotation defined as @Target({TYPE, METHOD, FIELD})</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>A deployment type is a Java annotation defined with @Retention(RUNTIME)</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>All deployment types must also specify the @javax.inject.DeploymentType meta-annotation.</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>Applications and third-party frameworks may define their own deployment types</text>
+ </assertion>
+
+ </section>
+
+ <section id="2.5.3" title="Declaring the deployment type of a bean using annotations">
+
+ <assertion id="a">
+ <text>The deployment type of the bean is declared by annotating the bean class or producer method or field</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>An bean class or producer method or field may specify at most one deployment type. If multiple deployment type annotations are specified, a DefinitionException is thrown by the container at deployment time.</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>By default, if no deployment type annotation is explicitly specified, a producer method or field inherits the deployment type of the bean in which it is defined.</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>a deployment type may be specified using a stereotype annotation, as defined in Section 2.7.2, "Declaring the stereotypes for a bean using annotations".</text>
+ </assertion>
+
+ </section>
+
+ <section id="2.5.4" title="Declaring the deployment type of a bean using XML">
+ <assertion id="a">
+ <text>When a bean is declared in beans.xml, the deployment type may be specified using a tag with the annotation type name</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>If more than one deployment type is specified in XML, a DefinitionException is thrown by the container at deployment time</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>A deployment type may be specified using a stereotype declared in XML, as defined in Section 2.7.3, "Declaring the stereotypes for a bean using XML".</text>
+ </assertion>
+ </section>
+
+ <section id="2.5.5" title="Default deployment type">
+
+ <assertion id="a">
+ <text>The default deployment type for a bean which does not explicitly declare a deployment type depends upon its declared stereotypes - if a bean does not declare any stereotype with a declared default deployment type, then the default deployment type is
+@Production</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>Otherwise, the default deployment type for the bean is the highest-precedence default deployment type declared by any stereotype declared by the bean</text>
+ <note>This assertion relates to assertion 2.5.5.b</note>
+ </assertion>
+
+ <assertion id="c">
+ <text>If a bean explicitly declares a deployment type, any default deployment type declared by stereotypes are ignored.</text>
+ </assertion>
+ </section>
+
+ <section id="2.5.6" title="Enabled deployment types">
+
+ <assertion id="a">
+ <text>Beans declared with a deployment type that is not enabled are not available to the resolution algorithms defined in Chapter 5, Lookup, dependency injection and EL resolution.</text>
+ </assertion>
+
+ </section>
<section id="3" title="Bean Implementation">
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1480 - in tck/trunk/impl: src/main/java/org/jboss/jsr299/tck/unit/definition/bean and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-02-10 20:57:42 -0500 (Tue, 10 Feb 2009)
New Revision: 1480
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/bean/BeanDefinitionTest.java
tck/trunk/impl/tck-audit.xml
Log:
Map more section 2 tests to assertions
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/bean/BeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/bean/BeanDefinitionTest.java 2009-02-11 00:07:04 UTC (rev 1479)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/bean/BeanDefinitionTest.java 2009-02-11 01:57:42 UTC (rev 1480)
@@ -41,15 +41,15 @@
// throws a definition exception if any of these occur
@Test
- @SpecAssertion(section = "2", id = "unknown")
- public void testApiTypesNonEmpty()
+ @SpecAssertion(section = "2", id = "a")
+ public void testBeanTypesNonEmpty()
{
assert manager.resolveByType(RedSnapper.class).size() == 1;
assert manager.resolveByType(RedSnapper.class).iterator().next().getTypes().size() > 0;
}
@Test
- @SpecAssertion(section = "2", id = "unknown")
+ @SpecAssertion(section = "2", id = "b")
public void testBindingTypesNonEmpty()
{
assert manager.resolveByType(RedSnapper.class).size() == 1;
@@ -57,7 +57,7 @@
}
@Test
- @SpecAssertion(section = "2", id = "unknown")
+ @SpecAssertion(section = "2", id = "c")
public void testHasScopeType()
{
assert manager.resolveByType(RedSnapper.class).size() == 1;
@@ -65,7 +65,7 @@
}
@Test
- @SpecAssertion(section = "2", id = "unknown")
+ @SpecAssertion(section = "2", id = "d")
public void testHasDeploymentType()
{
assert manager.resolveByType(RedSnapper.class).size() == 1;
@@ -73,7 +73,7 @@
}
@Test(groups = "producerMethod")
- @SpecAssertion(section = "5.2", id = "unknown")
+ @SpecAssertion(section = "5.2", id = "b")
public void testIsNullable() throws Exception
{
assert manager.resolveByType(Integer.class).size() == 1;
@@ -87,7 +87,10 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "3.2.2", id = "unknown"),
- @SpecAssertion(section = "2.2", id = "unknown")
+ @SpecAssertion(section = "2.2", id = "a"),
+ @SpecAssertion(section = "2.2", id = "d"),
+ @SpecAssertion(section = "2.2", id = "e"),
+ @SpecAssertion(section = "2.2", id = "k")
})
public void testBeanTypes()
{
@@ -103,7 +106,7 @@
}
@Test
- @SpecAssertion(section = "2.2", id = "unknown")
+ @SpecAssertion(section = "2.2", id = "g")
public void testFinalApiType()
{
manager.resolveByType(DependentFinalTuna.class);
Modified: tck/trunk/impl/tck-audit.xml
===================================================================
--- tck/trunk/impl/tck-audit.xml 2009-02-11 00:07:04 UTC (rev 1479)
+++ tck/trunk/impl/tck-audit.xml 2009-02-11 01:57:42 UTC (rev 1480)
@@ -1,7 +1,90 @@
<specification xmlns="http://jboss.com/products/webbeans/tck/audit"
name="JSR-299: Java Contexts and Dependency Injection"
version="Revised Public Review Draft">
+
+ <section id="2" title="Bean definition">
+
+ <assertion id="a">
+ <text>A bean comprises of a (nonempty) set of bean types</text>
+ </assertion>
+ <assertion id="b">
+ <text>A bean comprises of a (nonempty) set of bindings</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>A bean comprises of a scope</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>A bean comprises of a deployment type</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>A bean comprises of an optional bean name</text>
+ </assertion>
+
+ <assertion id="f">
+ <text>A bean comprises of a set of interceptor bindings</text>
+ </assertion>
+
+ <assertion id="g">
+ <text>A bean comprises of a bean implementation</text>
+ </assertion>
+ </section>
+
+ <section id="2.2" title="Bean types">
+
+ <assertion id="a">
+ <text>A bean may have multiple bean types</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>A bean type may be a parameterized type with an actual type parameter. For the purposes of the typesafe resolution algorithm defined in Section 5.9, "Typesafe resolution algorithm", parameterized bean types are considered identical by the container only if both the type and the type parameters (if any) are identical</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>Bean types may not declare a type variable or wildcard. If the type of an injection point is a parameterized type with a type variable or wildcard, a DefinitionException is thrown by the container at deployment time.</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>A bean type may be an interface</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>A bean type may be a concrete class</text>
+ </assertion>
+
+ <assertion id="f">
+ <text>A bean type may be an abstract class</text>
+ </assertion>
+
+ <assertion id="g">
+ <text>A bean type may be declared final</text>
+ </assertion>
+
+ <assertion id="h">
+ <text>A bean type may have final methods</text>
+ </assertion>
+
+ <assertion id="i">
+ <text>A bean type may be an array type. Two array types are considered identical only if the element type is identical</text>
+ </assertion>
+
+ <assertion id="j">
+ <text>A bean type may be a primitive types. Primitive types are considered to be identical to their corresponding wrapper types in java.lang.</text>
+ </assertion>
+
+ <assertion id="k">
+ <text>All beans have the bean type java.lang.Object</text>
+ </assertion>
+
+ <assertion id="l">
+ <text>A client of a bean may typecast its reference to any instance of the bean to any bean type of the bean</text>
+ </assertion>
+
+ </section>
+
<section id="2.3.1" title="Default binding type">
<assertion id="a">
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1479 - in tck/trunk/impl: src/main/java/org/jboss/jsr299/tck/unit/definition/binding and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-02-10 19:07:04 -0500 (Tue, 10 Feb 2009)
New Revision: 1479
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/binding/BindingDefinitionTest.java
tck/trunk/impl/tck-audit.xml
Log:
map chapter 2 tests to assertions
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/binding/BindingDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/binding/BindingDefinitionTest.java 2009-02-10 20:30:51 UTC (rev 1478)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/definition/binding/BindingDefinitionTest.java 2009-02-11 00:07:04 UTC (rev 1479)
@@ -31,7 +31,7 @@
}
@Test
- @SpecAssertions( { @SpecAssertion(section = "2.3.3", id = "unknown"), @SpecAssertion(section = "2.3.1", id = "unknown") })
+ @SpecAssertion(section = "2.3.1", id = "a")
public void testDefaultBindingDeclaredInJava()
{
Bean<Order> order = manager.resolveByType(Order.class).iterator().next();
@@ -40,7 +40,7 @@
}
@Test(groups = { "annotationDefinition", "underInvestigation" })
- @SpecAssertion(section = "2.3.2", id = "unknown")
+ @SpecAssertion(section = "2.3.2", id = "a")
public void testBindingHasCorrectTarget()
{
// TODO This is only a definition without any real assertion about a given
@@ -50,7 +50,7 @@
}
@Test(groups = { "annotationDefinition", "underInvestigation" })
- @SpecAssertion(section = "2.3.2", id = "unknown")
+ @SpecAssertion(section = "2.3.2", id = "a")
public void testBindingHasCorrectRetention()
{
// TODO This is only a definition without any real assertion about a given
@@ -60,14 +60,14 @@
}
@Test(groups = { "annotationDefinition" })
- @SpecAssertion(section = "2.3.2", id = "unknown")
+ @SpecAssertion(section = "2.3.2", id = "b")
public void testBindingDeclaresBindingAnnotation()
{
assert !manager.resolveByType(Tarantula.class, new TameBinding()).isEmpty();
}
@Test
- @SpecAssertion(section = "2.3.3", id = "unknown")
+ @SpecAssertion(section = "2.3.3", id = "a")
public void testBindingsDeclaredInJava()
{
Bean<Cat> cat = manager.resolveByType(Cat.class, new SynchronousBinding()).iterator().next();
@@ -76,7 +76,7 @@
}
@Test
- @SpecAssertion(section = "2.3.3", id = "unknown")
+ @SpecAssertion(section = "2.3.3", id = "b")
public void testMultipleBindings()
{
Bean<?> model = manager.resolveByType(Cod.class, new ChunkyBinding(true), new WhitefishBinding()).iterator().next();
@@ -84,7 +84,7 @@
}
@Test(groups = { "stub", "webbeansxml" })
- @SpecAssertion(section = "2.3.4", id = "unknown")
+ @SpecAssertion(section = "2.3.4", id = "a")
public void testBindingsDeclaredInXml()
{
// Map<Class<? extends Annotation>, Annotation> annotations = new
@@ -102,7 +102,7 @@
}
@Test(groups = { "stub", "webbeansxml" })
- @SpecAssertion(section = "2.3.4", id = "unknown")
+ @SpecAssertion(section = "2.3.5", id = "d")
public void testXmlBindingOverridesAndIgnoresJava()
{
// Map<Class<? extends Annotation>, Annotation> annotations = new
@@ -121,7 +121,7 @@
}
@Test(groups = { "stub", "webbeansxml" })
- @SpecAssertion(section = "2.3.4", id = "unknown")
+ @SpecAssertion(section = "2.3.4", id = "a")
public void testNoBindingsDeclaredInXml()
{
// Map<Class<? extends Annotation>, Annotation> annotations = new
@@ -138,7 +138,8 @@
}
@Test(groups = { "stub", "webbeansxml" })
- @SpecAssertions( { @SpecAssertion(section = "2.3.4", id = "unknown"), @SpecAssertion(section = "2.3.1", id = "unknown") })
+ @SpecAssertions( { @SpecAssertion(section = "2.3.4", id = "a"),
+ @SpecAssertion(section = "2.3.5", id = "c") })
public void testDefaultBindingDeclaredInXml()
{
Bean<?> model = manager.resolveByType(Tuna.class).iterator().next();
@@ -157,14 +158,14 @@
}
@Test(groups = { "stub", "injection", "webbeansxml" })
- @SpecAssertion(section = "2.3.5", id = "unknown")
+ @SpecAssertion(section = "2.3.6", id = "b")
public void testFieldWithBindingInXml()
{
assert false;
}
@Test(groups = { "stub", "injection", "webbeansxml" })
- @SpecAssertion(section = "2.3.5", id = "unknown")
+ @SpecAssertion(section = "2.3.6", id = "c")
public void testFieldWithBindingInXmlIgnoresAnnotations()
{
assert false;
Modified: tck/trunk/impl/tck-audit.xml
===================================================================
--- tck/trunk/impl/tck-audit.xml 2009-02-10 20:30:51 UTC (rev 1478)
+++ tck/trunk/impl/tck-audit.xml 2009-02-11 00:07:04 UTC (rev 1479)
@@ -1,6 +1,87 @@
<specification xmlns="http://jboss.com/products/webbeans/tck/audit"
name="JSR-299: Java Contexts and Dependency Injection"
version="Revised Public Review Draft">
+
+ <section id="2.3.1" title="Default binding type">
+
+ <assertion id="a">
+ <text>If a bean does not explicitly declare a binding, the bean has exactly one binding, of type @javax.inject.Current</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>The default binding is also assumed for any injection point that does not explicitly declare a binding</text>
+ </assertion>
+ </section>
+
+ <section id="2.3.2" title="Defining new binding types">
+ <assertion id="a">
+ <text>A binding type is a Java annotation defined as @Target({METHOD, FIELD, PARAMETER, TYPE}) and @Retention(RUNTIME).</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>A binding type may be declared by specifying the @javax.inject.BindingType meta-annotation</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>The @BindingType meta-annotation may be omitted, and the binding type may be declared in beans.xml</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>A binding type may define annotation members</text>
+ </assertion>
+ </section>
+
+ <section id="2.3.3" title="Declaring the bindings of a bean using annotations">
+
+ <assertion id="a">
+ <text>A bean's bindings are declared by annotating the bean class or producer method or field with the binding types</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>Any bean may declare multiple binding types</text>
+ </assertion>
+ </section>
+
+ <section id="2.3.4" title="Declaring the bindings of a bean using XML">
+
+ <assertion id="a">
+ <text>If a bean is declared in beans.xml, bindings may be specified using the binding type names</text>
+ </assertion>
+
+ </section>
+
+ <section id="2.3.5" title="Specifying bindings of an injected field">
+
+ <assertion id="a">
+ <text>Binding types may be applied to injected fields (see Section 3.8, "Injected fields") to determine the bean that is injected, according to the typesafe resolution algorithm defined in Section 5.9, "Typesafe resolution algorithm".</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>A bean may only be injected to an injection point if it has all the bindings of the injection point</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>For a bean defined in XML, the bindings of a field may be specified using XML</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>When the bindings of a field are specified using XML, any binding annotations of the field are ignored</text>
+ </assertion>
+ </section>
+
+ <section id="2.3.6" title="Specifying bindings of a method or constructor parameter">
+ <assertion id="a">
+ <text>Binding types may be applied to parameters of producer methods, initializer methods, disposal methods or bean constructors (see Chapter 3, Bean implementation) to determine the bean instance that is passed when the method is called by the container</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>For a bean defined in XML, the bindings of a method parameter may be specified using XML</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>When the bindings of a parameter are specified using XML, any binding annotations of the parameter are ignored</text>
+ </assertion>
+ </section>
<section id="3" title="Bean Implementation">
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1478 - in ri/trunk: webbeans-ri/src/main/java/org/jboss/webbeans and 9 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-02-10 15:30:51 -0500 (Tue, 10 Feb 2009)
New Revision: 1478
Modified:
ri/trunk/webbeans-api/src/main/java/javax/context/Context.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.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/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Exceptions.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockApplicationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockDependentContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockRequestContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockSessionContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/el/EL.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
Log:
minors
Modified: ri/trunk/webbeans-api/src/main/java/javax/context/Context.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/context/Context.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-api/src/main/java/javax/context/Context.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -44,7 +44,7 @@
* @param <T> the type of contextual type
* @param contextual the contextual type
* @param creationalContext the creational context in which incompletely
- * initialized may be placed
+ * initialized instances may be placed
* @return the contextual instance, or null if no creational context is given
* and an instance does not exist in the context
* @throws ContextNotActiveException if the context is not active
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -108,7 +108,7 @@
if (resolvedBean instanceof AbstractProducerBean)
{
AbstractProducerBean producerBean = (AbstractProducerBean) resolvedBean;
- if (producerBean.getScopeType().equals(Dependent.class) && !Reflections.isSerializable(producerBean.getType()))
+ if (producerBean.isDependent() && !Reflections.isSerializable(producerBean.getType()))
{
throw new IllegalProductException("Cannot inject @Depedent non-serializable type into " + injectionPoint);
}
@@ -123,7 +123,7 @@
{
injectionPoint.getBean();
}
- else if (producerBean.getScopeType().equals(Dependent.class) && !Reflections.isSerializable(producerBean.getType()))
+ else if (producerBean.isDependent() && !Reflections.isSerializable(producerBean.getType()))
{
throw new IllegalProductException("Cannot inject @Depedent non-serializable type into " + injectionPoint);
}
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-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -849,6 +849,7 @@
buffer.append("Registered beans: " + getBeans().size() + "\n");
buffer.append("Registered decorators: " + decorators.size() + "\n");
buffer.append("Registered interceptors: " + interceptors.size() + "\n");
+ buffer.append("Specialized beans: " + specializedBeans.size() + "\n");
return buffer.toString();
}
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-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -169,11 +169,11 @@
*/
protected void checkEnterpriseScopeAllowed()
{
- if (ejbDescriptor.isStateless() && !getScopeType().equals(Dependent.class))
+ if (ejbDescriptor.isStateless() && !isDependent())
{
throw new DefinitionException("Scope " + getScopeType() + " is not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
}
- if (ejbDescriptor.isSingleton() && (!(getScopeType().equals(Dependent.class) || getScopeType().equals(ApplicationScoped.class))))
+ if (ejbDescriptor.isSingleton() && (!isDependent() || getScopeType().equals(ApplicationScoped.class)))
{
throw new DefinitionException("Scope " + getScopeType() + " is not allowed on singleton enterpise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
}
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-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -339,7 +339,7 @@
protected void checkBeanImplementation()
{
super.checkBeanImplementation();
- if (!scopeType.equals(Dependent.class))
+ if (!isDependent())
{
for (AnnotatedField<?> field : getAnnotatedItem().getFields())
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * 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.context;
import java.util.HashMap;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -36,11 +36,11 @@
@WebBeans
public class JavaSEConversationTerminator implements ConversationTerminator, Serializable
{
- private ScheduledExecutorService terminator = Executors.newScheduledThreadPool(1);
+ private ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
public Future<?> scheduleForTermination(Runnable terminationTask, long timeoutInMilliseconds)
{
- return terminator.schedule(terminationTask, timeoutInMilliseconds, TimeUnit.MILLISECONDS);
+ return executor.schedule(terminationTask, timeoutInMilliseconds, TimeUnit.MILLISECONDS);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -45,6 +45,9 @@
public class ServletConversationManager implements ConversationManager, Serializable
{
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
+
+ private static final long CONVERSATION_TIMEOUT_IN_MS = 10 * 60 * 1000;
+ private static final long CONVERSATION_CONCURRENT_ACCESS_TIMEOUT_IN_MS = 1 * 1000;
// The conversation terminator
@Current
@@ -83,7 +86,7 @@
@WebBeans
public long getConversationTimeoutInMilliseconds()
{
- return 10 * 60 * 1000;
+ return CONVERSATION_TIMEOUT_IN_MS;
}
@Produces
@@ -91,7 +94,7 @@
@WebBeans
public long getConversationConcurrentAccessTimeout()
{
- return 1 * 1000;
+ return CONVERSATION_CONCURRENT_ACCESS_TIMEOUT_IN_MS;
}
public void beginOrRestoreConversation(String cid)
@@ -116,13 +119,13 @@
{
if (!longRunningConversations.get(cid).lock(concurrentAccessTimeout))
{
- log.info("Could not acquire conversation lock in " + concurrentAccessTimeout + "ms, giving up");
+ log.debug("Could not acquire conversation lock in " + concurrentAccessTimeout + "ms, giving up");
return;
}
}
catch (InterruptedException e)
{
- log.info("Interrupted while trying to acquire lock");
+ log.debug("Interrupted while trying to acquire lock");
return;
}
// If we can't cancel the termination, release the lock, return and continue
@@ -130,13 +133,15 @@
if (!longRunningConversations.get(cid).cancelTermination())
{
longRunningConversations.get(cid).unlock();
- log.info("Failed to cancel termination of conversation " + cid);
+ log.debug("Failed to cancel termination of conversation " + cid);
}
else
{
// If all goes well, set the identity of the current conversation to
// match the fetched long-running one
+ String oldConversation = currentConversation.toString();
currentConversation.switchTo(cid, true, inactivityTimeout);
+ log.trace("Conversation switched from " + oldConversation + " to " + currentConversation);
}
}
@@ -218,13 +223,14 @@
*/
public void run()
{
- log.trace("Conversation " + cid + " timed out and was terminated");
+ log.trace("Conversation " + cid + " timed out and was destroyed");
longRunningConversations.remove(cid).destroy(session);
}
}
public void destroyAllConversations()
{
+ log.trace("Destroying " + longRunningConversations.size() + " long-running conversations in session " + session.getId());
for (ConversationEntry conversationEntry : longRunningConversations.values())
{
conversationEntry.destroy(session);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * 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.injection;
import static org.jboss.webbeans.injection.Exceptions.rethrowException;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Exceptions.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Exceptions.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/Exceptions.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * 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.injection;
import java.lang.reflect.InvocationTargetException;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -25,27 +25,29 @@
import javax.faces.event.PhaseListener;
import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.conversation.ConversationManager;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.servlet.ServletLifecycle;
/**
- * A phase listener for propagating conversation id over postbacks through a hidden component
- *
+ * A phase listener for propagating conversation id over postbacks through a
+ * hidden component
+ *
* @author Nicklas Karlsson
- *
+ *
*/
public class WebBeansPhaseListener implements PhaseListener
{
// The ID/name of the conversation-propagating component
- private static final String CONVERSATION_PROPAGATION_COMPONENT = "jboss_org_webbeans_conversation_propagation";
+ private static final String CONVERSATION_PROPAGATION_COMPONENT = "webbeans_conversation_propagation";
private static LogProvider log = Logging.getLogProvider(ServletLifecycle.class);
/**
* Indicates if we are in a JSF postback or not
- *
+ *
* @return True if postback, false otherwise
*/
private boolean isPostback()
@@ -69,6 +71,10 @@
conversationManager.beginOrRestoreConversation(cid);
}
}
+ else if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+ {
+ ConversationContext.INSTANCE.setActive(false);
+ }
}
public void beforePhase(PhaseEvent phaseEvent)
@@ -78,7 +84,8 @@
// If we are rendering the response from a postback
log.trace("Processing after RENDER_RESPONSE phase");
Conversation conversation = CurrentManager.rootManager().getInstanceByType(Conversation.class);
- // If we are in a long-running conversation, create or update the conversation id
+ // If we are in a long-running conversation, create or update the
+ // conversation id
// in the propagation component in the view root
if (conversation.isLongRunning())
{
@@ -92,6 +99,10 @@
removePropagationComponent(phaseEvent.getFacesContext().getViewRoot());
}
}
+ else if (phaseEvent.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+ {
+ ConversationContext.INSTANCE.setActive(true);
+ }
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockBootstrap.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockBootstrap.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock;
import java.lang.annotation.Annotation;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock;
import java.lang.reflect.Method;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock;
import java.util.ArrayList;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockResourceLoader.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock;
import java.io.IOException;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock;
import java.net.URL;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockApplicationContext.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockApplicationContext.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock.context;
import org.jboss.webbeans.context.ApplicationContext;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockDependentContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockDependentContext.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockDependentContext.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock.context;
import org.jboss.webbeans.context.DependentContext;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockRequestContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockRequestContext.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockRequestContext.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock.context;
import org.jboss.webbeans.context.RequestContext;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockSessionContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockSessionContext.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/context/MockSessionContext.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock.context;
import org.jboss.webbeans.context.SessionContext;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/el/EL.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/el/EL.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/mock/el/EL.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.webbeans.mock.el;
import javax.el.ArrayELResolver;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-10 18:57:59 UTC (rev 1477)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ConversationBeanMap.java 2009-02-10 20:30:51 UTC (rev 1478)
@@ -21,6 +21,11 @@
import org.jboss.webbeans.context.ConversationContext;
+/**
+ * A HTTP session backed bean map for the conversational scope
+ *
+ * @author Nicklas Karlsson
+ */
public class ConversationBeanMap extends HttpSessionBeanMap
{
private String cid;
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1477 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-10 13:57:59 -0500 (Tue, 10 Feb 2009)
New Revision: 1477
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java
Log:
Fixed one of the broken tests related to binding types and resolution.
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java 2009-02-10 18:26:57 UTC (rev 1476)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java 2009-02-10 18:57:59 UTC (rev 1477)
@@ -124,14 +124,14 @@
}
@SuppressWarnings("unchecked")
- @Test(groups = "broken")
+ @Test
@SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasBindingsOfMethodAndRealizingType()
{
// deployBeans(TameHorse.class);
- assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
- assert annotationSetMatches(manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings().size() == 2;
+ assert annotationSetMatches(manager.resolveByType(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
}
@Test(groups = "broken")
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1476 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit: lookup/byname and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-02-10 13:26:57 -0500 (Tue, 10 Feb 2009)
New Revision: 1476
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/CowDung.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/HorseDung.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/DuplicateNameResolutionTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractCow.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractHorse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/InstantiationByNameTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/ResolutionByNameTest.java
Log:
New tests and a few old ones broken.
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractCow.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractCow.java 2009-02-10 08:00:12 UTC (rev 1475)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractCow.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -6,9 +6,9 @@
abstract class AbstractCow
{
- @Produces @RequestScoped @Smelly @FarmAnimalDeploymentType Dung getDung()
+ @Produces @RequestScoped @Smelly @FarmAnimalDeploymentType CowDung getDung()
{
- return new Dung();
+ return new CowDung();
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractHorse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractHorse.java 2009-02-10 08:00:12 UTC (rev 1475)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/AbstractHorse.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -6,6 +6,6 @@
abstract class AbstractHorse
{
- @Produces @Smelly @RequestScoped @FarmAnimalDeploymentType private Dung dung = new Dung();
+ @Produces @Smelly @RequestScoped @FarmAnimalDeploymentType private HorseDung dung = new HorseDung();
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/CowDung.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/CowDung.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/CowDung.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.unit.inheritance.realization;
+
+class CowDung extends Dung
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/CowDung.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/HorseDung.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/HorseDung.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/HorseDung.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.unit.inheritance.realization;
+
+class HorseDung extends Dung
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/HorseDung.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java 2009-02-10 08:00:12 UTC (rev 1475)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/inheritance/realization/RealizationTest.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -11,18 +11,25 @@
import org.jboss.jsr299.tck.AbstractTest;
import org.jboss.jsr299.tck.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
import org.testng.annotations.Test;
/**
*
* Spec version: PRD2
- *
+ *
*/
+@Artifact
public class RealizationTest extends AbstractTest
{
-
- private static Annotation SMELLY_LITERAL = new AnnotationLiteral<Smelly>(){};
-
+
+ private static Annotation SMELLY_LITERAL = new AnnotationLiteral<Smelly>()
+ {
+ };
+ private static Annotation TAME_LITERAL = new AnnotationLiteral<Tame>()
+ {
+ };
+
@Override
protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
@@ -32,121 +39,140 @@
deploymentTypes.add(FarmAnimalDeploymentType.class);
return deploymentTypes;
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerMethodHasSameScope()
{
- deployBeans(Cow.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
+ // deployBeans(Cow.class);
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerMethodHasDeploymentTypeOfRealizingClass()
{
- deployBeans(Cow.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ // deployBeans(Cow.class);
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerMethodHasSameBindings()
{
- deployBeans(Cow.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
+ // deployBeans(Cow.class);
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 1;
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
}
-
- @Test@SpecAssertion(section="4.4", id = "unknown")
+
+ @SuppressWarnings("unchecked")
+ @Test
+ @SpecAssertion(section = "4.4.1", id = "unknown")
public void testRealizedBeanWithProducerMethodHasBindingsOfMethodAndRealizingType()
{
- deployBeans(TameCow.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
- assert annotationSetMatches(manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
+ // deployBeans(TameCow.class);
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).size() == 1;
+ assert manager.resolveByType(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings().size() == 2;
+ assert annotationSetMatches(manager.resolveByType(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test(groups = "broken")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerMethodHasSameStereotypes()
{
- deployBeans(LabradorKennel.class);
+ // deployBeans(LabradorKennel.class);
assert manager.resolveByType(Dog.class).size() == 1;
assert manager.resolveByType(Dog.class).iterator().next().getScopeType().equals(RequestScoped.class);
}
-
- @Test(groups="stub") @SpecAssertion(section="4.1", id = "unknown")
+
+ @Test(groups = "stub")
+ @SpecAssertion(section = "4.1", id = "unknown")
public void testRealizedBeanWithProducerMethodHasSameInterceptorBindings()
{
assert false;
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasSameScope()
{
- deployBeans(Horse.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
+ // deployBeans(Horse.class);
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasDeploymentTypeOfRealizingClass()
{
- deployBeans(Horse.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ // deployBeans(Horse.class);
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasSameBindings()
{
- deployBeans(Horse.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
+ // deployBeans(Horse.class);
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().iterator().next().annotationType().equals(Smelly.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @SuppressWarnings("unchecked")
+ @Test(groups = "broken")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasBindingsOfMethodAndRealizingType()
{
- deployBeans(TameHorse.class);
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).size() == 1;
- assert manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
- assert annotationSetMatches(manager.resolveByType(Dung.class, SMELLY_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
+ // deployBeans(TameHorse.class);
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
+ assert annotationSetMatches(manager.resolveByType(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class);
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test(groups = "broken")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasSameStereotypes()
{
- deployBeans(Stable.class);
+ // deployBeans(Stable.class);
assert manager.resolveByType(Horse.class).size() == 1;
assert manager.resolveByType(Horse.class).iterator().next().getScopeType().equals(RequestScoped.class);
}
-
- @Test(groups="stub") @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test(groups = "stub")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedBeanWithProducerFieldHasSameInterceptorBindings()
{
assert false;
}
-
- @Test(groups="stub") @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test(groups = "stub")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testDisposalMethodInherited()
{
assert false;
}
-
- @Test(groups="stub") @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test(groups = "stub")
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testRealizedDisposalMethodHasBindingsOfMethodAndRealizingType()
{
assert false;
}
-
- @Test @SpecAssertion(section="4.4", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.4", id = "unknown")
public void testObserverMethodInheritedAndHasSameBindings()
{
- deployBeans(FarmHouse.class);
- assert manager.resolveObservers(new Cow(), new AnnotationLiteral<Tame>(){}).size() == 1;
+ // deployBeans(FarmHouse.class);
+ assert manager.resolveObservers(new Cow(), new AnnotationLiteral<Tame>()
+ {
+ }).size() == 1;
assert manager.resolveObservers(new Cow(), SMELLY_LITERAL).size() == 0;
}
-
+
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/DuplicateNameResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/DuplicateNameResolutionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/DuplicateNameResolutionTest.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.unit.lookup.byname;
+
+import javax.inject.AmbiguousDependencyException;
+
+import org.jboss.jsr299.tck.AbstractTest;
+import org.jboss.jsr299.tck.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.Classes;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Spec version: Public Release Draft 2
+ *
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes(value={Cod.class, Sole.class})
+public class DuplicateNameResolutionTest extends AbstractTest
+{
+ /**
+ * � Otherwise, if resolveByName() returned more than one Web Bean, throw an
+ * AmbiguousDependencyException.
+ *
+ * @throws Exception
+ */
+ @Test(groups = { "resolution", "el" }, expectedExceptions = AmbiguousDependencyException.class)
+ @SpecAssertion(section = "5.10", id = "unknown")
+ public void testDuplicateNamedBeans() throws Exception
+ {
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert manager.resolveByName("whitefish").size() == 2;
+ manager.getInstanceByName("whitefish");
+ }
+
+ }.run();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/DuplicateNameResolutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/InstantiationByNameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/InstantiationByNameTest.java 2009-02-10 08:00:12 UTC (rev 1475)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/InstantiationByNameTest.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -15,62 +15,8 @@
public class InstantiationByNameTest extends AbstractTest
{
- @Test(groups="resolution") @SpecAssertion(section="5.10", id = "unknown")
- public void testNoWebBeansFound() throws Exception
- {
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- manager.addBean(codBean);
- manager.addBean(salmonBean);
-
- assert manager.getInstanceByName("foo") == null;
- }
-
- @Test(expectedExceptions=AmbiguousDependencyException.class)
- @SpecAssertion(section="5.7.1", id = "unknown")
- public void testAmbiguousDependencies() throws Exception
- {
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- manager.addBean(codBean);
- manager.addBean(salmonBean);
- manager.addBean(soleBean);
-
- manager.getInstanceByName("whitefish");
- }
-
- @Test(groups={"resolution", "beanLifecycle"}) @SpecAssertion(section="5.7.1", id = "unknown")
- public void testGetInstanceByName()
- {
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
-
- manager.addBean(tunaBean);
- manager.addBean(codBean);
- manager.addBean(salmonBean);
- manager.addBean(soleBean);
- manager.addBean(haddockBean);
- manager.addBean(seaBassBean);
- manager.addBean(plaiceBean);
-
- try
- {
- activateDependentContext();
- assert manager.getInstanceByName("salmon") instanceof Salmon;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups={"stub", "resolution", "el"}) @SpecAssertion(section="5.10", id = "unknown")
+ @Test(groups={"underInvestigation", "resolution", "el"}) @SpecAssertion(section="5.10", id = "unknown")
+ //TODO Need to find a way to intercept calls to the manager to verify this condition
public void testGetInstanceByNameCalledOncePerDistinctNameInElExpression()
{
assert false;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/ResolutionByNameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/ResolutionByNameTest.java 2009-02-10 08:00:12 UTC (rev 1475)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/byname/ResolutionByNameTest.java 2009-02-10 18:26:57 UTC (rev 1476)
@@ -3,21 +3,20 @@
import java.lang.annotation.Annotation;
import java.util.List;
-import javax.inject.AmbiguousDependencyException;
-import javax.inject.manager.Bean;
-
import org.jboss.jsr299.tck.AbstractTest;
import org.jboss.jsr299.tck.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
import org.testng.annotations.Test;
/**
*
- * Spec version: PRD2
- *
+ * Spec version: Public Release Draft 2
+ *
*/
+@Artifact
public class ResolutionByNameTest extends AbstractTest
{
-
+
@Override
protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
@@ -29,121 +28,62 @@
/**
* The getInstanceByName() method must:
*
- * � Identify the Web Bean by calling Manager.resolveByName(), passing the name.
- * � If resolveByName() returned an empty set, return a null value.
- * � Otherwise, if exactly one Web Bean was returned, obtain an instance of the
- * Web Bean by calling Manager.getInstance(), passing the Bean instance representing
- * the Web Bean
+ * � Identify the Web Bean by calling Manager.resolveByName(), passing the
+ * name.
+ *
+ * � If resolveByName() returned an empty set, return a null value.
+ *
+ * � Otherwise, if exactly one Web Bean was returned, obtain an instance of
+ * the Web Bean by calling Manager.getInstance(), passing the Bean instance
+ * representing the Web Bean
+ *
+ * @throws Exception
*/
- @Test(groups={"stub", "el"})
- @SpecAssertion(section="5.11", id = "unknown")
- public void testELResolver()
- {
- assert manager.getInstanceByName("nonexistant") == null;
-
- try
+ @Test(groups = { "resolution", "el" })
+ @SpecAssertion(section = "5.10", id = "unknown")
+ public void testELResolver() throws Exception
+ {
+ new RunInDependentContext()
{
- activateDependentContext();
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- manager.addBean(salmonBean);
- assert manager.getInstanceByName("salmon") instanceof Salmon;
- }
- finally
- {
- deactivateDependentContext();
- }
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert manager.getInstanceByName("nonexistant") == null;
+ assert manager.getInstanceByName("salmon") instanceof Salmon;
+ }
+
+ }.run();
}
/**
- * � Otherwise, if resolveByName() returned more than one Web Bean, throw an
- * AmbiguousDependencyException.
+ * The following algorithm must be used by the container when resolving a
+ * bean by name:
+ *
+ * • The container identifies the set of matching enabled beans which have
+ * the given name.
+ *
+ * • Next, the container examines the deployment types of the matching beans,
+ * as defined in Section 2.5.7, “Deployment type precedence”, and returns the
+ * set of beans with the highest precedence deployment type that occurs in
+ * the set. If there are no matching beans, an empty set is returned.
+ * @throws Exception
*/
- @Test(expectedExceptions=AmbiguousDependencyException.class)
- @SpecAssertion(section="5.11", id = "unknown")
- public void testDuplicateNamedBeans()
+ @Test(groups = { "resolution", "el" })
+ @SpecAssertion(section = "5.11", id = "unknown")
+ public void testOnlyHighestPrecedenceResolved() throws Exception
{
- try
+ // Both Cod and Plaice are named "whitefish" - Plaice has the highest
+ // deployment type (AnotherDeploymentType)
+ new RunInDependentContext()
{
- activateDependentContext();
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert manager.getInstanceByName("whitefish") instanceof Plaice;
+ }
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- manager.addBean(codBean);
- manager.addBean(soleBean);
-
- assert manager.resolveByName("whitefish").size() == 2;
- manager.getInstanceByName("whitefish");
- }
- finally
- {
- deactivateDependentContext();
- }
+ }.run();
}
-
- @Test(groups="broken") @SpecAssertion(section="5.11", id = "unknown")
- public void testNamedBasedResolution()
- {
-
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
-
- manager.addBean(tunaBean);
- manager.addBean(codBean);
- manager.addBean(salmonBean);
- manager.addBean(soleBean);
- manager.addBean(haddockBean);
- manager.addBean(seaBassBean);
-
- assert manager.resolveByName("salmon").size() == 1;
- assert manager.resolveByName("salmon").contains(salmonBean);
-
- assert manager.resolveByName("whitefish").size() == 2;
- assert manager.resolveByName("whitefish").contains(codBean);
- assert manager.resolveByName("whitefish").contains(soleBean);
-
- manager.addBean(plaiceBean);
-
- assert manager.resolveByName("whitefish").size() == 1;
- assert manager.resolveByName("whitefish").contains(plaiceBean);
- }
-
- @Test(groups="resolution") @SpecAssertion(section="5.11", id = "unknown")
- public void testNoWebBeansFound() throws Exception
- {
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
-
- manager.addBean(codBean);
- manager.addBean(salmonBean);
-
- assert manager.resolveByName("foo").size() == 0;
- }
-
- /**
- * The following algorithm must be used by the Web Bean manager when resolving a Web Bean by name:
- *
- * � The Web Bean manager identifies the set of matching enabled Web Beans which have the given name.
- * � Next, the Web Bean manager examines the deployment types of the matching Web Beans, as defined
- * in Section 2.5.7, �Deployment type precedence�, and returns the set of Web Beans with the
- * highest precedence deployment type that occurs in the set. If there are no matching Web Beans,
- * an empty set is returned.
- */
- @Test(groups="stub") @SpecAssertion(section="5.11", id = "unknown")
- public void testOnlyHighestPrecedenceResolved()
- {
- // Both Cod and Plaice are named "whitefish" - Plaice has the highest deployment type (AnotherDeploymentType)
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
- manager.addBean(codBean);
- manager.addBean(plaiceBean);
-
- assert manager.resolveByName("whitefish").size() == 1;
- assert !manager.resolveByName("whitefish").contains(codBean);
- assert manager.resolveByName("whitefish").contains(plaiceBean);
- }
}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1475 - doc/trunk/reference/zh-CN.
by webbeans-commits@lists.jboss.org
Author: alartin
Date: 2009-02-10 03:00:12 -0500 (Tue, 10 Feb 2009)
New Revision: 1475
Modified:
doc/trunk/reference/zh-CN/ee.po
Log:
Modified: doc/trunk/reference/zh-CN/ee.po
===================================================================
--- doc/trunk/reference/zh-CN/ee.po 2009-02-10 03:19:40 UTC (rev 1474)
+++ doc/trunk/reference/zh-CN/ee.po 2009-02-10 08:00:12 UTC (rev 1475)
@@ -3,11 +3,11 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: master.xml \n"
+"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-12-20 22:08+0000\n"
-"PO-Revision-Date: 2008-12-19 20:26+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2009-02-10 15:58+0800\n"
+"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,34 +17,25 @@
#: ee.xml:4
#, no-c-format
msgid "Java EE integration"
-msgstr ""
+msgstr "Java EE整合"
#. Tag: para
#: ee.xml:6
#, no-c-format
-msgid ""
-"Web Beans is fully integrated into the Java EE environment. Web Beans have "
-"access to Java EE resources and JPA persistence contexts. They may be used "
-"in Unified EL expressions in JSF and JSP pages. They may even be injected "
-"into some objects, such as Servlets and Message-Driven Beans, which are not "
-"Web Beans."
-msgstr ""
+msgid "Web Beans is fully integrated into the Java EE environment. Web Beans have access to Java EE resources and JPA persistence contexts. They may be used in Unified EL expressions in JSF and JSP pages. They may even be injected into some objects, such as Servlets and Message-Driven Beans, which are not Web Beans."
+msgstr "Web Beans被完全地整合进了Java EE环境里。Web Beans 能够访问Java EE资源和JPA持久化上下文。它们可以在JSF和JSP页面中的统一表达式语言使用。它们甚至可以被注入到一些对象中,例如Servlet和消息驱动Bean,而这些对象都不是Web Bean。"
#. Tag: title
#: ee.xml:12
#, no-c-format
msgid "Injecting Java EE resources into a Web Bean"
-msgstr ""
+msgstr "将Java EE资源注入到一个Web Bean中"
#. Tag: para
#: ee.xml:14
#, no-c-format
-msgid ""
-"All simple and enterprise Web Beans may take advantage of Java EE dependency "
-"injection using <literal>@Resource</literal>, <literal>@EJB</literal> and "
-"<literal>@PersistenceContext</literal>. We've already seen a couple of "
-"examples of this, though we didn't pay much attention at the time:"
-msgstr ""
+msgid "All simple and enterprise Web Beans may take advantage of Java EE dependency injection using <literal>@Resource</literal>, <literal>@EJB</literal> and <literal>@PersistenceContext</literal>. We've already seen a couple of examples of this, though we didn't pay much attention at the time:"
+msgstr "所有简单的和企业的Web Beans都可以通过<literal>@Resource</literal>, <literal>@EJB</literal>和<literal>@PersistenceContext</literal>来使用Java EE的依赖注入。我们已经看过很多例子了,虽然我们没有在这上面耗费精力:"
#. Tag: programlisting
#: ee.xml:19
@@ -55,11 +46,18 @@
"\n"
" @Resource Transaction transaction;\n"
"\n"
-" @AroundInvoke public Object manageTransaction(InvocationContext ctx) "
-"{ ... }\n"
+" @AroundInvoke public Object manageTransaction(InvocationContext ctx) { ... }\n"
" \n"
"}]]>"
msgstr ""
+"<![CDATA[@Transactional @Interceptor\n"
+"public class TransactionInterceptor {\n"
+"\n"
+" @Resource Transaction transaction;\n"
+"\n"
+" @AroundInvoke public Object manageTransaction(InvocationContext ctx) { ... }\n"
+" \n"
+"}]]>"
#. Tag: programlisting
#: ee.xml:21
@@ -75,38 +73,39 @@
"\n"
"}]]>"
msgstr ""
+"<![CDATA[@SessionScoped\n"
+"public class Login {\n"
+"\n"
+" @Current Credentials credentials;\n"
+" @PersistenceContext EntityManager userDatabase;\n"
+" \n"
+" ...\n"
+"\n"
+"}]]>"
#. Tag: para
#: ee.xml:23
#, no-c-format
-msgid ""
-"The Java EE <literal>@PostConstruct</literal> and <literal>@PreDestroy</"
-"literal> callbacks are also supported for all simple and enterprise Web "
-"Beans. The <literal>@PostConstruct</literal> method is called after "
-"<emphasis>all</emphasis> injection has been performed."
-msgstr ""
+msgid "The Java EE <literal>@PostConstruct</literal> and <literal>@PreDestroy</literal> callbacks are also supported for all simple and enterprise Web Beans. The <literal>@PostConstruct</literal> method is called after <emphasis>all</emphasis> injection has been performed."
+msgstr "所有的简单的和企业的Web Beans都支持Java EE的<literal>@PostConstruct</literal>和<literal>@PreDestroy</literal>回调。<literal>@PostConstruct</literal>方法在<emphasis>所有的</emphasis> 注入完成后被调用。"
#. Tag: para
#: ee.xml:28
#, no-c-format
-msgid ""
-"There is one restriction to be aware of here: <literal>@PersistenceContext"
-"(type=EXTENDED)</literal> is not supported for simple Web Beans."
-msgstr ""
+msgid "There is one restriction to be aware of here: <literal>@PersistenceContext(type=EXTENDED)</literal> is not supported for simple Web Beans."
+msgstr "这里需要注意的一个限制是:简单的Web Beans不支持 <literal>@PersistenceContext(type=EXTENDED)</literal>"
#. Tag: title
#: ee.xml:35
#, no-c-format
msgid "Calling a Web Bean from a Servlet"
-msgstr ""
+msgstr "从Servlet调用一个Web Bean"
#. Tag: para
#: ee.xml:37
#, no-c-format
-msgid ""
-"It's easy to use a Web Bean from a Servlet in Java EE 6. Simply inject the "
-"Web Bean using Web Beans field or initializer method injection."
-msgstr ""
+msgid "It's easy to use a Web Bean from a Servlet in Java EE 6. Simply inject the Web Bean using Web Beans field or initializer method injection."
+msgstr "在Java EE 6中,从一个Servlet中调用一个Web Bean非常容易,只须使用Web Beans域注入一个Web Bean或者将初始方法注入即可。"
#. Tag: programlisting
#: ee.xml:40
@@ -118,8 +117,7 @@
" @Current Login login;\n"
"\n"
" @Override\n"
-" public void service(HttpServletRequest request, HttpServletResponse "
-"response)\n"
+" public void service(HttpServletRequest request, HttpServletResponse response)\n"
" throws ServletException, IOException {\n"
" credentials.setUsername( request.getAttribute(\"username\") ):\n"
" credentials.setPassword( request.getAttribute(\"password\") ):\n"
@@ -134,39 +132,50 @@
" \n"
"}"
msgstr ""
+"public class Login extends HttpServlet {\n"
+"\n"
+" @Current Credentials credentials;\n"
+" @Current Login login;\n"
+"\n"
+" @Override\n"
+" public void service(HttpServletRequest request, HttpServletResponse response)\n"
+" throws ServletException, IOException {\n"
+" credentials.setUsername( request.getAttribute(\"username\") ):\n"
+" credentials.setPassword( request.getAttribute(\"password\") ):\n"
+" login.login();\n"
+" if ( login.isLoggedIn() ) {\n"
+" response.sendRedirect(\"/home.jsp\");\n"
+" }\n"
+" else {\n"
+" response.sendRedirect(\"/loginError.jsp\");\n"
+" }\n"
+" }\n"
+" \n"
+"}"
#. Tag: para
#: ee.xml:42
#, no-c-format
-msgid ""
-"The Web Beans client proxy takes care of routing method invocations from the "
-"Servlet to the correct instances of <literal>Credentials</literal> and "
-"<literal>Login</literal> for the current request and HTTP session."
-msgstr ""
+msgid "The Web Beans client proxy takes care of routing method invocations from the Servlet to the correct instances of <literal>Credentials</literal> and <literal>Login</literal> for the current request and HTTP session."
+msgstr "Web Beans客户端代理将Servlet中的方法调用路由到当前请求和HTTP会话中相应的<literal>Credentials</literal> 和 <literal>Login</literal> 实例。"
#. Tag: title
#: ee.xml:49
#, no-c-format
msgid "Calling a Web Bean from a Message-Driven Bean"
-msgstr ""
+msgstr "从消息驱动Bean中调用一个Web Bean"
#. Tag: para
#: ee.xml:51
#, no-c-format
-msgid ""
-"Web Beans injection applies to all EJBs, even when they aren't under the "
-"control of the Web Bean manager (if they were obtained by direct JNDI "
-"lookup, or injection using <literal>@EJB</literal>, for example. In "
-"particular, you can use Web Beans injection in Message-Driven Beans, which "
-"are not considered Web Beans because you can't inject them."
-msgstr ""
+msgid "Web Beans injection applies to all EJBs, even when they aren't under the control of the Web Bean manager (if they were obtained by direct JNDI lookup, or injection using <literal>@EJB</literal>, for example. In particular, you can use Web Beans injection in Message-Driven Beans, which are not considered Web Beans because you can't inject them."
+msgstr "Web Beans注入可以应用于所有的EJB,甚至这些EJB不在Web Bean管理器的控制之下也可以(如果它们可以直接从JNDI查找或者使用<literal>@EJB</literal>注入)。消息驱动Bean不能成为Web Beans,因为你无法注入它们,但你仍然可以将Web Beans注入到消息驱动Bean中。"
#. Tag: para
#: ee.xml:57
#, no-c-format
-msgid ""
-"You can even use Web Beans interceptor bindings for Message-Driven Beans."
-msgstr ""
+msgid "You can even use Web Beans interceptor bindings for Message-Driven Beans."
+msgstr "你甚至可以将Web Beans拦截器绑定到消息驱动Bean上。"
#. Tag: programlisting
#: ee.xml:59
@@ -184,52 +193,47 @@
" \n"
"}"
msgstr ""
+"@Transactional @MessageDriven\n"
+"public class ProcessOrder implements MessageListener {\n"
+"\n"
+" @Current Inventory inventory;\n"
+" @PersistenceContext EntityManager em;\n"
+"\n"
+" public void onMessage(Message message) {\n"
+" ...\n"
+" }\n"
+" \n"
+"}"
#. Tag: para
#: ee.xml:61
#, no-c-format
-msgid ""
-"Thus, receiving messages is super-easy in a Web Beans environment. But "
-"beware that there is no session or conversation context available when a "
-"message is delivered to a Message-Driven Bean. Only <literal>@RequestScoped</"
-"literal> and <literal>@ApplicationScoped</literal> Web Beans are available."
-msgstr ""
+msgid "Thus, receiving messages is super-easy in a Web Beans environment. But beware that there is no session or conversation context available when a message is delivered to a Message-Driven Bean. Only <literal>@RequestScoped</literal> and <literal>@ApplicationScoped</literal> Web Beans are available."
+msgstr "这样,在一个Web Beans环境中接受消息就相当简单了。但是需要注意的是,当一个消息发送到一个消息驱动Bean的时候,此时没有会话,我们无法获得对话上下文。我们只能获得 <literal>@RequestScoped</literal> 和 <literal>@ApplicationScoped</literal> 注释的Web Beans。"
#. Tag: para
#: ee.xml:66
#, no-c-format
msgid "It's also easy to send messages using Web Beans."
-msgstr ""
+msgstr "使用Web Beans发送消息也相当简单。"
#. Tag: title
#: ee.xml:71
#, no-c-format
msgid "JMS endpoints"
-msgstr ""
+msgstr "JMS端点"
#. Tag: para
#: ee.xml:73
#, no-c-format
-msgid ""
-"Sending messages using JMS can be quite complex, because of the number of "
-"different objects you need to deal with. For queues we have <literal>Queue</"
-"literal>, <literal>QueueConnectionFactory</literal>, "
-"<literal>QueueConnection</literal>, <literal>QueueSession</literal> and "
-"<literal>QueueSender</literal>. For topics we have <literal>Topic</literal>, "
-"<literal>TopicConnectionFactory</literal>, <literal>TopicConnection</"
-"literal>, <literal>TopicSession</literal> and <literal>TopicPublisher</"
-"literal>. Each of these objects has its own lifecycle and threading model "
-"that we need to worry about."
-msgstr ""
+msgid "Sending messages using JMS can be quite complex, because of the number of different objects you need to deal with. For queues we have <literal>Queue</literal>, <literal>QueueConnectionFactory</literal>, <literal>QueueConnection</literal>, <literal>QueueSession</literal> and <literal>QueueSender</literal>. For topics we have <literal>Topic</literal>, <literal>TopicConnectionFactory</literal>, <literal>TopicConnection</literal>, <literal>TopicSession</literal> and <literal>TopicPublisher</literal>. Each of these objects has its own lifecycle and threading model that we need to worry about."
+msgstr "使用JMS发送消息有点复杂,因为你需要处理很多不同的对象。对于队列(Queue),我们有<literal>Queue</literal>, <literal>QueueConnectionFactory</literal>, <literal>QueueConnection</literal>, <literal>QueueSession</literal> 和 <literal>QueueSender</literal>。对于主题(Topic)有<literal>Topic</literal>, <literal>TopicConnectionFactory</literal>, <literal>TopicConnection</literal>, <literal>TopicSession</literal> 和 <literal>TopicPublisher</literal>。这些对象每个都有自己的生命周期和线程模型,我们都需要考虑这些问题。"
#. Tag: para
#: ee.xml:82
#, no-c-format
-msgid ""
-"Web Beans takes care of all this for us. All we need to do is declare the "
-"queue or topic in <literal>web-beans.xml</literal>, specifying an associated "
-"binding type and connection factory."
-msgstr ""
+msgid "Web Beans takes care of all this for us. All we need to do is declare the queue or topic in <literal>web-beans.xml</literal>, specifying an associated binding type and connection factory."
+msgstr "Web Beans为我们处理所有这些问题。我们只须在 <literal>web-beans.xml</literal>声明队列或者主题,指定一个关联的绑定类型和连接工厂即可。"
#. Tag: programlisting
#: ee.xml:86
@@ -237,11 +241,15 @@
msgid ""
"<![CDATA[<Queue>\n"
" <destination>java:comp/env/jms/OrderQueue</destination>\n"
-" <connectionFactory>java:comp/env/jms/QueueConnectionFactory</"
-"connectionFactory>\n"
+" <connectionFactory>java:comp/env/jms/QueueConnectionFactory</connectionFactory>\n"
" <myapp:OrderProcessor/> \n"
"</Queue>]]>"
msgstr ""
+"<![CDATA[<Queue>\n"
+" <destination>java:comp/env/jms/OrderQueue</destination>\n"
+" <connectionFactory>java:comp/env/jms/QueueConnectionFactory</connectionFactory>\n"
+" <myapp:OrderProcessor/> \n"
+"</Queue>]]>"
#. Tag: programlisting
#: ee.xml:88
@@ -249,22 +257,21 @@
msgid ""
"<![CDATA[<Topic>\n"
" <destination>java:comp/env/jms/StockPrices</destination>\n"
-" <connectionFactory>java:comp/env/jms/TopicConnectionFactory</"
-"connectionFactory>\n"
+" <connectionFactory>java:comp/env/jms/TopicConnectionFactory</connectionFactory>\n"
" <myapp:StockPrices/> \n"
"</Topic>]]>"
msgstr ""
+"<![CDATA[<Topic>\n"
+" <destination>java:comp/env/jms/StockPrices</destination>\n"
+" <connectionFactory>java:comp/env/jms/TopicConnectionFactory</connectionFactory>\n"
+" <myapp:StockPrices/> \n"
+"</Topic>]]>"
#. Tag: para
#: ee.xml:90
#, no-c-format
-msgid ""
-"Now we can just inject the <literal>Queue</literal>, "
-"<literal>QueueConnection</literal>, <literal>QueueSession</literal> or "
-"<literal>QueueSender</literal> for a queue, or the <literal>Topic</literal>, "
-"<literal>TopicConnection</literal>, <literal>TopicSession</literal> or "
-"<literal>TopicPublisher</literal> for a topic."
-msgstr ""
+msgid "Now we can just inject the <literal>Queue</literal>, <literal>QueueConnection</literal>, <literal>QueueSession</literal> or <literal>QueueSender</literal> for a queue, or the <literal>Topic</literal>, <literal>TopicConnection</literal>, <literal>TopicSession</literal> or <literal>TopicPublisher</literal> for a topic."
+msgstr "现在,对于队列,我们只须注入 <literal>Queue</literal>, <literal>QueueConnection</literal>, <literal>QueueSession</literal> 或者 <literal>QueueSender</literal>;对于主题,我们只须注入<literal>Topic</literal>, <literal>TopicConnection</literal>, <literal>TopicSession</literal> 或者 <literal>TopicPublisher</literal>。"
#. Tag: programlisting
#: ee.xml:96
@@ -279,6 +286,14 @@
" orderSender.send(msg);\n"
"}"
msgstr ""
+"@OrderProcessor QueueSender orderSender;\n"
+"@OrderProcessor QueueSession orderSession;\n"
+"\n"
+"public void sendMessage() {\n"
+" MapMessage msg = orderSession.createMapMessage();\n"
+" ...\n"
+" orderSender.send(msg);\n"
+"}"
#. Tag: programlisting
#: ee.xml:98
@@ -291,39 +306,34 @@
" pricePublisher.send( priceSession.createTextMessage(price) );\n"
"}"
msgstr ""
+"@StockPrices TopicPublisher pricePublisher;\n"
+"@StockPrices TopicSession priceSession;\n"
+"\n"
+"public void sendMessage(String price) {\n"
+" pricePublisher.send( priceSession.createTextMessage(price) );\n"
+"}"
#. Tag: para
#: ee.xml:100
#, no-c-format
-msgid ""
-"The lifecycle of the injected JMS objects is completely controlled by the "
-"Web Bean manager."
-msgstr ""
+msgid "The lifecycle of the injected JMS objects is completely controlled by the Web Bean manager."
+msgstr "被注入的JMS对象的生命周期完全由Web Bean管理器控制。"
#. Tag: title
#: ee.xml:106
#, no-c-format
msgid "Packaging and deployment"
-msgstr ""
+msgstr "打包和部署"
#. Tag: para
#: ee.xml:108
#, no-c-format
-msgid ""
-"Web Beans doesn't define any special deployment archive. You can package Web "
-"Beans in JARs, EJB-JARs or WARs — any deployment location in the "
-"application classpath. However, each archive that contains Web Beans must "
-"include a file named <literal>web-beans.xml</literal> in the <literal>META-"
-"INF</literal> or <literal>WEB-INF</literal> directory. The file may be "
-"empty. Web Beans deployed in archives that do not have a <literal>web-beans."
-"xml</literal> file will not be available for use in the application."
-msgstr ""
+msgid "Web Beans doesn't define any special deployment archive. You can package Web Beans in JARs, EJB-JARs or WARs — any deployment location in the application classpath. However, each archive that contains Web Beans must include a file named <literal>web-beans.xml</literal> in the <literal>META-INF</literal> or <literal>WEB-INF</literal> directory. The file may be empty. Web Beans deployed in archives that do not have a <literal>web-beans.xml</literal> file will not be available for use in the application."
+msgstr "Web Beans并没有指定特殊的部署包。你可以以JAR, EJB-JAR或者WAR—形式将Web Beans打包在任何应用类路径中的部署位置上。然而,每个包含Web Beans的包必须在<literal>META-INF</literal> 或者 <literal>WEB-INF</literal>目录下包含一个名为 <literal>web-beans.xml</literal>的配置文件。这个文件可以是空的。没有<literal>web-beans.xml</literal> 配置文件,应用将无法使用Web Beans。"
#. Tag: para
#: ee.xml:116
#, no-c-format
-msgid ""
-"For Java SE execution, Web Beans may be deployed in any location in which "
-"EJBs may be deployed for execution by the embeddable EJB Lite container. "
-"Again, each location must contain a <literal>web-beans.xml</literal> file."
-msgstr ""
+msgid "For Java SE execution, Web Beans may be deployed in any location in which EJBs may be deployed for execution by the embeddable EJB Lite container. Again, each location must contain a <literal>web-beans.xml</literal> file."
+msgstr "对于Java SE,Web Beans可以被部署在由嵌入式EJB轻量容器支持的EJB中的任何位置。同样,该位置必须包含 <literal>web-beans.xml</literal> 配置文件。"
+
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1474 - doc/trunk/reference/zh-CN.
by webbeans-commits@lists.jboss.org
Author: alartin
Date: 2009-02-09 22:19:40 -0500 (Mon, 09 Feb 2009)
New Revision: 1474
Modified:
doc/trunk/reference/zh-CN/decorators.po
Log:
Modified: doc/trunk/reference/zh-CN/decorators.po
===================================================================
--- doc/trunk/reference/zh-CN/decorators.po 2009-02-09 21:39:49 UTC (rev 1473)
+++ doc/trunk/reference/zh-CN/decorators.po 2009-02-10 03:19:40 UTC (rev 1474)
@@ -3,11 +3,11 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: master.xml \n"
+"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-12-19 20:26+0000\n"
-"PO-Revision-Date: 2008-12-19 20:26+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2009-02-10 11:18+0800\n"
+"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,38 +17,25 @@
#: decorators.xml:4
#, no-c-format
msgid "Decorators"
-msgstr ""
+msgstr "装饰器"
#. Tag: para
#: decorators.xml:6
#, no-c-format
-msgid ""
-"Interceptors are a powerful way to capture and separate concerns which are "
-"<emphasis>orthogonal</emphasis> to the type system. Any interceptor is able "
-"to intercept invocations of any Java type. This makes them perfect for "
-"solving technical concerns such as transaction management and security. "
-"However, by nature, interceptors are unaware of the actual semantics of the "
-"events they intercept. Thus, interceptors aren't an appropriate tool for "
-"separating business-related concerns."
-msgstr ""
+msgid "Interceptors are a powerful way to capture and separate concerns which are <emphasis>orthogonal</emphasis> to the type system. Any interceptor is able to intercept invocations of any Java type. This makes them perfect for solving technical concerns such as transaction management and security. However, by nature, interceptors are unaware of the actual semantics of the events they intercept. Thus, interceptors aren't an appropriate tool for separating business-related concerns."
+msgstr "拦截器能够以一种强大的方式来捕获和分离关注点,拦截器和类型系统的关系是正交的。任何拦截器都能够拦截任何Java类型的调用。这种特性能够让拦截器很好的处理技术关注点,例如事务管理和安全。不过,拦截器无法领会其所拦截时间的真实语义。因此,拦截器并不是分离业务相关的关注点的好工具。"
#. Tag: para
#: decorators.xml:14
#, no-c-format
-msgid ""
-"The reverse is true of <emphasis>decorators</emphasis>. A decorator "
-"intercepts invocations only for a certain Java interface, and is therefore "
-"aware of all the semantics attached to that interface. This makes decorators "
-"a perfect tool for modeling some kinds of business concerns. It also means "
-"that a decorator doesn't have the generality of an interceptor. Decorators "
-"aren't able to solve technical concerns that cut across many disparate types."
-msgstr ""
+msgid "The reverse is true of <emphasis>decorators</emphasis>. A decorator intercepts invocations only for a certain Java interface, and is therefore aware of all the semantics attached to that interface. This makes decorators a perfect tool for modeling some kinds of business concerns. It also means that a decorator doesn't have the generality of an interceptor. Decorators aren't able to solve technical concerns that cut across many disparate types."
+msgstr "对装饰器来说,反之亦然。一个装饰器只拦截特定Java接口的调用,因此它能够领会这个接口关联的语义。装饰器的特性使其成为某些业务关注点的理想的建模工具。这也意味着装饰器并不拥有一个拦截器的普遍性。装饰器无法解决跨越多个不同类型的技术关注点。"
#. Tag: para
#: decorators.xml:22
#, no-c-format
msgid "Suppose we have an interface that represents accounts:"
-msgstr ""
+msgstr "假定我们有一个表现帐户的接口:"
#. Tag: programlisting
#: decorators.xml:24
@@ -61,24 +48,24 @@
" public void deposit(BigDecimal amount);\n"
"}]]>"
msgstr ""
+"<![CDATA[public interface Account {\n"
+" public BigDecimal getBalance();\n"
+" public User getOwner();\n"
+" public void withdraw(BigDecimal amount);\n"
+" public void deposit(BigDecimal amount);\n"
+"}]]>"
#. Tag: para
#: decorators.xml:26
#, no-c-format
-msgid ""
-"Several different Web Beans in our system implement the <literal>Account</"
-"literal> interface. However, we have a common legal requirement that, for "
-"any kind of account, large transactions must be recorded by the system in a "
-"special log. This is a perfect job for a decorator."
-msgstr ""
+msgid "Several different Web Beans in our system implement the <literal>Account</literal> interface. However, we have a common legal requirement that, for any kind of account, large transactions must be recorded by the system in a special log. This is a perfect job for a decorator."
+msgstr "我们系统实现中可以有多个不同的Web Beans实现 <literal>Account</literal> 接口。然而我们有一个通用的法律要求对于任何帐户,大的交易必须由系统在一个特定的日志中记录。装饰器非常适合处理这种工作。"
#. Tag: para
#: decorators.xml:32
#, no-c-format
-msgid ""
-"A decorator is a simple Web Bean that implements the type it decorates and "
-"is annotated <literal>@Decorator</literal>."
-msgstr ""
+msgid "A decorator is a simple Web Bean that implements the type it decorates and is annotated <literal>@Decorator</literal>."
+msgstr "装饰器是一个简单的Web Bean,能够实现其装饰的类型。装饰器使用 <literal>@Decorator</literal> 注释。"
#. Tag: programlisting
#: decorators.xml:35
@@ -108,100 +95,107 @@
" \n"
"}]]>"
msgstr ""
+"<![CDATA[@Decorator\n"
+"public abstract class LargeTransactionDecorator \n"
+" implements Account {\n"
+" \n"
+" @Decorates Account account;\n"
+" \n"
+" @PersistenceContext EntityManager em;\n"
+" \n"
+" public void withdraw(BigDecimal amount) {\n"
+" account.withdraw(amount);\n"
+" if ( amount.compareTo(LARGE_AMOUNT)>0 ) {\n"
+" em.persist( new LoggedWithdrawl(amount) );\n"
+" }\n"
+" }\n"
+" \n"
+" public void deposit(BigDecimal amount);\n"
+" account.deposit(amount);\n"
+" if ( amount.compareTo(LARGE_AMOUNT)>0 ) {\n"
+" em.persist( new LoggedDeposit(amount) );\n"
+" }\n"
+" }\n"
+" \n"
+"}]]>"
#. Tag: para
#: decorators.xml:37
#, no-c-format
-msgid ""
-"Unlike other simple Web Beans, a decorator may be an abstract class. If "
-"there's nothing special the decorator needs to do for a particular method of "
-"the decorated interface, you don't need to implement that method."
-msgstr ""
+msgid "Unlike other simple Web Beans, a decorator may be an abstract class. If there's nothing special the decorator needs to do for a particular method of the decorated interface, you don't need to implement that method."
+msgstr "和其他简单的Web Beans不同,一个装饰器可以是一个抽象类。如果被装饰的接口中一个特殊方法对装饰器没有用处,那么装饰器可以不实现这个方法。"
#. Tag: title
#: decorators.xml:43
#, no-c-format
msgid "Delegate attributes"
-msgstr ""
+msgstr "委托属性"
#. Tag: para
#: decorators.xml:45
#, no-c-format
-msgid ""
-"All decorators have a <emphasis>delegate attribute</emphasis>. The type and "
-"binding types of the delegate attribute determine which Web Beans the "
-"decorator is bound to. The delegate attribute type must implement or extend "
-"all interfaces implemented by the decorator."
-msgstr ""
+msgid "All decorators have a <emphasis>delegate attribute</emphasis>. The type and binding types of the delegate attribute determine which Web Beans the decorator is bound to. The delegate attribute type must implement or extend all interfaces implemented by the decorator."
+msgstr "所有装饰器都有一个 <emphasis>委托属性</emphasis> 。委托属性的类型和绑定类型决定了装饰器绑定到哪个Web Bean上。委托属性类型必须实现或者继承装饰器实现的所有接口。"
#. Tag: para
#: decorators.xml:50
#, no-c-format
-msgid ""
-"This delegate attribute specifies that the decorator is bound to all Web "
-"Beans that implement <literal>Account</literal>:"
-msgstr ""
+msgid "This delegate attribute specifies that the decorator is bound to all Web Beans that implement <literal>Account</literal>:"
+msgstr "下面的委托属性指定了装饰器绑定到所有实现 <literal>Account</literal> 接口的Web Beans:"
#. Tag: programlisting
#: decorators.xml:53
#, no-c-format
msgid "<![CDATA[@Decorates Account account;]]>"
-msgstr ""
+msgstr "<![CDATA[@Decorates Account account;]]>"
#. Tag: para
#: decorators.xml:55
#, no-c-format
-msgid ""
-"A delegate attribute may specify a binding annotation. Then the decorator "
-"will only be bound to Web Beans with the same binding."
-msgstr ""
+msgid "A delegate attribute may specify a binding annotation. Then the decorator will only be bound to Web Beans with the same binding."
+msgstr "一个委托属性能够指定一个绑定注释。装饰器只能绑定具有相同绑定的Web Beans。"
#. Tag: programlisting
#: decorators.xml:58
#, no-c-format
msgid "<![CDATA[@Decorates @Foreign Account account;]]>"
-msgstr ""
+msgstr "<![CDATA[@Decorates @Foreign Account account;]]>"
#. Tag: para
#: decorators.xml:60
#, no-c-format
msgid "A decorator is bound to any Web Bean which:"
-msgstr ""
+msgstr "一个装饰器可以绑定到任何符合下面条件的Web Bean上:"
#. Tag: para
#: decorators.xml:64
#, no-c-format
msgid "has the type of the delegate attribute as an API type, and"
-msgstr ""
+msgstr "有一个作为API类型的委托属性类型,以及"
#. Tag: para
#: decorators.xml:67
#, no-c-format
msgid "has all binding types that are declared by the delegate attribute."
-msgstr ""
+msgstr "具备委托属性声明的说有绑定类型。"
#. Tag: para
#: decorators.xml:71
#, no-c-format
-msgid ""
-"The decorator may invoke the delegate attribute, which has much the same "
-"effect as calling <literal>InvocationContext.proceed()</literal> from an "
-"interceptor."
-msgstr ""
+msgid "The decorator may invoke the delegate attribute, which has much the same effect as calling <literal>InvocationContext.proceed()</literal> from an interceptor."
+msgstr "装饰器可以调用委托属性,这和从一个拦截器中调用 <literal>InvocationContext.proceed()</literal> 具有相同效果。"
#. Tag: title
#: decorators.xml:78
#, no-c-format
msgid "Enabling decorators"
-msgstr ""
+msgstr "激活装饰器"
#. Tag: para
#: decorators.xml:80
#, no-c-format
-msgid ""
-"We need to <emphasis>enable</emphasis> our decorator in <literal>web-beans."
-"xml</literal>."
-msgstr ""
+msgid "We need to <emphasis>enable</emphasis> our decorator in <literal>web-beans.xml</literal>."
+msgstr "我们需要在 <literal>web-beans.xml</literal> 文件中激活我们的装饰器。"
#. Tag: programlisting
#: decorators.xml:83
@@ -211,33 +205,31 @@
" <myapp:LargeTransactionDecorator/>\n"
"</Decorators>]]>"
msgstr ""
+"<![CDATA[<Decorators>\n"
+" <myapp:LargeTransactionDecorator/>\n"
+"</Decorators>]]>"
#. Tag: para
#: decorators.xml:85
#, no-c-format
-msgid ""
-"This declaration serves the same purpose for decorators that the "
-"<literal><Interceptors></literal> declaration serves for interceptors:"
-msgstr ""
+msgid "This declaration serves the same purpose for decorators that the <literal><Interceptors></literal> declaration serves for interceptors:"
+msgstr "这个声明对于装饰器来说和<literal><Interceptors></literal>声明对于拦截器来说是一样的:"
#. Tag: para
#: decorators.xml:90
#, no-c-format
-msgid ""
-"it enables us to specify a total ordering for all decorators in our system, "
-"ensuring deterministic behavior, and"
-msgstr ""
+msgid "it enables us to specify a total ordering for all decorators in our system, ensuring deterministic behavior, and"
+msgstr "它能让我们在系统中指定所有装饰器的排序,确保具有确定的行为,并且"
#. Tag: para
#: decorators.xml:94
#, no-c-format
msgid "it lets us enable or disable decorator classes at deployment time."
-msgstr ""
+msgstr "它能让我们在部署时期中激活或者关闭装饰器类。"
#. Tag: para
#: decorators.xml:98
#, no-c-format
-msgid ""
-"Interceptors for a method are called before decorators that apply to that "
-"method."
-msgstr ""
+msgid "Interceptors for a method are called before decorators that apply to that method."
+msgstr "一个方法的拦截器在这个方法的装饰器调用之前调用。"
+
17 years, 2 months