Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2015-01-27 04:29:52 -0500
committerAxel Richard2015-01-27 04:29:52 -0500
commitd75ea0d5c7b192ddffbd2c80b38abf05abc47141 (patch)
tree1db0dedbe03d823aed736b14e20e461b898b2b82 /performance
parentf0110ba679b93fd86d5193d8ca4b41e0976bc1b1 (diff)
downloadorg.eclipse.emf.compare-d75ea0d5c7b192ddffbd2c80b38abf05abc47141.tar.gz
org.eclipse.emf.compare-d75ea0d5c7b192ddffbd2c80b38abf05abc47141.tar.xz
org.eclipse.emf.compare-d75ea0d5c7b192ddffbd2c80b38abf05abc47141.zip
Improves git performances tests
Change-Id: I7dc77c0aa593ccc4fd5aa7f83cc448d4fd1a9dcd Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Diffstat (limited to 'performance')
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java68
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java17
2 files changed, 67 insertions, 18 deletions
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java b/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
index c105c9780..2a307f111 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
@@ -17,7 +17,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.compare.ITypedElement;
@@ -26,9 +26,12 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.Activator;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.EList;
@@ -94,9 +97,6 @@ public class DataGit {
private Repository repository;
- private Collection<IProject> importedProjects;
-
-
public DataGit(String zippedRepoLocation, String repoName, String rootProjectName, String modelName) {
try {
this.disposers = new ArrayList<Runnable>();
@@ -111,12 +111,33 @@ public class DataGit {
// Unzip repository to temp directory
GitUtil.unzipRepo(entry, systemTmpDir, new NullProgressMonitor());
- importedProjects = GitUtil.importProjectsFromRepo(repoFile);
+ Job importJob = new Job("ImportProjects") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ GitUtil.importProjectsFromRepo(repoFile);
+ return Status.OK_STATUS;
+ }
+ };
+ importJob.schedule();
+ importJob.join();
- // Connect eclipse projects to egit repository
- File gitDir = new File(repoFile, Constants.DOT_GIT);
- repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir);
- GitUtil.connectProjectsToRepo(repository, importedProjects);
+ Job connectJob = new Job("ConnectProjects") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ // Connect eclipse projects to egit repository
+ File gitDir = new File(repoFile, Constants.DOT_GIT);
+ repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir);
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ GitUtil.connectProjectsToRepo(repository, Arrays.asList(projects));
+ } catch (IOException e) {
+ Throwables.propagate(e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ connectJob.schedule();
+ connectJob.join();
IProject rootProject = ResourcesPlugin.getWorkspace().getRoot().getProject(rootProjectName);
@@ -151,6 +172,8 @@ public class DataGit {
Throwables.propagate(e);
} catch (CoreException e) {
Throwables.propagate(e);
+ } catch (InterruptedException e) {
+ Throwables.propagate(e);
}
}
@@ -225,16 +248,29 @@ public class DataGit {
resourceSets = null;
- try {
- // Close & delete projects from workspace
- for (IProject project : importedProjects) {
- project.close(new NullProgressMonitor());
- project.delete(false, new NullProgressMonitor());
+ Job cleanJob = new Job("ClearWorkspace") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ // Close & delete projects from workspace
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject project : projects) {
+ project.close(new NullProgressMonitor());
+ project.delete(false, new NullProgressMonitor());
+ }
+ } catch (CoreException e) {
+ Throwables.propagate(e);
+ }
+ return Status.OK_STATUS;
}
- importedProjects.clear();
- } catch (CoreException e) {
+ };
+ cleanJob.schedule();
+ try {
+ cleanJob.join();
+ } catch (InterruptedException e) {
Throwables.propagate(e);
}
+
if (repository != null) {
repository.close();
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
index 0304d91a3..8caa630a0 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/org/eclipse/emf/compare/tests/performance/AbstractEMFComparePerformanceTest.java
@@ -30,6 +30,9 @@ import java.util.List;
import java.util.Locale;
import java.util.Map.Entry;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EPackage;
@@ -123,8 +126,18 @@ public abstract class AbstractEMFComparePerformanceTest {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("performance", new XMIResourceFactoryImpl());
}
- timestamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
- .format(new Date());
+ //Deactivate auto-building
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ if (workspace != null) {
+ IWorkspaceDescription desc= workspace.getDescription();
+ boolean isAutoBuilding= desc.isAutoBuilding();
+ if (isAutoBuilding == true) {
+ desc.setAutoBuilding(false);
+ workspace.setDescription(desc);
+ }
+ }
+
+ timestamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date());
performance = new Performance("emf.compare.performance");
}

Back to the top