Author: scabanovich
Date: 2011-06-09 19:19:41 -0400 (Thu, 09 Jun 2011)
New Revision: 31996
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic2/DurableQueueConfiguration.wrongtype
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanValidationTest.java
Log:
JBIDE-8695
https://issues.jboss.org/browse/JBIDE-8695
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic2/DurableQueueConfiguration.wrongtype
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic2/DurableQueueConfiguration.wrongtype
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic2/DurableQueueConfiguration.wrongtype 2011-06-09
23:19:41 UTC (rev 31996)
@@ -0,0 +1,17 @@
+package org.jboss.generic2;
+
+import javax.enterprise.context.ConversationScoped;
+
+import org.jboss.seam.solder.core.Veto;
+
+//@Veto
+@Durable
+@ConversationScoped
+@ACMEQueue("durableQueue")
+public class DurableQueueConfiguration extends Object {
+
+ public DurableQueueConfiguration() {
+// super(null);
+ this.durable = true;
+ }
+}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java 2011-06-09
23:18:45 UTC (rev 31995)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java 2011-06-09
23:19:41 UTC (rev 31996)
@@ -10,17 +10,13 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.solder.core.test;
-import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IBean;
@@ -32,9 +28,6 @@
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.seam.solder.core.generic.GenericBeanProducerMethod;
import org.jboss.tools.cdi.seam.solder.core.generic.GenericClassBean;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ResourcesUtils;
/**
*
@@ -224,7 +217,7 @@
* Replace DurableQueueConfiguration.java with vetoed version.
* After that there are only 2 configurations.
*/
- replaceFile("src/org/jboss/generic2/DurableQueueConfiguration.vetoed",
+ replaceFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.vetoed",
"src/org/jboss/generic2/DurableQueueConfiguration.java");
beanToBeVetoed = null;
@@ -248,7 +241,7 @@
* Set original DurableQueueConfiguration.java back.
* Make sure that there are again 3 configurations.
*/
- replaceFile("src/org/jboss/generic2/DurableQueueConfiguration.original",
+ replaceFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.original",
"src/org/jboss/generic2/DurableQueueConfiguration.java");
beanToBeVetoed = null;
@@ -270,22 +263,8 @@
assertNotNull(beanToBeVetoed);
}
- void replaceFile(String sourcePath, String targetPath) throws CoreException {
- boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
- try {
- IFile target = project.getFile(new Path(targetPath));
- assertTrue(target.exists());
- IFile source = project.getFile(new Path(sourcePath));
- assertTrue(target.exists());
- target.setContents(source.getContents(), true, false, new NullProgressMonitor());
- JobUtils.waitForIdle();
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
NullProgressMonitor());
- JobUtils.waitForIdle();
- } finally {
- ResourcesUtils.setBuildAutomatically(saveAutoBuild);
- JobUtils.waitForIdle();
- }
+ static void replaceFile(IProject project, String sourcePath, String targetPath) throws
CoreException {
+ GenericBeanValidationTest.writeFile(project, sourcePath, targetPath);
}
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanValidationTest.java 2011-06-09
23:18:45 UTC (rev 31995)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanValidationTest.java 2011-06-09
23:19:41 UTC (rev 31996)
@@ -11,11 +11,13 @@
package org.jboss.tools.cdi.seam.solder.core.test;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
+import org.jboss.tools.cdi.seam.solder.core.validation.SeamSolderValidationMessages;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -52,7 +54,7 @@
* Set original DurableQueueConfiguration.java back.
* After that there are only 2 configurations, with different qualifiers.
*/
- writeFile("src/org/jboss/generic2/DurableQueueConfiguration.original",
+ writeFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.original",
"src/org/jboss/generic2/DurableQueueConfiguration.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS + ".*", 15);
@@ -74,7 +76,7 @@
* Replace DurableQueueConfiguration.java with not generic version.
* After that there are only 2 configurations.
*/
- writeFile("src/org/jboss/generic2/DurableQueueConfiguration.notgeneric",
+ writeFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.notgeneric",
"src/org/jboss/generic2/DurableQueueConfiguration.java");
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS + ".*");
@@ -83,13 +85,41 @@
* Set original DurableQueueConfiguration.java back.
* Assert that MessageLogger again has error marker.
*/
- writeFile("src/org/jboss/generic2/DurableQueueConfiguration.original",
+ writeFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.original",
"src/org/jboss/generic2/DurableQueueConfiguration.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS + ".*", 15);
}
- void writeFile(String sourcePath, String targetPath) throws CoreException {
+ public void testWrongTypeOfGenericPointConfiguration() throws CoreException {
+ /*
+ * Generic configuration point DurableQueueConfiguration has correct type.
+ */
+ IFile file = project.getFile(new
Path("src/org/jboss/generic2/DurableQueueConfiguration.java"));
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
SeamSolderValidationMessages.WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT + ".*");
+
+
+ /*
+ * Remove DurableQueueConfiguration.java with vetoed version.
+ * Generic configuration point DurableQueueConfiguration has incorrect type.
+ */
+ writeFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.wrongtype",
+ "src/org/jboss/generic2/DurableQueueConfiguration.java");
+
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
SeamSolderValidationMessages.WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT + ".*",
11);
+
+ /*
+ * Set original DurableQueueConfiguration.java back.
+ * Generic configuration point DurableQueueConfiguration has correct type.
+ */
+ writeFile(project,
"src/org/jboss/generic2/DurableQueueConfiguration.original",
+ "src/org/jboss/generic2/DurableQueueConfiguration.java");
+
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
SeamSolderValidationMessages.WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT + ".*");
+ }
+
+
+ static void writeFile(IProject project, String sourcePath, String targetPath) throws
CoreException {
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
JobUtils.waitForIdle();
try {