diff options
author | Laurent Goubet | 2014-02-03 16:07:41 +0000 |
---|---|---|
committer | Laurent Goubet | 2014-02-04 07:49:44 +0000 |
commit | 2d2f22fde594bac7c34f2e6c24a224745c80f446 (patch) | |
tree | 5f03e497f8a049dc492fff824067073839dd7f05 | |
parent | 7b228d59a0661b60888296b8d3debe4fb92cbad8 (diff) | |
download | org.eclipse.emf.compare-2d2f22fde594bac7c34f2e6c24a224745c80f446.tar.gz org.eclipse.emf.compare-2d2f22fde594bac7c34f2e6c24a224745c80f446.tar.xz org.eclipse.emf.compare-2d2f22fde594bac7c34f2e6c24a224745c80f446.zip |
use proper EGit and split EGit tests in separate project
Change-Id: Ie2fe99c70482ec87db6a01e921faed96e925312f
24 files changed, 841 insertions, 584 deletions
diff --git a/org.eclipse.emf.compare-parent/pom.xml b/org.eclipse.emf.compare-parent/pom.xml index 4adf9500d..590669a82 100644 --- a/org.eclipse.emf.compare-parent/pom.xml +++ b/org.eclipse.emf.compare-parent/pom.xml @@ -290,6 +290,8 @@ <modules> <module>../packaging/org.eclipse.emf.compare.update</module> + <module>../plugins/org.eclipse.emf.compare.ide.ui.tests.git</module> + <module>../packaging/org.eclipse.emf.compare.uml2-feature</module> <module>../plugins/org.eclipse.emf.compare.uml2</module> <module>../plugins/org.eclipse.emf.compare.uml2.edit</module> @@ -333,6 +335,8 @@ </plugins> </build> <modules> + <module>../plugins/org.eclipse.emf.compare.ide.ui.tests.git</module> + <module>../packaging/org.eclipse.emf.compare.uml2-feature</module> <module>../plugins/org.eclipse.emf.compare.uml2</module> <module>../plugins/org.eclipse.emf.compare.uml2.edit</module> @@ -376,6 +380,8 @@ </plugins> </build> <modules> + <module>../plugins/org.eclipse.emf.compare.ide.ui.tests.git</module> + <module>../packaging/org.eclipse.emf.compare.uml2-feature</module> <module>../plugins/org.eclipse.emf.compare.uml2</module> <module>../plugins/org.eclipse.emf.compare.uml2.edit</module> diff --git a/org.eclipse.emf.compare-parent/targetPlatforms/indigo-sdk.target b/org.eclipse.emf.compare-parent/targetPlatforms/indigo-sdk.target index b1ecb4d4c..1f539b210 100644 --- a/org.eclipse.emf.compare-parent/targetPlatforms/indigo-sdk.target +++ b/org.eclipse.emf.compare-parent/targetPlatforms/indigo-sdk.target @@ -26,9 +26,5 @@ <unit id="org.eclipse.emf.emfstore.modelmutator.feature.feature.group" version="0.9.3.M5"/> <repository location="http://download.eclipse.org/emf-store/milestones/archive/0.9.3.M5"/> </location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit"> -<unit id="org.eclipse.egit.feature.group" version="2.1.0.201209190230-r"/> -<repository location="http://download.eclipse.org/egit/updates-2.1"/> -</location> </locations> </target> diff --git a/org.eclipse.emf.compare-parent/targetPlatforms/juno-4.2-sdk.target b/org.eclipse.emf.compare-parent/targetPlatforms/juno-4.2-sdk.target index b21c687e9..70c965d85 100644 --- a/org.eclipse.emf.compare-parent/targetPlatforms/juno-4.2-sdk.target +++ b/org.eclipse.emf.compare-parent/targetPlatforms/juno-4.2-sdk.target @@ -26,8 +26,11 @@ <unit id="org.eclipse.uml2.sdk.feature.group" version="4.0.0.v20120604-0919"/> <unit id="org.eclipse.jdt.feature.group" version="3.8.0.v20120525-1249-8-8nFqlFNOfwKDRGz-pXLdGxEM83"/> <unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.9.1.v201209190809"/> -<unit id="org.eclipse.egit.feature.group" version="2.2.0.201212191850-r"/> <repository location="http://download.eclipse.org/releases/juno"/> </location> +<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit"> +<unit id="org.eclipse.egit.feature.group" version="3.0.0.201306101825-r"/> +<repository location="http://download.eclipse.org/egit/updates-3.0"/> +</location> </locations> </target> diff --git a/plugins/org.eclipse.emf.compare.ide.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.ide.tests/META-INF/MANIFEST.MF index ce49bdf3e..ce24df8d6 100644 --- a/plugins/org.eclipse.emf.compare.ide.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.ide.tests/META-INF/MANIFEST.MF @@ -10,8 +10,6 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.compare.ide;bundle-version="2.0.1", org.eclipse.team.core;bundle-version="3.5.0", org.eclipse.emf.ecore;bundle-version="2.5.0", - org.eclipse.egit.core;bundle-version="2.1.0", - org.eclipse.jgit;bundle-version="2.1.0", org.eclipse.emf.ecore.xmi;bundle-version="2.5.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.project b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.project new file mode 100644 index 000000000..3225ca174 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.emf.compare.ide.ui.tests.git</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..af0f20f97 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/META-INF/MANIFEST.MF new file mode 100644 index 000000000..da45d16ec --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/META-INF/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.emf.compare.ide.ui.tests.git +Bundle-Version: 4.0.0.qualifier +Bundle-Vendor: %providerName +Fragment-Host: org.eclipse.emf.compare.ide.ui.tests +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.egit.core;bundle-version="3.0.0", + org.eclipse.jgit;bundle-version="3.0.0" diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/about.html b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/about.html new file mode 100644 index 000000000..670d10856 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/about.html @@ -0,0 +1,106 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> +<title>Eclipse Foundation Software User Agreement</title> +</head> + +<body lang="EN-US"> +<h2>Eclipse Foundation Software User Agreement</h2> +<p>April 14, 2010</p> + +<h3>Usage Of Content</h3> + +<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> + +<h3>Applicable Licenses</h3> + +<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. + For purposes of the EPL, "Program" will mean the Content.</p> + +<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> + +<ul> + <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> + <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> + <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.</li> + <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> +</ul> + +<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:</p> + +<ul> + <li>The top-level (root) directory</li> + <li>Plug-in and Fragment directories</li> + <li>Inside Plug-ins and Fragments packaged as JARs</li> + <li>Sub-directories of the directory named "src" of certain Plug-ins</li> + <li>Feature directories</li> +</ul> + +<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.</p> + +<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> + +<ul> + <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> + <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> + <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> + <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> + <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> +</ul> + +<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> + + +<h3>Use of Provisioning Technology</h3> + +<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a + href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> + ("Specification").</p> + +<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> + +<ol> + <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.</li> + <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.</li> + <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> +</ol> + +<h3>Cryptography</h3> + +<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.</p> + +<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> +</body> +</html>
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/build.properties b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/build.properties new file mode 100644 index 000000000..34d2e4d2d --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/plugin.properties b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/plugin.properties new file mode 100644 index 000000000..e0e8f93c9 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/plugin.properties @@ -0,0 +1,12 @@ +################################################################################ +# Copyright (c) 2006, 2012 Obeo. +# 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: +# Obeo - initial API and implementation +################################################################################ +pluginName = EMF Compare IDE UI EGit Tests +providerName = Eclipse Modeling Project diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/pom.xml b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/pom.xml new file mode 100644 index 000000000..84b5fe857 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/pom.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + <parent> + <artifactId>emf.compare-parent</artifactId> + <groupId>org.eclipse.emf.compare</groupId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../../org.eclipse.emf.compare-parent</relativePath> + </parent> + <groupId>org.eclipse.emf.compare</groupId> + <artifactId>org.eclipse.emf.compare.ide.ui.tests.git</artifactId> + <version>4.0.0-SNAPSHOT</version> + <packaging>eclipse-test-plugin</packaging> + + <build> + <resources> + <resource> + <directory>src</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <includes> + <include>org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.class</include> + </includes> + <useUIHarness>true</useUIHarness> + <useUIThread>false</useUIThread> + <appArgLine>-Xmx1024m -XX:MaxPermSize=256m</appArgLine> + <testFailureIgnore>true</testFailureIgnore> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/StorageTypedElement.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/StorageTypedElement.java index bcbf8f227..ded9eb257 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/StorageTypedElement.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/StorageTypedElement.java @@ -1,79 +1,79 @@ -/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests;
-
-import java.io.InputStream;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.graphics.Image;
-
-/** Mostly copied from org.eclipse.team.internal.ui.StorageTypedElement. */
-public class StorageTypedElement implements ITypedElement, IEncodedStreamContentAccessor, IAdaptable {
- private final IStorage storage;
-
- private final String fullPath;
-
- public StorageTypedElement(IStorage storage, String fullPath) {
- this.storage = storage;
- this.fullPath = fullPath;
- }
-
- public StorageTypedElement(IFile file) {
- this(file, file.getFullPath().toString());
- }
-
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if (adapter == IStorage.class) {
- return storage;
- }
- return storage.getAdapter(adapter);
- }
-
- public String getCharset() throws CoreException {
- if (storage instanceof IEncodedStreamContentAccessor) {
- return ((IEncodedStreamContentAccessor)storage).getCharset();
- }
- return null;
- }
-
- public InputStream getContents() throws CoreException {
- return storage.getContents();
- }
-
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- public String getName() {
- return fullPath;
- }
-
- public String getType() {
- String name = getName();
- if (name != null) {
- int index = name.lastIndexOf('.');
- if (index == -1) {
- return ""; //$NON-NLS-1$
- }
- if (index == (name.length() - 1)) {
- return ""; //$NON-NLS-1$
- }
- return name.substring(index + 1);
- }
- return ITypedElement.FOLDER_TYPE;
- }
-}
+/******************************************************************************* + * Copyright (c) 2013 Obeo. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.ide.ui.tests; + +import java.io.InputStream; + +import org.eclipse.compare.CompareUI; +import org.eclipse.compare.IEncodedStreamContentAccessor; +import org.eclipse.compare.ITypedElement; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IStorage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.swt.graphics.Image; + +/** Mostly copied from org.eclipse.team.internal.ui.StorageTypedElement. */ +public class StorageTypedElement implements ITypedElement, IEncodedStreamContentAccessor, IAdaptable { + private final IStorage storage; + + private final String fullPath; + + public StorageTypedElement(IStorage storage, String fullPath) { + this.storage = storage; + this.fullPath = fullPath; + } + + public StorageTypedElement(IFile file) { + this(file, file.getFullPath().toString()); + } + + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + if (adapter == IStorage.class) { + return storage; + } + return storage.getAdapter(adapter); + } + + public String getCharset() throws CoreException { + if (storage instanceof IEncodedStreamContentAccessor) { + return ((IEncodedStreamContentAccessor)storage).getCharset(); + } + return null; + } + + public InputStream getContents() throws CoreException { + return storage.getContents(); + } + + public Image getImage() { + return CompareUI.getImage(getType()); + } + + public String getName() { + return fullPath; + } + + public String getType() { + String name = getName(); + if (name != null) { + int index = name.lastIndexOf('.'); + if (index == -1) { + return ""; //$NON-NLS-1$ + } + if (index == (name.length() - 1)) { + return ""; //$NON-NLS-1$ + } + return name.substring(index + 1); + } + return ITypedElement.FOLDER_TYPE; + } +} diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java index 53d3b4ae1..14521368a 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java @@ -28,7 +28,7 @@ import org.junit.BeforeClass; /** * The set up and tear down of this class were mostly copied from org.eclipse.egit.core.test.GitTestCase. */ -@SuppressWarnings("nls") +@SuppressWarnings({"restriction", "nls", }) public class CompareGitTestCase extends CompareTestCase { protected GitTestRepository repository; diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java index 3c227e674..7c2a541c4 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/GitTestRepository.java @@ -1,281 +1,281 @@ -/*******************************************************************************
- * Copyright (C) 2013, 2014 Obeo 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
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.tests.egit.fixture;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
-import org.eclipse.core.resources.mapping.ModelProvider;
-import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.egit.core.Activator;
-import org.eclipse.egit.core.op.BranchOperation;
-import org.eclipse.egit.core.op.ConnectProviderOperation;
-import org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber;
-import org.eclipse.egit.core.synchronize.GitSubscriberMergeContext;
-import org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext;
-import org.eclipse.egit.core.synchronize.dto.GitSynchronizeData;
-import org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet;
-import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
-import org.eclipse.jgit.api.CommitCommand;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.api.errors.NoFilepatternException;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.RefUpdate;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-
-/**
- * This class is largely inspired from org.eclipse.egit.core.test.TestRepository. It has been copied here in
- * order to be usable from our build without dependencies towards egit.core.tests.
- */
-@SuppressWarnings({"nls", "restriction" })
-public class GitTestRepository {
- Repository repository;
-
- String workdirPrefix;
-
- /**
- * Creates a new test repository.
- *
- * @param gitDir
- * The ".git" file we'll use to create a repository.
- * @throws IOException
- * Thrown if we cannot write at the given location.
- */
- public GitTestRepository(File gitDir) throws IOException {
- repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir);
- repository.create();
-
- try {
- workdirPrefix = repository.getWorkTree().getCanonicalPath();
- } catch (IOException err) {
- workdirPrefix = repository.getWorkTree().getAbsolutePath();
- }
- workdirPrefix = workdirPrefix.replace('\\', '/');
- if (!workdirPrefix.endsWith("/")) {
- workdirPrefix += "/";
- }
- }
-
- /**
- * Track, add to index and finally commit the given files.
- *
- * @param testProject
- * The project within which this file is located.
- * @param commitMessage
- * Message with which to commit this file.
- * @param files
- * The files to add and commit.
- * @return The RevCommit corresponding to this operation.
- */
- public RevCommit addAndCommit(TestProject testProject, String commitMessage, File... files)
- throws Exception {
- track(files);
- addToIndex(testProject, files);
- return commit(commitMessage);
- }
-
- /**
- * Adds The given files to version control.
- *
- * @param files
- * The files to add.
- */
- public void track(File... files) throws IOException, NoFilepatternException, GitAPIException {
- for (File file : files) {
- String repoPath = getRepoRelativePath(new Path(file.getPath()).toString());
- new Git(repository).add().addFilepattern(repoPath).call();
- }
- }
-
- /**
- * Adds the given files to the index.
- *
- * @param testProject
- * Project that contains these files.
- * @param files
- * Files to add to the index.
- */
- public void addToIndex(TestProject testProject, File... files) throws Exception {
- for (File file : files) {
- addToIndex(testProject.getIFile(testProject.getProject(), file));
- }
- }
-
- /**
- * Adds the given resources to the index
- *
- * @param resources
- * Resources to add to the index.
- */
- public void addToIndex(IResource... resources) throws CoreException, IOException, NoFilepatternException,
- GitAPIException {
- for (IResource resource : resources) {
- String repoPath = getRepoRelativePath(resource.getLocation().toOSString());
- new Git(repository).add().addFilepattern(repoPath).call();
- }
- }
-
- /**
- * Commits the current index.
- *
- * @param message
- * commit message
- * @return commit object
- */
- public RevCommit commit(String message) throws Exception {
- Git git = new Git(repository);
- CommitCommand commitCommand = git.commit();
- commitCommand.setAuthor("J. Git", "j.git@egit.org");
- commitCommand.setCommitter(commitCommand.getAuthor());
- commitCommand.setMessage(message);
- return commitCommand.call();
- }
-
- /**
- * Connect a project to this repository.
- *
- * @param project
- * The project to connect
- */
- public void connect(IProject project) throws CoreException {
- ConnectProviderOperation op = new ConnectProviderOperation(project, repository.getDirectory());
- op.execute(null);
- }
-
- /**
- * Creates a new branch.
- *
- * @param refName
- * Starting point for the new branch.
- * @param newRefName
- * Name of the new branch.
- */
- public void createBranch(String refName, String newRefName) throws IOException {
- RefUpdate updateRef;
- updateRef = repository.updateRef(newRefName);
- Ref startRef = repository.getRef(refName);
- ObjectId startAt = repository.resolve(refName);
- String startBranch;
- if (startRef != null) {
- startBranch = refName;
- } else {
- startBranch = startAt.name();
- }
- startBranch = Repository.shortenRefName(startBranch);
- updateRef.setNewObjectId(startAt);
- updateRef.setRefLogMessage("branch: Created from " + startBranch, false);
- updateRef.update();
- }
-
- /**
- * Checkouts branch.
- *
- * @param refName
- * Full name of the branch.
- */
- public void checkoutBranch(String refName) throws CoreException {
- new BranchOperation(repository, refName).execute(null);
- }
-
- /**
- * Dispose of this wrapper along with its underlying repository.
- */
- public void dispose() {
- if (repository != null) {
- repository.close();
- repository = null;
- }
- }
-
- /**
- * Simulate a comparison between the two given references and returns back the subscriber that can provide
- * all computed synchronization information.
- *
- * @param sourceRef
- * Source reference (i.e. "left" side of the comparison).
- * @param targetRef
- * Target reference (i.e. "right" side of the comparison).
- * @param comparedFile
- * The file we are comparing (that would be the file right-clicked into the workspace).
- * @return The created subscriber.
- */
- public Subscriber createSubscriberForComparison(String sourceRef, String targetRef, IFile comparedFile)
- throws IOException {
- final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, false);
- final GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data);
- final ResourceMapping[] mappings = getResourceMappings(comparedFile);
- GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(dataSet);
- subscriber.init(new NullProgressMonitor());
-
- final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext(
- subscriber, dataSet);
- final SubscriberScopeManager manager = new SubscriberScopeManager(subscriber.getName(), mappings,
- subscriber, remoteContext, true);
- final GitSubscriberMergeContext context = new GitSubscriberMergeContext(subscriber, manager, dataSet);
- return context.getSubscriber();
- }
-
- private String getRepoRelativePath(String path) {
- final int pfxLen = workdirPrefix.length();
- final int pLen = path.length();
- if (pLen > pfxLen) {
- return path.substring(pfxLen);
- } else if (path.length() == pfxLen - 1) {
- return "";
- }
- return null;
- }
-
- /**
- * This will query all model providers for those that are enabled on the given file and list all mappings
- * available for that file.
- *
- * @param file
- * The file for which we need the associated resource mappings.
- * @return All mappings available for that file.
- */
- private static ResourceMapping[] getResourceMappings(IFile file) {
- final IModelProviderDescriptor[] modelDescriptors = ModelProvider.getModelProviderDescriptors();
-
- final Set<ResourceMapping> mappings = new LinkedHashSet<ResourceMapping>();
- for (IModelProviderDescriptor candidate : modelDescriptors) {
- try {
- final IResource[] resources = candidate.getMatchingResources(new IResource[] {file, });
- if (resources.length > 0) {
- // get mappings from model provider if there are matching resources
- final ModelProvider model = candidate.getModelProvider();
- final ResourceMapping[] modelMappings = model.getMappings(file,
- ResourceMappingContext.LOCAL_CONTEXT, null);
- for (ResourceMapping mapping : modelMappings) {
- mappings.add(mapping);
- }
- }
- } catch (CoreException e) {
- Activator.logError(e.getMessage(), e);
- }
- }
- return mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-}
+/******************************************************************************* + * Copyright (C) 2013, 2014 Obeo 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 + *******************************************************************************/ +package org.eclipse.emf.compare.ide.ui.tests.egit.fixture; + +import java.io.File; +import java.io.IOException; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.mapping.IModelProviderDescriptor; +import org.eclipse.core.resources.mapping.ModelProvider; +import org.eclipse.core.resources.mapping.RemoteResourceMappingContext; +import org.eclipse.core.resources.mapping.ResourceMapping; +import org.eclipse.core.resources.mapping.ResourceMappingContext; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.egit.core.Activator; +import org.eclipse.egit.core.op.BranchOperation; +import org.eclipse.egit.core.op.ConnectProviderOperation; +import org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber; +import org.eclipse.egit.core.synchronize.GitSubscriberMergeContext; +import org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext; +import org.eclipse.egit.core.synchronize.dto.GitSynchronizeData; +import org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet; +import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject; +import org.eclipse.jgit.api.CommitCommand; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.NoFilepatternException; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Ref; +import org.eclipse.jgit.lib.RefUpdate; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.team.core.subscribers.Subscriber; +import org.eclipse.team.core.subscribers.SubscriberScopeManager; + +/** + * This class is largely inspired from org.eclipse.egit.core.test.TestRepository. It has been copied here in + * order to be usable from our build without dependencies towards egit.core.tests. + */ +@SuppressWarnings({"nls", "restriction" }) +public class GitTestRepository { + Repository repository; + + String workdirPrefix; + + /** + * Creates a new test repository. + * + * @param gitDir + * The ".git" file we'll use to create a repository. + * @throws IOException + * Thrown if we cannot write at the given location. + */ + public GitTestRepository(File gitDir) throws IOException { + repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir); + repository.create(); + + try { + workdirPrefix = repository.getWorkTree().getCanonicalPath(); + } catch (IOException err) { + workdirPrefix = repository.getWorkTree().getAbsolutePath(); + } + workdirPrefix = workdirPrefix.replace('\\', '/'); + if (!workdirPrefix.endsWith("/")) { + workdirPrefix += "/"; + } + } + + /** + * Track, add to index and finally commit the given files. + * + * @param testProject + * The project within which this file is located. + * @param commitMessage + * Message with which to commit this file. + * @param files + * The files to add and commit. + * @return The RevCommit corresponding to this operation. + */ + public RevCommit addAndCommit(TestProject testProject, String commitMessage, File... files) + throws Exception { + track(files); + addToIndex(testProject, files); + return commit(commitMessage); + } + + /** + * Adds The given files to version control. + * + * @param files + * The files to add. + */ + public void track(File... files) throws IOException, NoFilepatternException, GitAPIException { + for (File file : files) { + String repoPath = getRepoRelativePath(new Path(file.getPath()).toString()); + new Git(repository).add().addFilepattern(repoPath).call(); + } + } + + /** + * Adds the given files to the index. + * + * @param testProject + * Project that contains these files. + * @param files + * Files to add to the index. + */ + public void addToIndex(TestProject testProject, File... files) throws Exception { + for (File file : files) { + addToIndex(testProject.getIFile(testProject.getProject(), file)); + } + } + + /** + * Adds the given resources to the index + * + * @param resources + * Resources to add to the index. + */ + public void addToIndex(IResource... resources) throws CoreException, IOException, NoFilepatternException, + GitAPIException { + for (IResource resource : resources) { + String repoPath = getRepoRelativePath(resource.getLocation().toOSString()); + new Git(repository).add().addFilepattern(repoPath).call(); + } + } + + /** + * Commits the current index. + * + * @param message + * commit message + * @return commit object + */ + public RevCommit commit(String message) throws Exception { + Git git = new Git(repository); + CommitCommand commitCommand = git.commit(); + commitCommand.setAuthor("J. Git", "j.git@egit.org"); + commitCommand.setCommitter(commitCommand.getAuthor()); + commitCommand.setMessage(message); + return commitCommand.call(); + } + + /** + * Connect a project to this repository. + * + * @param project + * The project to connect + */ + public void connect(IProject project) throws CoreException { + ConnectProviderOperation op = new ConnectProviderOperation(project, repository.getDirectory()); + op.execute(null); + } + + /** + * Creates a new branch. + * + * @param refName + * Starting point for the new branch. + * @param newRefName + * Name of the new branch. + */ + public void createBranch(String refName, String newRefName) throws IOException { + RefUpdate updateRef; + updateRef = repository.updateRef(newRefName); + Ref startRef = repository.getRef(refName); + ObjectId startAt = repository.resolve(refName); + String startBranch; + if (startRef != null) { + startBranch = refName; + } else { + startBranch = startAt.name(); + } + startBranch = Repository.shortenRefName(startBranch); + updateRef.setNewObjectId(startAt); + updateRef.setRefLogMessage("branch: Created from " + startBranch, false); + updateRef.update(); + } + + /** + * Checkouts branch. + * + * @param refName + * Full name of the branch. + */ + public void checkoutBranch(String refName) throws CoreException { + new BranchOperation(repository, refName).execute(null); + } + + /** + * Dispose of this wrapper along with its underlying repository. + */ + public void dispose() { + if (repository != null) { + repository.close(); + repository = null; + } + } + + /** + * Simulate a comparison between the two given references and returns back the subscriber that can provide + * all computed synchronization information. + * + * @param sourceRef + * Source reference (i.e. "left" side of the comparison). + * @param targetRef + * Target reference (i.e. "right" side of the comparison). + * @param comparedFile + * The file we are comparing (that would be the file right-clicked into the workspace). + * @return The created subscriber. + */ + public Subscriber createSubscriberForComparison(String sourceRef, String targetRef, IFile comparedFile) + throws IOException { + final GitSynchronizeData data = new GitSynchronizeData(repository, sourceRef, targetRef, false); + final GitSynchronizeDataSet dataSet = new GitSynchronizeDataSet(data); + final ResourceMapping[] mappings = getResourceMappings(comparedFile); + GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(dataSet); + subscriber.init(new NullProgressMonitor()); + + final RemoteResourceMappingContext remoteContext = new GitSubscriberResourceMappingContext( + subscriber, dataSet); + final SubscriberScopeManager manager = new SubscriberScopeManager(subscriber.getName(), mappings, + subscriber, remoteContext, true); + final GitSubscriberMergeContext context = new GitSubscriberMergeContext(subscriber, manager, dataSet); + return context.getSubscriber(); + } + + private String getRepoRelativePath(String path) { + final int pfxLen = workdirPrefix.length(); + final int pLen = path.length(); + if (pLen > pfxLen) { + return path.substring(pfxLen); + } else if (path.length() == pfxLen - 1) { + return ""; + } + return null; + } + + /** + * This will query all model providers for those that are enabled on the given file and list all mappings + * available for that file. + * + * @param file + * The file for which we need the associated resource mappings. + * @return All mappings available for that file. + */ + private static ResourceMapping[] getResourceMappings(IFile file) { + final IModelProviderDescriptor[] modelDescriptors = ModelProvider.getModelProviderDescriptors(); + + final Set<ResourceMapping> mappings = new LinkedHashSet<ResourceMapping>(); + for (IModelProviderDescriptor candidate : modelDescriptors) { + try { + final IResource[] resources = candidate.getMatchingResources(new IResource[] {file, }); + if (resources.length > 0) { + // get mappings from model provider if there are matching resources + final ModelProvider model = candidate.getModelProvider(); + final ResourceMapping[] modelMappings = model.getMappings(file, + ResourceMappingContext.LOCAL_CONTEXT, null); + for (ResourceMapping mapping : modelMappings) { + mappings.add(mapping); + } + } + } catch (CoreException e) { + Activator.logError(e.getMessage(), e); + } + } + return mappings.toArray(new ResourceMapping[mappings.size()]); + } +} diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/MockSystemReader.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/MockSystemReader.java index e2bfcdd4c..78f2c5326 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/MockSystemReader.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/fixture/MockSystemReader.java @@ -1,200 +1,200 @@ -/*
- * Copyright (C) 2009, Google Inc.
- * Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com>
- * Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com>
- * and other copyright owners as documented in the project's IP log.
- *
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Distribution License v1.0 which
- * accompanies this distribution, is reproduced below, and is
- * available at http://www.eclipse.org/org/documents/edl-v10.php
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * - Neither the name of the Eclipse Foundation, Inc. nor the
- * names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.eclipse.emf.compare.ide.ui.tests.egit.fixture;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.eclipse.jgit.lib.Config;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.util.FS;
-import org.eclipse.jgit.util.SystemReader;
-
-/**
- * Except for this comment, verbatim copy/paste of org.eclipse.jgit.junit.MockSystemReader.
- */
-@SuppressWarnings("nls")
-public class MockSystemReader extends SystemReader {
- private final class MockConfig extends FileBasedConfig {
- private MockConfig(File cfgLocation, FS fs) {
- super(cfgLocation, fs);
- }
-
- @Override
- public void load() throws IOException, ConfigInvalidException {
- // Do nothing
- }
-
- @Override
- public boolean isOutdated() {
- return false;
- }
- }
-
- final Map<String, String> values = new HashMap<String, String>();
-
- FileBasedConfig userGitConfig;
-
- FileBasedConfig systemGitConfig;
-
- public MockSystemReader() {
- init(Constants.OS_USER_NAME_KEY);
- init(Constants.GIT_AUTHOR_NAME_KEY);
- init(Constants.GIT_AUTHOR_EMAIL_KEY);
- init(Constants.GIT_COMMITTER_NAME_KEY);
- init(Constants.GIT_COMMITTER_EMAIL_KEY);
- userGitConfig = new MockConfig(null, null);
- systemGitConfig = new MockConfig(null, null);
- setCurrentPlatform();
- }
-
- private void init(final String n) {
- setProperty(n, n);
- }
-
- public void clearProperties() {
- values.clear();
- }
-
- public void setProperty(String key, String value) {
- values.put(key, value);
- }
-
- @Override
- public String getenv(String variable) {
- return values.get(variable);
- }
-
- @Override
- public String getProperty(String key) {
- return values.get(key);
- }
-
- @Override
- public FileBasedConfig openUserConfig(Config parent, FS fs) {
- assert parent == null || parent == systemGitConfig;
- return userGitConfig;
- }
-
- @Override
- public FileBasedConfig openSystemConfig(Config parent, FS fs) {
- assert parent == null;
- return systemGitConfig;
- }
-
- @Override
- public String getHostname() {
- return "fake.host.example.com";
- }
-
- @Override
- public long getCurrentTime() {
- return 1250379778668L; // Sat Aug 15 20:12:58 GMT-03:30 2009
- }
-
- @Override
- public int getTimezone(long when) {
- return getTimeZone().getOffset(when) / (60 * 1000);
- }
-
- @Override
- public TimeZone getTimeZone() {
- return TimeZone.getTimeZone("GMT-03:30");
- }
-
- @Override
- public Locale getLocale() {
- return Locale.US;
- }
-
- @Override
- public SimpleDateFormat getSimpleDateFormat(String pattern) {
- return new SimpleDateFormat(pattern, getLocale());
- }
-
- @Override
- public DateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
- return DateFormat.getDateTimeInstance(dateStyle, timeStyle, getLocale());
- }
-
- /**
- * Assign some properties for the currently executing platform
- */
- public void setCurrentPlatform() {
- setProperty("os.name", System.getProperty("os.name"));
- setProperty("file.separator", System.getProperty("file.separator"));
- setProperty("path.separator", System.getProperty("path.separator"));
- setProperty("line.separator", System.getProperty("line.separator"));
- }
-
- /**
- * Emulate Windows
- */
- public void setWindows() {
- setProperty("os.name", "Windows");
- setProperty("file.separator", "\\");
- setProperty("path.separator", ";");
- setProperty("line.separator", "\r\n");
- }
-
- /**
- * Emulate Unix
- */
- public void setUnix() {
- setProperty("os.name", "*nix"); // Essentially anything but Windows
- setProperty("file.separator", "/");
- setProperty("path.separator", ":");
- setProperty("line.separator", "\n");
- }
-}
+/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.emf.compare.ide.ui.tests.egit.fixture; + +import java.io.File; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; + +import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.lib.Config; +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.storage.file.FileBasedConfig; +import org.eclipse.jgit.util.FS; +import org.eclipse.jgit.util.SystemReader; + +/** + * Except for this comment, verbatim copy/paste of org.eclipse.jgit.junit.MockSystemReader. + */ +@SuppressWarnings("nls") +public class MockSystemReader extends SystemReader { + private final class MockConfig extends FileBasedConfig { + private MockConfig(File cfgLocation, FS fs) { + super(cfgLocation, fs); + } + + @Override + public void load() throws IOException, ConfigInvalidException { + // Do nothing + } + + @Override + public boolean isOutdated() { + return false; + } + } + + final Map<String, String> values = new HashMap<String, String>(); + + FileBasedConfig userGitConfig; + + FileBasedConfig systemGitConfig; + + public MockSystemReader() { + init(Constants.OS_USER_NAME_KEY); + init(Constants.GIT_AUTHOR_NAME_KEY); + init(Constants.GIT_AUTHOR_EMAIL_KEY); + init(Constants.GIT_COMMITTER_NAME_KEY); + init(Constants.GIT_COMMITTER_EMAIL_KEY); + userGitConfig = new MockConfig(null, null); + systemGitConfig = new MockConfig(null, null); + setCurrentPlatform(); + } + + private void init(final String n) { + setProperty(n, n); + } + + public void clearProperties() { + values.clear(); + } + + public void setProperty(String key, String value) { + values.put(key, value); + } + + @Override + public String getenv(String variable) { + return values.get(variable); + } + + @Override + public String getProperty(String key) { + return values.get(key); + } + + @Override + public FileBasedConfig openUserConfig(Config parent, FS fs) { + assert parent == null || parent == systemGitConfig; + return userGitConfig; + } + + @Override + public FileBasedConfig openSystemConfig(Config parent, FS fs) { + assert parent == null; + return systemGitConfig; + } + + @Override + public String getHostname() { + return "fake.host.example.com"; + } + + @Override + public long getCurrentTime() { + return 1250379778668L; // Sat Aug 15 20:12:58 GMT-03:30 2009 + } + + @Override + public int getTimezone(long when) { + return getTimeZone().getOffset(when) / (60 * 1000); + } + + @Override + public TimeZone getTimeZone() { + return TimeZone.getTimeZone("GMT-03:30"); + } + + @Override + public Locale getLocale() { + return Locale.US; + } + + @Override + public SimpleDateFormat getSimpleDateFormat(String pattern) { + return new SimpleDateFormat(pattern, getLocale()); + } + + @Override + public DateFormat getDateTimeInstance(int dateStyle, int timeStyle) { + return DateFormat.getDateTimeInstance(dateStyle, timeStyle, getLocale()); + } + + /** + * Assign some properties for the currently executing platform + */ + public void setCurrentPlatform() { + setProperty("os.name", System.getProperty("os.name")); + setProperty("file.separator", System.getProperty("file.separator")); + setProperty("path.separator", System.getProperty("path.separator")); + setProperty("line.separator", System.getProperty("line.separator")); + } + + /** + * Emulate Windows + */ + public void setWindows() { + setProperty("os.name", "Windows"); + setProperty("file.separator", "\\"); + setProperty("path.separator", ";"); + setProperty("line.separator", "\r\n"); + } + + /** + * Emulate Unix + */ + public void setUnix() { + setProperty("os.name", "*nix"); // Essentially anything but Windows + setProperty("file.separator", "/"); + setProperty("path.separator", ":"); + setProperty("line.separator", "\n"); + } +} diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java new file mode 100644 index 000000000..47c311760 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2012 Obeo. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.ide.ui.tests.suite; + +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.textui.TestRunner; + +import org.eclipse.emf.compare.ide.ui.tests.unit.GitLogicalModelTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({GitLogicalModelTest.class, }) +public class AllTests { + /** + * Launches the test with the given arguments. + * + * @param args + * Arguments of the testCase. + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * Creates the {@link junit.framework.TestSuite TestSuite} for all the test. + * + * @return The test suite containing all the tests + */ + public static Test suite() { + return new JUnit4TestAdapter(AllTests.class); + } +} diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalModelTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalModelTest.java index 748a2136a..748a2136a 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalModelTest.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/GitLogicalModelTest.java diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.ide.ui.tests/META-INF/MANIFEST.MF index 7866ec872..3f3bb0e6c 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/META-INF/MANIFEST.MF @@ -10,8 +10,6 @@ Require-Bundle: org.eclipse.core.runtime, org.junit;bundle-version="4.8.0", org.eclipse.core.resources;bundle-version="3.5.0", org.eclipse.team.core;bundle-version="3.5.0", - org.eclipse.jgit;bundle-version="2.1.0", - org.eclipse.egit.core;bundle-version="2.1.0", org.eclipse.emf.ecore.xmi;bundle-version="2.5.0", org.eclipse.emf.compare.ide.ui;bundle-version="3.0.0", org.eclipse.emf.compare;bundle-version="3.0.0", diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java index 7fefd68e1..e347d0138 100644 --- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java +++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java @@ -14,13 +14,13 @@ import junit.framework.JUnit4TestAdapter; import junit.framework.Test;
import junit.textui.TestRunner;
-import org.eclipse.emf.compare.ide.ui.tests.unit.GitLogicalModelTest;
+import org.eclipse.emf.compare.ide.ui.tests.unit.DependenciesTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({GitLogicalModelTest.class, })
+@SuiteClasses({DependenciesTest.class, })
public class AllTests {
/**
* Launches the test with the given arguments.
diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/.classpath b/plugins/org.eclipse.emf.compare.tests.fuzzy/.classpath index ad32c83a7..64c5e31b7 100644 --- a/plugins/org.eclipse.emf.compare.tests.fuzzy/.classpath +++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.jdt.core.prefs index c537b6306..af0f20f97 100644 --- a/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.tests.fuzzy/META-INF/MANIFEST.MF index 671b9a061..b03202078 100644 --- a/plugins/org.eclipse.emf.compare.tests.fuzzy/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.compare.tests.fuzzy -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 3.1.0.qualifier Bundle-Vendor: %providerName -Fragment-Host: org.eclipse.emf.compare.tests;bundle-version="[4.0.0,4.0.0]" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Fragment-Host: org.eclipse.emf.compare.tests;bundle-version="3.1.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.emf.emfstore.fuzzy.emf diff --git a/plugins/org.eclipse.emf.compare.tests.fuzzy/pom.xml b/plugins/org.eclipse.emf.compare.tests.fuzzy/pom.xml index f5d345551..3700a7c50 100644 --- a/plugins/org.eclipse.emf.compare.tests.fuzzy/pom.xml +++ b/plugins/org.eclipse.emf.compare.tests.fuzzy/pom.xml @@ -9,8 +9,8 @@ <relativePath>../../org.eclipse.emf.compare-parent</relativePath> </parent> <groupId>org.eclipse.emf.compare</groupId> - <artifactId>org.eclipse.emf.compare.tests</artifactId> - <version>4.0.0-SNAPSHOT</version> + <artifactId>org.eclipse.emf.compare.tests.fuzzy</artifactId> + <version>3.1.0-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <build> @@ -35,10 +35,7 @@ <version>${tycho-version}</version> <configuration> <includes> - <include>org/eclipse/emf/compare/tests/suite/AllTests.class</include> - <!-- <include>org/eclipse/emf/compare/tests/suite/AllPluginTests.class</include> - --> </includes> <useUIHarness>false</useUIHarness> <useUIThread>false</useUIThread> |