Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-01-05 15:22:20 +0000
committerLaurent Redor2017-01-06 08:31:28 +0000
commita0daaed694185518090f64ea93308e5ed662fab5 (patch)
tree4bc46dee971e23253c5f7f61ee172b131b009f1d
parentc7a02cd5c20ae8682157174fb1ffac09d39f4df6 (diff)
downloadorg.eclipse.sirius-a0daaed694185518090f64ea93308e5ed662fab5.tar.gz
org.eclipse.sirius-a0daaed694185518090f64ea93308e5ed662fab5.tar.xz
org.eclipse.sirius-a0daaed694185518090f64ea93308e5ed662fab5.zip
[500253] Fix compilation pb during tests execution with Tycho surefire
This problem is explained/detailed in: * https://bugs.eclipse.org/bugs/show_bug.cgi?id=343152 * https://wiki.eclipse.org/Tycho/Testing_with_Surefire * https://bugs.eclipse.org/bugs/show_bug.cgi?id=343156 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=386988 To resume, Tycho surefire executes tests in an Eclipse initialized with OSGi but not with PDE. So the PDE target platform is not fully initialized and all "tools" using it, like plugin compilation, fail. This commit uses the solution [1] that loaded a new PDE target platform created from the known OSGI bundles. The new static method org.eclipse.sirius.tests.support.api.TestsUtil.setTargetPlatform() must be called for each test that need to compile a plug-in in the execution runtime. [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=343152#c9 Bug: 500253 Change-Id: I2385535f63a52929e918df44bf49c1f2037e3cd5 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html50
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile8
-rw-r--r--plugins/org.eclipse.sirius.tests.junit.support/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java71
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CompletionProposalInVSMTest.java14
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/MigrationOnVsmEditorReloadTest.java6
6 files changed, 125 insertions, 27 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 0613ec5afd..810a29faf2 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -13,13 +13,21 @@
<a href="#ReleaseNotesforSirius">Release Notes for Sirius</a>
<ol style="list-style: disc;">
<li>
+ <a href="#sirius4.1.3">Changes in Sirius 4.1.3</a>
+ <ol style="list-style: disc;">
+ <li>
+ <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ </li>
+ </ol>
+ </li>
+ <li>
<a href="#sirius4.1.2">Changes in Sirius 4.1.2</a>
<ol style="list-style: disc;">
<li>
<a href="#UserVisibleChanges">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -30,7 +38,7 @@
<a href="#UserVisibleChanges2">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -44,7 +52,7 @@
<a href="#SpecifierVisibleChanges">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -58,7 +66,7 @@
<a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -72,7 +80,7 @@
<a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -86,7 +94,7 @@
<a href="#SpecifierVisibleChanges4">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges7">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -96,6 +104,16 @@
<p>This document contains the release notes for recent major releases of Sirius. See also
<a href="Release_Notes_Previous.html">the release notes from previous versions</a> for details about older releases.
</p>
+ <h2 id="sirius4.1.3">Changes in Sirius 4.1.3</h2>
+ <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
+ <h4 id="Changesinorg.eclipse.sirius.tests.junit.support">Changes in
+ <code>org.eclipse.sirius.tests.junit.support</code>
+ </h4>
+ <ul>
+ <li><span class="label label-success">Added</span> The utility method
+ <code>org.eclipse.sirius.tests.support.api.TestsUtil.setTargetPlatform()</code> has been added to allow to load a PDE target platform according to all known OSGi bundles. It is usefull to compile a plug-in in the execution runtime of the tests.
+ </li>
+ </ul>
<h2 id="sirius4.1.2">Changes in Sirius 4.1.2</h2>
<h3 id="UserVisibleChanges">User-Visible Changes</h3>
<ul>
@@ -106,7 +124,7 @@
<br/>
<img border="0" src="./images/PreferencePageMaxTabName.png"/>
</p>
- <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span>
<code>org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerWithMapping</code> class has been added to handle copy/paste format with mapping information when an element target of a format pasting has many source diagram format corresponding to its key. In this case, we use the mapping information to get the more precise data format. And if no result matched, then we return the first found by using the key.
@@ -141,7 +159,7 @@
<ul>
<li><span class="label label-info">Modified</span>The &#8220;straighten to&#8221; actions were previously disabled when an edge is connected to border nodes that have several edges. It is now allowed.</li>
</ul>
- <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span>
<code>org.eclipse.sirius.table.business.api.helper.TableHelper.getEStructuralFeature(DLine, DColumn)</code> method has been added to retrieve the EStructuralFeature associated to a table column.
@@ -264,7 +282,7 @@
<code>org.eclipse.sirius.diagram.ui.formatDataManager</code>. The deprecated extension point will be removed in the next 5.0 Sirius major release. Several classes associated with this deprecated extension point are also deprecated (see Developer-Visible Changes for details).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> As the first step to save the DRepresentation in its own resource,
<code>org.eclipse.sirius.viewpoint.DView.getOwnedRepresentationDescriptors()</code> has been added as a wrapper of the
@@ -600,7 +618,7 @@
<code>org.eclipse.sirius.ext.gef</code> is deprecated and will be removed in the next version.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.tests.junit.support">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.tests.junit.support2">Changes in
<code>org.eclipse.sirius.tests.junit.support</code>
</h4>
<ul>
@@ -752,7 +770,7 @@
</li>
<li><span class="label label-info">Modified</span> The variable under VariableFilter, previously named &#8220;Variable&#8221;, is renamed to &#8220;Select Model Element Variable&#8221;. It is functionally equivalent.</li>
</ul>
- <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> It is now possible to provide a full customized tab-bar by implementing the
<code>ITabbarContributor</code> through the
@@ -1091,7 +1109,7 @@
<code>org.eclipse.sirius.editor</code>) still depends on PDE (and thus indirectly the JDT too).
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.tests.junit.support2">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.tests.junit.support3">Changes in
<code>org.eclipse.sirius.tests.junit.support</code>
</h4>
<ul>
@@ -1234,7 +1252,7 @@
<code>IPermissionAuthority</code>) of the potential to delete objects. This is the reverse order of what was done before, and can have performance impacts if the precondition is slow. The specifier will to take care to ensure a good performance for the precondition expression of the delete tool.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3>
<h4 id="Partialsupportforinternationalization">Partial support for internationalization</h4>
<p>Sirius 3.1 introduces partial support for internationalization: all literal strings from the runtime part of Sirius are now externalized and can be localized by third parties by providing the appropriate &#8220;language packs&#8221; as OSGi fragments. Note that this does not concern the VSM editor&#8217;s UI, the VSMs themselves, or the parts of the UI inherited from Eclipse/EMF/GEF/GMF and other libraries and frameworks used by Sirius.</p>
<p>Some API changes were required to enable this. While technically breaking changes if interpreting strictly the OSGi versioning rules, the major version number of the impacted bundles was not incremented as the changes only concern classes that should not impact the vast majority of users. Most breaking changes concern the plug-in/activator classes from each bundle. They are:</p>
@@ -1600,7 +1618,7 @@
<code>RefreshPlan</code> in parameter to have more informations to say if children must be synchronized.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.tests.junit.support3">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.tests.junit.support4">Changes in
<code>org.eclipse.sirius.tests.junit.support</code>
</h4>
<ul>
@@ -1791,7 +1809,7 @@
<em>EStructuralFeature</em> (inherited or with same name).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges7">Developer-Visible Changes</h3>
<p>The most important and impacting changes in this release are (details below in plug-in specific sections):</p>
<ul>
<li><span class="label label-success">Added</span> The new extension point
@@ -2530,7 +2548,7 @@
</ul>
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.tests.junit.support4">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.tests.junit.support5">Changes in
<code>org.eclipse.sirius.tests.junit.support</code>
</h4>
<ul>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index a601f9ca17..ec8b41ed63 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -4,6 +4,14 @@ h1. Release Notes for Sirius
This document contains the release notes for recent major releases of Sirius. See also "the release notes from previous versions":Release_Notes_Previous.html for details about older releases.
+h2(#sirius4.1.3). Changes in Sirius 4.1.3
+
+h3. Developer-Visible Changes
+
+h4. Changes in @org.eclipse.sirius.tests.junit.support@
+
+* <span class="label label-success">Added</span> The utility method @org.eclipse.sirius.tests.support.api.TestsUtil.setTargetPlatform()@ has been added to allow to load a PDE target platform according to all known OSGi bundles. It is usefull to compile a plug-in in the execution runtime of the tests.
+
h2(#sirius4.1.2). Changes in Sirius 4.1.2
h3. User-Visible Changes
diff --git a/plugins/org.eclipse.sirius.tests.junit.support/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.junit.support/META-INF/MANIFEST.MF
index eaba0054eb..54552ab2cb 100644
--- a/plugins/org.eclipse.sirius.tests.junit.support/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.sirius.tests.junit.support/META-INF/MANIFEST.MF
@@ -16,7 +16,8 @@ Require-Bundle: org.junit;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.common.ui;bundle-version="2.3.1",
org.eclipse.ui.ide,
org.eclipse.sirius.diagram.ui,
- org.eclipse.emf.edit.ui
+ org.eclipse.emf.edit.ui,
+ org.eclipse.pde.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
index cf6ae644e6..b14e51c11c 100644
--- a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
+++ b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
@@ -1,6 +1,6 @@
-/**
- * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES
+ * 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
@@ -9,10 +9,26 @@
* Obeo - Initial API and implementation
* Ketan Padegaonkar and others - the various waitUntil() methods come
* from org.eclipse.swtbot.swt.finder.SWTBotFactory
- */
+ *******************************************************************************/
package org.eclipse.sirius.tests.support.api;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.internal.framework.EquinoxBundle;
+import org.eclipse.osgi.storage.BundleInfo.Generation;
+import org.eclipse.pde.core.target.ITargetDefinition;
+import org.eclipse.pde.core.target.ITargetHandle;
+import org.eclipse.pde.core.target.ITargetLocation;
+import org.eclipse.pde.core.target.ITargetPlatformService;
+import org.eclipse.pde.core.target.LoadTargetDefinitionJob;
+import org.eclipse.pde.internal.core.target.TargetPlatformService;
import org.eclipse.ui.PlatformUI;
import org.junit.Assert;
import org.osgi.framework.Bundle;
@@ -284,4 +300,51 @@ public final class TestsUtil {
public static void waitUntil(ICondition condition) {
TestsUtil.waitUntil(condition, 5000, 500);
}
+
+ /**
+ * Sets a target platform in the test platform to get workspace builds OK
+ * with PDE.<BR>
+ * Copied and adpated from
+ * http://git.eclipse.org/c/gmf-tooling/org.eclipse.gmf-tooling.git/tree/
+ * tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/Utils.java
+ *
+ * @throws CoreException
+ * In case of problem to retrieve current target platform or to
+ * save the new one.
+ * @throws InterruptedException
+ * if the loading platform job is interrupted while waiting
+ */
+ @SuppressWarnings("restriction")
+ public static void setTargetPlatform() throws CoreException, InterruptedException {
+ String targetName = "PDE Platgorm from OSGi bundles";
+ ITargetPlatformService tpService = TargetPlatformService.getDefault();
+ ITargetHandle targetHandle = tpService.getWorkspaceTargetHandle();
+ if (targetHandle == null || !targetName.equals(targetHandle.getTargetDefinition().getName())) {
+ ITargetDefinition targetDef = tpService.newTarget();
+ targetDef.setName(targetName);
+ Bundle[] bundles = Platform.getBundle("org.eclipse.core.runtime").getBundleContext().getBundles();
+ List<ITargetLocation> bundleContainers = new ArrayList<ITargetLocation>();
+ Set<File> dirs = new HashSet<File>();
+ for (Bundle bundle : bundles) {
+ EquinoxBundle bundleImpl = (EquinoxBundle) bundle;
+ Generation generation = (Generation) bundleImpl.getModule().getCurrentRevision().getRevisionInfo();
+ File file = generation.getBundleFile().getBaseFile();
+ File folder = file.getParentFile();
+ if (!dirs.contains(folder)) {
+ dirs.add(folder);
+ bundleContainers.add(tpService.newDirectoryLocation(folder.getAbsolutePath()));
+ }
+ }
+ targetDef.setTargetLocations(bundleContainers.toArray(new ITargetLocation[bundleContainers.size()]));
+ targetDef.setArch(Platform.getOSArch());
+ targetDef.setOS(Platform.getOS());
+ targetDef.setWS(Platform.getWS());
+ targetDef.setNL(Platform.getNL());
+ tpService.saveTargetDefinition(targetDef);
+
+ Job job = new LoadTargetDefinitionJob(targetDef);
+ job.schedule();
+ job.join();
+ }
+ }
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CompletionProposalInVSMTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CompletionProposalInVSMTest.java
index 137cd9cbfa..a1115c4d0e 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CompletionProposalInVSMTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CompletionProposalInVSMTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
* 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
@@ -92,6 +92,10 @@ public class CompletionProposalInVSMTest extends AbstractContentAssistTest {
@Override
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
setErrorCatchActive(false);
+
+ // Load the target platform, if not already done, to allow compilation
+ // of the java services
+ TestsUtil.setTargetPlatform();
}
/**
@@ -178,7 +182,7 @@ public class CompletionProposalInVSMTest extends AbstractContentAssistTest {
// avoid dependencies from viewpoint.ui to Acceleo.
if (addAcceleoNatureCommand != null && addAcceleoNatureCommand.isDefined()) {
// Force org.eclipse.sirius.common.acceleo.mtl.ide plugin
- // inialization.
+ // initialization.
ProposalProviderRegistry.getAllProviders();
ParameterizedCommand parmCommand = new ParameterizedCommand(addAcceleoNatureCommand, null);
EvaluationContext evaluationContext = new EvaluationContext(null, Collections.singletonList(projet));
@@ -233,7 +237,7 @@ public class CompletionProposalInVSMTest extends AbstractContentAssistTest {
* Check that the right Java service appears in the completion proposals
* with Acceleo interpreter.
*
- * Warning: To ensure the non regression of the associtated bug 500253, the
+ * Warning: To ensure the non regression of the associated bug 500253, the
* manifest must not have a direct reference to org.eclipse.emf.ecore.
*
* @exception Exception
@@ -268,7 +272,7 @@ public class CompletionProposalInVSMTest extends AbstractContentAssistTest {
* Check that the right Java service appears in the completion proposals
* with service keyword used.
*
- * Warning: To ensure the non regression of the associtated bug 500253, the
+ * Warning: To ensure the non regression of the associated bug 500253, the
* manifest must not have a direct reference to org.eclipse.emf.ecore.
*
* @exception Exception
@@ -303,7 +307,7 @@ public class CompletionProposalInVSMTest extends AbstractContentAssistTest {
* Check that the right Java service appears in the completion proposals
* with AQL interpreter.
*
- * Warning: To ensure the non regression of the associtated bug 500253, the
+ * Warning: To ensure the non regression of the associated bug 500253, the
* manifest must not have a direct reference to org.eclipse.emf.ecore.
*
* @exception Exception
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/MigrationOnVsmEditorReloadTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/MigrationOnVsmEditorReloadTest.java
index 592dbfe222..968a8e79dd 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/MigrationOnVsmEditorReloadTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/MigrationOnVsmEditorReloadTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
* 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
@@ -51,6 +51,10 @@ public class MigrationOnVsmEditorReloadTest extends AbstractContentAssistTest {
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
designerPerspectives.openSiriusPerspective();
+ // Load the target platform, if not already done, to allow compilation
+ // of the VSP
+ TestsUtil.setTargetPlatform();
+
// Create VSM Project.
ViewpointSpecificationProjectCreationTest.createViewpointSpecificationProject(bot, VSM_PROJECT_NAME, VSM);

Back to the top