[jbosstools-commits] JBoss Tools SVN: r43835 - in trunk/as/tests/org.jboss.tools.as.test.core: src/org/jboss/tools/as/test/core/internal/utils/classpath and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 19 12:22:27 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-19 12:22:27 -0400 (Wed, 19 Sep 2012)
New Revision: 43835

Modified:
   trunk/as/tests/org.jboss.tools.as.test.core/plugin.xml
   trunk/as/tests/org.jboss.tools.as.test.core/src/org/jboss/tools/as/test/core/internal/utils/classpath/ASToolsInternalVariableInitializer.java
Log:
Unit test errors required changes to the unit test plugin

Modified: trunk/as/tests/org.jboss.tools.as.test.core/plugin.xml
===================================================================
(Binary files differ)

Modified: trunk/as/tests/org.jboss.tools.as.test.core/src/org/jboss/tools/as/test/core/internal/utils/classpath/ASToolsInternalVariableInitializer.java
===================================================================
--- trunk/as/tests/org.jboss.tools.as.test.core/src/org/jboss/tools/as/test/core/internal/utils/classpath/ASToolsInternalVariableInitializer.java	2012-09-19 16:05:59 UTC (rev 43834)
+++ trunk/as/tests/org.jboss.tools.as.test.core/src/org/jboss/tools/as/test/core/internal/utils/classpath/ASToolsInternalVariableInitializer.java	2012-09-19 16:22:27 UTC (rev 43835)
@@ -10,16 +10,56 @@
  ******************************************************************************/
 package org.jboss.tools.as.test.core.internal.utils.classpath;
 
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ClasspathVariableInitializer;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.tools.as.test.core.ASMatrixTests;
+import org.jboss.tools.as.test.core.internal.utils.BundleUtils;
+
 /**
  * @author Rob Stryker
  *
  */
-public class ASToolsInternalVariableInitializer {
+public class ASToolsInternalVariableInitializer extends ClasspathVariableInitializer {
 
-	public static final String ASTOOLS_TEST_HOME_VAR = "JUNIT_HOME";
+	public static final String ASTOOLS_TEST_HOME_VAR = "ASTOOLS_TEST_HOME";
 
+	private static final String twiddle_suffix = ".mf.twiddle.jar";
+	private static final String twiddle_3_2_8 = "3.2.8" + twiddle_suffix;
+
 	public static void ensureFoldersCreated() {
-		// TODO Auto-generated method stub
+		IPath jarFolder = getPath();
+		jarFolder.toFile().mkdirs();
+		
+		try {
+			File source = BundleUtils.getFileLocation("serverMock/" + twiddle_3_2_8);
+			File dest = jarFolder.append("junit.jar").toFile();
+			FileUtil.fileSafeCopy(source, dest);
+		} catch(CoreException ce) {
+			ce.printStackTrace();
+		}
 	}
-
+	
+	public void initialize(String variable) {
+		ensureFoldersCreated();
+		if( variable.equals(ASTOOLS_TEST_HOME_VAR)) {
+			IPath newPath = getPath();
+			try {
+				JavaCore.setClasspathVariable(variable, newPath, new NullProgressMonitor());
+			} catch(JavaModelException jme) {
+				jme.printStackTrace();
+			}
+		}
+	}
+	protected static IPath getPath() {
+		IPath state = ASMatrixTests.getDefault().getStateLocation();
+		IPath jarFolder = state.append(".astools_test");
+		return jarFolder;
+	}
 }



More information about the jbosstools-commits mailing list