You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2008/12/19 19:27:42 UTC
svn commit: r728094 -
/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
Author: gerdogdu
Date: Fri Dec 19 10:27:41 2008
New Revision: 728094
URL: http://svn.apache.org/viewvc?rev=728094&view=rev
Log:
Simple XML component creation test method is added.
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java?rev=728094&r1=728093&r2=728094&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java Fri Dec 19 10:27:41 2008
@@ -33,6 +33,7 @@
import org.apache.webbeans.component.AbstractComponent;
import org.apache.webbeans.component.ComponentImpl;
import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.xml.XMLComponentImpl;
import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.SimpleWebBeansConfigurator;
import org.apache.webbeans.decorator.DecoratorUtil;
@@ -60,6 +61,7 @@
import org.apache.webbeans.test.sterotype.StereoWithSessionScope2;
import org.apache.webbeans.util.WebBeansUtil;
import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.dom4j.Element;
public abstract class TestContext implements ITestContext
{
@@ -82,30 +84,50 @@
{
if (!init)
{
- initializeDeploymentType(Production.class,1);
+ initDeploymentTypes();
+ initInterceptors();
+ initDecorators();
+ initStereoTypes();
- initializeStereoType(Interceptor.class);
- initializeStereoType(Decorator.class);
- initializeStereoType(StereoWithNonScope.class);
- initializeStereoType(StereoWithRequestScope.class);
- initializeStereoType(StereoWithSessionScope.class);
- initializeStereoType(StereoWithSessionScope2.class);
-
- initializeInterceptorType(WebBeansInterceptor.class);
- initializeInterceptorType(WebBeanswithMetaInterceptor.class);
-
- initializeDecoratorType(DelegateAttributeIsnotInterface.class);
- initializeDecoratorType(MoreThanOneDelegateAttribute.class);
- initializeDecoratorType(PaymentDecorator.class);
- initializeDecoratorType(DelegateAttributeMustImplementAllDecoratedTypes.class);
- initializeDecoratorType(ServiceDecorator.class);
- initializeDecoratorType(LargeTransactionDecorator.class);
-
init = true;
}
+ }
+
+ protected void initDeploymentTypes()
+ {
+ initializeDeploymentType(Production.class,1);
}
+ protected void initInterceptors()
+ {
+ initializeInterceptorType(WebBeansInterceptor.class);
+ initializeInterceptorType(WebBeanswithMetaInterceptor.class);
+
+ }
+
+ protected void initDecorators()
+ {
+ initializeDecoratorType(DelegateAttributeIsnotInterface.class);
+ initializeDecoratorType(MoreThanOneDelegateAttribute.class);
+ initializeDecoratorType(PaymentDecorator.class);
+ initializeDecoratorType(DelegateAttributeMustImplementAllDecoratedTypes.class);
+ initializeDecoratorType(ServiceDecorator.class);
+ initializeDecoratorType(LargeTransactionDecorator.class);
+
+ }
+
+ protected void initStereoTypes()
+ {
+ initializeStereoType(Interceptor.class);
+ initializeStereoType(Decorator.class);
+ initializeStereoType(StereoWithNonScope.class);
+ initializeStereoType(StereoWithRequestScope.class);
+ initializeStereoType(StereoWithSessionScope.class);
+ initializeStereoType(StereoWithSessionScope2.class);
+
+ }
+
protected void beforeTest(){}
public void fail(String methodName)
@@ -168,6 +190,18 @@
return bean;
}
+ protected <T> void defineXMLSimpleWebBeans(Class<T> simpleClass, Element webBeanDecleration)
+ {
+ XMLComponentImpl<T> bean = null;
+ bean = WebBeansXMLConfigurator.configureSimpleWebBean(simpleClass, webBeanDecleration);
+
+ if(bean != null)
+ {
+ getComponents().add(bean);
+ manager.addBean(bean);
+ }
+ }
+
@SuppressWarnings("unchecked")
protected <T> AbstractComponent<T> defineSimpleWebBeanInterceptor(Class<T> clazz)
@@ -256,26 +290,26 @@
WebBeansXMLConfigurator.configure(file, fileName);
}
- private void initializeDeploymentType(Class<? extends Annotation> deploymentType, int precedence)
+ protected void initializeDeploymentType(Class<? extends Annotation> deploymentType, int precedence)
{
DeploymentTypeManager.getInstance().addNewDeploymentType(deploymentType, precedence);
}
- private void initializeStereoType(Class<?> stereoClass)
+ protected void initializeStereoType(Class<?> stereoClass)
{
WebBeansUtil.checkStereoTypeClass(stereoClass);
StereoTypeModel model = new StereoTypeModel(stereoClass);
StereoTypeManager.getInstance().addStereoTypeModel(model);
}
- private void initializeInterceptorType(Class<?> interceptorClazz)
+ protected void initializeInterceptorType(Class<?> interceptorClazz)
{
InterceptorsManager.getInstance().addNewInterceptor(interceptorClazz);
}
- private void initializeDecoratorType(Class<?> decoratorClazz)
+ protected void initializeDecoratorType(Class<?> decoratorClazz)
{
DecoratorsManager.getInstance().addNewDecorator(decoratorClazz);