[jbosstools-commits] JBoss Tools SVN: r39598 - trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Mar 16 21:11:12 EDT 2012


Author: akazakov
Date: 2012-03-16 21:11:12 -0400 (Fri, 16 Mar 2012)
New Revision: 39598

Added:
   trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/JBTValidationTestException.java
Modified:
   trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionLogger.java
   trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionTest.java
Log:
Fixed org.jboss.tools.cdi.test.launcher tests

Added: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/JBTValidationTestException.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/JBTValidationTestException.java	                        (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/JBTValidationTestException.java	2012-03-17 01:11:12 UTC (rev 39598)
@@ -0,0 +1,23 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 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.common.base.test.validation;
+
+import org.jboss.tools.common.validation.JBTValidationException;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JBTValidationTestException extends JBTValidationException {
+
+	public JBTValidationTestException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}
\ No newline at end of file


Property changes on: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/JBTValidationTestException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionLogger.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionLogger.java	2012-03-17 00:34:57 UTC (rev 39597)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionLogger.java	2012-03-17 01:11:12 UTC (rev 39598)
@@ -42,10 +42,14 @@
 	}
 
 	public Set<IStatus> getExceptions() {
+		return getExceptions(true);
+	}
+
+	public Set<IStatus> getExceptions(boolean ignoreTestExceptions) {
 		Set<IStatus> result = new HashSet<IStatus>();
 		for (IStatus status : exceptions) {
 			Throwable exception = status.getException();
-			if(exception instanceof JBTValidationException) {
+			if(exception instanceof JBTValidationException && (!ignoreTestExceptions || !(exception instanceof JBTValidationTestException))) {
 				result.add(status);
 			}
 		}

Modified: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionTest.java	2012-03-17 00:34:57 UTC (rev 39597)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/ValidationExceptionTest.java	2012-03-17 01:11:12 UTC (rev 39598)
@@ -16,7 +16,6 @@
 
 import org.eclipse.core.runtime.IStatus;
 import org.jboss.tools.common.validation.CommonValidationPlugin;
-import org.jboss.tools.common.validation.JBTValidationException;
 
 /**
  * @author Alexey Kazakov
@@ -32,17 +31,19 @@
 
 	public static void assertExceptionsIsEmpty(ValidationExceptionLogger logger) throws Exception {
 		Set<IStatus> exceptions = logger.getExceptions();
-		StringBuffer error = new StringBuffer("The following exceptions were thrown during project validation:");
+		StringBuffer error = new StringBuffer("The following exceptions were thrown during project validation: [");
 		for (IStatus status : exceptions) {
+			error.append("\r\n").append(status.toString()).append(":");
 			Throwable cause = status.getException().getCause();
-			error.append("\r\n").append(status.toString()).append(":");
 			if(cause!=null) {
 				error.append(cause.toString()).append(":");
 				if(cause.getStackTrace()!=null && cause.getStackTrace().length>0) {
 					error.append(cause.getStackTrace()[0].toString());
 				}
 			}
+			error.append(";\r\n");
 		}
+		error.append("]");
 		assertTrue(error.toString(), exceptions.isEmpty());
 	}
 
@@ -52,8 +53,8 @@
 
 	public void testLogging() {
 		ValidationExceptionLogger logger = new ValidationExceptionLogger();
-		CommonValidationPlugin.getDefault().logError(new JBTValidationException("Test logging", null));
-		Set<IStatus> exceptions = logger.getExceptions();
+		CommonValidationPlugin.getDefault().logError(new JBTValidationTestException("Test logging", null));
+		Set<IStatus> exceptions = logger.getExceptions(false);
 		assertEquals(1, exceptions.size());
 	}
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list