openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r900559 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields: GetterStringInjectorTest.java beans/GetterStringFieldInjector.java beans/GetterStringProducerBean.java
Date Mon, 18 Jan 2010 21:11:28 GMT
Author: gerdogdu
Date: Mon Jan 18 21:11:28 2010
New Revision: 900559

URL: http://svn.apache.org/viewvc?rev=900559&view=rev
Log:
TEst for Named qualification in injection fields

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java
  (with props)

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java?rev=900559&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
Mon Jan 18 21:11:28 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.newtests.profields;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector;
+import org.apache.webbeans.newtests.profields.beans.GetterStringProducerBean;
+import org.junit.Test;
+
+public class GetterStringInjectorTest extends AbstractUnitTest
+{
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testGetterStringInjector()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(GetterStringProducerBean.class);
+        beanClasses.add(GetterStringFieldInjector.class);
+        
+        startContainer(beanClasses, beanXmls);   
+        
+        Bean<GetterStringFieldInjector> bean = (Bean<GetterStringFieldInjector>)
getBeanManager().getBeans("org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector").iterator().next();
+        GetterStringFieldInjector injector = (GetterStringFieldInjector) getBeanManager().getReference(bean,
GetterStringFieldInjector.class, getBeanManager().createCreationalContext(bean));
+        
+        Assert.assertEquals("Sucess from getProducts",injector.getTestNamed3());
+        
+        shutDownContainer();
+    }
+    
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java?rev=900559&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java
Mon Jan 18 21:11:28 2010
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.profields.beans;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector")
+public class GetterStringFieldInjector
+{
+    public @Inject @Named("products") String N3;
+
+    public String getTestNamed3()
+    {
+        String y = N3;
+        return y;
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringFieldInjector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java?rev=900559&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java
Mon Jan 18 21:11:28 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.profields.beans;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class GetterStringProducerBean
+{
+    @Produces
+    @Named("products")
+    public String getProducts()
+    {
+        return "Sucess from getProducts";
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/GetterStringProducerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message