moved the code to make tests run in one thread on Mac to the parent pom

Change-Id: I91255856046a499f99a130becee2b8b22b3b1b16
diff --git a/org.eclipse.capra.handler.cdt.tests/pom.xml b/org.eclipse.capra.handler.cdt.tests/pom.xml
index 8a79f32..00a61e5 100644
--- a/org.eclipse.capra.handler.cdt.tests/pom.xml
+++ b/org.eclipse.capra.handler.cdt.tests/pom.xml
@@ -21,7 +21,7 @@
 		<artifactId>parent</artifactId>
 		<version>0.7.0-SNAPSHOT</version>
 	</parent>
-
+	
 	<artifactId>org.eclipse.capra.handler.cdt.tests</artifactId>
 	<packaging>eclipse-test-plugin</packaging>
 
diff --git a/org.eclipse.capra.handler.jdt.tests/pom.xml b/org.eclipse.capra.handler.jdt.tests/pom.xml
index 2a11fd0..405407b 100644
--- a/org.eclipse.capra.handler.jdt.tests/pom.xml
+++ b/org.eclipse.capra.handler.jdt.tests/pom.xml
@@ -21,7 +21,7 @@
 		<artifactId>parent</artifactId>
 		<version>0.7.0-SNAPSHOT</version>
 	</parent>
-
+	
 	<artifactId>org.eclipse.capra.handler.jdt.tests</artifactId>
 	<packaging>eclipse-test-plugin</packaging>
 
diff --git a/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java b/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java
index 89b65da..5e3eca7 100644
--- a/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java
+++ b/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java
@@ -10,8 +10,10 @@
  *******************************************************************************/
 package org.eclipse.capra.handler.jdt;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.UUID;
 
 import org.eclipse.capra.core.adapters.ArtifactMetaModelAdapter;
 import org.eclipse.capra.core.adapters.TracePersistenceAdapter;
@@ -22,6 +24,7 @@
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@@ -32,9 +35,12 @@
 import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.launching.StandardVMType;
 import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
 import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.jdt.launching.LibraryLocation;
+import org.eclipse.jdt.launching.VMStandin;
 import org.junit.Before;
 
 public class TestUtil {
@@ -60,14 +66,27 @@
 		IFolder binFolder = project.getFolder("bin");
 		javaProject.setOutputLocation(binFolder.getFullPath(), null);
 
-		// Set classpath
+		// Manually set Java Runtime Environment to make sure it is not null
+		// even for Mac OS where the default is not set
+		@SuppressWarnings("restriction")
+		final IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
+		String id = UUID.randomUUID().toString();
+		VMStandin newVm = new VMStandin(vmInstallType, id);
+		newVm.setName("Default-VM");
+		String javaHome = System.getProperty("java.home");
+		File installLocation = new File(javaHome);
+		newVm.setInstallLocation(installLocation);
+		IVMInstall realVm = newVm.convertToRealVM();
+		JavaRuntime.setDefaultVMInstall(realVm, new NullProgressMonitor());
+
 		List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+		// add libs to project class path
 		IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
 		LibraryLocation[] locations = JavaRuntime.getLibraryLocations(vmInstall);
 		for (LibraryLocation element : locations) {
 			entries.add(JavaCore.newLibraryEntry(element.getSystemLibraryPath(), null, null));
 		}
-		// add libs to project class path
+		// Set classpath
 		javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
 
 		// Create source folder
diff --git a/org.eclipse.capra.testsuite/pom.xml b/org.eclipse.capra.testsuite/pom.xml
index 0c80162..d6bc3f5 100644
--- a/org.eclipse.capra.testsuite/pom.xml
+++ b/org.eclipse.capra.testsuite/pom.xml
@@ -17,47 +17,7 @@
 		<artifactId>parent</artifactId>
 		<version>0.7.0-SNAPSHOT</version>
 	</parent>
-
-	<properties>
-		<os-jvm-flags /> <!-- for the default case -->
-	</properties>
-
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.eclipse.tycho</groupId>
-				<artifactId>tycho-surefire-plugin</artifactId>
-				<version>${tycho-version}</version>
-				<configuration>
-					<useUIHarness>true</useUIHarness>
-					<useUIThread>true</useUIThread>
-					<argLine>${os-jvm-flags}</argLine>
-					<dependencies>
-						<dependency>
-							<type>eclipse-plugin</type>
-							<artifactId>org.eclipse.equinox.event</artifactId>
-							<version>0.0.0</version>
-						</dependency>
-					</dependencies>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-
-	<profiles>
-		<profile>
-			<id>macosx-jvm-flags</id>
-			<activation>
-				<os>
-					<family>mac</family>
-				</os>
-			</activation>
-			<properties>
-				<os-jvm-flags>-XstartOnFirstThread</os-jvm-flags>
-			</properties>
-		</profile>
-	</profiles>
-
+	
 	<artifactId>org.eclipse.capra.testsuite</artifactId>
 	<packaging>eclipse-test-plugin</packaging>
 
diff --git a/pom.xml b/pom.xml
index 6f25a2e..1f74cb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,128 +1,147 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-    Copyright (c) 2016 Chalmers | University of Gothenburg, rt-labs and others.
-    All rights reserved. This program and the accompanying materials
-    are 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
+	Copyright (c) 2016 Chalmers | University of Gothenburg, rt-labs and others.
+	All rights reserved. This program and the accompanying materials
+	are 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:
-         Chalmers | University of Gothenburg and rt-labs - initial API and implementation and/or initial documentation
-         -->
+	Contributors:
+		Chalmers | University of Gothenburg and rt-labs - initial API and implementation and/or initial documentation
+-->
 
 <project
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.eclipse.capra</groupId>
-  <artifactId>parent</artifactId>
-  <version>0.7.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
+	<groupId>org.eclipse.capra</groupId>
+	<artifactId>parent</artifactId>
+	<version>0.7.0-SNAPSHOT</version>
+	<packaging>pom</packaging>
 
-  <modules>
-    <module>org.eclipse.capra.core</module>
-    <module>org.eclipse.capra.documentation</module>
-    <module>org.eclipse.capra.feature</module>
-    <module>org.eclipse.capra.generic.persistence</module>
-    <module>org.eclipse.capra.generic.priority</module>
-    <module>org.eclipse.capra.generic.tracemodels</module>
-    <module>org.eclipse.capra.handler.cdt</module>
-    <module>org.eclipse.capra.handler.cdt.tests</module>
-    <module>org.eclipse.capra.handler.emf</module>
-    <module>org.eclipse.capra.handler.file</module>
-    <module>org.eclipse.capra.handler.gef</module>
-    <module>org.eclipse.capra.handler.hudson</module>
-    <module>org.eclipse.capra.handler.jdt</module>
-    <module>org.eclipse.capra.handler.jdt.tests</module>
-    <module>org.eclipse.capra.handler.mylyn</module>
-    <module>org.eclipse.capra.handler.papyrus</module>
-    <module>org.eclipse.capra.handler.reqIf</module>
-    <module>org.eclipse.capra.testsuite</module>
-    <module>org.eclipse.capra.ui</module>
-    <module>org.eclipse.capra.ui.notification</module>
-    <module>org.eclipse.capra.ui.plantuml</module>
-    <module>org.eclipse.capra.releng.target</module>
-    <module>org.eclipse.capra.releng.p2</module>
-  </modules>
+	<modules>
+		<module>org.eclipse.capra.core</module>
+		<module>org.eclipse.capra.documentation</module>
+		<module>org.eclipse.capra.feature</module>
+		<module>org.eclipse.capra.generic.persistence</module>
+		<module>org.eclipse.capra.generic.priority</module>
+		<module>org.eclipse.capra.generic.tracemodels</module>
+		<module>org.eclipse.capra.handler.cdt</module>
+		<module>org.eclipse.capra.handler.cdt.tests</module>
+		<module>org.eclipse.capra.handler.emf</module>
+		<module>org.eclipse.capra.handler.file</module>
+		<module>org.eclipse.capra.handler.gef</module>
+		<module>org.eclipse.capra.handler.hudson</module>
+		<module>org.eclipse.capra.handler.jdt</module>
+		<module>org.eclipse.capra.handler.jdt.tests</module>
+		<module>org.eclipse.capra.handler.mylyn</module>
+		<module>org.eclipse.capra.handler.papyrus</module>
+		<module>org.eclipse.capra.handler.reqIf</module>
+		<module>org.eclipse.capra.testsuite</module>
+		<module>org.eclipse.capra.ui</module>
+		<module>org.eclipse.capra.ui.notification</module>
+		<module>org.eclipse.capra.ui.plantuml</module>
+		<module>org.eclipse.capra.releng.target</module>
+		<module>org.eclipse.capra.releng.p2</module>
+	</modules>
 
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <tycho-version>0.24.0</tycho-version>
-  </properties>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<tycho-version>0.24.0</tycho-version>
+	</properties>
 
-  <profiles>
-  </profiles>
+	<profiles>
+		<profile>
+			<id>macosx-jvm-flags</id>
+			<activation>
+				<os>
+					<family>mac</family>
+				</os>
+			</activation>
+			<properties>
+				<os-jvm-flags>-XstartOnFirstThread</os-jvm-flags>
+			</properties>
+		</profile>
+	</profiles>
 
-  <repositories>
-    <repository>
-      <id>license-feature</id>
-      <url>http://download.eclipse.org/cbi/updates/license/</url>
-      <layout>p2</layout>
-    </repository>
-  </repositories>
+	<repositories>
+		<repository>
+			<id>license-feature</id>
+			<url>http://download.eclipse.org/cbi/updates/license/</url>
+			<layout>p2</layout>
+		</repository>
+	</repositories>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.eclipse.tycho</groupId>
-        <artifactId>tycho-maven-plugin</artifactId>
-        <version>${tycho-version}</version>
-        <extensions>true</extensions>
-      </plugin>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-maven-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<extensions>true</extensions>
+			</plugin>
 
-      <!-- Only required if tests need UI -->
-      <plugin>
-        <groupId>org.eclipse.tycho</groupId>
-        <artifactId>tycho-surefire-plugin</artifactId>
-        <version>${tycho-version}</version>
-        <configuration>
-          <useUIHarness>true</useUIHarness>
-        </configuration>
-      </plugin>
+			<!-- Only required if tests need UI -->
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-surefire-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<configuration>
+					<useUIHarness>true</useUIHarness>
+					<useUIThread>true</useUIThread>
+					<argLine>${os-jvm-flags}</argLine>
+					<dependencies>
+						<dependency>
+							<type>eclipse-plugin</type>
+							<artifactId>org.eclipse.equinox.event</artifactId>
+							<version>0.0.0</version>
+						</dependency>
+					</dependencies>
+				</configuration>
+			</plugin>
 
-      <plugin>
-        <groupId>org.eclipse.tycho</groupId>
-        <artifactId>target-platform-configuration</artifactId>
-        <version>${tycho-version}</version>
-        <configuration>
-          <target>
-            <artifact>
-              <groupId>org.eclipse.capra</groupId>
-              <artifactId>org.eclipse.capra.releng.target</artifactId>
-              <version>0.7.0-SNAPSHOT</version>
-            </artifact>
-          </target>
-          <environments>
-            <environment>
-              <os>win32</os>
-              <ws>win32</ws>
-              <arch>x86</arch>
-            </environment>
-            <environment>
-              <os>win32</os>
-              <ws>win32</ws>
-              <arch>x86_64</arch>
-            </environment>
-            <environment>
-              <os>linux</os>
-              <ws>gtk</ws>
-              <arch>x86</arch>
-            </environment>
-            <environment>
-              <os>linux</os>
-              <ws>gtk</ws>
-              <arch>x86_64</arch>
-            </environment>
-            <environment>
-              <os>macosx</os>
-              <ws>cocoa</ws>
-              <arch>x86_64</arch>
-            </environment>
-          </environments>
-        </configuration>
-      </plugin>
-
-    </plugins>
-  </build>
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>target-platform-configuration</artifactId>
+				<version>${tycho-version}</version>
+				<configuration>
+					<target>
+						<artifact>
+							<groupId>org.eclipse.capra</groupId>
+							<artifactId>org.eclipse.capra.releng.target</artifactId>
+							<version>0.7.0-SNAPSHOT</version>
+						</artifact>
+					</target>
+					<environments>
+						<environment>
+							<os>win32</os>
+							<ws>win32</ws>
+							<arch>x86</arch>
+						</environment>
+						<environment>
+							<os>win32</os>
+							<ws>win32</ws>
+							<arch>x86_64</arch>
+						</environment>
+						<environment>
+							<os>linux</os>
+							<ws>gtk</ws>
+							<arch>x86</arch>
+						</environment>
+						<environment>
+							<os>linux</os>
+							<ws>gtk</ws>
+							<arch>x86_64</arch>
+						</environment>
+						<environment>
+							<os>macosx</os>
+							<ws>cocoa</ws>
+							<arch>x86_64</arch>
+						</environment>
+					</environments>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
 </project>