Author: akazakov
Date: 2011-07-29 02:22:00 -0400 (Fri, 29 Jul 2011)
New Revision: 33343
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTestSuite.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/NPEValidation.java
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/tck/validation/ValidationExceptionTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
Log:
https://issues.jboss.org/browse/JBIDE-9423
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/NPEValidation.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/NPEValidation.java 2011-07-29
05:44:56 UTC (rev 33342)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/NPEValidation.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -1,12 +1,17 @@
package org.jboss.jsr299.tck.tests.jbt.validation;
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
-public class NPEValidation extends UnResolvedClass implements UnResolvedInterface {
+@Decorator
+public class NPEValidation extends UnResolvedClass {
- @Inject UnResolvedType t;
+ @Inject @Delegate String t;
+ @Inject UnResolvedType t1;
+
@Inject
public UnResolvedType set(UnResolvedType p) {
}
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 2011-07-29
05:44:56 UTC (rev 33342)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -56,6 +56,7 @@
import org.jboss.tools.cdi.core.test.tck.validation.DisableCDISupportTest;
import org.jboss.tools.cdi.core.test.tck.validation.ELValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.IncrementalValidationTest;
+import org.jboss.tools.cdi.core.test.tck.validation.ValidationExceptionTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
@@ -67,7 +68,8 @@
// it could be done here because it is not needed to be enabled back
JavaModelManager.getIndexManager().disable();
-// ValidationExceptionTestSuite suiteAll = new ValidationExceptionTestSuite("CDI
Core Tests");
+ ValidationExceptionTest.initLogger();
+
TestSuite suiteAll = new TestSuite("CDI Core Tests");
suiteAll.addTestSuite(TypeTest.class);
TestSuite suite = new TestSuite("TCK Tests");
@@ -133,7 +135,7 @@
suiteAll.addTestSuite(DisableCDISupportTest.class);
-// suiteAll.addTestSuite(ValidationExceptionTest.class); // This test should be added
last!
+ suiteAll.addTestSuite(ValidationExceptionTest.class); // This test should be added
last!
return suiteAll;
}
}
\ No newline at end of file
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.core.test.tck.validation;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.validation.KBValidationException;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationExceptionLogger implements ILogListener {
+
+ private Map<String, Set<IStatus>> exceptions = new HashMap<String,
Set<IStatus>>();
+
+ public ValidationExceptionLogger() {
+ Platform.addLogListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus,
java.lang.String)
+ */
+ public void logging(IStatus status, String plugin) {
+ String id = status.getPlugin();
+ if(id==null) {
+ id = plugin;
+ }
+ Set<IStatus> statuses = exceptions.get(id);
+ if(statuses==null) {
+ statuses = new HashSet<IStatus>();
+ exceptions.put(id, statuses);
+ }
+ statuses.add(status);
+ }
+
+ public boolean hasExceptions() {
+ return !getExceptions().isEmpty();
+ }
+
+ public Set<IStatus> getExceptions() {
+ Set<IStatus> result = new HashSet<IStatus>();
+ Set<IStatus> statuses = exceptions.get(WebKbPlugin.PLUGIN_ID);
+ if(statuses!=null) {
+ for (IStatus status : statuses) {
+ Throwable exception = status.getException();
+ if(exception instanceof KBValidationException) {
+ result.add(status);
+ }
+ }
+ }
+ return result;
+ }
+}
\ 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/validation/ValidationExceptionLogger.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java 2011-07-29
05:44:56 UTC (rev 33342)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -21,11 +21,19 @@
*/
public class ValidationExceptionTest extends TestCase {
+ private static ValidationExceptionLogger LOGGER;
+
+ public static ValidationExceptionLogger initLogger() {
+ LOGGER = new ValidationExceptionLogger();
+ return LOGGER;
+ }
+
public void testExceptions() {
- Set<IStatus> exceptions = ValidationExceptionTestSuite.getExceptions();
+ Set<IStatus> exceptions = LOGGER.getExceptions();
StringBuffer error = new StringBuffer("The following exceptions were thrown during
project validation:");
for (IStatus status : exceptions) {
- error.append("\r\n").append(status.getException().toString());
+ Throwable cause = status.getException().getCause();
+ error.append("\r\n").append(status.toString()).append(":
").append(cause.toString()).append(":
").append(cause.getStackTrace()[0].toString());
}
assertTrue(error.toString(), exceptions.isEmpty());
}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTestSuite.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTestSuite.java 2011-07-29
05:44:56 UTC (rev 33342)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTestSuite.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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.core.test.tck.validation;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.jboss.tools.jst.web.kb.validation.KBValidationException;
-
-/**
- * @author Alexey Kazakov
- */
-public class ValidationExceptionTestSuite extends TestSuite implements ILogListener {
-
- private static Map<String, Set<IStatus>> EXCEPTIONS = new HashMap<String,
Set<IStatus>>();
-
- public ValidationExceptionTestSuite(String name) {
- super(name);
- Platform.addLogListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus,
java.lang.String)
- */
- public void logging(IStatus status, String plugin) {
- Set<IStatus> statuses = EXCEPTIONS.get(plugin);
- if(statuses==null) {
- statuses = new HashSet<IStatus>();
- EXCEPTIONS.put(plugin, statuses);
- }
- statuses.add(status);
- }
-
- public static boolean hasExceptions() {
- return !getExceptions().isEmpty();
- }
-
- public static Set<IStatus> getExceptions() {
- Set<IStatus> result = new HashSet<IStatus>();
- Set<IStatus> statuses = EXCEPTIONS.get(WebKbPlugin.PLUGIN_ID);
- for (IStatus status : statuses) {
- Throwable exception = status.getException();
- if(exception instanceof KBValidationException) {
- result.add(status);
- }
- }
- return result;
- }
-}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-07-29
05:44:56 UTC (rev 33342)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-07-29
06:22:00 UTC (rev 33343)
@@ -25,7 +25,6 @@
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -54,8 +53,6 @@
public static final String RUNNING = "Running"; //$NON-NLS-1$
private static String STATUS = SLEEPING;
- private final IStatus EXCEPTION_STATUS = new Status(IStatus.ERROR,
WebKbPlugin.PLUGIN_ID, 0, "EXCEPTION", null); //$NON-NLS-1$ //$NON-NLS-2$
-
public ValidatorManager() {
super();
}
@@ -114,7 +111,7 @@
} catch(Exception e) {
// We need to catch exceptions and wrap them in KBValidationException to let JUnit
tests catch validation exceptions reported to eclipse log.
WebKbPlugin.getDefault().logError(new KBValidationException(e.getMessage(), e));
- return EXCEPTION_STATUS;
+ return OK_STATUS;
} finally {
STATUS = SLEEPING;
}