openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r719890 [12/14] - in /incubator/openwebbeans/trunk/webbeans-impl: ./ src/ src/main/ src/main/java/ src/main/java/META-INF/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/webbeans/ src/main/java/org/apache/webbeans/ann...
Date Sat, 22 Nov 2008 18:09:48 GMT
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,171 @@
+/*
+ *  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.containertests;
+
+
+import javax.servlet.ServletContext;
+import javax.webbeans.manager.Manager;
+
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithNonBindingMember;
+import org.apache.webbeans.test.component.BindingComponent;
+import org.apache.webbeans.test.component.NonBindingComponent;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Test;
+
+
+
+public class ComponentResolutionByTypeTest extends TestContext
+{
+	public @AnnotationWithBindingMember(value="B",number=3) BindingComponent s1= null;
+	public @AnnotationWithBindingMember(value="B") BindingComponent s2= null;
+	
+	public @AnnotationWithNonBindingMember(value="B",arg1="arg1",arg2="arg2") NonBindingComponent s3 = null;
+	public @AnnotationWithNonBindingMember(value="B",arg1="arg11",arg2="arg21") NonBindingComponent s4 = null;
+	public @AnnotationWithNonBindingMember(value="C",arg1="arg11",arg2="arg21") NonBindingComponent s5 = null;
+	
+	private static  Manager cont = ManagerImpl.getManager();
+	private static final String CLAZZ_NAME = ComponentResolutionByTypeTest.class.getName();
+	
+	public ComponentResolutionByTypeTest()
+	{
+		super(CLAZZ_NAME);
+	}
+
+	public void init()
+	{
+		
+	}
+	
+	public void endTests(ServletContext ctx)
+	{
+		cont = null;
+	}
+
+	public void startTests(ServletContext ctx)
+	{
+		
+		try
+		{
+			testBindingTypeNonOk();
+			testBindingTypeOk();
+			testNonBindingTypeNonOk();
+			testNonBindingTypeOk1();
+			testNonBindingTypeOk2();
+			
+		} catch (Throwable e)
+		{
+			
+		}
+	}
+
+	@Test
+	public void startTests()
+	{
+		
+		try
+		{
+			testBindingTypeNonOk();
+			testBindingTypeOk();
+			testNonBindingTypeNonOk();
+			testNonBindingTypeOk1();
+			testNonBindingTypeOk2();
+			
+		} catch (Throwable e)
+		{
+			
+		}
+	}
+	
+	public void testBindingTypeOk() throws Throwable
+	{
+		try
+		{
+			cont.resolveByType(BindingComponent.class,ComponentResolutionByTypeTest.class.getDeclaredField("s1").getAnnotations());
+			pass("testBindingTypeOk");
+			
+		} catch (Throwable e)
+		{
+			fail("testBindingTypeOk");			
+			
+		}
+		
+	}
+	
+	public void testBindingTypeNonOk() throws Throwable
+	{
+		try
+		{
+			cont.resolveByType(BindingComponent.class,ComponentResolutionByTypeTest.class.getDeclaredField("s2").getAnnotations());
+			fail("testBindingTypeNonOk");
+			
+		} catch (Throwable e)
+		{
+			pass("testBindingTypeNonOk");			
+			
+		}
+		
+	}
+	
+	public void testNonBindingTypeOk1() throws Throwable
+	{
+		try
+		{
+			cont.resolveByType(NonBindingComponent.class,ComponentResolutionByTypeTest.class.getDeclaredField("s3").getAnnotations());
+			pass("testNonBindingTypeOk1");	
+			
+		} catch (Throwable e)
+		{
+			fail("testNonBindingTypeOk1");		
+			
+		}
+		
+	}
+	
+	public void testNonBindingTypeOk2() throws Throwable
+	{
+		try
+		{
+			cont.resolveByType(NonBindingComponent.class,ComponentResolutionByTypeTest.class.getDeclaredField("s4").getAnnotations());
+			pass("testNonBindingTypeOk2");
+			
+		} catch (Throwable e)
+		{
+			fail("testNonBindingTypeOk2");			
+			
+		}
+		
+	}
+	
+	
+	public void testNonBindingTypeNonOk() throws Throwable
+	{
+		try
+		{
+			cont.resolveByType(NonBindingComponent.class,ComponentResolutionByTypeTest.class.getDeclaredField("s5").getAnnotations());
+			fail("testNonBindingTypeNonOk");
+			
+		} catch (Throwable e)
+		{
+			pass("testNonBindingTypeNonOk");			
+			
+		}
+		
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,22 @@
+/*
+ *  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.event;
+
+public interface ITypeArgumentEventInterface
+{
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,38 @@
+/*
+ *  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.event;
+
+public class LoggedInEvent
+{
+	private String userName;
+	
+	public LoggedInEvent()
+	{
+		
+	}
+	
+	public LoggedInEvent(String userName)
+	{
+		this.userName = userName;
+	}
+	
+	public String getUserName()
+	{
+		return this.userName;
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,49 @@
+/*
+ *  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.event;
+
+import javax.webbeans.Observer;
+
+public class LoggedInObserver implements Observer<LoggedInEvent>
+{
+	private String result = null;
+
+	public void notify(LoggedInEvent event)
+	{
+		result = "ok";
+		
+	}
+
+	/**
+	 * @return the result
+	 */
+	public String getResult()
+	{
+		return result;
+	}
+
+	/**
+	 * @param result the result to set
+	 */
+	public void setResult(String result)
+	{
+		this.result = result;
+	}
+	
+	
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,22 @@
+/*
+ *  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.event;
+
+public  abstract class TypeArgumentBaseEvent implements ITypeArgumentEventInterface
+{
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,22 @@
+/*
+ *  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.event;
+
+public class TypeArgumentEvent extends TypeArgumentBaseEvent
+{
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,35 @@
+/*
+ *  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.event;
+
+import javax.webbeans.Observer;
+
+public class TypeArgumentInterfaceObserver implements Observer<ITypeArgumentEventInterface>
+{
+	private String result;
+
+	public void notify(ITypeArgumentEventInterface event)
+	{
+		this.result = "ok";
+	}
+	
+	public String getResult()
+	{
+		return this.result;
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,35 @@
+/*
+ *  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.event;
+
+import javax.webbeans.Observer;
+
+public class TypeArgumentObserver implements Observer<TypeArgumentBaseEvent>
+{
+	private String result = null;
+
+	public void notify(TypeArgumentBaseEvent event)
+	{
+		result = "ok";
+		
+	}
+
+	public String getResult()
+	{
+		return result;
+	}
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,22 @@
+/*
+ *  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.event.broke;
+
+public class BrokenEvent<T>
+{
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,29 @@
+/*
+ *  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.event.broke;
+
+import javax.webbeans.Observer;
+
+public class BrokenObserver implements Observer<BrokenEvent>
+{
+
+	public void notify(BrokenEvent event)
+	{
+		
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockHttpSession.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockHttpSession.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockHttpSession.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockHttpSession.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,133 @@
+/*
+ *  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.mock;
+
+import java.util.Enumeration;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+@SuppressWarnings("unchecked")
+public class MockHttpSession implements HttpSession
+{
+	private static AtomicInteger id = new AtomicInteger(0);
+
+	public Object getAttribute(String arg0)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Enumeration getAttributeNames()
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getCreationTime()
+	{
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public String getId()
+	{
+		return Integer.toString(id.getAndIncrement());
+	}
+
+	public long getLastAccessedTime()
+	{
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public int getMaxInactiveInterval()
+	{
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public ServletContext getServletContext()
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public HttpSessionContext getSessionContext()
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getValue(String arg0)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String[] getValueNames()
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void invalidate()
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public boolean isNew()
+	{
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void putValue(String arg0, Object arg1)
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void removeAttribute(String arg0)
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void removeValue(String arg0)
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void setAttribute(String arg0, Object arg1)
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void setMaxInactiveInterval(int arg0)
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockHttpSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,182 @@
+/*
+ *  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.mock;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.webbeans.Observer;
+import javax.webbeans.TypeLiteral;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Context;
+import javax.webbeans.manager.Decorator;
+import javax.webbeans.manager.InterceptionType;
+import javax.webbeans.manager.Interceptor;
+import javax.webbeans.manager.Manager;
+
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class MockManager implements Manager
+{
+	private static MockManager instance = new MockManager();
+	
+	private static ManagerImpl manager = ManagerImpl.getManager();
+
+	private List<AbstractComponent<?>> componentList = new ArrayList<AbstractComponent<?>>();
+
+	private MockManager()
+	{
+
+	}
+
+	public static MockManager getInstance()
+	{
+		return instance;
+	}
+
+	public void clear()
+	{
+		componentList.clear();
+		manager.getBeans().clear();
+	}
+
+	public List<AbstractComponent<?>> getComponents()
+	{
+		return componentList;
+	}	
+	
+	
+	public AbstractComponent<?> getComponent(int i)
+	{
+		return componentList.get(i);
+	}
+	
+	public int getDeployedCompnents()
+	{
+		return manager.getBeans().size();
+	}
+
+	public Manager addBean(Bean<?> bean)
+	{
+		manager.addBean(bean);
+		return this;
+	}
+
+	public Manager addContext(Context context)
+	{
+		return manager.addContext(context);
+	}
+
+	public Manager addDecorator(Decorator decorator)
+	{
+		return manager.addDecorator(decorator);
+	}
+
+	public Manager addInterceptor(Interceptor interceptor)
+	{
+		manager.addInterceptor(interceptor);
+		return this;
+	}
+
+	public <T> Manager addObserver(Observer<T> observer, Class<T> eventType, Annotation... bindings)
+	{
+		manager.addObserver(observer, eventType, bindings);
+		return this;
+	}
+
+	public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation... bindings)
+	{
+		manager.addObserver(observer, eventType, bindings);
+		return this;
+	}
+
+	public void fireEvent(Object event, Annotation... bindings)
+	{
+		manager.fireEvent(event, bindings);
+		
+	}
+
+	public Context getContext(Class<? extends Annotation> scopeType)
+	{
+		return manager.getContext(scopeType);
+	}
+
+	public <T> T getInstance(Bean<T> bean)
+	{
+		return manager.getInstance(bean);
+	}
+
+	public Object getInstanceByName(String name)
+	{
+		return manager.getInstanceByName(name);
+	}
+
+	public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
+	{
+		return manager.getInstanceByType(type, bindingTypes);
+	}
+
+	public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
+	{
+		return manager.getInstanceByType(type, bindingTypes);
+	}
+
+	public <T> Manager removeObserver(Observer<T> observer, Class<T> eventType, Annotation... bindings)
+	{
+		return manager.removeObserver(observer, eventType, bindings);
+	}
+
+	public <T> Manager removeObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation... bindings)
+	{
+		return manager.removeObserver(observer, eventType, bindings);
+	}
+
+	public Set<Bean<?>> resolveByName(String name)
+	{
+		return manager.resolveByName(name);
+	}
+
+	public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation... bindings)
+	{
+		return manager.resolveByType(type, bindings);
+	}
+
+	public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> apiType, Annotation... bindingTypes)
+	{
+		return manager.resolveByType(apiType, bindingTypes);
+	}
+
+	public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation... bindingTypes)
+	{
+		return manager.resolveDecorators(types, bindingTypes);
+	}
+
+	public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+	{
+		return manager.resolveInterceptors(type, interceptorBindings);
+	}
+
+	public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
+	{
+		return manager.resolveObservers(event, bindings);
+	}
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java?rev=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,44 @@
+/*
+ *  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;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Simple test interfaces.
+ * 
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public interface ITestContext
+{
+	/**
+	 * Initialize the test context
+	 */
+	public void init();
+	
+	/**
+	 * Start all tests in the context
+	 */
+	public void startTests(ServletContext ctx);
+	
+	/**
+	 * End tests in the context
+	 */
+	public void endTests(ServletContext ctx);
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,286 @@
+/*
+ *  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;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.webbeans.Decorator;
+import javax.webbeans.Interceptor;
+import javax.webbeans.Production;
+import javax.webbeans.manager.Context;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.ComponentImpl;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.DefinitionUtil;
+import org.apache.webbeans.config.SimpleWebBeansConfigurator;
+import org.apache.webbeans.decorator.DecoratorUtil;
+import org.apache.webbeans.decorator.DecoratorsManager;
+import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
+import org.apache.webbeans.deployment.DeploymentTypeManager;
+import org.apache.webbeans.deployment.StereoTypeManager;
+import org.apache.webbeans.deployment.StereoTypeModel;
+import org.apache.webbeans.intercept.InterceptorUtil;
+import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeIsnotInterface;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeMustImplementAllDecoratedTypes;
+import org.apache.webbeans.test.component.decorator.broken.MoreThanOneDelegateAttribute;
+import org.apache.webbeans.test.component.decorator.broken.PaymentDecorator;
+import org.apache.webbeans.test.component.decorator.clean.LargeTransactionDecorator;
+import org.apache.webbeans.test.component.decorator.clean.ServiceDecorator;
+import org.apache.webbeans.test.component.intercept.webbeans.WebBeansInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.WebBeanswithMetaInterceptor;
+import org.apache.webbeans.test.mock.MockHttpSession;
+import org.apache.webbeans.test.mock.MockManager;
+import org.apache.webbeans.test.sterotype.StereoWithNonScope;
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope2;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public abstract class TestContext implements ITestContext
+{
+	private static Set<ITestContext> testContexts = new HashSet<ITestContext>();
+
+	private String clazzName;
+
+	private MockManager manager;
+
+	private static boolean init;
+
+	protected TestContext(String clazzName)
+	{
+		this.clazzName = clazzName;
+		testContexts.add(this);
+		this.manager = MockManager.getInstance();
+	}
+
+	public void init()
+	{
+		if (!init)
+		{
+			initializeDeploymentType(Production.class,1);
+			
+			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 beforeTest(){}
+
+	public void fail(String methodName)
+	{
+		System.err.println("Test Class: " + clazzName + ",Method Name: " + methodName + " is FAILED");
+	}
+
+	public void pass(String methodName)
+	{
+		System.out.println("Test Class: " + clazzName + ",Method Name: " + methodName + " is PASSED");
+	}
+
+	public static void initTests()
+	{
+		Iterator<ITestContext> it = testContexts.iterator();
+		while (it.hasNext())
+		{
+			it.next().init();
+		}
+
+	}
+
+	public static void startAllTests(ServletContext ctx)
+	{
+		Iterator<ITestContext> it = testContexts.iterator();
+		while (it.hasNext())
+		{
+			it.next().startTests(ctx);
+		}
+
+	}
+
+	public static void endAllTests(ServletContext ctx)
+	{
+		Iterator<ITestContext> it = testContexts.iterator();
+		while (it.hasNext())
+		{
+			it.next().endTests(ctx);
+		}
+
+	}
+
+	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;
+	}
+	
+	
+	@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);
+			}
+			
+		}
+		
+		return component;
+	}
+	
+	@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;
+	}
+	
+	
+
+	protected void clear()
+	{
+		manager.clear();
+	}
+
+	protected AbstractComponent<?> getComponent(int i)
+	{
+		return manager.getComponent(i);
+	}
+
+	protected List<AbstractComponent<?>> getComponents()
+	{
+		return manager.getComponents();
+	}
+
+	protected int getDeployedComponents()
+	{
+		return manager.getDeployedCompnents();
+	}
+
+	protected Object getInstanceByName(String name)
+	{
+		return manager.getInstanceByName(name);
+	}
+
+	protected Context getContext(Class<? extends Annotation> scopeType)
+	{
+		return manager.getContext(scopeType);
+	}
+
+	protected MockManager getManager()
+	{
+		return manager;
+	}
+	
+	protected HttpSession getSession()
+	{
+		return new MockHttpSession();
+	}
+	
+	private void initializeDeploymentType(Class<? extends Annotation> deploymentType, int precedence)
+	{
+		DeploymentTypeManager.getInstance().addNewDeploymentType(deploymentType, precedence);
+		
+	}
+
+	private void initializeStereoType(Class<?> stereoClass)
+	{
+		WebBeansUtil.checkStereoTypeClass(stereoClass);
+		StereoTypeModel model = new StereoTypeModel(stereoClass);
+		StereoTypeManager.getInstance().addStereoTypeModel(model);
+	}
+
+	private void initializeInterceptorType(Class<?> interceptorClazz)
+	{
+		InterceptorsManager.getInstance().addNewInterceptor(interceptorClazz);
+
+	}
+	
+	private void initializeDecoratorType(Class<?> decoratorClazz)
+	{
+		DecoratorsManager.getInstance().addNewDecorator(decoratorClazz);
+
+	}
+	
+	public void endTests(ServletContext ctx)
+	{
+	}
+
+	public void startTests(ServletContext ctx)
+	{
+	}
+	
+	
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,59 @@
+/*
+ *  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;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.webbeans.test.containertests.ComponentResolutionByTypeTest;
+import org.junit.Test;
+
+
+/**
+ * This test listener class is used for running the tests.
+ * 
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class TestListener implements ServletContextListener
+{
+	private void init()
+	{
+		System.out.println("Initializing all of the test contexts");
+		new ComponentResolutionByTypeTest();
+		TestContext.initTests();
+	}
+
+	public void contextDestroyed(ServletContextEvent arg0)
+	{
+		TestContext.endAllTests(arg0.getServletContext());
+	}
+
+	
+	@Test
+	public void contextInitialized()
+	{
+		
+	}
+	
+	public void contextInitialized(ServletContextEvent arg0)
+	{
+		init();
+		TestContext.startAllTests(arg0.getServletContext());
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,32 @@
+/*
+ *  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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.webbeans.SessionScoped;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={ElementType.TYPE,ElementType.METHOD})
+public @interface StereoWithNonScope {
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,34 @@
+/*
+ *  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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.webbeans.RequestScoped;
+import javax.webbeans.SessionScoped;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@RequestScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={ElementType.TYPE,ElementType.METHOD})
+public @interface StereoWithRequestScope {
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,33 @@
+/*
+ *  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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.webbeans.SessionScoped;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@SessionScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={ElementType.TYPE,ElementType.METHOD})
+public @interface StereoWithSessionScope {
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,33 @@
+/*
+ *  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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.webbeans.SessionScoped;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@SessionScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={ElementType.TYPE,ElementType.METHOD})
+public @interface StereoWithSessionScope2 {
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,105 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.SessionScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.ContaintsCurrentComponent;
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.component.service.ITyped2;
+import org.apache.webbeans.test.component.service.Typed2;
+import org.apache.webbeans.test.servlet.TestContext;
+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);
+ 	}	
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/CurrentInjectedComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,107 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.ApplicationScopeLiteral;
+import org.apache.webbeans.annotation.RequestedScopeLiteral;
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.config.WebBeansContainerDeployer;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.RequestContext;
+import org.apache.webbeans.test.component.DisposalMethodComponent;
+import org.apache.webbeans.test.component.service.IService;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class DisposalInjectedComponentTest extends TestContext
+{
+	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();
+		
+		Assert.assertNull(s);
+ 	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/DisposalInjectedComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,83 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.service.InjectedComponent;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.apache.webbeans.test.servlet.TestContext;
+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);
+ 	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,90 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.webbeans.SessionScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.BindingComponent;
+import org.apache.webbeans.test.component.NonBindingComponent;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class InjectedComponentTestWithMember extends TestContext
+{
+	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);
+		
+		ContextFactory.destroySessionContext(session);
+ 	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/InjectedComponentTestWithMember.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,102 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class PaymentProcessorComponentTest extends TestContext
+{
+	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());
+		
+		
+		ContextFactory.destroyRequestContext(null);
+ 	}	
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PaymentProcessorComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,98 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.ComponentImpl;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.intercept.InterceptorData;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PostConstructComponent;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class PostConstructComponentTest extends TestContext
+{
+	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 = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(0), true);
+		Object object2 = ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), true);
+		
+		Assert.assertTrue(object instanceof CheckWithCheckPayment);
+		Assert.assertTrue(object2 instanceof PostConstructComponent);
+		
+		PostConstructComponent pcc = (PostConstructComponent)object2;
+		
+		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);
+ 	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PostConstructComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,103 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.ComponentImpl;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.intercept.InterceptorData;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PreDestroyComponent;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class PreDestroyComponentTest extends TestContext
+{
+	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);
+		
+		Assert.assertNotNull(pcc.getP2());
+		Assert.assertEquals(pcc.getP(), pcc.getP2());
+
+ 	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/PreDestroyComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=719890&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java Sat Nov 22 10:09:38 2008
@@ -0,0 +1,103 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Manager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.producer.Producer1;
+import org.apache.webbeans.test.component.service.IService;
+import org.apache.webbeans.test.component.service.Producer1ConsumerComponent;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class Producer1ConsumerComponentTest extends TestContext
+{
+	Manager container = null;
+
+	public Producer1ConsumerComponentTest()
+	{
+		super(Producer1ConsumerComponentTest.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(ServiceImpl1.class);
+		defineSimpleWebBean(Producer1.class);
+		defineSimpleWebBean(Producer1ConsumerComponent.class);
+		
+		List<AbstractComponent<?>> comps = getComponents();
+		
+		ContextFactory.initRequestContext(null);
+		ContextFactory.initApplicationContext(null);
+		
+		Assert.assertEquals(4,getDeployedComponents());
+		
+		Object obj = getContext(ApplicationScoped.class).get(comps.get(0), true);
+		
+		getInstanceByName("service");
+		
+		getContext(ApplicationScoped.class).get(comps.get(1), true);
+		
+		Object object =getContext(ApplicationScoped.class).get(comps.get(2), true);
+		
+		Assert.assertTrue(object instanceof Producer1ConsumerComponent);
+		
+		Producer1ConsumerComponent single = (Producer1ConsumerComponent)object;
+		
+		IService service = single.getService();
+		
+		Assert.assertNotNull(service);
+		Assert.assertEquals(service, obj);
+		
+		ContextFactory.destroyApplicationContext(null);
+		ContextFactory.destroyRequestContext(null); 
+		}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message