Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2122] Add a non-regression test on adapter factory on descriptors
Bug: 2122 Change-Id: Idb37c993781ff1ead499f49d8a215427318edac0 Signed-off-by: Philippe DUL <philippe.dul@thalesgroup.com>
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...sys/capella/test/platform/ju/testcases/InvalidRepresentationDescriptorAdapterFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 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 | ||
* | ||
* Contributors: | ||
* Thales - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.test.platform.ju.testcases; | ||
|
||
import org.eclipse.core.runtime.Adapters; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; | ||
import org.eclipse.sirius.viewpoint.ViewpointFactory; | ||
import org.polarsys.capella.core.data.ctx.CtxFactory; | ||
import org.polarsys.capella.core.data.ctx.SystemAnalysis; | ||
import org.polarsys.capella.test.framework.api.BasicTestCase; | ||
import org.polarsys.kitalpha.emde.model.Element; | ||
|
||
public class InvalidRepresentationDescriptorAdapterFactory extends BasicTestCase { | ||
|
||
@Override | ||
public void test() throws Exception { | ||
|
||
//Create a descriptor | ||
SystemAnalysis analysis = CtxFactory.eINSTANCE.createSystemAnalysis(); | ||
DRepresentationDescriptor descriptor = ViewpointFactory.eINSTANCE.createDRepresentationDescriptor(); | ||
descriptor.setTarget(analysis); | ||
|
||
//Find an adapter. If descriptor can be adapted to its target, there is an issue. | ||
EObject obj = Adapters.adapt(descriptor, Element.class, true); | ||
if (obj instanceof Element) { | ||
assertFalse( | ||
"An adapter from 'DRepresentationDescriptor' towards 'Element' exist. " | ||
+ "It breaks menus like 'Show in Semantic Browser, Show in Diagram' as they will now also appears on descriptors. " | ||
+ "Please ensure that adapter is really wanted and fix menus in that case.", | ||
true); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters