Author: scabanovich
Date: 2011-10-07 15:14:02 -0400 (Fri, 07 Oct 2011)
New Revision: 35478
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean1.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/Validation.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/SeamServletValidationTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
Log:
JBIDE-9852
https://issues.jboss.org/browse/JBIDE-9852
Tests for seam servlet migrated to 3.1.
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean1.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean1.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean1.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -0,0 +1,5 @@
+package org.jboss.servlet;
+
+public class MyBean1 {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean2.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -0,0 +1,5 @@
+package org.jboss.servlet;
+
+public class MyBean2 extends MyBean1 {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyBean2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyQualifier.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyQualifier.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyQualifier.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -0,0 +1,21 @@
+package org.jboss.servlet;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface MyQualifier {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/MyQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/Validation.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/Validation.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/Validation.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -0,0 +1,44 @@
+package org.jboss.servlet;
+
+import javax.inject.Inject;
+
+import org.jboss.solder.servlet.http.CookieParam;
+import org.jboss.solder.servlet.http.DefaultValue;
+import org.jboss.solder.servlet.http.HeaderParam;
+import org.jboss.solder.servlet.http.RequestParam;
+
+public class Validation {
+
+ @Inject @RequestParam("id") @MyQualifier String bookId;
+ @Inject @RequestParam @MyQualifier String id;
+ @Inject @RequestParam @DefaultValue("25") String pageSize;
+ @Inject @HeaderParam("User-Agent") @MyQualifier String userAgent;
+ @Inject @HeaderParam @MyQualifier String userAgent2;
+ @Inject @HeaderParam @DefaultValue("25") @MyQualifier String userAgent3;
+ @Inject @CookieParam("User-Agent") String userAgent4;
+ @Inject @CookieParam @MyQualifier String userAgent5;
+ @Inject @CookieParam @DefaultValue("25") @MyQualifier String userAgent6;
+ @Inject @RequestParam("id") MyBean1 bookId1;
+ @Inject @RequestParam MyBean1 id1;
+ @Inject @RequestParam @DefaultValue("25") MyBean1 pageSize1;
+ @Inject @HeaderParam("User-Agent") MyBean1 userAgent7;
+ @Inject @HeaderParam MyBean1 userAgent8;
+ @Inject @HeaderParam @DefaultValue("25") MyBean1 userAgent9;
+ @Inject @CookieParam("User-Agent") MyBean1 userAgent10;
+ @Inject @CookieParam MyBean1 userAgent11;
+ @Inject @CookieParam @DefaultValue("25") MyBean1 userAgent12;
+ @Inject @RequestParam public void setMyBeanOk(MyBean1 bean, @MyQualifier String bean2)
{}
+ @Inject @RequestParam("id") public void setMyBeanOk1(MyBean1 bean,
@MyQualifier String bean2) {}
+ @Inject @RequestParam @DefaultValue("25") public void setMyBeanOk2(MyBean1
bean, @MyQualifier String bean2) {}
+ @Inject @HeaderParam public void setMyBeanOk3(MyBean1 bean, @MyQualifier String bean2)
{}
+ @Inject @HeaderParam("id") public void setMyBeanOk4(MyBean1 bean, String
bean2) {}
+ @Inject @HeaderParam @DefaultValue("25") public void setMyBeanOk5(MyBean1
bean, @MyQualifier String bean2) {}
+ @Inject @CookieParam public void setMyBeanOk6(MyBean1 bean, @MyQualifier String bean2)
{}
+ @Inject @CookieParam("id") public void setMyBeanOk7(MyBean1 bean, @MyQualifier
String bean2) {}
+ @Inject @CookieParam @DefaultValue("25") public void setMyBeanOk8(MyBean1
bean, @MyQualifier String bean2) {}
+
+ @Inject MyBean1 beanBroken;
+ @Inject @MyQualifier String bean2Broken;
+ @Inject public void setMyBeanBroken(MyBean1 bean) {}
+ @Inject public void setMyBeanBroken(@MyQualifier String bean) {}
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/servlet/Validation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-10-07
19:13:28 UTC (rev 35477)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -47,6 +47,7 @@
suite31.addTestSuite(ServiceHandlerTest.class);
suite31.addTestSuite(DefaultBeanTest.class);
suite31.addTestSuite(UnwrapsTest.class);
+ suite31.addTestSuite(SeamServletValidationTest.class);
suiteAll.addTest(suite);
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/SeamServletValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/SeamServletValidationTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/SeamServletValidationTest.java 2011-10-07
19:14:02 UTC (rev 35478)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.seam.solder.core.test;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SeamServletValidationTest extends SeamSolderTest {
+
+ /**
+ * CDI validator should ignore injection points annotated
@RequestParam/@HeaderParam/@CookieParam
+ * See
https://issues.jboss.org/browse/JBIDE-9389
+ * @throws Exception
+ */
+ public void testInjectionValidationForField() throws Exception {
+ IFile file =
getTestProject().getFile("src/org/jboss/servlet/Validation.java");
+ for (int i = 12; i < 30; i++) {
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, i);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, i);
+ }
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 40, 42);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 41, 43);
+ }
+
+ /**
+ * CDI validator should ignore injection points annotated
@RequestParam/@HeaderParam/@CookieParam
+ * See
https://issues.jboss.org/browse/JBIDE-9389
+ * @throws Exception
+ */
+ public void testInjectionValidationForParam() throws Exception {
+ IFile file =
getTestProject().getFile("src/org/jboss/servlet/Validation.java");
+ for (int i = 30; i < 39; i++) {
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, i);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, i);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/SeamServletValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain