[jbosstools-commits] JBoss Tools SVN: r22916 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: src/org/jboss/tools/cdi/core/test and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 21 12:32:31 EDT 2010


Author: akazakov
Date: 2010-06-21 12:32:30 -0400 (Mon, 21 Jun 2010)
New Revision: 22916

Added:
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AdvancedPaymentProcessor.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AsynchronousPaymentProcessor.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/CashPaymentProcessor.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/ObtainsInstanceBean.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/OtherPaymentProcessor.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PayBy.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PaymentProcessor.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierWithMembersTest.java
Modified:
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6512 Added JUnit tests

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AdvancedPaymentProcessor.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AdvancedPaymentProcessor.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AdvancedPaymentProcessor.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod;
+
+ at PayBy(PaymentMethod.CHEQUE)
+ at ApplicationScoped
+class AdvancedPaymentProcessor implements AsynchronousPaymentProcessor {
+   private int value = 0;
+
+   public int getValue() {
+      return value;
+   }
+
+   public void setValue(int value) {
+      this.value = value;
+   }
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AdvancedPaymentProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AsynchronousPaymentProcessor.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AsynchronousPaymentProcessor.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AsynchronousPaymentProcessor.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.jsr299.tck.tests.jbt.resolution;
+
+interface AsynchronousPaymentProcessor extends PaymentProcessor
+{
+   int getValue();
+   void setValue(int value);
+}


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/AsynchronousPaymentProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/CashPaymentProcessor.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/CashPaymentProcessor.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/CashPaymentProcessor.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import static org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CASH;
+
+import javax.enterprise.context.ApplicationScoped;
+
+ at PayBy(CASH)
+ at ApplicationScoped
+class CashPaymentProcessor implements AsynchronousPaymentProcessor {
+   private int value = 0;
+
+   public int getValue() {
+      return value;
+   }
+
+   public void setValue(int value) {
+      this.value = value;
+   }
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/CashPaymentProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/ObtainsInstanceBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/ObtainsInstanceBean.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/ObtainsInstanceBean.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import static org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CASH;
+import static org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CHEQUE;
+import static org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CREDIT_CARD;
+import static org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.OTHER;
+
+import javax.inject.Inject;
+
+import org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod;
+
+class ObtainsInstanceBean {
+   @Inject @PayBy(CHEQUE) AsynchronousPaymentProcessor chequePaymentProcessor;
+
+   @Inject @PayBy(PaymentMethod.CHEQUE) AsynchronousPaymentProcessor chequePaymentProcessor2;
+
+   @Inject @PayBy(org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CHEQUE) AsynchronousPaymentProcessor chequePaymentProcessor3;
+
+   @Inject @PayBy(CASH) AsynchronousPaymentProcessor cashPaymentProcessor;
+
+   @Inject @PayBy(PaymentMethod.CASH) AsynchronousPaymentProcessor cashPaymentProcessor2;
+
+   @Inject @PayBy(org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CASH) AsynchronousPaymentProcessor cashPaymentProcessor3;
+
+   @Inject @PayBy(OTHER) AsynchronousPaymentProcessor otherPaymentProcessor;
+
+   @Inject @PayBy(PaymentMethod.OTHER) AsynchronousPaymentProcessor otherPaymentProcessor2;
+
+   @Inject @PayBy(org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.OTHER) AsynchronousPaymentProcessor otherPaymentProcessor3;
+
+   @Inject @PayBy(PaymentMethod.CREDIT_CARD) AsynchronousPaymentProcessor unresolvedCreditCardPaymentProcessor;
+
+   @Inject @PayBy(CREDIT_CARD) AsynchronousPaymentProcessor unresolvedCreditCardPaymentProcessor2;
+
+   @Inject @PayBy(org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.CREDIT_CARD) AsynchronousPaymentProcessor unresolvedCreditCardPaymentProcessor3;
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/ObtainsInstanceBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/OtherPaymentProcessor.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/OtherPaymentProcessor.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/OtherPaymentProcessor.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import javax.enterprise.context.ApplicationScoped;
+
+ at PayBy(org.jboss.jsr299.tck.tests.jbt.resolution.PayBy.PaymentMethod.OTHER)
+ at ApplicationScoped
+class OtherPaymentProcessor implements AsynchronousPaymentProcessor {
+   private int value = 0;
+
+   public int getValue() {
+      return value;
+   }
+
+   public void setValue(int value) {
+      this.value = value;
+   }
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/OtherPaymentProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PayBy.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PayBy.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PayBy.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,23 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface PayBy {
+   public static enum PaymentMethod { CASH, CHEQUE, CREDIT_CARD, OTHER };
+
+   PaymentMethod value();
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PayBy.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PaymentProcessor.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PaymentProcessor.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PaymentProcessor.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.jsr299.tck.tests.jbt.resolution;
+
+interface PaymentProcessor
+{
+}


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/PaymentProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java	2010-06-21 15:52:18 UTC (rev 22915)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -26,6 +26,7 @@
 import org.jboss.tools.cdi.core.test.tck.NameDefinitionTest;
 import org.jboss.tools.cdi.core.test.tck.ProducerMethodDefinitionTest;
 import org.jboss.tools.cdi.core.test.tck.QualifierDefinitionTest;
+import org.jboss.tools.cdi.core.test.tck.QualifierWithMembersTest;
 import org.jboss.tools.cdi.core.test.tck.ResolutionByTypeTest;
 import org.jboss.tools.cdi.core.test.tck.ScopeDefinitionTest;
 import org.jboss.tools.cdi.core.test.tck.StereotypeDefinitionTest;
@@ -58,6 +59,7 @@
 		suite.addTestSuite(ResolutionByTypeTest.class);
 		suite.addTestSuite(EnterpriseResolutionByTypeTest.class);
 		suite.addTestSuite(AssignabilityOfRawAndParameterizedTypesTest.class);
+		suite.addTestSuite(QualifierWithMembersTest.class);
 		suite.addTestSuite(ValidationTest.class);
 		return new CDICoreTestSetup(suite);
 	}

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierWithMembersTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierWithMembersTest.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierWithMembersTest.java	2010-06-21 16:32:30 UTC (rev 22916)
@@ -0,0 +1,104 @@
+/******************************************************************************* 
+ * Copyright (c) 2010 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.cdi.core.test.tck;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class QualifierWithMembersTest extends TCKTest {
+
+	public void testQualifierWithStaticImportInInjectingBeanAndNonStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "chequePaymentProcessor");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.AdvancedPaymentProcessor");
+	}
+
+	public void testQualifierWithNonStaticImportInInjectingBeanAndNonStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "chequePaymentProcessor2");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.AdvancedPaymentProcessor");
+	}
+
+	public void testQualifierWithoutImportInInjectingBeanAndNonStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "chequePaymentProcessor3");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.AdvancedPaymentProcessor");
+	}
+
+	public void testQualifierWithStaticImportInInjectingBeanAndStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "cashPaymentProcessor");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.CashPaymentProcessor");
+	}
+
+	public void testQualifierWithNonStaticImportInInjectingBeanAndStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "cashPaymentProcessor2");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.CashPaymentProcessor");
+	}
+
+	public void testQualifierWithoutImportInInjectingBeanAndStaticInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "cashPaymentProcessor3");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.CashPaymentProcessor");
+	}
+
+	public void testQualifierWithStaticImportInInjectingBeanAndWithoutImportInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "otherPaymentProcessor");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.OtherPaymentProcessor");
+	}
+
+	public void testQualifierWithNonStaticImportInInjectingBeanAndWithoutImportInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "otherPaymentProcessor2");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.OtherPaymentProcessor");
+	}
+
+	public void testQualifierWithoutImportInInjectingBeanAndWithoutImportInInjectedBeanResolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "otherPaymentProcessor3");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 1, beans.size());
+		assertContainsBeanClass(beans, "org.jboss.jsr299.tck.tests.jbt.resolution.OtherPaymentProcessor");
+	}
+
+	public void testQualifierWithNonStaticImportInInjectingBeanUnresolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "unresolvedCreditCardPaymentProcessor");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 0, beans.size());
+	}
+
+	public void testQualifierWithStaticImportInInjectingBeanUnresolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "unresolvedCreditCardPaymentProcessor2");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 0, beans.size());
+	}
+
+	public void testQualifierWithoutImportInInjectingBeanUnresolved() throws CoreException {
+		IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/ObtainsInstanceBean.java", "unresolvedCreditCardPaymentProcessor3");
+		Set<IBean> beans = cdiProject.getBeans(true, injection);
+		assertEquals("Wrong number of the beans", 0, beans.size());
+	}
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierWithMembersTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list