openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r732806 [7/11] - in /incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test: annotation/binding/ component/ component/binding/ component/decorator/broken/ component/decorator/clean/ component/dependent/ component/...
Date Thu, 08 Jan 2009 19:45:17 GMT
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=732806&r1=732805&r2=732806&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 Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.servlet;
 
@@ -67,491 +64,470 @@
 import org.dom4j.Element;
 
 /**
- * Superclass of all the unit test classes. It defines some methods
- * for subclasses and also do some initializtions for running the
- * tests succesfully.
+ * Superclass of all the unit test classes. It defines some methods for
+ * subclasses and also do some initializtions for running the tests succesfully.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
 public abstract class TestContext implements ITestContext
 {
-	private Logger logger = Logger.getLogger(TestContext.class);
-	
-	/**All unit test classes. It is defined for starting the tests from the {@link ServletContextListener} methods*/
-	private static Set<ITestContext> testContexts = new HashSet<ITestContext>();
-
-	/**Test class name*/
-	private String clazzName;
-
-	/**MockManager is the mock implementation of the {@link Manager}*/
-	private MockManager manager;
-	
-	/**Tests initialization is already done or not*/
-	private static boolean init;
-	
-	/**Use for XML tests*/
-	protected WebBeansXMLConfigurator xmlConfigurator = null;
-
-	/**
-	 * Creates new test class.
-	 * 
-	 * @param clazzName class name of the test class
-	 */
-	protected TestContext(String clazzName)
-	{
-		this.clazzName = clazzName;
-		TestContext.testContexts.add(this);
-		this.manager = MockManager.getInstance();
-		this.xmlConfigurator = new WebBeansXMLConfigurator();
-	}
-
-	/**
-	 * Initialize the tests.
-	 * 
-	 * NOTE : Actually this has to be defined for each test classes.
-	 * But for the time being, this super-class globally defines some 
-	 * deployment types, interceptor types, decorator types and stereotypes.
-	 * 
-	 * If you would like to override default initialization, override these methods
-	 * in your test classes.
-	 */
-	public void init()
-	{
-		if (!init)
-		{
-			initDeploymentTypes();
-			initInterceptors();
-			initDecorators();
-			initStereoTypes();
-			
-			init = true;
-		}
-	}
-	
-	/**
-	 * Initialize deployment types.
-	 */
-	protected void initDeploymentTypes()
-	{
-		initializeDeploymentType(Production.class,1);
-
-	}
-	
-	/**
-	 * Initialize some predefined interceptors.
-	 */
-	protected void initInterceptors()
-	{
-		initializeInterceptorType(WebBeansInterceptor.class);
-		initializeInterceptorType(WebBeanswithMetaInterceptor.class);
-		
-	}
-	
-	/**
-	 * Initialize some predefined decorators.
-	 */
-	protected void initDecorators()
-	{
-		initializeDecoratorType(DelegateAttributeIsnotInterface.class);
-		initializeDecoratorType(MoreThanOneDelegateAttribute.class);
-		initializeDecoratorType(PaymentDecorator.class);
-		initializeDecoratorType(DelegateAttributeMustImplementAllDecoratedTypes.class);
-		initializeDecoratorType(ServiceDecorator.class);
-		initializeDecoratorType(LargeTransactionDecorator.class);
-		
-	}
-	
-	/**
-	 * Initialize some predefined stereotypes.
-	 */
-	protected void initStereoTypes()
-	{
-		initDefaultStereoTypes();
-		initializeStereoType(StereoWithNonScope.class);
-		initializeStereoType(StereoWithRequestScope.class);
-		initializeStereoType(StereoWithSessionScope.class);
-		initializeStereoType(StereoWithSessionScope2.class);
-		
-	}
-	
-	/**
-	 * Default stereo types
-	 */
-	protected void initDefaultStereoTypes()
-	{
-		initializeStereoType(Interceptor.class);
-		initializeStereoType(Decorator.class);		
-	}
-	
-	/**
-	 * Call before test.
-	 */
-	protected void beforeTest()
-	{
-		
-	}
-
-	/**
-	 * This will be called whenever the test is failed.
-	 * 
-	 * NOT : This method is used for running the tests from the
-	 * {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 * @param methodName failed method name 
-	 */
-	public void fail(String methodName)
-	{
-		logger.error("Test Class: " + clazzName + ",Method Name: " + methodName + " is FAILED");
-	}
-
-	/**
-	 * This will be called whenever the test is passed.
-	 * 
-	 * NOT : This method is used for running the tests from the
-	 * {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 * @param methodName passed method name 
-	 */	
-	public void pass(String methodName)
-	{
-		logger.info("Test Class: " + clazzName + ",Method Name: " + methodName + " is PASSED");
-	}
-
-	/**
-	 * Initialize all tests.
-	 * 
-	 * NOT : This method is used for initializing the all tests classes 
-	 * from the {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 */
-	public static void initTests()
-	{
-		Iterator<ITestContext> it = testContexts.iterator();
-		while (it.hasNext())
-		{
-			it.next().init();
-		}
-
-	}
-
-	/**
-	 * Start all tests.
-	 * 
-	 * NOT : This method is used for starting the all tests classes 
-	 * from the {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 */	
-	public static void startAllTests(ServletContext ctx)
-	{
-		Iterator<ITestContext> it = testContexts.iterator();
-		while (it.hasNext())
-		{
-			it.next().startTests(ctx);
-		}
-
-	}
-
-	/**
-	 * Ending all tests.
-	 * 
-	 * NOT : This method is used for ending the all tests classes 
-	 * from the {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 */	
-	public static void endAllTests(ServletContext ctx)
-	{
-		Iterator<ITestContext> it = testContexts.iterator();
-		while (it.hasNext())
-		{
-			it.next().endTests(ctx);
-		}
-
-	}
-
-	/**
-	 * Defines simple webbeans from the given class.
-	 * 
-	 * @param clazz simple webbeans class
-	 * @return simple webbean
-	 */
-	protected <T> AbstractComponent<T> defineSimpleWebBean(Class<T> clazz)
-	{
-		ComponentImpl<T> bean = null;
-		
-		
-		SimpleWebBeansConfigurator.checkSimpleWebBeanCondition(clazz);
-		bean = SimpleWebBeansConfigurator.define(clazz, WebBeansType.SIMPLE);
-		
-		if(bean != null)
-		{
-			DecoratorUtil.checkSimpleWebBeanDecoratorConditions(bean);
-			//DefinitionUtil.defineSimpleWebBeanInterceptorStack(bean);
-			
-			getComponents().add((AbstractComponent<?>)bean);
-			manager.addBean(bean);
-		}			
-		
-		return bean;
-	}
-	
-	/**
-	 * Defines XML defined new simple webbean.
-	 * 
-	 * @param simpleClass webbeans class
-	 * @param webBeanDecleration element decleration defines simple webbeans
-	 */
-	protected <T> XMLComponentImpl<T> defineXMLSimpleWebBeans(Class<T> simpleClass, Element webBeanDecleration)
-	{
-		XMLComponentImpl<T> bean = null;
-		bean = this.xmlConfigurator.configureSimpleWebBean(simpleClass, webBeanDecleration);
-		
-		if(bean != null)
-		{
-			getComponents().add(bean);
-			manager.addBean(bean);
-		}
-		
-		return bean;
-	}
-	
-	
-	/**
-	 * Defines simple webbeans interceptor.
-	 * 
-	 * @param clazz interceptor class
-	 * @return the new interceptor
-	 */
-	@SuppressWarnings("unchecked")
-	protected <T> AbstractComponent<T> defineSimpleWebBeanInterceptor(Class<T> clazz)
-	{
-		ComponentImpl<T> component = null;
-		
-		SimpleWebBeansConfigurator.checkSimpleWebBeanCondition(clazz);
-		{
-			//This is the interceptor class
-			if(InterceptorsManager.getInstance().isInterceptorEnabled(clazz))
-			{
-				InterceptorUtil.checkInterceptorConditions(clazz);
-				component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.INTERCEPTOR);
-				WebBeansInterceptorConfig.configureInterceptorClass((ComponentImpl<Object>)component, clazz.getDeclaredAnnotations());
-			}
-			
-		}
-		
-		return component;
-	}
-	
-	/**
-	 * Defines the simple webbeans decorator.
-	 * 
-	 * @param clazz decorator class
-	 * @return the new decorator
-	 */
-	@SuppressWarnings("unchecked")
-	protected  <T> AbstractComponent<T> defineSimpleWebBeansDecorators(Class<T> clazz)
-	{
-		ComponentImpl<T> component = null;
-		
-		if(DecoratorsManager.getInstance().isDecoratorEnabled(clazz))
-		{			
-			DecoratorUtil.checkDecoratorConditions(clazz);
-			component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.DECORATOR);
-			
-			if(component != null)
-			{
-				WebBeansDecoratorConfig.configureDecoratorClass((ComponentImpl<Object>)component);
-			}			
-		}	
-		
-		
-		return component;
-	}
-	
-	
-	/**
-	 * Clear all components in the {@link MockManager}
-	 */
-	protected void clear()
-	{
-		manager.clear();
-	}
-
-	/**
-	 * Gets the ith component in the {@link MockManager}
-	 * 
-	 * @param i ith component in the {@link MockManager}
-	 * @return the ith component in the list
-	 */
-	protected AbstractComponent<?> getComponent(int i)
-	{
-		return manager.getComponent(i);
-	}
-
-	/**
-	 * Gets all components in the {@link MockManager}
-	 * 
-	 * @return all components
-	 */
-	protected List<AbstractComponent<?>> getComponents()
-	{
-		return manager.getComponents();
-	}
-
-	/**
-	 * Return the size of the webbeans in the {@link MockManager}
-	 * 
-	 * @return the size of the components in the {@link MockManager}
-	 */
-	protected int getDeployedComponents()
-	{
-		return manager.getDeployedCompnents();
-	}
-
-	/**
-	 * Gets the webbeans instance.
-	 * 
-	 * @param name name of the webbean
-	 * @return the webbeans instance
-	 */
-	protected Object getInstanceByName(String name)
-	{
-		return manager.getInstanceByName(name);
-	}
-
-	/**
-	 * Gets the context with given scope type.
-	 * 
-	 * @param scopeType scope type
-	 * @return the context with given scope type
-	 */
-	protected Context getContext(Class<? extends Annotation> scopeType)
-	{
-		return manager.getContext(scopeType);
-	}
-
-	/**
-	 * Gets the {@link MockManager} instance.
-	 * 
-	 * @return manager instance
-	 */
-	protected MockManager getManager()
-	{
-		return manager;
-	}
-	
-	/**
-	 * Return new {@link MockHttpSession}
-	 * 
-	 * @return new mock session
-	 */
-	protected HttpSession getSession()
-	{
-		return new MockHttpSession();
-	}
-	
-	/**
-	 * Configuration of the webbeans XML file.
-	 * 
-	 * @param file input stream
-	 * @param fileName file name
-	 */
-	protected void configureFromXML(InputStream file, String fileName)
-	{
-		this.xmlConfigurator.configure(file, fileName);
-	}
-	
-	
-	/**
-	 * Add new deployment type with given precedence.
-	 * 
-	 * @param deploymentType deployment type
-	 * @param precedence precedence
-	 */
-	protected void initializeDeploymentType(Class<? extends Annotation> deploymentType, int precedence)
-	{
-		DeploymentTypeManager.getInstance().addNewDeploymentType(deploymentType, precedence);
-		
-	}
-
-	/**
-	 * Add new stereotype model.
-	 * 
-	 * @param stereoClass stereotype class
-	 */
-	protected void initializeStereoType(Class<?> stereoClass)
-	{
-		WebBeansUtil.checkStereoTypeClass(stereoClass);
-		StereoTypeModel model = new StereoTypeModel(stereoClass);
-		StereoTypeManager.getInstance().addStereoTypeModel(model);
-	}
-
-	/**
-	 * Add new interceptor class.
-	 * 
-	 * @param interceptorClazz interceptor class
-	 */
-	protected void initializeInterceptorType(Class<?> interceptorClazz)
-	{
-		InterceptorsManager.getInstance().addNewInterceptor(interceptorClazz);
-
-	}
-	
-	/**
-	 * Add new deocrator class.
-	 * 
-	 * @param decoratorClazz decorator class
-	 */
-	protected void initializeDecoratorType(Class<?> decoratorClazz)
-	{
-		DecoratorsManager.getInstance().addNewDecorator(decoratorClazz);
-
-	}
-	
-	/**
-	 * End tests for sub-class.
-	 * 
-	 * NOT : This method is used for ending the all test methods in sub-class 
-	 * from the {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 */			
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	/**
-	 * Start tests for sub-class.
-	 * 
-	 * NOT : This method is used for starting the all test methods in sub-class 
-	 * from the {@link ServletContextListener}. It is not used for normal
-	 * unit tests.
-	 * 
-	 * @see TestListener
-	 * @see ComponentResolutionByTypeTest
-	 */		
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	
+    private Logger logger = Logger.getLogger(TestContext.class);
+
+    /**
+     * All unit test classes. It is defined for starting the tests from the
+     * {@link ServletContextListener} methods
+     */
+    private static Set<ITestContext> testContexts = new HashSet<ITestContext>();
+
+    /** Test class name */
+    private String clazzName;
+
+    /** MockManager is the mock implementation of the {@link Manager} */
+    private MockManager manager;
+
+    /** Tests initialization is already done or not */
+    private static boolean init;
+
+    /** Use for XML tests */
+    protected WebBeansXMLConfigurator xmlConfigurator = null;
+
+    /**
+     * Creates new test class.
+     * 
+     * @param clazzName class name of the test class
+     */
+    protected TestContext(String clazzName)
+    {
+        this.clazzName = clazzName;
+        TestContext.testContexts.add(this);
+        this.manager = MockManager.getInstance();
+        this.xmlConfigurator = new WebBeansXMLConfigurator();
+    }
+
+    /**
+     * Initialize the tests. NOTE : Actually this has to be defined for each
+     * test classes. But for the time being, this super-class globally defines
+     * some deployment types, interceptor types, decorator types and
+     * stereotypes. If you would like to override default initialization,
+     * override these methods in your test classes.
+     */
+    public void init()
+    {
+        if (!init)
+        {
+            initDeploymentTypes();
+            initInterceptors();
+            initDecorators();
+            initStereoTypes();
+
+            init = true;
+        }
+    }
+
+    /**
+     * Initialize deployment types.
+     */
+    protected void initDeploymentTypes()
+    {
+        initializeDeploymentType(Production.class, 1);
+
+    }
+
+    /**
+     * Initialize some predefined interceptors.
+     */
+    protected void initInterceptors()
+    {
+        initializeInterceptorType(WebBeansInterceptor.class);
+        initializeInterceptorType(WebBeanswithMetaInterceptor.class);
+
+    }
+
+    /**
+     * Initialize some predefined decorators.
+     */
+    protected void initDecorators()
+    {
+        initializeDecoratorType(DelegateAttributeIsnotInterface.class);
+        initializeDecoratorType(MoreThanOneDelegateAttribute.class);
+        initializeDecoratorType(PaymentDecorator.class);
+        initializeDecoratorType(DelegateAttributeMustImplementAllDecoratedTypes.class);
+        initializeDecoratorType(ServiceDecorator.class);
+        initializeDecoratorType(LargeTransactionDecorator.class);
+
+    }
+
+    /**
+     * Initialize some predefined stereotypes.
+     */
+    protected void initStereoTypes()
+    {
+        initDefaultStereoTypes();
+        initializeStereoType(StereoWithNonScope.class);
+        initializeStereoType(StereoWithRequestScope.class);
+        initializeStereoType(StereoWithSessionScope.class);
+        initializeStereoType(StereoWithSessionScope2.class);
+
+    }
+
+    /**
+     * Default stereo types
+     */
+    protected void initDefaultStereoTypes()
+    {
+        initializeStereoType(Interceptor.class);
+        initializeStereoType(Decorator.class);
+    }
+
+    /**
+     * Call before test.
+     */
+    protected void beforeTest()
+    {
+
+    }
+
+    /**
+     * This will be called whenever the test is failed. NOT : This method is
+     * used for running the tests from the {@link ServletContextListener}. It
+     * is not used for normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     * @param methodName failed method name
+     */
+    public void fail(String methodName)
+    {
+        logger.error("Test Class: " + clazzName + ",Method Name: " + methodName + " is FAILED");
+    }
+
+    /**
+     * This will be called whenever the test is passed. NOT : This method is
+     * used for running the tests from the {@link ServletContextListener}. It
+     * is not used for normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     * @param methodName passed method name
+     */
+    public void pass(String methodName)
+    {
+        logger.info("Test Class: " + clazzName + ",Method Name: " + methodName + " is PASSED");
+    }
+
+    /**
+     * Initialize all tests. NOT : This method is used for initializing the all
+     * tests classes from the {@link ServletContextListener}. It is not used
+     * for normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     */
+    public static void initTests()
+    {
+        Iterator<ITestContext> it = testContexts.iterator();
+        while (it.hasNext())
+        {
+            it.next().init();
+        }
+
+    }
+
+    /**
+     * Start all tests. NOT : This method is used for starting the all tests
+     * classes from the {@link ServletContextListener}. It is not used for
+     * normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     */
+    public static void startAllTests(ServletContext ctx)
+    {
+        Iterator<ITestContext> it = testContexts.iterator();
+        while (it.hasNext())
+        {
+            it.next().startTests(ctx);
+        }
+
+    }
+
+    /**
+     * Ending all tests. NOT : This method is used for ending the all tests
+     * classes from the {@link ServletContextListener}. It is not used for
+     * normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     */
+    public static void endAllTests(ServletContext ctx)
+    {
+        Iterator<ITestContext> it = testContexts.iterator();
+        while (it.hasNext())
+        {
+            it.next().endTests(ctx);
+        }
+
+    }
+
+    /**
+     * Defines simple webbeans from the given class.
+     * 
+     * @param clazz simple webbeans class
+     * @return simple webbean
+     */
+    protected <T> AbstractComponent<T> defineSimpleWebBean(Class<T> clazz)
+    {
+        ComponentImpl<T> bean = null;
+
+        SimpleWebBeansConfigurator.checkSimpleWebBeanCondition(clazz);
+        bean = SimpleWebBeansConfigurator.define(clazz, WebBeansType.SIMPLE);
+
+        if (bean != null)
+        {
+            DecoratorUtil.checkSimpleWebBeanDecoratorConditions(bean);
+            // DefinitionUtil.defineSimpleWebBeanInterceptorStack(bean);
+
+            getComponents().add((AbstractComponent<?>) bean);
+            manager.addBean(bean);
+        }
+
+        return bean;
+    }
+
+    /**
+     * Defines XML defined new simple webbean.
+     * 
+     * @param simpleClass webbeans class
+     * @param webBeanDecleration element decleration defines simple webbeans
+     */
+    protected <T> XMLComponentImpl<T> defineXMLSimpleWebBeans(Class<T> simpleClass, Element webBeanDecleration)
+    {
+        XMLComponentImpl<T> bean = null;
+        bean = this.xmlConfigurator.configureSimpleWebBean(simpleClass, webBeanDecleration);
+
+        if (bean != null)
+        {
+            getComponents().add(bean);
+            manager.addBean(bean);
+        }
+
+        return bean;
+    }
+
+    /**
+     * Defines simple webbeans interceptor.
+     * 
+     * @param clazz interceptor class
+     * @return the new interceptor
+     */
+    @SuppressWarnings("unchecked")
+    protected <T> AbstractComponent<T> defineSimpleWebBeanInterceptor(Class<T> clazz)
+    {
+        ComponentImpl<T> component = null;
+
+        SimpleWebBeansConfigurator.checkSimpleWebBeanCondition(clazz);
+        {
+            // This is the interceptor class
+            if (InterceptorsManager.getInstance().isInterceptorEnabled(clazz))
+            {
+                InterceptorUtil.checkInterceptorConditions(clazz);
+                component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.INTERCEPTOR);
+                WebBeansInterceptorConfig.configureInterceptorClass((ComponentImpl<Object>) component, clazz.getDeclaredAnnotations());
+            }
+
+        }
+
+        return component;
+    }
+
+    /**
+     * Defines the simple webbeans decorator.
+     * 
+     * @param clazz decorator class
+     * @return the new decorator
+     */
+    @SuppressWarnings("unchecked")
+    protected <T> AbstractComponent<T> defineSimpleWebBeansDecorators(Class<T> clazz)
+    {
+        ComponentImpl<T> component = null;
+
+        if (DecoratorsManager.getInstance().isDecoratorEnabled(clazz))
+        {
+            DecoratorUtil.checkDecoratorConditions(clazz);
+            component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.DECORATOR);
+
+            if (component != null)
+            {
+                WebBeansDecoratorConfig.configureDecoratorClass((ComponentImpl<Object>) component);
+            }
+        }
+
+        return component;
+    }
+
+    /**
+     * Clear all components in the {@link MockManager}
+     */
+    protected void clear()
+    {
+        manager.clear();
+    }
+
+    /**
+     * Gets the ith component in the {@link MockManager}
+     * 
+     * @param i ith component in the {@link MockManager}
+     * @return the ith component in the list
+     */
+    protected AbstractComponent<?> getComponent(int i)
+    {
+        return manager.getComponent(i);
+    }
+
+    /**
+     * Gets all components in the {@link MockManager}
+     * 
+     * @return all components
+     */
+    protected List<AbstractComponent<?>> getComponents()
+    {
+        return manager.getComponents();
+    }
+
+    /**
+     * Return the size of the webbeans in the {@link MockManager}
+     * 
+     * @return the size of the components in the {@link MockManager}
+     */
+    protected int getDeployedComponents()
+    {
+        return manager.getDeployedCompnents();
+    }
+
+    /**
+     * Gets the webbeans instance.
+     * 
+     * @param name name of the webbean
+     * @return the webbeans instance
+     */
+    protected Object getInstanceByName(String name)
+    {
+        return manager.getInstanceByName(name);
+    }
+
+    /**
+     * Gets the context with given scope type.
+     * 
+     * @param scopeType scope type
+     * @return the context with given scope type
+     */
+    protected Context getContext(Class<? extends Annotation> scopeType)
+    {
+        return manager.getContext(scopeType);
+    }
+
+    /**
+     * Gets the {@link MockManager} instance.
+     * 
+     * @return manager instance
+     */
+    protected MockManager getManager()
+    {
+        return manager;
+    }
+
+    /**
+     * Return new {@link MockHttpSession}
+     * 
+     * @return new mock session
+     */
+    protected HttpSession getSession()
+    {
+        return new MockHttpSession();
+    }
+
+    /**
+     * Configuration of the webbeans XML file.
+     * 
+     * @param file input stream
+     * @param fileName file name
+     */
+    protected void configureFromXML(InputStream file, String fileName)
+    {
+        this.xmlConfigurator.configure(file, fileName);
+    }
+
+    /**
+     * Add new deployment type with given precedence.
+     * 
+     * @param deploymentType deployment type
+     * @param precedence precedence
+     */
+    protected void initializeDeploymentType(Class<? extends Annotation> deploymentType, int precedence)
+    {
+        DeploymentTypeManager.getInstance().addNewDeploymentType(deploymentType, precedence);
+
+    }
+
+    /**
+     * Add new stereotype model.
+     * 
+     * @param stereoClass stereotype class
+     */
+    protected void initializeStereoType(Class<?> stereoClass)
+    {
+        WebBeansUtil.checkStereoTypeClass(stereoClass);
+        StereoTypeModel model = new StereoTypeModel(stereoClass);
+        StereoTypeManager.getInstance().addStereoTypeModel(model);
+    }
+
+    /**
+     * Add new interceptor class.
+     * 
+     * @param interceptorClazz interceptor class
+     */
+    protected void initializeInterceptorType(Class<?> interceptorClazz)
+    {
+        InterceptorsManager.getInstance().addNewInterceptor(interceptorClazz);
+
+    }
+
+    /**
+     * Add new deocrator class.
+     * 
+     * @param decoratorClazz decorator class
+     */
+    protected void initializeDecoratorType(Class<?> decoratorClazz)
+    {
+        DecoratorsManager.getInstance().addNewDecorator(decoratorClazz);
+
+    }
+
+    /**
+     * End tests for sub-class. NOT : This method is used for ending the all
+     * test methods in sub-class from the {@link ServletContextListener}. It is
+     * not used for normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     */
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    /**
+     * Start tests for sub-class. NOT : This method is used for starting the all
+     * test methods in sub-class from the {@link ServletContextListener}. It is
+     * not used for normal unit tests.
+     * 
+     * @see TestListener
+     * @see ComponentResolutionByTypeTest
+     */
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.servlet;
 
@@ -22,55 +19,51 @@
 import org.apache.log4j.Logger;
 import org.junit.Test;
 
-
 /**
- * This test listener class is used for running the tests
- * from the web page.
- * 
+ * This test listener class is used for running the tests from the web page.
  * <p>
- * NOT : Actually this is not used, it is created and used as an
- * experimental.
+ * NOT : Actually this is not used, it is created and used as an experimental.
  * </p>
+ * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
 public class TestListener implements ServletContextListener
 {
-	Logger log = Logger.getLogger(TestListener.class);
-	
-	private void init()
-	{
-		log.info("Initializing the test contexts");
-		TestContext.initTests();
-	}
-
-	/**
-	 * Ending all tests
-	 */
-	public void contextDestroyed(ServletContextEvent arg0)
-	{
-		log.info("Ending all tests");
-		
-		TestContext.endAllTests(arg0.getServletContext());
-	}
-
-	
-	@Test
-	public void contextInitialized()
-	{
-		
-	}
-	
-	/**
-	 * Initialize and start all tests from the web application.
-	 */
-	public void contextInitialized(ServletContextEvent arg0)
-	{
-		init();
-		
-		log.info("Starting all tests");
-		
-		TestContext.startAllTests(arg0.getServletContext());
-	}
+    Logger log = Logger.getLogger(TestListener.class);
+
+    private void init()
+    {
+        log.info("Initializing the test contexts");
+        TestContext.initTests();
+    }
+
+    /**
+     * Ending all tests
+     */
+    public void contextDestroyed(ServletContextEvent arg0)
+    {
+        log.info("Ending all tests");
+
+        TestContext.endAllTests(arg0.getServletContext());
+    }
+
+    @Test
+    public void contextInitialized()
+    {
+
+    }
+
+    /**
+     * Initialize and start all tests from the web application.
+     */
+    public void contextInitialized(ServletContextEvent arg0)
+    {
+        init();
+
+        log.info("Starting all tests");
+
+        TestContext.startAllTests(arg0.getServletContext());
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.sterotype;
 
@@ -25,7 +22,7 @@
 
 @Stereotype
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.TYPE,ElementType.METHOD})
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
 public @interface StereoWithNonScope {
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.sterotype;
 
@@ -27,7 +24,7 @@
 @Stereotype
 @RequestScoped
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.TYPE,ElementType.METHOD})
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
 public @interface StereoWithRequestScope {
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.sterotype;
 
@@ -27,7 +24,7 @@
 @Stereotype
 @SessionScoped
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.TYPE,ElementType.METHOD})
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
 public @interface StereoWithSessionScope {
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.sterotype;
 
@@ -27,7 +24,7 @@
 @Stereotype
 @SessionScoped
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.TYPE,ElementType.METHOD})
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
 public @interface StereoWithSessionScope2 {
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -36,69 +33,68 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class CurrentInjectedComponentTest extends TestContext
 {
-	public CurrentInjectedComponentTest()
-	{
-		super(CurrentInjectedComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		super.init();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(Typed2.class);
-		defineSimpleWebBean(CurrentBindingComponent.class);
-		defineSimpleWebBean(ContaintsCurrentComponent.class);
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		HttpSession session = getSession();
-		ContextFactory.initRequestContext(null);
-		ContextFactory.initSessionContext(session);
-		
-		Assert.assertEquals(3, comps.size());
-		
-		ManagerImpl.getManager().getContext(SessionScoped.class).get(comps.get(0), true);
-		ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), true);
-		
-		Object object = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(2), true);
-		
-		Assert.assertTrue(object instanceof ContaintsCurrentComponent);
-		
-		ContaintsCurrentComponent i = (ContaintsCurrentComponent)object;
-		
-		Assert.assertTrue(i.getInstance() instanceof CurrentBindingComponent);
-		
-		Object obj2 = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), false);
-		
-		Assert.assertEquals(i.getInstance(), obj2);
-		
-		CurrentBindingComponent bc = (CurrentBindingComponent)obj2;
-		ITyped2 typed2 = bc.getTyped2();
-		
-		Assert.assertNotNull(typed2);
-		
-		ContextFactory.destroyRequestContext(null);
-		ContextFactory.destroySessionContext(session);
- 	}	
+    public CurrentInjectedComponentTest()
+    {
+        super(CurrentInjectedComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        super.init();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(Typed2.class);
+        defineSimpleWebBean(CurrentBindingComponent.class);
+        defineSimpleWebBean(ContaintsCurrentComponent.class);
+        List<AbstractComponent<?>> comps = getComponents();
+
+        HttpSession session = getSession();
+        ContextFactory.initRequestContext(null);
+        ContextFactory.initSessionContext(session);
+
+        Assert.assertEquals(3, comps.size());
+
+        ManagerImpl.getManager().getContext(SessionScoped.class).get(comps.get(0), true);
+        ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), true);
+
+        Object object = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(2), true);
+
+        Assert.assertTrue(object instanceof ContaintsCurrentComponent);
+
+        ContaintsCurrentComponent i = (ContaintsCurrentComponent) object;
+
+        Assert.assertTrue(i.getInstance() instanceof CurrentBindingComponent);
+
+        Object obj2 = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), false);
+
+        Assert.assertEquals(i.getInstance(), obj2);
+
+        CurrentBindingComponent bc = (CurrentBindingComponent) obj2;
+        ITyped2 typed2 = bc.getTyped2();
+
+        Assert.assertNotNull(typed2);
+
+        ContextFactory.destroyRequestContext(null);
+        ContextFactory.destroySessionContext(session);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -35,68 +32,65 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class DisposalInjectedComponentTest extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
+
+    public DisposalInjectedComponentTest()
+    {
+        super(DisposalInjectedComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        this.container = ManagerImpl.getManager();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(ServiceImpl1.class);
+        defineSimpleWebBean(DisposalMethodComponent.class);
+
+        List<AbstractComponent<?>> comps = getComponents();
+
+        ContextFactory.initRequestContext(null);
+        ContextFactory.initApplicationContext(null);
+
+        Assert.assertEquals(2, comps.size());
+
+        getContext(ApplicationScoped.class).get(getManager().resolveByName("service").iterator().next(), true);
+        Object disposalComp = getContext(RequestScoped.class).get(comps.get(1), true);
+        Object object = getContext(ApplicationScoped.class).get(comps.get(0), true);
+
+        Assert.assertTrue(object instanceof ServiceImpl1);
+        Assert.assertTrue(disposalComp instanceof DisposalMethodComponent);
+
+        DisposalMethodComponent mc = (DisposalMethodComponent) disposalComp;
+
+        IService s = mc.service();
+
+        Assert.assertNotNull(s);
+
+        ContextFactory.destroyApplicationContext(null);
+        ContextFactory.destroyRequestContext(null);
+
+        s = mc.service();
 
-	public DisposalInjectedComponentTest()
-	{
-		super(DisposalInjectedComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		this.container = ManagerImpl.getManager();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(ServiceImpl1.class);
-		defineSimpleWebBean(DisposalMethodComponent.class);
-		
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		ContextFactory.initRequestContext(null);
-		ContextFactory.initApplicationContext(null);
-		
-		Assert.assertEquals(2, comps.size());
-		
-		
-		getContext(ApplicationScoped.class).get(getManager().resolveByName("service").iterator().next(), true);
-		Object disposalComp = getContext(RequestScoped.class).get(comps.get(1), true);
-		Object object = getContext(ApplicationScoped.class).get(comps.get(0), true);
-		
-		
-		Assert.assertTrue(object instanceof ServiceImpl1);
-		Assert.assertTrue(disposalComp instanceof DisposalMethodComponent);
-		
-		DisposalMethodComponent mc = (DisposalMethodComponent) disposalComp;
-		
-		IService s = mc.service();
-		
-		Assert.assertNotNull(s);
-		
-		ContextFactory.destroyApplicationContext(null);
-		ContextFactory.destroyRequestContext(null);
-		
-		s = mc.service();
-		
-		Assert.assertNull(s);
- 	}
+        Assert.assertNull(s);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -32,51 +29,50 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class InjectedComponentTest extends TestContext
 {
 
-	public InjectedComponentTest()
-	{
-		super(InjectedComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		super.init();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(InjectedComponent.class);
-		defineSimpleWebBean(ServiceImpl1.class);
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		ContextFactory.initRequestContext(null);
-		ContextFactory.initApplicationContext(null);
-		
-		Assert.assertEquals(2, comps.size());
-		
-		Object object = ManagerImpl.getManager().getContext(ApplicationScoped.class).get(comps.get(0), true);
-		
-		Assert.assertTrue(object instanceof InjectedComponent);
-		
-		ContextFactory.destroyApplicationContext(null);
-		ContextFactory.destroyRequestContext(null);
- 	}
+    public InjectedComponentTest()
+    {
+        super(InjectedComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        super.init();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(InjectedComponent.class);
+        defineSimpleWebBean(ServiceImpl1.class);
+        List<AbstractComponent<?>> comps = getComponents();
+
+        ContextFactory.initRequestContext(null);
+        ContextFactory.initApplicationContext(null);
+
+        Assert.assertEquals(2, comps.size());
+
+        Object object = ManagerImpl.getManager().getContext(ApplicationScoped.class).get(comps.get(0), true);
+
+        Assert.assertTrue(object instanceof InjectedComponent);
+
+        ContextFactory.destroyApplicationContext(null);
+        ContextFactory.destroyRequestContext(null);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -34,57 +31,56 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class InjectedComponentTestWithMember extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
+
+    public InjectedComponentTestWithMember()
+    {
+        super(InjectedComponentTestWithMember.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        super.init();
+        this.container = ManagerImpl.getManager();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+        defineSimpleWebBean(BindingComponent.class);
+        defineSimpleWebBean(NonBindingComponent.class);
+        List<AbstractComponent<?>> comps = getComponents();
+
+        HttpSession session = getSession();
+        ContextFactory.initSessionContext(session);
+
+        Assert.assertEquals(2, comps.size());
+
+        getContext(SessionScoped.class).get(comps.get(0), true);
+        Object object = getContext(SessionScoped.class).get(comps.get(1), true);
+
+        Assert.assertTrue(object instanceof NonBindingComponent);
+
+        NonBindingComponent comp = (NonBindingComponent) object;
+        BindingComponent bc = comp.getComponent();
+
+        Assert.assertTrue(bc != null);
 
-	public InjectedComponentTestWithMember()
-	{
-		super(InjectedComponentTestWithMember.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		super.init();
-		this.container = ManagerImpl.getManager();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		defineSimpleWebBean(BindingComponent.class);
-		defineSimpleWebBean(NonBindingComponent.class);
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		HttpSession session = getSession();
-		ContextFactory.initSessionContext(session);
-		
-		Assert.assertEquals(2, comps.size());
-		
-		getContext(SessionScoped.class).get(comps.get(0), true);
-		Object object = getContext(SessionScoped.class).get(comps.get(1), true);
-		
-		Assert.assertTrue(object instanceof NonBindingComponent);
-		
-		NonBindingComponent comp = (NonBindingComponent)object;
-		BindingComponent bc = comp.getComponent();
-		
-		Assert.assertTrue(bc != null);
-		
-		ContextFactory.destroySessionContext(session);
- 	}
+        ContextFactory.destroySessionContext(session);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -34,68 +31,66 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class PaymentProcessorComponentTest extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
+
+    public PaymentProcessorComponentTest()
+    {
+        super(PaymentProcessorComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        super.init();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(CheckWithCheckPayment.class);
+        defineSimpleWebBean(CheckWithMoneyPayment.class);
+        defineSimpleWebBean(PaymentProcessorComponent.class);
+
+        List<AbstractComponent<?>> comps = getComponents();
+
+        ContextFactory.initRequestContext(null);
+
+        Assert.assertEquals(3, comps.size());
+
+        getContext(RequestScoped.class).get(comps.get(0), true);
+        getContext(RequestScoped.class).get(comps.get(1), true);
+
+        Object object = getContext(RequestScoped.class).get(comps.get(2), true);
+        Assert.assertNotNull(object);
+        Assert.assertTrue(object instanceof PaymentProcessorComponent);
+
+        PaymentProcessorComponent uc = (PaymentProcessorComponent) object;
+        IPayment p = uc.getPaymentCheck();
+
+        Assert.assertTrue(p instanceof CheckWithCheckPayment);
+        Assert.assertEquals("CHECK", p.pay());
+
+        p = uc.getPaymentMoney();
+
+        Assert.assertTrue(p instanceof CheckWithMoneyPayment);
+
+        Assert.assertEquals("MONEY", p.pay());
 
-	public PaymentProcessorComponentTest()
-	{
-		super(PaymentProcessorComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		super.init();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(CheckWithCheckPayment.class);
-		defineSimpleWebBean(CheckWithMoneyPayment.class);
-		defineSimpleWebBean(PaymentProcessorComponent.class);
-		
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		ContextFactory.initRequestContext(null);
-		
-		Assert.assertEquals(3, comps.size());
-		
-		getContext(RequestScoped.class).get(comps.get(0), true);
-		getContext(RequestScoped.class).get(comps.get(1), true);
-		
-		Object object =getContext(RequestScoped.class).get(comps.get(2), true);
-		Assert.assertNotNull(object);
-		Assert.assertTrue(object instanceof PaymentProcessorComponent);
-		
-		PaymentProcessorComponent uc = (PaymentProcessorComponent)object;
-		IPayment p = uc.getPaymentCheck();
-		
-		Assert.assertTrue(p instanceof CheckWithCheckPayment);		
-		Assert.assertEquals("CHECK", p.pay());
-		
-		p = uc.getPaymentMoney();
-		
-		Assert.assertTrue(p instanceof CheckWithMoneyPayment);
-		
-		Assert.assertEquals("MONEY", p.pay());
-		
-		
-		ContextFactory.destroyRequestContext(null);
- 	}	
+        ContextFactory.destroyRequestContext(null);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -33,66 +30,64 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class PostConstructComponentTest extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
+
+    public PostConstructComponentTest()
+    {
+        super(PostConstructComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        super.init();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(CheckWithCheckPayment.class);
+        defineSimpleWebBean(PostConstructComponent.class);
+        List<AbstractComponent<?>> comps = getComponents();
+
+        ContextFactory.initRequestContext(null);
+
+        Assert.assertEquals(2, comps.size());
+
+        Object object = getManager().getInstance(comps.get(0));
+        Object object2 = getManager().getInstance(comps.get(1));
+
+        Assert.assertTrue(object instanceof CheckWithCheckPayment);
+        Assert.assertTrue(object2 instanceof PostConstructComponent);
+
+        PostConstructComponent pcc = (PostConstructComponent) object2;
+
+        pcc.getP();
+
+        ComponentImpl<PostConstructComponent> s = (ComponentImpl<PostConstructComponent>) comps.get(1);
+        List<InterceptorData> stack = s.getInterceptorStack();
+
+        Assert.assertEquals(1, stack.size());
+
+        Assert.assertNotNull(pcc.getP());
+        Assert.assertEquals(object, pcc.getP());
 
-	public PostConstructComponentTest()
-	{
-		super(PostConstructComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		super.init();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(CheckWithCheckPayment.class);
-		defineSimpleWebBean(PostConstructComponent.class);
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		ContextFactory.initRequestContext(null);
-		
-		Assert.assertEquals(2, comps.size());
-		
-		Object object = getManager().getInstance(comps.get(0));
-		Object object2 = getManager().getInstance(comps.get(1));
-		
-		Assert.assertTrue(object instanceof CheckWithCheckPayment);
-		Assert.assertTrue(object2 instanceof PostConstructComponent);
-		
-		PostConstructComponent pcc = (PostConstructComponent)object2;
-		
-		pcc.getP();
-		
-		ComponentImpl<PostConstructComponent> s = (ComponentImpl<PostConstructComponent>) comps.get(1);
-		List<InterceptorData> stack = s.getInterceptorStack();
-		
-		Assert.assertEquals(1, stack.size());
-		
-		
-		Assert.assertNotNull(pcc.getP());
-		Assert.assertEquals(object, pcc.getP());
-		
-		ContextFactory.destroyRequestContext(null);
- 	}
+        ContextFactory.destroyRequestContext(null);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java Thu Jan  8 11:45:11 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.test.unittests;
 
@@ -35,69 +32,66 @@
 import org.junit.Before;
 import org.junit.Test;
 
-
 public class PreDestroyComponentTest extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
+
+    public PreDestroyComponentTest()
+    {
+        super(PreDestroyComponentTest.class.getSimpleName());
+    }
+
+    public void endTests(ServletContext ctx)
+    {
+
+    }
+
+    @Before
+    public void init()
+    {
+        this.container = ManagerImpl.getManager();
+    }
+
+    public void startTests(ServletContext ctx)
+    {
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
+
+        defineSimpleWebBean(CheckWithCheckPayment.class);
+        defineSimpleWebBean(PreDestroyComponent.class);
+        List<AbstractComponent<?>> comps = getComponents();
+
+        ContextFactory.initRequestContext(null);
+
+        Assert.assertEquals(2, comps.size());
+
+        Object object = getContext(RequestScoped.class).get(comps.get(0), true);
+        Object object2 = getContext(RequestScoped.class).get(comps.get(1), true);
+
+        Assert.assertTrue(object instanceof CheckWithCheckPayment);
+        Assert.assertTrue(object2 instanceof PreDestroyComponent);
+
+        PreDestroyComponent pcc = (PreDestroyComponent) object2;
+
+        ComponentImpl<PreDestroyComponent> s = (ComponentImpl<PreDestroyComponent>) comps.get(1);
+        List<InterceptorData> stack = s.getInterceptorStack();
+
+        Assert.assertEquals(2, stack.size());
+
+        Assert.assertNotNull(pcc.getP());
+        Assert.assertEquals(object, pcc.getP());
+
+        ContextFactory.destroyRequestContext(null);
 
-	public PreDestroyComponentTest()
-	{
-		super(PreDestroyComponentTest.class.getSimpleName());
-	}
-
-	public void endTests(ServletContext ctx)
-	{
-		
-	}
-
-	@Before
-	public void init()
-	{
-		this.container = ManagerImpl.getManager();
-	}
-
-	public void startTests(ServletContext ctx)
-	{
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
-		
-		defineSimpleWebBean(CheckWithCheckPayment.class);
-		defineSimpleWebBean(PreDestroyComponent.class);
-		List<AbstractComponent<?>> comps = getComponents();
-		
-		ContextFactory.initRequestContext(null);
-		
-		Assert.assertEquals(2, comps.size());
-		
-		Object object = getContext(RequestScoped.class).get(comps.get(0), true);
-		Object object2 = getContext(RequestScoped.class).get(comps.get(1), true);
-		
-		Assert.assertTrue(object instanceof CheckWithCheckPayment);
-		Assert.assertTrue(object2 instanceof PreDestroyComponent);
-		
-		PreDestroyComponent pcc = (PreDestroyComponent)object2;
-		
-		ComponentImpl<PreDestroyComponent> s = (ComponentImpl<PreDestroyComponent>) comps.get(1);
-		List<InterceptorData> stack = s.getInterceptorStack();
-		
-		Assert.assertEquals(2, stack.size());
-		
-		
-		Assert.assertNotNull(pcc.getP());
-		Assert.assertEquals(object, pcc.getP());
-				
-		
-		ContextFactory.destroyRequestContext(null);
-		
-		Assert.assertNotNull(pcc.getP2());
-		Assert.assertEquals(pcc.getP(), pcc.getP2());
+        Assert.assertNotNull(pcc.getP2());
+        Assert.assertEquals(pcc.getP(), pcc.getP2());
 
- 	}
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java Thu Jan  8 11:45:11 2009
@@ -34,65 +34,65 @@
 
 public class Producer1ConsumerComponentTest extends TestContext
 {
-	Manager container = null;
+    Manager container = null;
 
-	public Producer1ConsumerComponentTest()
-	{
-		super(Producer1ConsumerComponentTest.class.getSimpleName());
-	}
+    public Producer1ConsumerComponentTest()
+    {
+        super(Producer1ConsumerComponentTest.class.getSimpleName());
+    }
 
-	public void endTests(ServletContext ctx)
-	{
+    public void endTests(ServletContext ctx)
+    {
 
-	}
+    }
 
-	@Before
-	public void init()
-	{
-		super.init();
-		this.container = ManagerImpl.getManager();
-	}
+    @Before
+    public void init()
+    {
+        super.init();
+        this.container = ManagerImpl.getManager();
+    }
 
-	public void startTests(ServletContext ctx)
-	{
+    public void startTests(ServletContext ctx)
+    {
 
-	}
+    }
 
-	@Test
-	public void testTypedComponent() throws Throwable
-	{
-		clear();
+    @Test
+    public void testTypedComponent() throws Throwable
+    {
+        clear();
 
-		defineSimpleWebBean(ServiceImpl1.class);
-		defineSimpleWebBean(Producer1.class);
-		defineSimpleWebBean(Producer1ConsumerComponent.class);
+        defineSimpleWebBean(ServiceImpl1.class);
+        defineSimpleWebBean(Producer1.class);
+        defineSimpleWebBean(Producer1ConsumerComponent.class);
 
-		List<AbstractComponent<?>> comps = getComponents();
+        List<AbstractComponent<?>> comps = getComponents();
 
-		ContextFactory.initRequestContext(null);
-		ContextFactory.initApplicationContext(null);
+        ContextFactory.initRequestContext(null);
+        ContextFactory.initApplicationContext(null);
 
-		Assert.assertEquals(4, getDeployedComponents());
+        Assert.assertEquals(4, getDeployedComponents());
 
-		Object obj = getContext(ApplicationScoped.class).get(comps.get(0), true);
+        Object obj = getContext(ApplicationScoped.class).get(comps.get(0), true);
 
-		getInstanceByName("service");
+        getInstanceByName("service");
 
-		getContext(ApplicationScoped.class).get(comps.get(1), true);
+        getContext(ApplicationScoped.class).get(comps.get(1), true);
 
-		Object object = getContext(ApplicationScoped.class).get(comps.get(2), true);
+        Object object = getContext(ApplicationScoped.class).get(comps.get(2), true);
 
-		Assert.assertTrue(object instanceof Producer1ConsumerComponent);
+        Assert.assertTrue(object instanceof Producer1ConsumerComponent);
 
-		Producer1ConsumerComponent single = (Producer1ConsumerComponent) object;
+        Producer1ConsumerComponent single = (Producer1ConsumerComponent) object;
 
-		IService service = single.getService();
+        IService service = single.getService();
 
-		Assert.assertNotNull(service);
-		Assert.assertEquals(service, obj);
+        Assert.assertNotNull(service);
+        Assert.assertEquals(service, obj);
 
-		ContextFactory.destroyApplicationContext(null);
-		ContextFactory.destroyRequestContext(null);
-	}
+        ContextFactory.destroyApplicationContext(null);
+        ContextFactory.destroyRequestContext(null);
+    }
 
 }



Mime
View raw message