You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/01/08 20:45:17 UTC
svn commit: r732806 [10/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...
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.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.intercept;
@@ -34,173 +31,168 @@
import org.junit.Before;
import org.junit.Test;
-
public class EJBInterceptComponentTest extends TestContext
{
-
- public EJBInterceptComponentTest()
- {
- super(EJBInterceptComponentTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Test
- public void testInterceptedComponent()
- {
- WebBeansConfigurationException exc = null;
-
- try
- {
- defineSimpleWebBean(InterceptedComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
- @Test
- public void testInterceptorCalls()
- {
- clear();
- defineSimpleWebBean(InterceptedComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof InterceptedComponent);
-
- InterceptedComponent comp = (InterceptedComponent)object;
- Object s = comp.hello(null);
-
- Assert.assertEquals(new Integer(5), s);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testMultipleInterceptedComponent()
- {
- clear();
- defineSimpleWebBean(MultipleInterceptedComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof MultipleInterceptedComponent);
-
- MultipleInterceptedComponent comp = (MultipleInterceptedComponent)object;
- Object obj = comp.intercepted();
-
- Assert.assertTrue(obj instanceof String[]);
-
- String[] arr = (String[])obj;
-
- Assert.assertEquals(2, arr.length);
- Assert.assertEquals("key", arr[0]);
- Assert.assertEquals("key2", arr[1]);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testInterceptorWithSuperClassComponent()
- {
- clear();
- defineSimpleWebBean(InterceptorWithSuperClassInterceptedComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof InterceptorWithSuperClassInterceptedComponent);
-
- InterceptorWithSuperClassInterceptedComponent comp = (InterceptorWithSuperClassInterceptedComponent)object;
- Object obj = comp.intercepted();
-
- Assert.assertTrue(obj instanceof String[]);
-
- String[] arr = (String[])obj;
-
- Assert.assertEquals(2, arr.length);
- Assert.assertEquals("key", arr[0]);
- Assert.assertEquals("key0", arr[1]);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testMultipleListOfInterceptedComponent()
- {
- clear();
- defineSimpleWebBean(MultipleListOfInterceptedComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof MultipleListOfInterceptedComponent);
-
- MultipleListOfInterceptedComponent comp = (MultipleListOfInterceptedComponent)object;
- Object obj = comp.intercepted();
-
- Assert.assertTrue(obj instanceof String);
-
-
- Assert.assertEquals("ok", (String)obj);
-
- ContextFactory.destroyRequestContext(null);
- }
-
-
- @Test
- public void testMultipleListOfInterceptedWithExcludeClassComponent()
- {
- clear();
- defineSimpleWebBean(MultipleListOfInterceptedWithExcludeClassComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof MultipleListOfInterceptedWithExcludeClassComponent);
-
- MultipleListOfInterceptedWithExcludeClassComponent comp = (MultipleListOfInterceptedWithExcludeClassComponent)object;
- Object obj = comp.intercepted();
-
- Assert.assertTrue(obj instanceof String);
-
-
- Assert.assertEquals("value2", (String)obj);
-
- ContextFactory.destroyRequestContext(null);
- }
+
+ public EJBInterceptComponentTest()
+ {
+ super(EJBInterceptComponentTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Test
+ public void testInterceptedComponent()
+ {
+ WebBeansConfigurationException exc = null;
+
+ try
+ {
+ defineSimpleWebBean(InterceptedComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testInterceptorCalls()
+ {
+ clear();
+ defineSimpleWebBean(InterceptedComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof InterceptedComponent);
+
+ InterceptedComponent comp = (InterceptedComponent) object;
+ Object s = comp.hello(null);
+
+ Assert.assertEquals(new Integer(5), s);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testMultipleInterceptedComponent()
+ {
+ clear();
+ defineSimpleWebBean(MultipleInterceptedComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof MultipleInterceptedComponent);
+
+ MultipleInterceptedComponent comp = (MultipleInterceptedComponent) object;
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String[]);
+
+ String[] arr = (String[]) obj;
+
+ Assert.assertEquals(2, arr.length);
+ Assert.assertEquals("key", arr[0]);
+ Assert.assertEquals("key2", arr[1]);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testInterceptorWithSuperClassComponent()
+ {
+ clear();
+ defineSimpleWebBean(InterceptorWithSuperClassInterceptedComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof InterceptorWithSuperClassInterceptedComponent);
+
+ InterceptorWithSuperClassInterceptedComponent comp = (InterceptorWithSuperClassInterceptedComponent) object;
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String[]);
+
+ String[] arr = (String[]) obj;
+
+ Assert.assertEquals(2, arr.length);
+ Assert.assertEquals("key", arr[0]);
+ Assert.assertEquals("key0", arr[1]);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testMultipleListOfInterceptedComponent()
+ {
+ clear();
+ defineSimpleWebBean(MultipleListOfInterceptedComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof MultipleListOfInterceptedComponent);
+
+ MultipleListOfInterceptedComponent comp = (MultipleListOfInterceptedComponent) object;
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String);
+
+ Assert.assertEquals("ok", (String) obj);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testMultipleListOfInterceptedWithExcludeClassComponent()
+ {
+ clear();
+ defineSimpleWebBean(MultipleListOfInterceptedWithExcludeClassComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof MultipleListOfInterceptedWithExcludeClassComponent);
+
+ MultipleListOfInterceptedWithExcludeClassComponent comp = (MultipleListOfInterceptedWithExcludeClassComponent) object;
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String);
+
+ Assert.assertEquals("value2", (String) obj);
+
+ ContextFactory.destroyRequestContext(null);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.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.intercept;
@@ -28,52 +25,49 @@
import org.junit.Before;
import org.junit.Test;
-
public class EJBInterceptorExceptionComponentTest extends TestContext
{
-
- public EJBInterceptorExceptionComponentTest()
- {
- super(EJBInterceptorExceptionComponentTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Test
- public void testComponentTypeException()
- {
- WebBeansConfigurationException exc = null;
-
- try
- {
- AbstractComponent<MultpleInterceptor> component = defineSimpleWebBean(MultpleInterceptor.class);
-
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNotNull(exc);
- }
-
+
+ public EJBInterceptorExceptionComponentTest()
+ {
+ super(EJBInterceptorExceptionComponentTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Test
+ public void testComponentTypeException()
+ {
+ WebBeansConfigurationException exc = null;
+
+ try
+ {
+ AbstractComponent<MultpleInterceptor> component = defineSimpleWebBean(MultpleInterceptor.class);
+
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNotNull(exc);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.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.intercept;
@@ -32,67 +29,64 @@
import org.junit.Before;
import org.junit.Test;
-
public class PostConstructDoubleInterceptorComponentTest extends TestContext
{
- public PostConstructDoubleInterceptorComponentTest()
- {
- super(PostConstructDoubleInterceptorComponentTest.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(PostConstructDoubleInterceptorComponent.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 PostConstructDoubleInterceptorComponent);
-
- PostConstructDoubleInterceptorComponent pcc = (PostConstructDoubleInterceptorComponent)object2;
-
- ComponentImpl<PostConstructDoubleInterceptorComponent> s = (ComponentImpl<PostConstructDoubleInterceptorComponent>) comps.get(1);
-
- Assert.assertNotNull(pcc.getP());
-
- List<InterceptorData> stack = s.getInterceptorStack();
-
- Assert.assertEquals(5, stack.size());
-
-
-
- Assert.assertNotNull(PostConstructDoubleInterceptorComponent.setininterceptor2);
- Assert.assertEquals("value1", PostConstructDoubleInterceptorComponent.setininterceptor2);
-
- ContextFactory.destroyRequestContext(null);
- }
+ public PostConstructDoubleInterceptorComponentTest()
+ {
+ super(PostConstructDoubleInterceptorComponentTest.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(PostConstructDoubleInterceptorComponent.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 PostConstructDoubleInterceptorComponent);
+
+ PostConstructDoubleInterceptorComponent pcc = (PostConstructDoubleInterceptorComponent) object2;
+
+ ComponentImpl<PostConstructDoubleInterceptorComponent> s = (ComponentImpl<PostConstructDoubleInterceptorComponent>) comps.get(1);
+
+ Assert.assertNotNull(pcc.getP());
+
+ List<InterceptorData> stack = s.getInterceptorStack();
+
+ Assert.assertEquals(5, stack.size());
+
+ Assert.assertNotNull(PostConstructDoubleInterceptorComponent.setininterceptor2);
+ Assert.assertEquals("value1", PostConstructDoubleInterceptorComponent.setininterceptor2);
+
+ ContextFactory.destroyRequestContext(null);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.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.intercept;
@@ -32,62 +29,60 @@
import org.junit.Before;
import org.junit.Test;
-
public class PostConstructInterceptorComponentTest extends TestContext
{
- public PostConstructInterceptorComponentTest()
- {
- super(PostConstructInterceptorComponentTest.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(PostConstructInterceptorComponent.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 PostConstructInterceptorComponent);
-
- PostConstructInterceptorComponent pcc = (PostConstructInterceptorComponent)object2;
-
- ComponentImpl<PostConstructInterceptorComponent> s = (ComponentImpl<PostConstructInterceptorComponent>) comps.get(1);
-
- Assert.assertNotNull(pcc.getP());
-
- List<InterceptorData> stack = s.getInterceptorStack();
-
- Assert.assertEquals(2, stack.size());
-
-
- ContextFactory.destroyRequestContext(null);
- }
+ public PostConstructInterceptorComponentTest()
+ {
+ super(PostConstructInterceptorComponentTest.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(PostConstructInterceptorComponent.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 PostConstructInterceptorComponent);
+
+ PostConstructInterceptorComponent pcc = (PostConstructInterceptorComponent) object2;
+
+ ComponentImpl<PostConstructInterceptorComponent> s = (ComponentImpl<PostConstructInterceptorComponent>) comps.get(1);
+
+ Assert.assertNotNull(pcc.getP());
+
+ List<InterceptorData> stack = s.getInterceptorStack();
+
+ Assert.assertEquals(2, stack.size());
+
+ ContextFactory.destroyRequestContext(null);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.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.intercept.webbeans;
@@ -28,37 +25,36 @@
public class SecureInterceptorComponentTest extends TestContext
{
- public SecureInterceptorComponentTest()
- {
- super(SecureInterceptorComponentTest.class.getName());
- }
-
- @Before
- public void init()
- {
- initDeploymentTypes();
- initDefaultStereoTypes();
- initializeInterceptorType(SecureInterceptor.class);
- }
-
- @Test
- public void testSecureInterceptor()
- {
- defineSimpleWebBeanInterceptor(SecureInterceptor.class);
- AbstractComponent<SecureComponent> component = defineSimpleWebBean(SecureComponent.class);
-
- ContextFactory.initRequestContext(null);
-
- SecureComponent secureComponent = getManager().getInstance(component);
-
- Assert.assertNotNull(secureComponent);
-
- boolean value = secureComponent.checkout();
-
- Assert.assertTrue(SecureInterceptor.CALL);
- Assert.assertTrue(value);
-
-
- }
+ public SecureInterceptorComponentTest()
+ {
+ super(SecureInterceptorComponentTest.class.getName());
+ }
+
+ @Before
+ public void init()
+ {
+ initDeploymentTypes();
+ initDefaultStereoTypes();
+ initializeInterceptorType(SecureInterceptor.class);
+ }
+
+ @Test
+ public void testSecureInterceptor()
+ {
+ defineSimpleWebBeanInterceptor(SecureInterceptor.class);
+ AbstractComponent<SecureComponent> component = defineSimpleWebBean(SecureComponent.class);
+
+ ContextFactory.initRequestContext(null);
+
+ SecureComponent secureComponent = getManager().getInstance(component);
+
+ Assert.assertNotNull(secureComponent);
+
+ boolean value = secureComponent.checkout();
+
+ Assert.assertTrue(SecureInterceptor.CALL);
+ Assert.assertTrue(value);
+
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.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.intercept.webbeans;
@@ -20,7 +17,6 @@
import javax.servlet.ServletContext;
-
import junit.framework.Assert;
import org.apache.webbeans.component.AbstractComponent;
@@ -34,102 +30,100 @@
import org.junit.Before;
import org.junit.Test;
-
public class WebBeansInterceptComponentTest extends TestContext
{
- boolean init = false;
-
- public WebBeansInterceptComponentTest()
- {
- super(WebBeansInterceptComponentTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Test
- public void testInterceptedComponent()
- {
- WebBeansConfigurationException exc = null;
-
- try
- {
- defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
- defineSimpleWebBean(WInterceptorComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
- @Test
- public void testInterceptorCalls()
- {
- getComponents().clear();
-
- defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
- defineSimpleWebBean(WInterceptorComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object = getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof WInterceptorComponent);
-
- WInterceptorComponent comp = (WInterceptorComponent)object;
- int s = comp.hello();
-
- Assert.assertEquals(5, s);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testMetaInterceptorCalls()
- {
- getComponents().clear();
-
- defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
- defineSimpleWebBeanInterceptor(WebBeanswithMetaInterceptor.class);
- defineSimpleWebBean(WMetaInterceptorComponent.class);
-
- ContextFactory.initRequestContext(null);
- List<AbstractComponent<?>> comps = getComponents();
-
- Object object =getManager().getInstance(comps.get(0));
-
- Assert.assertTrue(object instanceof WMetaInterceptorComponent);
-
- WMetaInterceptorComponent comp = (WMetaInterceptorComponent)object;
- int s = comp.hello();
-
- Assert.assertEquals(5, s);
-
- s = comp.hello2();
-
- Assert.assertEquals(10, s);
-
- ContextFactory.destroyRequestContext(null);
- }
+ boolean init = false;
+
+ public WebBeansInterceptComponentTest()
+ {
+ super(WebBeansInterceptComponentTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Test
+ public void testInterceptedComponent()
+ {
+ WebBeansConfigurationException exc = null;
+
+ try
+ {
+ defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
+ defineSimpleWebBean(WInterceptorComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testInterceptorCalls()
+ {
+ getComponents().clear();
+
+ defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
+ defineSimpleWebBean(WInterceptorComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof WInterceptorComponent);
+
+ WInterceptorComponent comp = (WInterceptorComponent) object;
+ int s = comp.hello();
+
+ Assert.assertEquals(5, s);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testMetaInterceptorCalls()
+ {
+ getComponents().clear();
+
+ defineSimpleWebBeanInterceptor(WebBeansInterceptor.class);
+ defineSimpleWebBeanInterceptor(WebBeanswithMetaInterceptor.class);
+ defineSimpleWebBean(WMetaInterceptorComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof WMetaInterceptorComponent);
+
+ WMetaInterceptorComponent comp = (WMetaInterceptorComponent) object;
+ int s = comp.hello();
+
+ Assert.assertEquals(5, s);
+
+ s = comp.hello2();
+
+ Assert.assertEquals(10, s);
+
+ ContextFactory.destroyRequestContext(null);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.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.library;
@@ -31,52 +28,51 @@
import org.junit.Before;
import org.junit.Test;
-
public class LibraryComponentTest extends TestContext
{
- public LibraryComponentTest()
- {
- super(LibraryComponentTest.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(BookShop.class);
- List<AbstractComponent<?>> comps = getComponents();
-
- ContextFactory.initRequestContext(null);
-
- Assert.assertEquals(1, comps.size());
-
- AbstractComponent<?> obj = comps.get(0);
-
- Object instance = getManager().getInstance(obj);
- Assert.assertTrue(instance instanceof Shop);
-
- @SuppressWarnings("unchecked")
- Shop<Book> shop = (Shop<Book>)instance;
- shop.shop();
-
- ContextFactory.destroyRequestContext(null);
- }
-
+ public LibraryComponentTest()
+ {
+ super(LibraryComponentTest.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(BookShop.class);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ ContextFactory.initRequestContext(null);
+
+ Assert.assertEquals(1, comps.size());
+
+ AbstractComponent<?> obj = comps.get(0);
+
+ Object instance = getManager().getInstance(obj);
+ Assert.assertTrue(instance instanceof Shop);
+
+ @SuppressWarnings("unchecked")
+ Shop<Book> shop = (Shop<Book>) instance;
+ shop.shop();
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.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.newcomp;
@@ -35,72 +32,71 @@
import org.junit.Before;
import org.junit.Test;
-
public class NewComponentTest extends TestContext
{
- public NewComponentTest()
- {
- super(NewComponentTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Before
- public void init()
- {
- super.init();
-
- }
-
- public void startTests(ServletContext ctx)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Test
- public void testDependent()
- {
- clear();
-
- defineSimpleWebBean(DependentComponent.class);
- defineSimpleWebBean(DependentOwnerComponent.class);
- defineSimpleWebBean(NewComponent.class);
-
- ContextFactory.initRequestContext(null);
-
- List<AbstractComponent<?>> comps = getComponents();
-
- Assert.assertEquals(3,comps.size());
-
- NewComponent comp = (NewComponent)getContext(RequestScoped.class).get(comps.get(2), true);
-
- DependentOwnerComponent own = comp.owner();
-
- Assert.assertNotNull(own);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testDepedent2()
- {
- clear();
- defineSimpleWebBean(CheckWithCheckPayment.class);
- defineSimpleWebBean(ProducerNewComponent.class);
-
- ContextFactory.initRequestContext(null);
- Assert.assertEquals(3,getDeployedComponents());
-
- IPayment payment = (IPayment) getManager().getInstanceByName("paymentProducer");
- Assert.assertNotNull(payment);
-
- IPayment payment2 = (IPayment) getManager().getInstanceByName("paymentProducer");
-
- Assert.assertNotSame(payment, payment2);
- }
+ public NewComponentTest()
+ {
+ super(NewComponentTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Test
+ public void testDependent()
+ {
+ clear();
+
+ defineSimpleWebBean(DependentComponent.class);
+ defineSimpleWebBean(DependentOwnerComponent.class);
+ defineSimpleWebBean(NewComponent.class);
+
+ ContextFactory.initRequestContext(null);
+
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Assert.assertEquals(3, comps.size());
+
+ NewComponent comp = (NewComponent) getContext(RequestScoped.class).get(comps.get(2), true);
+
+ DependentOwnerComponent own = comp.owner();
+
+ Assert.assertNotNull(own);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testDepedent2()
+ {
+ clear();
+ defineSimpleWebBean(CheckWithCheckPayment.class);
+ defineSimpleWebBean(ProducerNewComponent.class);
+
+ ContextFactory.initRequestContext(null);
+ Assert.assertEquals(3, getDeployedComponents());
+
+ IPayment payment = (IPayment) getManager().getInstanceByName("paymentProducer");
+ Assert.assertNotNull(payment);
+
+ IPayment payment2 = (IPayment) getManager().getInstanceByName("paymentProducer");
+
+ Assert.assertNotSame(payment, payment2);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.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.resolution;
@@ -28,31 +25,31 @@
public class ManagerResolutionTest extends TestContext
{
- public ManagerResolutionTest()
- {
- super(ManagerResolutionTest.class.getName());
- }
-
- @Before
- public void beforeTest()
- {
- super.init();
- getManager().addBean(WebBeansUtil.getManagerComponent());
- }
-
- @Test
- public void testManagerResolution()
- {
- ManagerComponentImpl component = WebBeansUtil.getManagerComponent();
- Manager manager = getManager().getInstance(component);
-
- Assert.assertNotNull(manager);
- }
-
- @Test
- public void test2()
- {
-
- }
-
+ public ManagerResolutionTest()
+ {
+ super(ManagerResolutionTest.class.getName());
+ }
+
+ @Before
+ public void beforeTest()
+ {
+ super.init();
+ getManager().addBean(WebBeansUtil.getManagerComponent());
+ }
+
+ @Test
+ public void testManagerResolution()
+ {
+ ManagerComponentImpl component = WebBeansUtil.getManagerComponent();
+ Manager manager = getManager().getInstance(component);
+
+ Assert.assertNotNull(manager);
+ }
+
+ @Test
+ public void test2()
+ {
+
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.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.typedliteral;
@@ -38,79 +35,81 @@
import org.junit.Before;
import org.junit.Test;
-
public class TypedLiteralComponentTest extends TestContext
{
- public TypedLiteralComponentTest()
- {
- super(TypedLiteralComponentTest.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(TypeLiteralComponent.class);
- defineSimpleWebBean(InjectedTypeLiteralComponent.class);
- List<AbstractComponent<?>> comps = getComponents();
-
- ContextFactory.initRequestContext(null);
-
- Assert.assertEquals(2, comps.size());
-
- TypeLiteralComponent userComponent = (TypeLiteralComponent) ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(0), true);
- InjectedTypeLiteralComponent tc = (InjectedTypeLiteralComponent) ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), true);
-
- Assert.assertNotNull(tc.getComponent());
- Assert.assertNotNull(userComponent);
-
- Assert.assertTrue(tc.getComponent() instanceof TypeLiteralComponent);
-
- Assert.assertEquals("GURKAN", TypeLiteralComponent.STR);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testTypedLiteralComponent() throws Throwable
- {
- clear();
-
- defineSimpleWebBean(TypeLiteralComponent.class);
- List<AbstractComponent<?>> comps = getComponents();
-
- ContextFactory.initRequestContext(null);
-
- Assert.assertEquals(1, comps.size());
-
- TypeLiteral<ITypeLiteralComponent<List<String>>> tl = new TypeLiteral<ITypeLiteralComponent<List<String>>>(){};
-
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Current>(){
-
- };
-
- Bean<ITypeLiteralComponent<List<String>>> s = ManagerImpl.getManager().resolveByType(tl, anns).iterator().next();
- Assert.assertNotNull(s);
-
- ContextFactory.destroyRequestContext(null);
- }
-
+ public TypedLiteralComponentTest()
+ {
+ super(TypedLiteralComponentTest.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(TypeLiteralComponent.class);
+ defineSimpleWebBean(InjectedTypeLiteralComponent.class);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ ContextFactory.initRequestContext(null);
+
+ Assert.assertEquals(2, comps.size());
+
+ TypeLiteralComponent userComponent = (TypeLiteralComponent) ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(0), true);
+ InjectedTypeLiteralComponent tc = (InjectedTypeLiteralComponent) ManagerImpl.getManager().getContext(RequestScoped.class).get(comps.get(1), true);
+
+ Assert.assertNotNull(tc.getComponent());
+ Assert.assertNotNull(userComponent);
+
+ Assert.assertTrue(tc.getComponent() instanceof TypeLiteralComponent);
+
+ Assert.assertEquals("GURKAN", TypeLiteralComponent.STR);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testTypedLiteralComponent() throws Throwable
+ {
+ clear();
+
+ defineSimpleWebBean(TypeLiteralComponent.class);
+ List<AbstractComponent<?>> comps = getComponents();
+
+ ContextFactory.initRequestContext(null);
+
+ Assert.assertEquals(1, comps.size());
+
+ TypeLiteral<ITypeLiteralComponent<List<String>>> tl = new TypeLiteral<ITypeLiteralComponent<List<String>>>()
+ {
+ };
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Current>()
+ {
+
+ };
+
+ Bean<ITypeLiteralComponent<List<String>>> s = ManagerImpl.getManager().resolveByType(tl, anns).iterator().next();
+ Assert.assertNotNull(s);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.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.xml;
@@ -28,38 +25,37 @@
public class XMLAnnotTypeTest extends TestContext
{
- public XMLAnnotTypeTest()
- {
- super(XMLAnnotTypeTest.class.getName());
- }
-
- public void init()
- {
-
- }
-
-
- @Test
- public void testBindingAnnotation()
- {
- InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/bindingTypeAnnot.xml");
- Assert.assertNotNull(stream);
- configureFromXML(stream, "bindingTypeAnnot.xml");
-
- Set<Class<? extends Annotation>> aanns = XMLAnnotationTypeManager.getInstance().getBindingTypes();
-
- Assert.assertEquals(2, aanns.size());
- }
-
- @Test
- public void testInterceptorBindingAnnotation()
- {
-
- }
-
- @Test
- public void testStereotypeAnnotation()
- {
-
- }
+ public XMLAnnotTypeTest()
+ {
+ super(XMLAnnotTypeTest.class.getName());
+ }
+
+ public void init()
+ {
+
+ }
+
+ @Test
+ public void testBindingAnnotation()
+ {
+ InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/bindingTypeAnnot.xml");
+ Assert.assertNotNull(stream);
+ configureFromXML(stream, "bindingTypeAnnot.xml");
+
+ Set<Class<? extends Annotation>> aanns = XMLAnnotationTypeManager.getInstance().getBindingTypes();
+
+ Assert.assertEquals(2, aanns.size());
+ }
+
+ @Test
+ public void testInterceptorBindingAnnotation()
+ {
+
+ }
+
+ @Test
+ public void testStereotypeAnnotation()
+ {
+
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.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.xml;
@@ -29,78 +26,73 @@
import org.junit.Before;
import org.junit.Test;
-
public class XMLFieldTest extends TestContext
{
- Manager container = null;
+ Manager container = null;
+
+ public XMLFieldTest()
+ {
+ super(XMLFieldTest.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 nameSpacesNotDeclared()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/fieldTest.xml");
+ Assert.assertNotNull(stream);
+
+ /* Clear the manager component list */
+ clear();
+
+ this.xmlConfigurator.configure(stream, "fieldTest.xml");
+
+ ComponentForField cff = (ComponentForField) container.getInstanceByName("componentForField");
+
+ Assert.assertNotNull(cff);
+ Assert.assertEquals(35, cff.getIntField());
+ Assert.assertEquals(35.3f, cff.getFloatField());
+ Assert.assertEquals(35.5d, cff.getDoubleField());
+ Assert.assertEquals('a', cff.getCharField());
+ Assert.assertEquals(37, cff.getLongField());
+ Assert.assertEquals(1, cff.getByteField());
+ Assert.assertEquals(5, cff.getShortField());
+ Assert.assertEquals(true, cff.isBooleanField());
+ Assert.assertEquals("ENUM1", cff.getEnum1().name());
+ Assert.assertEquals("dskfj", cff.getStrField());
+ Assert.assertNotNull(cff.getDateField());
+ Assert.assertNotNull(cff.getCalendarField());
+ Assert.assertNotNull(cff.getDateField2());
+ Assert.assertNotNull(cff.getCalendarField2());
+ Assert.assertEquals(ComponentForField.class, cff.getClazzField());
+ Assert.assertNotNull(cff.getListStrField());
+ Assert.assertNotNull(cff.getListEnumField());
+
+ } catch (Throwable e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNull(e);
+ }
- public XMLFieldTest()
- {
- super(XMLFieldTest.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 nameSpacesNotDeclared()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/fieldTest.xml");
- Assert.assertNotNull(stream);
-
- /*Clear the manager component list*/
- clear();
-
- this.xmlConfigurator.configure(stream,"fieldTest.xml");
-
- ComponentForField cff = (ComponentForField) container.getInstanceByName("componentForField");
-
- Assert.assertNotNull(cff);
- Assert.assertEquals(35, cff.getIntField());
- Assert.assertEquals(35.3f, cff.getFloatField());
- Assert.assertEquals(35.5d, cff.getDoubleField());
- Assert.assertEquals('a', cff.getCharField());
- Assert.assertEquals(37, cff.getLongField());
- Assert.assertEquals(1, cff.getByteField());
- Assert.assertEquals(5, cff.getShortField());
- Assert.assertEquals(true, cff.isBooleanField());
- Assert.assertEquals("ENUM1", cff.getEnum1().name());
- Assert.assertEquals("dskfj", cff.getStrField());
- Assert.assertNotNull(cff.getDateField());
- Assert.assertNotNull(cff.getCalendarField());
- Assert.assertNotNull(cff.getDateField2());
- Assert.assertNotNull(cff.getCalendarField2());
- Assert.assertEquals(ComponentForField.class, cff.getClazzField());
- Assert.assertNotNull(cff.getListStrField());
- Assert.assertNotNull(cff.getListEnumField());
-
-
-
-
- }catch(Throwable e1)
- {
- e = e1;
- }
-
- Assert.assertNull(e);
- }
-
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.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.xml;
@@ -32,67 +29,67 @@
public class XMLTest extends TestContext
{
- Manager container = null;
+ Manager container = null;
- public XMLTest()
- {
- super(XMLTest.class.getSimpleName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- this.container = ManagerImpl.getManager();
- }
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Test
- public void nameSpacesIsDefined()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/web-beans2.xml");
- Assert.assertNotNull(stream);
-
- Element root = XMLUtil.getRootElement(stream);
-
- Assert.assertNotNull(root);
-
- }catch(Throwable e1)
- {
- e1.printStackTrace();
- e = e1;
- }
-
- Assert.assertNull(e);
- }
-
- @Test
- public void nameSpacesNotDeclared()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml");
- Assert.assertNotNull(stream);
-
- XMLUtil.getRootElement(stream);
-
- }catch(Throwable e1)
- {
- e = e1;
- }
-
- Assert.assertNotNull(e);
- }
+ public XMLTest()
+ {
+ super(XMLTest.class.getSimpleName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ this.container = ManagerImpl.getManager();
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Test
+ public void nameSpacesIsDefined()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/web-beans2.xml");
+ Assert.assertNotNull(stream);
+
+ Element root = XMLUtil.getRootElement(stream);
+
+ Assert.assertNotNull(root);
+
+ } catch (Throwable e1)
+ {
+ e1.printStackTrace();
+ e = e1;
+ }
+
+ Assert.assertNull(e);
+ }
+
+ @Test
+ public void nameSpacesNotDeclared()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml");
+ Assert.assertNotNull(stream);
+
+ XMLUtil.getRootElement(stream);
+
+ } catch (Throwable e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.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.xml.definition;
@@ -31,116 +28,112 @@
public class XMLDefinitionTest extends TestContext
{
- public XMLDefinitionTest()
- {
- super(XMLDefinitionTest.class.getName());
- }
-
- @Before
- public void init()
- {
- initDeploymentTypes();
- }
-
- @Test
- public void testDefinition1()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition1.xml");
- Assert.assertNotNull(stream);
-
- clear();
-
- Element rootElement = XMLUtil.getRootElement(stream);
- Element beanElement = (Element)rootElement.elements().get(0);
-
- Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
-
- defineXMLSimpleWebBeans(clazz, beanElement);
-
- Assert.assertEquals(1, getComponents().size());
- Object def = getComponents().get(0);
-
- Assert.assertTrue(def instanceof XMLComponentImpl);
-
- XMLComponentImpl<?> comp = (XMLComponentImpl<?>)def;
-
- Assert.assertEquals("definition1", comp.getName());
-
- Object instance = comp.create();
-
- Assert.assertNotNull(instance);
- Assert.assertTrue(instance instanceof Definition1);
-
- }catch(Throwable e1)
- {
- e1.printStackTrace();
- e = e1;
- }
-
- Assert.assertNull(e);
-
-
- }
-
- @Test
- public void testDefinition2()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition2.xml");
- Assert.assertNotNull(stream);
-
- clear();
-
- Element rootElement = XMLUtil.getRootElement(stream);
- Element beanElement = (Element)rootElement.elements().get(0);
-
- Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
-
- defineXMLSimpleWebBeans(clazz, beanElement);
-
-
- }catch(Throwable e1)
- {
- e1.printStackTrace();
- e = e1;
- }
-
- Assert.assertNull(e);
-
-
- }
-
- @Test
- public void testDefinition3()
- {
- Throwable e = null;
- try
- {
- InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition3.xml");
- Assert.assertNotNull(stream);
-
- clear();
-
- Element rootElement = XMLUtil.getRootElement(stream);
- Element beanElement = (Element)rootElement.elements().get(0);
-
- Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
-
- defineXMLSimpleWebBeans(clazz, beanElement);
-
-
- }catch(Throwable e1)
- {
- e1.printStackTrace();
- e = e1;
- }
-
- Assert.assertNull(e);
- }
-
+ public XMLDefinitionTest()
+ {
+ super(XMLDefinitionTest.class.getName());
+ }
+
+ @Before
+ public void init()
+ {
+ initDeploymentTypes();
+ }
+
+ @Test
+ public void testDefinition1()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition1.xml");
+ Assert.assertNotNull(stream);
+
+ clear();
+
+ Element rootElement = XMLUtil.getRootElement(stream);
+ Element beanElement = (Element) rootElement.elements().get(0);
+
+ Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
+
+ defineXMLSimpleWebBeans(clazz, beanElement);
+
+ Assert.assertEquals(1, getComponents().size());
+ Object def = getComponents().get(0);
+
+ Assert.assertTrue(def instanceof XMLComponentImpl);
+
+ XMLComponentImpl<?> comp = (XMLComponentImpl<?>) def;
+
+ Assert.assertEquals("definition1", comp.getName());
+
+ Object instance = comp.create();
+
+ Assert.assertNotNull(instance);
+ Assert.assertTrue(instance instanceof Definition1);
+
+ } catch (Throwable e1)
+ {
+ e1.printStackTrace();
+ e = e1;
+ }
+
+ Assert.assertNull(e);
+
+ }
+
+ @Test
+ public void testDefinition2()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition2.xml");
+ Assert.assertNotNull(stream);
+
+ clear();
+
+ Element rootElement = XMLUtil.getRootElement(stream);
+ Element beanElement = (Element) rootElement.elements().get(0);
+
+ Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
+
+ defineXMLSimpleWebBeans(clazz, beanElement);
+
+ } catch (Throwable e1)
+ {
+ e1.printStackTrace();
+ e = e1;
+ }
+
+ Assert.assertNull(e);
+
+ }
+
+ @Test
+ public void testDefinition3()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition3.xml");
+ Assert.assertNotNull(stream);
+
+ clear();
+
+ Element rootElement = XMLUtil.getRootElement(stream);
+ Element beanElement = (Element) rootElement.elements().get(0);
+
+ Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
+
+ defineXMLSimpleWebBeans(clazz, beanElement);
+
+ } catch (Throwable e1)
+ {
+ e1.printStackTrace();
+ e = e1;
+ }
+
+ Assert.assertNull(e);
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/Component1.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/Component1.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/Component1.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/Component1.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.xml;