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 16:14:23 UTC

svn commit: r735302 - in /incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test: component/producer/primitive/ unittests/producer/primitive/

Author: gerdogdu
Date: Sat Jan 17 07:14:23 2009
New Revision: 735302

URL: http://svn.apache.org/viewvc?rev=735302&view=rev
Log:
Producer method primitive injection tests are added.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java   (with props)

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java?rev=735302&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java Sat Jan 17 07:14:23 2009
@@ -0,0 +1,42 @@
+/*
+ *  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.component.producer.primitive;
+
+import javax.webbeans.Named;
+import javax.webbeans.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@RequestScoped
+@Named
+public class PrimitiveConsumer
+{
+    private @Binding1 @Binding2 Float primitiveProducer;
+    
+    public PrimitiveConsumer()
+    {
+        
+    }
+    
+    
+    public float getSalary()
+    {
+        return this.primitiveProducer;
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java?rev=735302&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java Sat Jan 17 07:14:23 2009
@@ -0,0 +1,40 @@
+/*
+ *  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.component.producer.primitive;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+public class PrimitiveProducer
+{
+    public PrimitiveProducer()
+    {
+        
+    }
+
+    @Produces
+    @Binding1
+    @Binding2
+    @Dependent
+    public Float getSalary()
+    {
+        return 56.7f;
+    }
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java?rev=735302&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java Sat Jan 17 07:14:23 2009
@@ -0,0 +1,56 @@
+/*
+ *  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.primitive;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.component.producer.primitive.PrimitiveConsumer;
+import org.apache.webbeans.test.component.producer.primitive.PrimitiveProducer;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PrimitiveProducerTest extends TestContext
+{
+    public PrimitiveProducerTest()
+    {
+        super(PrimitiveProducerTest.class.getName());
+    }
+
+    @Before
+    public void init()
+    {
+        initDefaultDeploymentTypes();
+    }
+    
+    
+    @Test
+    public void testPrimitiveProducer()
+    {
+        ContextFactory.initRequestContext(null);
+        
+        defineSimpleWebBean(PrimitiveProducer.class);
+        defineSimpleWebBean(PrimitiveConsumer.class);
+        
+        PrimitiveConsumer consumer = (PrimitiveConsumer) getManager().getInstanceByName("primitiveConsumer");
+        
+        Assert.assertEquals(56.7f, consumer.getSalary());
+        
+    }
+}
+

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