blob: ad7bad933cdbb07b9a0197a7df42c76a1e45b537 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2019 CEA LIST, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.interoperability.sysml16.sysml14.tests.tests;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.internal.spec.AttributeChangeSpec;
import org.eclipse.emf.compare.internal.spec.MatchSpec;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
import org.eclipse.papyrus.interoperability.sysml16.sysml14.utils.SysMLMigrationConstantsUtils;
/**
* This allows to define the interoperability QvTo transformation from SysML1.4 to SysML1.6 for the notation models.
*/
@SuppressWarnings("restriction")
public class AbstractImportSysMLModelWithNotationTests extends AbstractImportSysMLModelTests {
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.m2m.qvto.tests.tools.tests.AbstractImportModelTests#checkNotationElementSpecificities(org.eclipse.emf.ecore.EModelElement)
*/
@Override
protected void checkNotationElementSpecificities(final EModelElement notationElement) {
checkEAnnotationUsedForSysMLMigration(notationElement);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.uml.m2m.qvto.tests.tools.tests.AbstractImportModelTests#getFilteredDiffForNotationModel(java.util.List)
*/
@Override
protected List<Diff> getFilteredDiffForNotationModel(final List<Diff> diff) {
final List<Diff> returnedDiffs = new ArrayList<>(diff);
for (final Diff current : diff) {
if (current instanceof AttributeChangeSpec && ((AttributeChangeSpec) current).eContainer() instanceof MatchSpec) {
if (current.getKind() == DifferenceKind.CHANGE) {
final EObject value = ((MatchSpec) ((AttributeChangeSpec) current).eContainer()).basicGetLeft();
if (value instanceof EStringToStringMapEntryImpl) {
final EStringToStringMapEntryImpl map = (EStringToStringMapEntryImpl) value;
final String key = map.getKey();
if (SysMLMigrationConstantsUtils.VERSIONING_EANNOTATION_DETAIL_KEY_PAPYRUS_MIGRATION_DATE.equals(key) || SysMLMigrationConstantsUtils.VERSIONING_EANNOTATION_DETAIL_KEY_PAPYRUS_MIGRATION_BUNDLE_VERSION.equals(key)) {
returnedDiffs.remove(current);
}
}
}
}
}
return returnedDiffs;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.interoperability.sysml16.sysml14.tests.tests.AbstractImportSysMLModelTests#compareNotation()
*/
@Override
protected boolean compareNotation() {
return true;
}
}