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 [9/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/decorator/DecoratorTest1.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorTest1.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorTest1.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorTest1.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.decorator;
@@ -45,75 +42,74 @@
public class DecoratorTest1 extends TestContext
{
- public DecoratorTest1()
- {
- super(DecoratorTest1.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
- @Test
- public void test1()
- {
- defineSimpleWebBean(CheckWithCheckPayment.class);
- defineSimpleWebBeansDecorators(ServiceDecorator.class);
- AbstractComponent<ServiceImpl1> component = defineSimpleWebBean(ServiceImpl1.class);
-
- ContextFactory.initRequestContext(null);
- ContextFactory.initApplicationContext(null);
-
- ServiceImpl1 serviceImpl = getManager().getInstance(component);
- String s = serviceImpl.service();
-
- Assert.assertEquals("ServiceImpl1", s);
-
- Set<Class<?>> apiTyeps = new HashSet<Class<?>>();
- apiTyeps.add(IService.class);
-
- List<Decorator> decs = getManager().resolveDecorators(apiTyeps, new Annotation[]{new Binding1Literal()});
-
- ServiceDecorator dec = (ServiceDecorator)getManager().getInstance(decs.get(0));
- Assert.assertEquals("ServiceImpl1", dec.getDelegateAttr());
-
- }
-
- @Test
- public void test2()
- {
- defineSimpleWebBeansDecorators(LargeTransactionDecorator.class);
- AbstractComponent<AccountComponent> component = defineSimpleWebBean(AccountComponent.class);
-
- ContextFactory.initRequestContext(null);
-
- AccountComponent account = getManager().getInstance(component);
-
- account.deposit(new BigDecimal(1500));
- account.withdraw(new BigDecimal(3000));
-
-
- Set<Class<?>> apiTyeps = new HashSet<Class<?>>();
- apiTyeps.add(Account.class);
-
- List<Decorator> decs = getManager().resolveDecorators(apiTyeps, new Annotation[]{new CurrentLiteral()});
-
- LargeTransactionDecorator dec = (LargeTransactionDecorator)getManager().getInstance(decs.get(0));
- Assert.assertEquals(new BigDecimal(1500), dec.getDepositeAmount());
- Assert.assertEquals(new BigDecimal(3000), dec.getWithDrawAmount());
-
- }
-
+ public DecoratorTest1()
+ {
+ super(DecoratorTest1.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void test1()
+ {
+ defineSimpleWebBean(CheckWithCheckPayment.class);
+ defineSimpleWebBeansDecorators(ServiceDecorator.class);
+ AbstractComponent<ServiceImpl1> component = defineSimpleWebBean(ServiceImpl1.class);
+
+ ContextFactory.initRequestContext(null);
+ ContextFactory.initApplicationContext(null);
+
+ ServiceImpl1 serviceImpl = getManager().getInstance(component);
+ String s = serviceImpl.service();
+
+ Assert.assertEquals("ServiceImpl1", s);
+
+ Set<Class<?>> apiTyeps = new HashSet<Class<?>>();
+ apiTyeps.add(IService.class);
+
+ List<Decorator> decs = getManager().resolveDecorators(apiTyeps, new Annotation[] { new Binding1Literal() });
+
+ ServiceDecorator dec = (ServiceDecorator) getManager().getInstance(decs.get(0));
+ Assert.assertEquals("ServiceImpl1", dec.getDelegateAttr());
+
+ }
+
+ @Test
+ public void test2()
+ {
+ defineSimpleWebBeansDecorators(LargeTransactionDecorator.class);
+ AbstractComponent<AccountComponent> component = defineSimpleWebBean(AccountComponent.class);
+
+ ContextFactory.initRequestContext(null);
+
+ AccountComponent account = getManager().getInstance(component);
+
+ account.deposit(new BigDecimal(1500));
+ account.withdraw(new BigDecimal(3000));
+
+ Set<Class<?>> apiTyeps = new HashSet<Class<?>>();
+ apiTyeps.add(Account.class);
+
+ List<Decorator> decs = getManager().resolveDecorators(apiTyeps, new Annotation[] { new CurrentLiteral() });
+
+ LargeTransactionDecorator dec = (LargeTransactionDecorator) getManager().getInstance(decs.get(0));
+ Assert.assertEquals(new BigDecimal(1500), dec.getDepositeAmount());
+ Assert.assertEquals(new BigDecimal(3000), dec.getWithDrawAmount());
+
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.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.dependent;
@@ -33,66 +30,63 @@
import org.junit.Before;
import org.junit.Test;
-
public class DependentComponentTest extends TestContext
{
- public DependentComponentTest()
- {
- super(DependentComponentTest.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);
-
- ContextFactory.initRequestContext(null);
-
- List<AbstractComponent<?>> comps = getComponents();
-
- Assert.assertEquals(2,comps.size());
-
- DependentOwnerComponent comp = (DependentOwnerComponent)getContext(RequestScoped.class).get(comps.get(1), true);
-
- DependentComponent dc = comp.getDependent();
-
- Assert.assertNotNull(dc);
-
- ContextFactory.destroyRequestContext(null);
- }
-
- @Test
- public void testDependentCircular()
- {
- clear();
-
- AbstractComponent<DependentA> componentA = defineSimpleWebBean(DependentA.class);
- AbstractComponent<DependentB> componentB = defineSimpleWebBean(DependentB.class);
-
- DependentA dependentA = componentA.create();
-
-
-
- }
+ public DependentComponentTest()
+ {
+ super(DependentComponentTest.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);
+
+ ContextFactory.initRequestContext(null);
+
+ List<AbstractComponent<?>> comps = getComponents();
+
+ Assert.assertEquals(2, comps.size());
+
+ DependentOwnerComponent comp = (DependentOwnerComponent) getContext(RequestScoped.class).get(comps.get(1), true);
+
+ DependentComponent dc = comp.getDependent();
+
+ Assert.assertNotNull(dc);
+
+ ContextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testDependentCircular()
+ {
+ clear();
+
+ AbstractComponent<DependentA> componentA = defineSimpleWebBean(DependentA.class);
+ AbstractComponent<DependentB> componentB = defineSimpleWebBean(DependentB.class);
+
+ DependentA dependentA = componentA.create();
+
+ }
}
\ No newline at end of file
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.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.event;
@@ -36,63 +33,69 @@
public class EventTest extends TestContext
{
- public EventTest()
- {
- super(EventTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
- }
-
- public void startTests(ServletContext ctx)
- {
- }
-
- @Test
- public void testObserverWithClazz()
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Binding1>(){};
-
- LoggedInObserver observer = new LoggedInObserver();
- getManager().addObserver(observer, LoggedInEvent.class, anns);
-
- getManager().fireEvent(new LoggedInEvent(), anns);
-
- Assert.assertEquals("ok", observer.getResult());
- }
-
- @Test
- public void testObserverWithClazzAndTypeArguments()
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Binding1>(){};
-
- TypeArgumentObserver observer = new TypeArgumentObserver();
- TypeLiteral<TypeArgumentBaseEvent> tl = new TypeLiteral<TypeArgumentBaseEvent>(){};
-
- getManager().addObserver(observer, tl, anns);
-
-
- getManager().fireEvent(new TypeArgumentEvent(), anns);
-
- Assert.assertEquals("ok", observer.getResult());
- }
-
- @Test
- public void testObserverWithInterface()
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Binding1>(){};
-
- TypeArgumentInterfaceObserver observer = new TypeArgumentInterfaceObserver();
- getManager().addObserver(observer, ITypeArgumentEventInterface.class, anns);
-
-
- getManager().fireEvent(new TypeArgumentEvent(), anns);
- Assert.assertEquals("ok", observer.getResult());
-
- }
+ public EventTest()
+ {
+ super(EventTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+ }
+
+ @Test
+ public void testObserverWithClazz()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver();
+ getManager().addObserver(observer, LoggedInEvent.class, anns);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+ }
+
+ @Test
+ public void testObserverWithClazzAndTypeArguments()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ TypeArgumentObserver observer = new TypeArgumentObserver();
+ TypeLiteral<TypeArgumentBaseEvent> tl = new TypeLiteral<TypeArgumentBaseEvent>()
+ {
+ };
+
+ getManager().addObserver(observer, tl, anns);
+
+ getManager().fireEvent(new TypeArgumentEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+ }
+
+ @Test
+ public void testObserverWithInterface()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ TypeArgumentInterfaceObserver observer = new TypeArgumentInterfaceObserver();
+ getManager().addObserver(observer, ITypeArgumentEventInterface.class, anns);
+
+ getManager().fireEvent(new TypeArgumentEvent(), anns);
+ Assert.assertEquals("ok", observer.getResult());
+
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java Thu Jan 8 11:45:11 2009
@@ -1,22 +1,18 @@
/*
- * 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.event.component;
-
import junit.framework.Assert;
import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent1;
@@ -31,127 +27,123 @@
public class BrokenComponentTest extends TestContext
{
- public BrokenComponentTest()
- {
- super(BrokenComponentTest.class.getName());
- }
-
-
- @Before
- public void init()
- {
- super.init();
- }
-
-
-
- @Test
- public void test1()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent1.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void test2()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent2.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void test3()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent3.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void test4()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent4.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void test5()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent5.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void test6()
- {
- Exception exc = null;
-
- try
- {
- defineSimpleWebBean(BrokenObserverComponent6.class);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- }
+ public BrokenComponentTest()
+ {
+ super(BrokenComponentTest.class.getName());
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void test1()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent1.class);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test2()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent2.class);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test3()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent3.class);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test4()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent4.class);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test5()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent5.class);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test6()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineSimpleWebBean(BrokenObserverComponent6.class);
+
+ } catch (Exception 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/event/component/ObserversComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.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.event.component;
@@ -20,7 +17,6 @@
import javax.webbeans.AnnotationLiteral;
-
import junit.framework.Assert;
import org.apache.webbeans.annotation.CurrentLiteral;
@@ -42,138 +38,138 @@
@SuppressWarnings("unchecked")
public class ObserversComponentTest extends TestContext
{
- public ObserversComponentTest()
- {
- super(ObserversComponentTest.class.getName());
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
- @Test
- public void testObserves()
- {
- clear();
-
- AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
- ContextFactory.initRequestContext(null);
-
- LoggedInEvent event = new LoggedInEvent("Gurkan");
-
- Annotation[] anns = new Annotation[1];
- anns[0] = new CurrentLiteral();
-
- getManager().fireEvent(event, anns);
-
- ComponentWithObserves1 instance = getManager().getInstance(component);
-
- Assert.assertEquals("Gurkan", instance.getUserName());
- }
-
- @Test
- public void testWithObservable()
- {
- clear();
-
- AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
- AbstractComponent<ComponentWithObservable1> componentObservable = defineSimpleWebBean(ComponentWithObservable1.class);
-
- ContextFactory.initRequestContext(null);
-
- ComponentWithObserves1 instance = getManager().getInstance(component);
- ComponentWithObservable1 observable = getManager().getInstance(componentObservable);
-
- observable.afterLoggedIn();
-
- Assert.assertEquals("Gurkan", instance.getUserName());
- }
-
- @Test
- public void testObservesWithBindingMember()
- {
- clear();
-
- AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
- ContextFactory.initRequestContext(null);
-
- LoggedInEvent event = new LoggedInEvent("Gurkan");
-
- class CheckLiteral extends AnnotationLiteral<Check> implements Check
- {
-
- public String type()
- {
- return "CHECK";
- }
-
- }
-
- Annotation[] anns = new Annotation[1];
- anns[0] = new CheckLiteral();
-
- getManager().fireEvent(event, anns);
-
- ComponentWithObserves1 instance = getManager().getInstance(component);
-
- Assert.assertNull(instance.getUserName());
-
- Assert.assertEquals("Gurkan", instance.getUserNameWithMember());
- }
-
- @Test
- public void testObservesWithBindingMember2()
- {
- clear();
-
- defineSimpleWebBean(CheckWithCheckPayment.class);
- defineSimpleWebBean(CheckWithMoneyPayment.class);
- defineSimpleWebBean(PaymentProcessorComponent.class);
- AbstractComponent<ComponentWithObserves2> component = defineSimpleWebBean(ComponentWithObserves2.class);
- ContextFactory.initRequestContext(null);
-
- LoggedInEvent event = new LoggedInEvent("USER");
-
- class RoleUser extends AnnotationLiteral<Role> implements Role
- {
-
- public String value()
- {
- return "USER";
- }
-
- }
-
- class RoleAdmin extends AnnotationLiteral<Role> implements Role
- {
-
- public String value()
- {
- return "ADMIN";
- }
-
- }
-
- Annotation[] anns = new Annotation[1];
- anns[0] = new RoleUser();
-
- getManager().fireEvent(event, anns);
- ComponentWithObserves2 instance = getManager().getInstance(component);
-
- Assert.assertNotNull(instance.getPayment());
- Assert.assertEquals("USER", instance.getUser());
-
- anns[0] = new RoleAdmin();
- event = new LoggedInEvent("ADMIN");
-
- getManager().fireEvent(event, anns);
- instance = getManager().getInstance(component);
-
- Assert.assertNotNull(instance.getPayment());
- Assert.assertEquals("ADMIN", instance.getUser());
-
- }
-
+ public ObserversComponentTest()
+ {
+ super(ObserversComponentTest.class.getName());
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testObserves()
+ {
+ clear();
+
+ AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
+ ContextFactory.initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("Gurkan");
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new CurrentLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+
+ Assert.assertEquals("Gurkan", instance.getUserName());
+ }
+
+ @Test
+ public void testWithObservable()
+ {
+ clear();
+
+ AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
+ AbstractComponent<ComponentWithObservable1> componentObservable = defineSimpleWebBean(ComponentWithObservable1.class);
+
+ ContextFactory.initRequestContext(null);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+ ComponentWithObservable1 observable = getManager().getInstance(componentObservable);
+
+ observable.afterLoggedIn();
+
+ Assert.assertEquals("Gurkan", instance.getUserName());
+ }
+
+ @Test
+ public void testObservesWithBindingMember()
+ {
+ clear();
+
+ AbstractComponent<ComponentWithObserves1> component = defineSimpleWebBean(ComponentWithObserves1.class);
+ ContextFactory.initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("Gurkan");
+
+ class CheckLiteral extends AnnotationLiteral<Check> implements Check
+ {
+
+ public String type()
+ {
+ return "CHECK";
+ }
+
+ }
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new CheckLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+
+ Assert.assertNull(instance.getUserName());
+
+ Assert.assertEquals("Gurkan", instance.getUserNameWithMember());
+ }
+
+ @Test
+ public void testObservesWithBindingMember2()
+ {
+ clear();
+
+ defineSimpleWebBean(CheckWithCheckPayment.class);
+ defineSimpleWebBean(CheckWithMoneyPayment.class);
+ defineSimpleWebBean(PaymentProcessorComponent.class);
+ AbstractComponent<ComponentWithObserves2> component = defineSimpleWebBean(ComponentWithObserves2.class);
+ ContextFactory.initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("USER");
+
+ class RoleUser extends AnnotationLiteral<Role> implements Role
+ {
+
+ public String value()
+ {
+ return "USER";
+ }
+
+ }
+
+ class RoleAdmin extends AnnotationLiteral<Role> implements Role
+ {
+
+ public String value()
+ {
+ return "ADMIN";
+ }
+
+ }
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new RoleUser();
+
+ getManager().fireEvent(event, anns);
+ ComponentWithObserves2 instance = getManager().getInstance(component);
+
+ Assert.assertNotNull(instance.getPayment());
+ Assert.assertEquals("USER", instance.getUser());
+
+ anns[0] = new RoleAdmin();
+ event = new LoggedInEvent("ADMIN");
+
+ getManager().fireEvent(event, anns);
+ instance = getManager().getInstance(component);
+
+ Assert.assertNotNull(instance.getPayment());
+ Assert.assertEquals("ADMIN", instance.getUser());
+
+ }
+
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.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.event.exception;
@@ -34,121 +31,128 @@
@SuppressWarnings("unchecked")
public class EventExceptionTest extends TestContext
{
- public EventExceptionTest()
- {
- super(EventExceptionTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
- }
-
- public void startTests(ServletContext ctx)
- {
- }
-
- @Test
- public void testAddObserverGenericType()
- {
- Exception exc = null;
-
- try
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Binding1>(){};
-
- BrokenObserver observer = new BrokenObserver();
- getManager().addObserver(observer, BrokenEvent.class, anns);
-
- getManager().fireEvent(new BrokenEvent(), anns);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
-
- }
-
- @Test
- public void testFireEventGenericType()
- {
- Exception exc = null;
-
- try
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<Binding1>(){};
-
-
- getManager().fireEvent(new BrokenEvent(), anns);
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAddObserverDuplicateBinding()
- {
- Exception exc = null;
-
- try
- {
- Annotation[] anns = new Annotation[2];
- anns[0] = new AnnotationLiteral<Binding1>(){};
- anns[1] = new AnnotationLiteral<Binding1>(){};
-
- LoggedInObserver observer = new LoggedInObserver();
- getManager().addObserver(observer, LoggedInEvent.class, anns);
-
- getManager().fireEvent(new LoggedInEvent(), anns);
-
- Assert.assertEquals("ok", observer.getResult());
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAddObserverIllegalArgument()
- {
- Exception exc = null;
-
- try
- {
- Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<ScopeType>(){};
-
- LoggedInObserver observer = new LoggedInObserver();
- getManager().addObserver(observer, LoggedInEvent.class, anns);
-
- getManager().fireEvent(new LoggedInEvent(), anns);
-
- Assert.assertEquals("ok", observer.getResult());
-
- }catch(Exception e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
-
- }
+ public EventExceptionTest()
+ {
+ super(EventExceptionTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+ }
+
+ @Test
+ public void testAddObserverGenericType()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ BrokenObserver observer = new BrokenObserver();
+ getManager().addObserver(observer, BrokenEvent.class, anns);
+
+ getManager().fireEvent(new BrokenEvent(), anns);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testFireEventGenericType()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ getManager().fireEvent(new BrokenEvent(), anns);
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAddObserverDuplicateBinding()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+ anns[1] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver();
+ getManager().addObserver(observer, LoggedInEvent.class, anns);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+
+ } catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAddObserverIllegalArgument()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<ScopeType>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver();
+ getManager().addObserver(observer, LoggedInEvent.class, anns);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+
+ } catch (Exception 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/exception/ExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.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.exception;
@@ -56,544 +53,537 @@
import org.junit.Before;
import org.junit.Test;
-
public class ExceptionComponentTest extends TestContext
{
-
- public ExceptionComponentTest()
- {
- super(ExceptionComponentTest.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
- {
- defineSimpleWebBean(ComponentTypeExceptionComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void testProducerMethodComponentTypeException()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(ProducerTypeExceptionComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
-
- }
-
- @Test
- public void testFinal()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(FinalComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAbstract()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(AbstractComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testInner()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(InnerInnerComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testHasFinalMethod()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(HasFinalMethodComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void constructorTest()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(MoreThanOneConstructureComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
- exc = null;
-
- try
- {
- defineSimpleWebBean(MoreThanOneConstructureComponent2.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
- Assert.assertNotNull(exc);
- exc = null;
-
- try
- {
- defineSimpleWebBean(NoConstructureComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
- Assert.assertNull(exc);
- }
-
-
- @Test
- public void testStaticProducerMethod()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(ProducerTypeStaticComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testDisposeMethod()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(MultipleDisposalMethodComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
-
- @Test
- public void testNewInterface()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(NewComponentInterfaceComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
- @Test
- public void testNewBinding()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(NewComponentBindingComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testNewMethod()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(NewMethodComponentBindingComponent.class);
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testMoreThanOnePostConstruct()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<MoreThanOnePostConstructComponent> component = defineSimpleWebBean(MoreThanOnePostConstructComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testPostConstructHasParameter()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<PostContructMethodHasParameterComponent> component = defineSimpleWebBean(PostContructMethodHasParameterComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testPostConstructHasReturnType()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasReturnTypeComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testPostConstructHasCheckedException()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasCheckedExceptionComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testPostConstructHasStatic()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasStaticComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testMoreThanOneAroundInvoke()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(MoreThanOneAroundInvokeComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithSameMethodName()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- defineSimpleWebBean(AroundInvokeWithSameMethodNameComponent.class);
- Bean<?> comp =getComponents().get(0);
-
- Assert.assertEquals(0, ((AbstractComponent<?>)comp).getInterceptorStack().size());
-
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithoutParameter()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutParameterComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithoutReturnType()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutReturnTypeComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithWrongReturnType()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithWrongReturnTypeComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithoutException()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutExceptionComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithStatic()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithStaticMethodComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testAroundInvokeWithFinal()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithFinalMethodComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
- @Test
- public void testNoArgConstructorInterceptor()
- {
- WebBeansConfigurationException exc = null;
- try
- {
- AbstractComponent<?> component = defineSimpleWebBean(NoArgConstructorInterceptorComponent.class);
- EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
- }
-
- Assert.assertNotNull(exc);
-
- }
-
+ public ExceptionComponentTest()
+ {
+ super(ExceptionComponentTest.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
+ {
+ defineSimpleWebBean(ComponentTypeExceptionComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void testProducerMethodComponentTypeException()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(ProducerTypeExceptionComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testFinal()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(FinalComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAbstract()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(AbstractComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testInner()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(InnerInnerComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testHasFinalMethod()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(HasFinalMethodComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void constructorTest()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(MoreThanOneConstructureComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ exc = null;
+
+ try
+ {
+ defineSimpleWebBean(MoreThanOneConstructureComponent2.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+ Assert.assertNotNull(exc);
+ exc = null;
+
+ try
+ {
+ defineSimpleWebBean(NoConstructureComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testStaticProducerMethod()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(ProducerTypeStaticComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testDisposeMethod()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(MultipleDisposalMethodComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testNewInterface()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(NewComponentInterfaceComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testNewBinding()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(NewComponentBindingComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testNewMethod()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(NewMethodComponentBindingComponent.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testMoreThanOnePostConstruct()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<MoreThanOnePostConstructComponent> component = defineSimpleWebBean(MoreThanOnePostConstructComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testPostConstructHasParameter()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<PostContructMethodHasParameterComponent> component = defineSimpleWebBean(PostContructMethodHasParameterComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testPostConstructHasReturnType()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasReturnTypeComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testPostConstructHasCheckedException()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasCheckedExceptionComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testPostConstructHasStatic()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(PostContructMethodHasStaticComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testMoreThanOneAroundInvoke()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(MoreThanOneAroundInvokeComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithSameMethodName()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ defineSimpleWebBean(AroundInvokeWithSameMethodNameComponent.class);
+ Bean<?> comp = getComponents().get(0);
+
+ Assert.assertEquals(0, ((AbstractComponent<?>) comp).getInterceptorStack().size());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithoutParameter()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutParameterComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithoutReturnType()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutReturnTypeComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithWrongReturnType()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithWrongReturnTypeComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithoutException()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithoutExceptionComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithStatic()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithStaticMethodComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAroundInvokeWithFinal()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(AroundInvokeWithFinalMethodComponent.class);
+ EJBInterceptorConfig.configure(component.getReturnType(), component.getInterceptorStack());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testNoArgConstructorInterceptor()
+ {
+ WebBeansConfigurationException exc = null;
+ try
+ {
+ AbstractComponent<?> component = defineSimpleWebBean(NoArgConstructorInterceptorComponent.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/exception/ScopeTypeExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java?rev=732806&r1=732805&r2=732806&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.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.exception;
@@ -37,206 +34,198 @@
import org.junit.Before;
import org.junit.Test;
-
public class ScopeTypeExceptionComponentTest extends TestContext
{
-
- public ScopeTypeExceptionComponentTest()
- {
- super(ScopeTypeExceptionComponentTest.class.getName());
- }
-
- public void endTests(ServletContext ctx)
- {
-
- }
-
- @Before
- public void init()
- {
- super.init();
- }
-
-
- public void startTests(ServletContext ctx)
- {
-
- }
-
- @Test
- public void testComponentWithNonScopeStero()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentWithNonScopeStero.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(Dependent.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
- @Test
- public void testComponentDefaultScopeWithNonScopeStero()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentDefaultScopeWithNonScopeStero.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(SessionScoped.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
- @Test
- public void testComponentWithDefaultScopeStero()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentWithDefaultScopeStero.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(RequestScoped.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
-
- @Test
- public void testComponentWithDifferentScopeSteros()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentWithDifferentScopeSteros.class);
-
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNotNull(exc);
- }
-
- @Test
- public void testComponentWithoutScopeStero()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentWithoutScopeStero.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(Dependent.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
-
- @Test
- public void testComponentWithSameScopeSteros()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentWithSameScopeSteros.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(SessionScoped.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
-
- @Test
- public void testComponentDefaultScopeWithDifferentScopeSteros()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentDefaultScopeWithDifferentScopeSteros.class);
- Bean<?> bean = getComponents().get(0);
-
- Assert.assertEquals(SessionScoped.class, bean.getScopeType());
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNull(exc);
- }
-
- @Test
- public void testComponentNonDefaultScopeWithDifferentScopeSteros()
- {
- WebBeansConfigurationException exc = null;
- clear();
- try
- {
- defineSimpleWebBean(ComponentNonDefaultScopeWithDifferentScopeSteros.class);
-
-
- }catch(WebBeansConfigurationException e)
- {
- System.out.println(e.getMessage());
- exc = e;
-
- }
-
- Assert.assertNotNull(exc);
- }
-
+
+ public ScopeTypeExceptionComponentTest()
+ {
+ super(ScopeTypeExceptionComponentTest.class.getName());
+ }
+
+ public void endTests(ServletContext ctx)
+ {
+
+ }
+
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ public void startTests(ServletContext ctx)
+ {
+
+ }
+
+ @Test
+ public void testComponentWithNonScopeStero()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentWithNonScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(Dependent.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentDefaultScopeWithNonScopeStero()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentDefaultScopeWithNonScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentWithDefaultScopeStero()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentWithDefaultScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(RequestScoped.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentWithDifferentScopeSteros()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentWithDifferentScopeSteros.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void testComponentWithoutScopeStero()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentWithoutScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(Dependent.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentWithSameScopeSteros()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentWithSameScopeSteros.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentDefaultScopeWithDifferentScopeSteros()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentDefaultScopeWithDifferentScopeSteros.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScopeType());
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testComponentNonDefaultScopeWithDifferentScopeSteros()
+ {
+ WebBeansConfigurationException exc = null;
+ clear();
+ try
+ {
+ defineSimpleWebBean(ComponentNonDefaultScopeWithDifferentScopeSteros.class);
+
+ } catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNotNull(exc);
+ }
}