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..5fc309592 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 = WorkspaceSynchronizer.getFile(session.getSessionResource()).getProject().getFile("TotoDisplay.png").getFullPath(); + 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..3e5538edd 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 = WorkspaceSynchronizer.getFile(session.getSessionResource()).getProject().getFile("TotoRot.png").getFullPath(); + 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 = WorkspaceSynchronizer.getFile(session.getSessionResource()).getProject().getFile("TotoRot2.png").getFullPath(); + 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..0eb9af8f1 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 @@ -26,7 +26,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 +38,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 +56,30 @@ 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); + } + + /** + * 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);