diff --git a/Jenkinsfile b/Jenkinsfile index cb02f3551..030ef0dcc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,17 +81,6 @@ pipeline { } } - stage('Run RCPTT Tests') { - steps { - wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) { - script { - sh 'mvn -Dmaven.test.failure.ignore=true verify -P rcptt -e' - - } - } - } - } - stage('Publish tests results') { steps { junit allowEmptyResults: true, testResults: '*.xml,**/target/surefire-reports/*.xml' @@ -124,7 +113,7 @@ pipeline { } post { always { - archiveArtifacts artifacts: '**/*.log' + archiveArtifacts artifacts: '**/*.log, **/Toto*' } } } \ No newline at end of file diff --git a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/META-INF/MANIFEST.MF b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/META-INF/MANIFEST.MF index 2b94cde86..6f4591b51 100644 --- a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/META-INF/MANIFEST.MF +++ b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.junit, org.eclipse.gmf.runtime.draw2d.ui, org.eclipse.gmf.runtime.diagram.ui, org.eclipse.sirius.common, - org.apache.batik.transcoder;bundle-version="1.14.0" + org.apache.batik.transcoder;bundle-version="1.14.0", + org.eclipse.emf.common.ui;bundle-version="2.21.0" Bundle-Vendor: %providerName Import-Package: org.eclipse.core.runtime, org.eclipse.gmf.runtime.diagram.ui.editparts diff --git a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageDisplayTest.java b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageDisplayTest.java index 894139a3d..1e0d07106 100644 --- a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageDisplayTest.java +++ b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageDisplayTest.java @@ -17,14 +17,22 @@ import java.util.Map; import java.util.Map.Entry; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; +import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.sirius.common.tools.api.resource.ImageFileFormat; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.internal.refresh.listeners.WorkspaceFileResourceChangeListener; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; +import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.eclipse.sirius.ui.business.api.dialect.ExportFormat; +import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat; +import org.eclipse.sirius.ui.tools.api.actions.export.SizeTooLargeException; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; @@ -94,6 +102,8 @@ public class RotativeImageDisplayTest extends RotativeSiriusTest { protected void setUp() throws Exception { super.setUp(); Resource.setNonDisposeHandler(null); + setPreferenceAutoRefresh(true); + setPrefereneRefreshOnOpening(true); genericSetUp(TEST_XMI_PATH, TEST_ODESIGN_PATH, TEST_AIRD_PATH); // Set test data @@ -141,6 +151,14 @@ public void testSVGDiagramImages() { DDiagram ddiagram = getDDiagramFromId(repId); DiagramEditor editor = openEditor(ddiagram); + IPath path = getProject().getFile("TotoDisplay.png").getLocation(); + try { + DialectUIManager.INSTANCE.export(ddiagram, session, path, new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG), new NullProgressMonitor()); + } catch (SizeTooLargeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + for (Entry entry : dDiagramElementToPositionConstantRotationSVG.entrySet()) { String elementId = entry.getKey(); int position = entry.getValue(); diff --git a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageMovementTest.java b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageMovementTest.java index 9759ec12e..8cdd29180 100644 --- a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageMovementTest.java +++ b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeImageMovementTest.java @@ -14,16 +14,25 @@ import java.util.List; import java.util.stream.Collectors; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.draw2d.IFigure; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.sirius.common.tools.api.resource.ImageFileFormat; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.ui.internal.edit.parts.WorkspaceImageEditPart; +import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.eclipse.sirius.ui.business.api.dialect.ExportFormat; +import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat; +import org.eclipse.sirius.ui.tools.api.actions.export.SizeTooLargeException; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.swt.graphics.Resource; import org.polarsys.kitalpha.sirius.rotativeimage.figures.Rotative4ImagesSVGWorkspaceImageFigure; @@ -60,6 +69,8 @@ public class RotativeImageMovementTest extends RotativeSiriusTest { @Override protected void setUp() throws Exception { super.setUp(); + setPreferenceAutoRefresh(true); + setPrefereneRefreshOnOpening(true); Resource.setNonDisposeHandler(null); genericSetUp(TEST_XMI_PATH, TEST_ODESIGN_PATH, TEST_AIRD_PATH); } @@ -82,7 +93,15 @@ public void testMoveImages() { String figureDocumentKey = ((Rotative4ImagesSVGWorkspaceImageFigure) bottomFigure).getDocumentKey(); assertTrue("Figure should reference uri " + FOURIMAGESICON_PREFIX + "_" + BOTTOM + SVG + " instead uri is " + figureDocumentKey, figureDocumentKey.endsWith(FOURIMAGESICON_PREFIX + "_" + BOTTOM + SVG)); - + + IPath path = getProject().getFile("TotoRot.png").getLocation(); + try { + DialectUIManager.INSTANCE.export(ddiagram, session, path, new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG), new NullProgressMonitor()); + } catch (SizeTooLargeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // We change the name of a port. After an Arrange all, it will move to west according to conditional style. closeEditor(editor); DDiagramElement port = getDiagramElementFromUid(ddiagram, BOTTOM_E1_BORDERNODE_ID, DDiagramElement.class); @@ -90,6 +109,13 @@ public void testMoveImages() { editor = openEditor(ddiagram); + path = getProject().getFile("TotoRot2.png").getLocation(); + try { + DialectUIManager.INSTANCE.export(ddiagram, session, path, new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG), new NullProgressMonitor()); + } catch (SizeTooLargeException e) { + e.printStackTrace(); + } + // Check new position bottomFigure = getFigure(ddiagram, BOTTOM_E1_BORDERNODE_ID, editor); assertTrue(bottomFigure instanceof Rotative4ImagesSVGWorkspaceImageFigure); diff --git a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeSiriusTest.java b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeSiriusTest.java index 967380c4e..644e2694d 100644 --- a/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeSiriusTest.java +++ b/sirius/tests/plugins/org.polarsys.kitalpha.sirius.rotativeimage.junit.tests/src/org/polarsys/kitalpha/sirius/rotativeimage/junit/tests/testcases/RotativeSiriusTest.java @@ -19,6 +19,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.draw2d.IFigure; import org.eclipse.emf.ecore.EClass; @@ -26,7 +29,9 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.sirius.business.api.dialect.DialectManager; +import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.diagram.DDiagram; @@ -36,9 +41,11 @@ import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys; import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; +import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.PlatformUI; import org.junit.Assert; @@ -52,6 +59,50 @@ private EStructuralFeature uidFeature(final EClass class1) { return class1.getEStructuralFeature("uid"); } + /** + * Set the auto refresh preference for diagram + * + * @apiNote that this method will affect the running instance (not specific to a given project) + * @see org.eclipse.sirius.business.api.session.Session.getSiriusPreferences + * @param value + */ + public static void setPreferenceAutoRefresh(final boolean value) { + IPreferenceStore preferenceStore = SiriusEditPlugin.getPlugin().getCorePreferenceStore(); + preferenceStore.setValue(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), value); + } + + protected static IProject getProject() { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("toto"); + if (!project.exists()) { + try { + project.create(new NullProgressMonitor()); + } catch (CoreException e) { + e.printStackTrace(); + } + } + if (!project.isOpen()) { + try { + project.open(new NullProgressMonitor()); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return project; + } + + /** + * Set the refresh on opening preference for diagram + * + * @apiNote that this method will affect the running instance (not specific to a given project) + * @see org.eclipse.sirius.business.api.session.Session.getSiriusPreferences + * @param value + */ + public static void setPrefereneRefreshOnOpening(final boolean value) { + IPreferenceStore preferenceStore = SiriusEditPlugin.getPlugin().getPreferenceStore(); + preferenceStore.setValue(SiriusUIPreferencesKeys.PREF_REFRESH_ON_REPRESENTATION_OPENING.name(), value); + } + public DRepresentationDescriptor getRepresentationDescriptor(Session session, String id) { Collection representationDescriptors = DialectManager.INSTANCE .getAllRepresentationDescriptors(session);