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/17 09:09:06 UTC
svn commit: r735244 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer:
./ StaticProducerTest.java broken/ broken/BrokenProducerTest.java
Author: gerdogdu
Date: Sat Jan 17 00:09:06 2009
New Revision: 735244
URL: http://svn.apache.org/viewvc?rev=735244&view=rev
Log:
Static producer component and broken tests are added.
Added:
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java (with props)
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java?rev=735244&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java Sat Jan 17 00:09:06 2009
@@ -0,0 +1,67 @@
+/*
+ * 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.producer;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.webbeans.component.ProducerComponentImpl;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.producer.StaticProducer1;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class StaticProducerTest extends TestContext
+{
+
+ public StaticProducerTest()
+ {
+ super(StaticProducerTest.class.getName());
+ }
+
+ @Before
+ public void init()
+ {
+ initDefaultDeploymentTypes();
+ }
+
+ @Test
+ public void testStaticProducer1()
+ {
+ clear();
+
+ ContextFactory.initRequestContext(null);
+
+ defineSimpleWebBean(StaticProducer1.class);
+
+ ProducerComponentImpl<?> pc = (ProducerComponentImpl<?>) getManager().resolveByName("weight").iterator().next();
+
+ Object obj = getManager().getInstance(pc);
+
+ Assert.assertTrue(obj instanceof Integer);
+ Assert.assertEquals(79, obj);
+
+ pc = (ProducerComponentImpl<?>)getManager().resolveByType(int.class, new Annotation[]{}).iterator().next();
+
+ obj = getManager().getInstance(pc);
+
+ Assert.assertTrue(obj instanceof Integer);
+ Assert.assertEquals(79, obj);
+
+ }
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java?rev=735244&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java Sat Jan 17 00:09:06 2009
@@ -0,0 +1,159 @@
+/*
+ * 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.producer.broken;
+
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent1;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent2;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent3;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent4;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent5;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent6;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BrokenProducerTest extends TestContext
+{
+
+ public BrokenProducerTest()
+ {
+ super(BrokenProducerTest.class.getName());
+ }
+
+
+ @Before
+ public void init()
+ {
+ initDefaultDeploymentTypes();
+ }
+
+ @Test
+ public void testBroken1()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent1.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void testBroken2()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent2.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+
+ }
+
+ @Test
+ public void testBroken3()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent3.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+
+ }
+
+ @Test
+ public void testBroken4()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent4.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+
+ }
+
+ @Test
+ public void testBroken5()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent5.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+
+ }
+
+ @Test
+ public void testBroken6()
+ {
+ Exception e = null;
+
+ try
+ {
+ clear();
+ defineSimpleWebBean(BrokenProducerComponent6.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+
+ }
+
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native