diff options
| author | cbrun | 2015-10-05 09:08:21 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2015-12-29 14:23:48 +0000 |
| commit | 672acad1a494ad9a59d07443786635ca61089960 (patch) | |
| tree | 6f3241128c51678e3ebd6414eba35a777e26ab53 | |
| parent | 2306cbd0a5fa6fca6a6abe09afdd515dbb73cda5 (diff) | |
| download | org.eclipse.sirius-672acad1a494ad9a59d07443786635ca61089960.tar.gz org.eclipse.sirius-672acad1a494ad9a59d07443786635ca61089960.tar.xz org.eclipse.sirius-672acad1a494ad9a59d07443786635ca61089960.zip | |
[478878] Migrate to AQL legacy expressions hardcoded in JUnit Tests
- Removes all the occurrences of '<%' in the java code by migrating the
expression to AQL.
- Removes tests which are explicitely testing for query legacy and for
which it makes no sense to adapt them to AQL.
- Update tests which can be reused for AQL.
AQLProposalProvider is updated to accomodate calls with an
InterpreterContext which has not element. This allows CompletionTests to
be reused in the context of AQL.
Bug: 478878
Change-Id: I9eb1f931c8bca797b88d26f146cc3eaf5ea2a1bd
Signed-off-by: Cedric Brun <cedric.brun@obeo.fr>
41 files changed, 460 insertions, 483 deletions
diff --git a/plugins/org.eclipse.sirius.common.acceleo.aql.ide/src/org/eclipse/sirius/common/acceleo/aql/ide/proposal/AQLProposalProvider.java b/plugins/org.eclipse.sirius.common.acceleo.aql.ide/src/org/eclipse/sirius/common/acceleo/aql/ide/proposal/AQLProposalProvider.java index 55086f80c8..4b335f51a0 100644 --- a/plugins/org.eclipse.sirius.common.acceleo.aql.ide/src/org/eclipse/sirius/common/acceleo/aql/ide/proposal/AQLProposalProvider.java +++ b/plugins/org.eclipse.sirius.common.acceleo.aql.ide/src/org/eclipse/sirius/common/acceleo/aql/ide/proposal/AQLProposalProvider.java @@ -87,9 +87,11 @@ public class AQLProposalProvider implements IProposalProvider { } } interpreter.activateMetamodels(metamodels); - Resource vsmResource = context.getInterpreterContext().getElement().eResource(); - if (vsmResource != null) { - interpreter.setProperty(IInterpreter.FILES, Lists.newArrayList(vsmResource.getURI().toPlatformString(true))); + if (context.getInterpreterContext().getElement() != null) { + Resource vsmResource = context.getInterpreterContext().getElement().eResource(); + if (vsmResource != null) { + interpreter.setProperty(IInterpreter.FILES, Lists.newArrayList(vsmResource.getURI().toPlatformString(true))); + } } for (String imp : context.getInterpreterContext().getDependencies()) { interpreter.addImport(imp); @@ -108,7 +110,7 @@ public class AQLProposalProvider implements IProposalProvider { for (ICompletionProposal propFromAQL : proposal) { int offset = position - completionResult.getPrefix().length(); int length = completionResult.getPrefix().length() + completionResult.getRemaining().length(); - + ContentProposal contentProposal = ContentProposalBuilder.proposal(propFromAQL.getProposal(), propFromAQL.toString(), propFromAQL.getDescription(), propFromAQL.getCursorOffset()) .withReplacement(offset, length).build(); proposals.add(contentProposal); diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/operations/createView.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/operations/createView.odesign index fbbecf344d..141e770528 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/operations/createView.odesign +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/operations/createView.odesign @@ -15,7 +15,7 @@ <element name="element"/> <elementView name="elementView"/> <initialOperation> - <firstModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='viewpoint1']/@ownedRepresentations[name='diagram1']/@defaultLayer/@nodeMappings[name='nodeMapping1']" containerViewExpression="<%$elementView.eContainer("DDiagram")%>"/> + <firstModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='viewpoint1']/@ownedRepresentations[name='diagram1']/@defaultLayer/@nodeMappings[name='nodeMapping1']" containerViewExpression="aql:elementView.eContainerOrSelf(diagram::DDiagram)"/> </initialOperation> </ownedTools> </toolSections> diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/AddSemanticElementTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/AddSemanticElementTest.java index ec0279621f..881205ff84 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/AddSemanticElementTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/AddSemanticElementTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -31,7 +31,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one container representing the chapter in the // diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -40,7 +40,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there is no edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -56,7 +56,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 2 containers representing the 2 chapters in the // diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -65,7 +65,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 1 edge between both chapters in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -88,7 +88,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one node representing the chapter in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -104,7 +104,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 2 nodes representing the 2 chapters in the // diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -130,7 +130,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 4 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -139,7 +139,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 3 edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -154,7 +154,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 4 edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -163,7 +163,7 @@ public class AddSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 5 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DeleteSemanticElementTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DeleteSemanticElementTest.java index 1adc7ed142..34c7b3e162 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DeleteSemanticElementTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DeleteSemanticElementTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -36,7 +36,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is Two DNodeContainer representing the 2 chapters in // the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -45,7 +45,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one DEdge between chapters in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -60,7 +60,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one DNodeContainer left in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -69,7 +69,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no more Edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -93,7 +93,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one DNode representing the 2 chapters in the // diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -108,7 +108,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no DNode left in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(sessionModel, "<%eAllContents(\"DSemanticDiagram\")[name == \"evoluate view\"].eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(sessionModel, "aql:self.eAllContents(diagram::DSemanticDiagram)->select( e | e.name = 'evoluate view').eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -135,7 +135,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 4 Edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -144,7 +144,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 5 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -159,7 +159,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 3 Edges left in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -168,7 +168,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // check that there is is 4 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -187,7 +187,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { int eltCount = -1; try { - eltCount = INTERPRETER.evaluateInteger(sessionModel, "<%eAllContents(\"DRepresentation\")[name == \"chapterDiagram\"].nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(sessionModel, "aql:self.eAllContents(viewpoint::DRepresentation)->select(r | r.name = 'chapterDiagram')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -214,7 +214,7 @@ public class DeleteSemanticElementTest extends DiagramIntegrityTestCase { // refreshRepresentation(); try { - eltCount = INTERPRETER.evaluateInteger(sessionModel, "<%eAllContents(\"DRepresentation\")[name == \"chapterDiagram\"].nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(sessionModel, "aql:self.eAllContents(viewpoint::DRepresentation)->select(r | r.name = 'chapterDiagram')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/ModifySemanticElementTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/ModifySemanticElementTest.java index 8075e6bf76..bbd2a7e328 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/ModifySemanticElementTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/ModifySemanticElementTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -32,7 +32,7 @@ public class ModifySemanticElementTest extends DiagramIntegrityTestCase { // check that there is Two DNodeContainer representing the 2 chapters in // the diagram. try { - eltName = INTERPRETER.evaluateString(myRepresentation, "<%eAllContents(\"DNode\").nFirst().name%>").toString(); + eltName = INTERPRETER.evaluateString(myRepresentation, "aql:self.eAllContents(diagram::DNode)->first().name").toString(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -47,7 +47,7 @@ public class ModifySemanticElementTest extends DiagramIntegrityTestCase { // check that there is one DNodeContainer left in the diagram. try { - eltName = INTERPRETER.evaluateString(myRepresentation, "<%eAllContents(\"DNode\").nFirst().name%>").toString(); + eltName = INTERPRETER.evaluateString(myRepresentation, "aql:self.eAllContents(diagram::DNode)->first().name").toString(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/MoveSemanticElementTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/MoveSemanticElementTest.java index e370d45e12..2a92584b84 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/MoveSemanticElementTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/MoveSemanticElementTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -34,7 +34,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 5 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -43,7 +43,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 4 edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -58,7 +58,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 3 edges in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -67,7 +67,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 4 nodes in the diagram. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eAllContents(\"DNode\").nSize()%>").intValue(); + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eAllContents(diagram::DNode)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -95,7 +95,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are 2 elements under the first chapter. try { eltCount = INTERPRETER.evaluateInteger(myRepresentation, - "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nFirst()].eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->first()).eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -105,7 +105,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no elements under the second (last) chapter. try { eltCount = INTERPRETER - .evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nLast()].eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + .evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->last()).eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -121,7 +121,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no elements under the first chapter. try { eltCount = INTERPRETER.evaluateInteger(myRepresentation, - "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nFirst()].eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->first()).eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -131,7 +131,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there is one element under the second (last) chapter. try { eltCount = INTERPRETER - .evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nLast()].eAllContents(\"DNodeContainer\").nSize()%>").intValue(); + .evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->last()).eAllContents(diagram::DNodeContainer)->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); e.printStackTrace(); @@ -158,7 +158,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there is 1 element under the first big section. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nFirst()].eAllContents(\"DNode\").nSize()%>") + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->first()).eAllContents(diagram::DNode)->size()") .intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); @@ -168,7 +168,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no elements under the second (last) big section. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nLast()].eAllContents(\"DNode\").nSize()%>") + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->last()).eAllContents(diagram::DNode)->size()") .intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); @@ -184,7 +184,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no elements under the first chapter. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nFirst()].eAllContents(\"DNode\").nSize()%>") + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->first()).eAllContents(diagram::DNode)->size()") .intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); @@ -194,7 +194,7 @@ public class MoveSemanticElementTest extends DiagramIntegrityTestCase { // check that there are no elements under the second (last) chapter. try { - eltCount = INTERPRETER.evaluateInteger(myRepresentation, "<%eContents().filter(\"DNodeContainer\")[target == target.eContainer.chapter.nLast()].eAllContents(\"DNode\").nSize()%>") + eltCount = INTERPRETER.evaluateInteger(myRepresentation, "aql:self.eContents()->filter(diagram::DNodeContainer)->select(e | e.target = e.target.eContainer().chapter->last()).eAllContents(diagram::DNode)->size()") .intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the integer value."); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/dialect/DialectManagerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/dialect/DialectManagerTest.java index 0123467d26..622e57df93 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/dialect/DialectManagerTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/dialect/DialectManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -72,7 +72,7 @@ public class DialectManagerTest extends TestCase { assertEquals("we should have one possible representation", 1, descriptions.size()); final DiagramDescription diagramDescription = findDiagramDescription(dialectGroup, "Class Diagram"); - diagramDescription.setPreconditionExpression("<%false%>"); + diagramDescription.setPreconditionExpression("aql:false"); descriptions = DialectManager.INSTANCE.getAvailableRepresentationDescriptions(currentVp, class1); assertEquals("we should have zero possible representation", 0, descriptions.size()); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/CompletionTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/CompletionTests.java index f78ce7c573..8440ebe374 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/CompletionTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/CompletionTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -12,17 +12,17 @@ package org.eclipse.sirius.tests.unit.api.interpreter; import java.util.Collection; import java.util.Collections; +import java.util.Map; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.sirius.common.tools.api.contentassist.ContentContext; import org.eclipse.sirius.common.tools.api.contentassist.ContentProposal; import org.eclipse.sirius.common.tools.api.contentassist.IProposalProvider; import org.eclipse.sirius.common.tools.api.interpreter.DefaultInterpreterContextFactory; import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterContext; -import org.eclipse.sirius.common.tools.api.interpreter.TypeName; import org.eclipse.sirius.common.tools.api.interpreter.VariableType; import org.eclipse.sirius.diagram.DiagramPackage; import org.eclipse.sirius.diagram.description.tool.NodeCreationDescription; @@ -30,8 +30,12 @@ import org.eclipse.sirius.diagram.description.tool.ToolFactory; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler; +import org.eclipse.sirius.tools.api.interpreter.context.SiriusInterpreterContextFactory; import org.eclipse.sirius.viewpoint.description.tool.ToolPackage; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + /** * Tests on editing domain based on entities diagram of ecore modeler. * @@ -49,7 +53,7 @@ public class CompletionTests extends SiriusDiagramTestCase implements EcoreModel } public void testGetStructuralFeatures() { - ContentContext context = getContext(null, null, "DDiagram:1.1.0", getContentContextText(), 2); + ContentContext context = getContext(null, null, "diagram.DDiagram", getContentContextText(), 9); assertTrue(interpreter instanceof IProposalProvider); @@ -63,7 +67,7 @@ public class CompletionTests extends SiriusDiagramTestCase implements EcoreModel NodeCreationDescription nodeCreationDescription = ToolFactory.eINSTANCE.createNodeCreationDescription(); EAttribute precondition = ToolPackage.eINSTANCE.getAbstractToolDescription_Precondition(); - ContentContext context = getContext(nodeCreationDescription, precondition, NodeCreationDescription.class.getName(), getContentContextText("c"), 2); + ContentContext context = getContext(nodeCreationDescription, precondition, NodeCreationDescription.class.getName(), getContentContextText("c"), 4); assertTrue(interpreter instanceof IProposalProvider); @@ -72,19 +76,24 @@ public class CompletionTests extends SiriusDiagramTestCase implements EcoreModel } private ContentContext getContext(EObject element, EStructuralFeature feature, String domainClass, String text, int cursorPosition) { - IInterpreterContext interContext = DefaultInterpreterContextFactory.createInterpreterContext(element, true, feature, VariableType.fromString(domainClass), Collections.<EPackage> emptyList(), - Collections.<String, VariableType> emptyMap(), Collections.<String> emptyList()); + Map<String, VariableType> variables = Maps.newLinkedHashMap(); + if (element != null && feature != null) { + variables = SiriusInterpreterContextFactory.createInterpreterContext(element, feature).getVariables(); + } + + IInterpreterContext interContext = DefaultInterpreterContextFactory.createInterpreterContext(element, true, feature, VariableType.fromString(domainClass), + Sets.newHashSet(DiagramPackage.eINSTANCE, EcorePackage.eINSTANCE), variables, Collections.<String> emptyList()); ContentContext context = new ContentContext(text, cursorPosition, interContext); return context; } private String getContentContextText() { - return getContentContextText(""); + return getContentContextText("self."); } private String getContentContextText(String firstChars) { - return "<%" + firstChars; + return "aql:" + firstChars; } private void assertContains(Collection<ContentProposal> contentProposals, String name) { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/ContentHelperTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/ContentHelperTests.java index f837855fc4..bd41060afc 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/ContentHelperTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/ContentHelperTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -78,7 +78,7 @@ public class ContentHelperTests extends TestCase { assertTrue(Character.isJavaIdentifierPart('A')); assertTrue(Character.isJavaIdentifierStart('A')); - + assertTrue(Character.isJavaIdentifierPart('$')); assertTrue(Character.isJavaIdentifierStart('$')); } @@ -119,35 +119,6 @@ public class ContentHelperTests extends TestCase { * There is a bug in Acceleo completion without context: * getEStructuralFeature(name) is not proposed. */ - public void testContextHelperAndAcceleo() { - - ContentContextHelper cch = new ContentContextHelper("<%$cur%>", 6, "$"); - assertEquals("$cur", cch.getProposalStart()); - - cch = new ContentContextHelper("<%cur%>", 5, "$"); - assertEquals("cur", cch.getProposalStart()); - - cch = new ContentContextHelper("<%%>", 2, "$"); - assertEquals("", cch.getProposalStart()); - - cch = new ContentContextHelper("<%current[%>", 10, "$"); - assertEquals("", cch.getProposalStart()); - - cch = new ContentContextHelper("<%current[a%>", 11, "$"); - assertEquals("a", cch.getProposalStart()); - - cch = new ContentContextHelper("<%current[a==%>", 13, "$"); - assertEquals("", cch.getProposalStart()); - cch = new ContentContextHelper("<%current[a==b%>", 14, "$"); - assertEquals("b", cch.getProposalStart()); - } - - /** - * Tests completion for an EClass. - * - * There is a bug in Acceleo completion without context: - * getEStructuralFeature(name) is not proposed. - */ public void testContextHelperAndOCL() { ContentContextHelper cch = new ContentContextHelper("ocl:", 4, ""); @@ -156,7 +127,7 @@ public class ContentHelperTests extends TestCase { cch = new ContentContextHelper("ocl:sel", 7, ""); assertEquals("sel", cch.getProposalStart()); } - + /** * Tests completion for an EClass. * @@ -170,13 +141,13 @@ public class ContentHelperTests extends TestCase { cch = new ContentContextHelper("aaaa.aaaa()", 11, ""); assertEquals("", cch.getProposalStart()); - + cch = new ContentContextHelper("aaaa.aaaa().", 12, ""); assertEquals("", cch.getProposalStart()); - + cch = new ContentContextHelper("aaaa.aaa_9", 10, ""); assertEquals("aaa_9", cch.getProposalStart()); - + cch = new ContentContextHelper("-> a", 4, ""); assertEquals("a", cch.getProposalStart()); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/InterpreterPerformanceTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/InterpreterPerformanceTests.java index 794a440c26..790a945e6c 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/InterpreterPerformanceTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/interpreter/InterpreterPerformanceTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -67,8 +67,8 @@ public class InterpreterPerformanceTests extends SiriusDiagramTestCase implement Thread.sleep(3000); } - public void testEvaluateNameWithAcceleo2() throws EvaluationException { - measure("Acceleo 2", semanticModel, "<%name%>", NAME, ITER); + public void testEvaluateNameWithAQL() throws EvaluationException { + measure("AQL", semanticModel, "aql:self.name", NAME, ITER); } public void testEvaluateNameWithAcceleo3() throws EvaluationException { @@ -79,8 +79,8 @@ public class InterpreterPerformanceTests extends SiriusDiagramTestCase implement measure("feature:", semanticModel, "feature:name", NAME, ITER); } - public void testEvaluateVarWithAcceleo2() throws EvaluationException { - measure("Acceleo 2", semanticModel, "<%$testVar%>", VAR_VALUE, ITER); + public void testEvaluateVarWithAQL() throws EvaluationException { + measure("AQL", semanticModel, "aql:testVar", VAR_VALUE, ITER); } public void testEvaluateVarWithAcceleo3() throws EvaluationException { @@ -91,8 +91,8 @@ public class InterpreterPerformanceTests extends SiriusDiagramTestCase implement measure("var:", semanticModel, "var:testVar", VAR_VALUE, ITER); } - public void _testEvaluateServiceWithAcceleo2() throws EvaluationException { - measure("Acceleo 2", testAttr, "<%self.render()%>", "foo : EString", ITER); + public void _testEvaluateServiceWithAQL() throws EvaluationException { + measure("AQL", testAttr, "aql:self.render()", "foo : EString", ITER); } public void _testEvaluateServiceWithAcceleo3() throws EvaluationException { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/refresh/EdgeWithConditionalStyleTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/refresh/EdgeWithConditionalStyleTest.java index d467de2042..678a5fd770 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/refresh/EdgeWithConditionalStyleTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/refresh/EdgeWithConditionalStyleTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -89,7 +89,7 @@ public class EdgeWithConditionalStyleTest extends DocbookTestCase { // Test that the style for the first edge is the conditional style EObject firstBigSectionEdge = null; try { - firstBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DEdge\")[target.eClass.name==\"Sect1\"].nFirst()%>"); + firstBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "aql:self.eAllContents(diagram::DEdge)->select(e | e.target.eClass().name='Sect1')->first()"); } catch (final EvaluationException e) { fail("Exception while trying to get the first edge for the mapping \"belong to Chapter\"."); e.printStackTrace(); @@ -106,8 +106,8 @@ public class EdgeWithConditionalStyleTest extends DocbookTestCase { // Test that the style for the second edge is the normal style EObject secondBigSectionEdge = null; try { - secondBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "<%(" + "eAllContents(\"DEdge\")[target.eClass.name==\"Sect1\"] - " - + "eAllContents(\"DEdge\")[target.eClass.name==\"Sect1\"].nFirst()).nFirst()%>"); + secondBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "aql:(" + "self.eAllContents(diagram::DEdge)->select(e | e.target.eClass().name='Sect1') - " + + "Sequence{self.eAllContents(diagram::DEdge)->select(e | e.target.eClass().name='Sect1')->first()})->first()"); } catch (final EvaluationException e) { fail("Exception while trying to get the second edge for the mapping \"belong to Chapter\"."); e.printStackTrace(); @@ -160,7 +160,7 @@ public class EdgeWithConditionalStyleTest extends DocbookTestCase { // Test that the style for the first edge is the conditional style EObject firstBigSectionEdge = null; try { - firstBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DEdge\")[target.eClass.name==\"Sect1\"].nFirst()%>"); + firstBigSectionEdge = INTERPRETER.evaluateEObject(evoluateDiagram, "aql:self.eAllContents(diagram::DEdge)->select(e | e.target.eClass().name='Sect1')->first()"); } catch (final EvaluationException e) { fail("Exception while trying to get the first edge for the mapping \"belong to Chapter\"."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DeleteTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DeleteTest.java index 7f33c12832..df1a11aded 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DeleteTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DeleteTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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,9 +92,9 @@ public class DeleteTest extends DocbookTestCase { } private void checkModel(int paraSemanticNb, int evoDiagParaNb, int obviousDiagParaNb) { - check(evoluateDiagram, "<%target.eAllContents(\"Para\").nSize()%>", paraSemanticNb); - check(evoluateDiagram, "<%eAllContents().target.filter(\"Para\").nSize()%>", evoDiagParaNb); - check(obviousDiagram, "<%nFirst().eAllContents(\"DNodeContainer\").eAllContents().target.filter(\"Para\").nSize()%>", obviousDiagParaNb); + check(evoluateDiagram, "aql:self.target.eAllContents(docbook::Para)->size()", paraSemanticNb); + check(evoluateDiagram, "aql:self.eAllContents().target->filter(docbook::Para)->size()", evoDiagParaNb); + check(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer).eAllContents().target->filter(docbook::Para)->size()", obviousDiagParaNb); } private void check(DDiagram context, String expression, int expected) { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DirectEditTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DirectEditTest.java index 3648727c3f..37bcd13335 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DirectEditTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DirectEditTest.java @@ -26,7 +26,7 @@ public class DirectEditTest extends DocbookTestCase { final DRepresentationElement repElement = createBigSection(); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\" && target.id == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer)->select(c | c.target.eClass().name ='Sect1' and c.target.id = 'new label')->size() ").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -40,7 +40,7 @@ public class DirectEditTest extends DocbookTestCase { // check that the container label has changed to the new one. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\" && target.id == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer)->select(c | c.target.eClass().name ='Sect1' and c.target.id = 'new label')->size() ").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -57,7 +57,7 @@ public class DirectEditTest extends DocbookTestCase { final DRepresentationElement repElement = createMediumSection(); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Sect2\" && target.id == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNode)->select(n | n.target.eClass().name = 'Sect2' and n.target.id = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -71,7 +71,7 @@ public class DirectEditTest extends DocbookTestCase { // check that the node label has changed to the new one. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Sect2\" && target.id == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNode)->select(n | n.target.eClass().name = 'Sect2' and n.target.id = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -88,7 +88,7 @@ public class DirectEditTest extends DocbookTestCase { final DRepresentationElement repElement = createChapterReturnTitle(); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Title\" && target.data == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNode)->select( n | n.target.eClass().name = 'Title' and n.target.data = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -102,7 +102,7 @@ public class DirectEditTest extends DocbookTestCase { // check that the node label has changed to the new one. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Title\" && target.data == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DNode)->select( n | n.target.eClass().name = 'Title' and n.target.data = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -119,7 +119,7 @@ public class DirectEditTest extends DocbookTestCase { DRepresentationElement repElement = (DRepresentationElement) createNoteInEvoluateView().get(1); try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents(\"DEdge\")[target.eClass.name == \"Para\" && target.data == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | e.target.eClass().name = 'Para' and e.target.data = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -133,7 +133,7 @@ public class DirectEditTest extends DocbookTestCase { // check that the edge label has changed to the new one. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents(\"DEdge\")[target.eClass.name == \"Para\" && target.data == \"new label\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | e.target.eClass().name = 'Para' and e.target.data = 'new label')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropTest.java index 55859f367b..cc95146677 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -26,6 +26,15 @@ import org.eclipse.sirius.tools.api.command.DCommand; */ public class DragAndDropTest extends DocbookTestCase { + private static final String QUERY_E_CONTENTS_E_CLASS_NAME_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE = "aql:self.eContents()->select( e | e.eClass().name = 'DNode').target->select(e | e.eClass().name = 'Para')->size()"; + private static final String QUERY_TARGET_E_ALL_CONTENTS_CHAPTER_N_LAST_E_ALL_CONTENTS_PARA_N_SIZE = "aql:self.target.eAllContents(docbook::Chapter)->last().eAllContents(docbook::Para)->size()"; + private static final String QUERY_TARGET_E_ALL_CONTENTS_CHAPTER_N_FIRST_E_ALL_CONTENTS_PARA_N_SIZE = "aql:self.target.eAllContents(docbook::Chapter)->first().eAllContents(docbook::Para)->size()"; + private static final String QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE = "aql:self.eAllContents(diagram::DNodeContainer)->select( e | e.target.eClass().name = 'Chapter')->at(2).eAllContents(diagram::DNode)->select( e | e.target.eClass().name = 'Para')->size()"; + private static final String QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE = "aql:self.eAllContents(diagram::DNodeContainer)->select( e | e.target.eClass().name = 'Chapter')->at(1).eAllContents(diagram::DNode)->select(e | e.target.eClass().name = 'Para')->size()"; + private static final String QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_SIZE = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->at(2).eAllContents(diagram::DNode)->select(e | e.target.eClass().name = 'Sect2')->size()"; + private static final String QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_SIZE = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->at(1).eAllContents(diagram::DNode)->select(e | e.target.eClass().name = 'Sect2')->size()"; + private static final String QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_SIZE = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->at(1).eAllContents(diagram::DNodeContainer)->select(e| e.target.eClass().name = 'Sect1')->size()"; + /** * test drag and drop of a container in a container. */ @@ -38,7 +47,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -56,7 +65,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -66,7 +75,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1).eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->at(2).eAllContents(diagram::DNodeContainer)->select(n | n.target.eClass().name = 'Sect1')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -86,7 +95,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNode\")[target.eClass.name == \"Sect2\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -104,7 +113,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNode\")[target.eClass.name == \"Sect2\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -114,7 +123,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1).eAllContents(\"DNode\")[target.eClass.name == \"Sect2\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -136,7 +145,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNode\")[target.eClass.name == \"Para\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -154,7 +163,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNode\")[target.eClass.name == \"Para\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -164,7 +173,7 @@ public class DragAndDropTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1).eAllContents(\"DNode\")[target.eClass.name == \"Para\"].nSize()%>").intValue(); + QUERY_E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -184,7 +193,7 @@ public class DragAndDropTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%target.eAllContents(\"Chapter\").nFirst().eAllContents(\"Para\").nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, QUERY_TARGET_E_ALL_CONTENTS_CHAPTER_N_FIRST_E_ALL_CONTENTS_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -201,7 +210,7 @@ public class DragAndDropTest extends DocbookTestCase { // that no medium section is inside the second chapter. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%target.eAllContents(\"Chapter\").nFirst().eAllContents(\"Para\").nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, QUERY_TARGET_E_ALL_CONTENTS_CHAPTER_N_FIRST_E_ALL_CONTENTS_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -210,7 +219,7 @@ public class DragAndDropTest extends DocbookTestCase { assertEquals("Wrong bordered node count inside the considered DNode.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%target.eAllContents(\"Chapter\").nLast().eAllContents(\"Para\").nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, QUERY_TARGET_E_ALL_CONTENTS_CHAPTER_N_LAST_E_ALL_CONTENTS_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -233,7 +242,7 @@ public class DragAndDropTest extends DocbookTestCase { // before command execution. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eContents()[eClass.name == \"DNode\"].target[eClass.name == \"Para\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, QUERY_E_CONTENTS_E_CLASS_NAME_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -248,7 +257,7 @@ public class DragAndDropTest extends DocbookTestCase { // the diagram. try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eContents()[eClass.name == \"DNode\"].target[eClass.name == \"Para\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, QUERY_E_CONTENTS_E_CLASS_NAME_D_NODE_TARGET_E_CLASS_NAME_PARA_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReconnectionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReconnectionTest.java index 4fe5fcd273..8b92850609 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReconnectionTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReconnectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -29,6 +29,36 @@ import org.eclipse.sirius.tests.unit.common.DocbookTestCase; */ public class ReconnectionTest extends DocbookTestCase { + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_SOURCE_NODE_NAME_CHAP1_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.oclIsTypeOf(docbook::Sect1) and e.sourceNode.name='chap1')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_SOURCE_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.oclIsTypeOf(docbook::Sect1) and e.sourceNode.name='chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_NAME_CHAP1_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.oclIsTypeOf(docbook::Sect2) and e.sourceNode.name='chap1')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.oclIsTypeOf(docbook::Sect2) and e.sourceNode.name='chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.target.oclIsTypeOf(docbook::Chapter) and e.targetNode.target.oclIsTypeOf(docbook::Sect1))->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.target.oclIsTypeOf(docbook::Sect3) and e.targetNode.target.oclIsTypeOf(docbook::Chapter))->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP1_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.eClass().name = 'Para' and e.sourceNode.name = 'chap1')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.eClass().name = 'Para' and e.sourceNode.name = 'chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.target.eClass().name = 'Chapter' and e.targetNode.target.eClass().name = 'Sect2')->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect3' and e.targetNode.target.eClass().name = 'Chapter').targetNode->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect3' and e.targetNode.target.eClass().name = 'Chapter').targetNode->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect3' and e.targetNode.target.eClass().name = 'Sect2').targetNode->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect3' and e.targetNode.target.eClass().name = 'Sect2').targetNode->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect3' and e.targetNode.target.eClass().name = 'Sect2')->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT1_TARGET_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect1' and e.targetNode.name = 'chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_NAME_CHAP1_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect2' and e.targetNode.name = 'chap1')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect2' and e.targetNode.name = 'chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT1_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Chapter' and e.sourceNode.target.eClass().name = 'Sect1')->first()"; + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_12 = "aql:self.eAllContents(diagram::DNode)->select( e | e.target.eClass().name = 'Sect2')->at(2)"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Chapter')->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP1_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Para' and e.targetNode.name = 'chap1')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP0_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Para' and e.targetNode.name = 'chap0')->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Chapter' and e.sourceNode.target.eClass().name = 'Sect2')->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Chapter').sourceNode->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Chapter').sourceNode->size()"; + private static final String E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1 = "aql:self.eAllContents(diagram::DNodeContainer)->select( e | e.target.eClass().name = 'Chapter')->at(2)"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_SIZE = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Sect2').sourceNode->size()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Sect2').sourceNode->first()"; + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select( e | e.targetNode.target.eClass().name = 'Sect3' and e.sourceNode.target.eClass().name = 'Sect2')->first()"; + /** * test reconnection of edge source from DNode to DNode. */ @@ -39,7 +69,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -47,7 +77,7 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -67,7 +97,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -77,7 +107,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -98,7 +128,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -106,14 +136,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -132,7 +162,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -142,7 +172,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -171,7 +201,7 @@ public class ReconnectionTest extends DocbookTestCase { // // Gets the edge to reconnect. try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Chapter\" && sourceNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -192,7 +222,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -201,7 +231,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -222,7 +252,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -230,14 +260,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Sect2\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_12); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -256,7 +286,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -266,7 +296,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Sect2\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -287,7 +317,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -295,14 +325,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -321,7 +351,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -331,7 +361,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect3\" && sourceNode.target.eClass.name == \"Chapter\"].sourceNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT3_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -351,7 +381,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject edge = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Chapter\" && sourceNode.target.eClass.name == \"Sect1\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT1_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -372,7 +402,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -381,7 +411,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -416,7 +446,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect2\" && targetNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -425,7 +455,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect2\" && targetNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -456,7 +486,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect1\" && targetNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT1_TARGET_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -465,7 +495,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect1\" && targetNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | e.sourceNode.target.eClass().name = 'Sect1' and e.targetNode.name = 'chap1')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -497,7 +527,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -506,7 +536,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 2, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\" && targetNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_TARGET_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -525,7 +555,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -533,7 +563,7 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -553,7 +583,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -563,7 +593,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -584,7 +614,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -592,14 +622,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -618,7 +648,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -628,7 +658,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -648,7 +678,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject edge = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Chapter\" && targetNode.target.eClass.name == \"Sect2\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -669,7 +699,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -678,7 +708,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -699,7 +729,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -707,14 +737,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name == \"Sect2\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_12); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -733,7 +763,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -742,7 +772,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Sect2\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -763,7 +793,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject source = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -771,14 +801,14 @@ public class ReconnectionTest extends DocbookTestCase { try { source = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); } try { - target = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1)%>"); + target = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_GET_1); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject target."); e.printStackTrace(); @@ -797,7 +827,7 @@ public class ReconnectionTest extends DocbookTestCase { try { targetCount = INTERPRETER.evaluateInteger(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nSize%>").intValue(); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -807,7 +837,7 @@ public class ReconnectionTest extends DocbookTestCase { try { effectiveTarget = INTERPRETER.evaluateEObject(obviousDiagram, - "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Sect3\" && targetNode.target.eClass.name == \"Chapter\"].targetNode.nGet(0)%>"); + E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_SECT3_TARGET_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject source."); e.printStackTrace(); @@ -827,7 +857,7 @@ public class ReconnectionTest extends DocbookTestCase { EObject edge = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Chapter\" && targetNode.target.eClass.name == \"Sect1\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_CHAPTER_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -848,7 +878,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -857,7 +887,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -892,7 +922,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect2\" && sourceNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -901,7 +931,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect2\" && sourceNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT2_SOURCE_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -932,7 +962,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect1\" && sourceNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_SOURCE_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -941,7 +971,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 1, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Sect1\" && sourceNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_SECT1_SOURCE_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -974,7 +1004,7 @@ public class ReconnectionTest extends DocbookTestCase { int targetCount = -1; try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap0\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP0_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -983,7 +1013,7 @@ public class ReconnectionTest extends DocbookTestCase { assertEquals("Wrong target count for the considered edge.", 2, targetCount); try { - targetCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_SOURCE_NODE_NAME_CHAP1_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReusedMappingTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReusedMappingTest.java index 1c365f05df..2fd59adcaa 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReusedMappingTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ReusedMappingTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -38,7 +38,7 @@ public class ReusedMappingTest extends DocbookTestCase { // before executing the command, we check that there is no "title" // object in the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.eClass.name == \"Title\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eAllContents()->select(e | e.target.eClass().name = 'Title')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -51,7 +51,7 @@ public class ReusedMappingTest extends DocbookTestCase { // directly under the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents()[target.eClass.name == \"Title\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->select(e | e.target.eClass().name = 'Title')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -61,7 +61,7 @@ public class ReusedMappingTest extends DocbookTestCase { // we verify that 1 and only one "title" object has been created in the // "info" container. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents()[target.eClass.name == \"Info\"].eContents()[target.eClass.name == \"Title\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->select(e | e.target.eClass().name = 'Info').eContents()->select(e | e.target.eClass().name = 'Title')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -85,7 +85,7 @@ public class ReusedMappingTest extends DocbookTestCase { // before executing the command, we check that there is no "big sect" // object in the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eAllContents()->select(e | e.target.eClass().name = 'Sect1')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -98,7 +98,7 @@ public class ReusedMappingTest extends DocbookTestCase { // directly under the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents().filter(\"DNode\")[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->filter(diagram::DNode)->select(n | n.target.eClass().name = 'Sect1')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -108,7 +108,7 @@ public class ReusedMappingTest extends DocbookTestCase { // we verify that 1 and only one "big sect" object has been created in // the "info" container. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents()[target.eClass.name == \"Info\"].eContents()[target.eClass.name == \"Sect1\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->select(n | n.target.eClass().name = 'Info').eContents()->select(e | e.target.eClass().name= 'Sect1')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -132,7 +132,7 @@ public class ReusedMappingTest extends DocbookTestCase { // before executing the command, we check that there is no "author" // object in the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.eClass.name == \"Author\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eAllContents()->select(e | e.target.eClass().name = 'Author')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -144,7 +144,7 @@ public class ReusedMappingTest extends DocbookTestCase { // we verify that 1 and only one "author" object has been created in // border of the "info" container. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents()[target.eClass.name == \"Info\"].eContents()[target.eClass.name == \"Author\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->select(e | e.target.eClass().name = 'Info').eContents()->select(n | n.target.eClass().name = 'Author')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -154,7 +154,7 @@ public class ReusedMappingTest extends DocbookTestCase { // we verify that 1 and only one "author" object has been created // directly under the diagram. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eContents().filter(\"DNode\")[target.eClass.name == \"Author\"].nSize()%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "aql:self.eContents()->filter(diagram::DNode)->select(n | n.target.eClass().name = 'Author')->size()").intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/SelectionWizardTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/SelectionWizardTest.java index 26440442cc..b01be6be7e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/SelectionWizardTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/SelectionWizardTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -22,6 +22,8 @@ import org.eclipse.sirius.viewpoint.DSemanticDecorator; public class SelectionWizardTest extends DocbookTestCase { + private static final String QUERY_E_ALL_CONTENTS_TARGET_DATA_DATA_VALUE_N_SIZE = "aql:self.eAllContents(viewpoint::DSemanticDecorator)->select( e | e.target.data = 'data value')->size()"; + /** * Test that a multiple selection is possible only if allowed. Test that a * single selection is always possible. @@ -35,7 +37,7 @@ public class SelectionWizardTest extends DocbookTestCase { /* retrieve elements from the diagram. */ try { - selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "<%eAllContents()[target.data == \"\"]%>")); + selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "aql:self.eAllContents(viewpoint::DSemanticDecorator)->select(e | e.target.data->size() = 0)")); } catch (final EvaluationException e) { fail("Exception while trying to fetch the created chapter."); } @@ -48,7 +50,7 @@ public class SelectionWizardTest extends DocbookTestCase { // check that the selection wizard tool apply just on the first element. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.data == \"data value\"].nSize%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, QUERY_E_ALL_CONTENTS_TARGET_DATA_DATA_VALUE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -71,14 +73,14 @@ public class SelectionWizardTest extends DocbookTestCase { /* retrieve elements from the diagram. */ try { - selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "<%eAllContents()[target.data == \"\"]%>")); + selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "aql:self.eAllContents(viewpoint::DSemanticDecorator)->select(e | e.target.data->size() = 0)")); } catch (final EvaluationException e) { fail("Exception while trying to fetch the created chapter."); } EObject sect1 = null; try { - sect1 = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect1\"].nLast()%>"); + sect1 = INTERPRETER.evaluateEObject(evoluateDiagram, "aql:self.eAllContents(diagram::DNode)->select(n | n.target.eClass().name='Sect1')->last()"); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject big section : " + e.getMessage()); } @@ -91,7 +93,7 @@ public class SelectionWizardTest extends DocbookTestCase { // check that the selection wizard tool apply just on the first element. try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.data == \"data value\"].nSize%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, QUERY_E_ALL_CONTENTS_TARGET_DATA_DATA_VALUE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); @@ -113,7 +115,7 @@ public class SelectionWizardTest extends DocbookTestCase { /* retrieve elements from the diagram. */ try { - selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "<%eAllContents()[target.data == \"\"]%>")); + selectedElements = new ArrayList<EObject>(INTERPRETER.evaluateCollection(evoluateDiagram, "aql:self.eAllContents(viewpoint::DSemanticDecorator)->select(e | e.target.data->size() = 0)")); } catch (final EvaluationException e) { fail("Exception while trying to fetch the created chapter."); } @@ -126,7 +128,7 @@ public class SelectionWizardTest extends DocbookTestCase { /* check that the selection wizard tool apply on every elements. */ try { - targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, "<%eAllContents()[target.data == \"data value\"].nSize%>").intValue(); + targetCount = INTERPRETER.evaluateInteger(evoluateDiagram, QUERY_E_ALL_CONTENTS_TARGET_DATA_DATA_VALUE_N_SIZE).intValue(); } catch (final EvaluationException e) { fail("Exception while trying to get the Int source."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ToolFilterDescriptionListenerTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ToolFilterDescriptionListenerTests.java index 72f890d8dc..a5751c4743 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ToolFilterDescriptionListenerTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/ToolFilterDescriptionListenerTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -187,7 +187,7 @@ public class ToolFilterDescriptionListenerTests extends TestCase { private ToolFilterDescription createToolFilterDescriptionOnDiagram(String... featureNames) { ToolFilterDescription filterDescription = ToolFactory.eINSTANCE.createToolFilterDescription(); - filterDescription.setElementsToListen("<%current%>"); + filterDescription.setElementsToListen("aql:self"); filterDescription.setPrecondition(""); for (final String featureName : featureNames) { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/UndoRedoTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/UndoRedoTest.java index e749c839b4..82919d6303 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/UndoRedoTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/UndoRedoTest.java @@ -40,7 +40,7 @@ public class UndoRedoTest extends DocbookTestCase { final Command command = createChapterCommand(obviousDiagram); // check that before chapter creation, obvious diagram is empty. - String expression = "<%eContents().filter(\"DDiagramElement\").nSize%>"; + String expression = "aql:self.eContents(diagram::DDiagramElement)->size()"; String failureMessage = "Wrong element count."; check(obviousDiagram, expression, 0, failureMessage); @@ -71,8 +71,8 @@ public class UndoRedoTest extends DocbookTestCase { // check that before reconnection the note (Para) element is linked with // the second chapter (chap1) // and not with the first (chap0). - String after = "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap0\"].nSize()%>"; - String before = "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\" && sourceNode.name == \"chap1\"].nSize()%>"; + String after = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.eClass().name = 'Para' and e.sourceNode.name = 'chap0')->size()"; + String before = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.eClass().name = 'Para' and e.sourceNode.name = 'chap1')->size()"; String failureMessage = "Wrong target count for the considered edge."; check(obviousDiagram, after, 0, failureMessage); @@ -80,7 +80,7 @@ public class UndoRedoTest extends DocbookTestCase { // retrieve the edge to reconnect. try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Chapter\" && targetNode.target.eClass.name == \"Sect1\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.target.eClass().name = 'Chapter' and e.targetNode.target.eClass().name = 'Sect1')->first()"); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -124,8 +124,8 @@ public class UndoRedoTest extends DocbookTestCase { // check that in the initial state, there is no container in the first // chapter. - String after = "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(0).eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\"].nSize()%>"; - String before = "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Chapter\"].nGet(1).eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\"].nSize()%>"; + String after = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->first().eAllContents(diagram::DNodeContainer)->select(n | n.target.eClass().name = 'Sect1')->size()"; + String before = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Chapter')->at(2).eAllContents(diagram::DNodeContainer)->select( n | n.target.eClass().name = 'Sect1')->size()"; String failureMessage = "Wrong DNodeContainer count inside the considered DNodeContainer."; check(obviousDiagram, after, 0, failureMessage); check(obviousDiagram, before, 1, failureMessage); @@ -162,7 +162,7 @@ public class UndoRedoTest extends DocbookTestCase { // check that in the initial state, there is no "Sect1" element with the // label "new label". - String expression = "<%eAllContents(\"DNodeContainer\")[target.eClass.name == \"Sect1\" && target.id == \"new label\"].nSize()%>"; + String expression = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name = 'Sect1' and e.target.id = 'new label')->size()"; String failureMessage = "Wrong container count having the right label name."; check(obviousDiagram, expression, 0, failureMessage); @@ -279,9 +279,9 @@ public class UndoRedoTest extends DocbookTestCase { private void checkModel(int paraSemanticNb, int evoDiagParaNb, int obviousDiagParaNb) { String message = "Wrong element count having the right type."; - check(evoluateDiagram, "<%target.eAllContents(\"Para\").nSize()%>", paraSemanticNb, message); - check(evoluateDiagram, "<%eAllContents().target.filter(\"Para\").nSize()%>", evoDiagParaNb, message); - check(obviousDiagram, "<%nFirst().eAllContents(\"DNodeContainer\").eAllContents().target.filter(\"Para\").nSize()%>", obviousDiagParaNb, message); + check(evoluateDiagram, "aql:self.target.eAllContents(docbook::Para)->size()", paraSemanticNb, message); + check(evoluateDiagram, "aql:self.eAllContents().target->filter(docbook::Para)->size()", evoDiagParaNb, message); + check(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer).eAllContents().target->filter(docbook::Para)->size()", obviousDiagParaNb, message); } private void check(DDiagram context, String expression, int expected, String failureMessage) { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocbookTestCase.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocbookTestCase.java index 73f5a25ed0..6d7898d7ab 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocbookTestCase.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocbookTestCase.java @@ -77,6 +77,36 @@ import com.google.common.collect.Multimap; */ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookModeler { + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_E_CLASS_NAME_PARA_N_LAST = "aql:self.eAllContents(diagram::DEdge)->select(e | e.target.eClass().name ='Para')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_LAST = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Chapter')->last()"; + + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_E_CLASS_NAME_D_NODE_CONTAINER_TARGET_NODE_E_CLASS_NAME_D_NODE_CONTAINER_N_GET_0 = "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.eClass().name = 'DNodeContainer' and e.targetNode.eClass().name = 'DNodeContainer')->at(1)"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT3_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST = "aql:self.eAllContents(diagram::DNode)->select(n | n.target.eClass().name = 'Sect3').eAllContents(diagram::DNode)->select(n | n.target.eClass().name = 'Para')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_1 = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Sect2')->at(2)"; + + private static final String E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_GET_0 = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name ='Sect1')->first()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT3_N_LAST = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Sect3')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_LAST = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Sect2')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_TITLE_N_GET_0 = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Title')->first()"; + + private static final String E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_LAST = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name ='Sect1')->last()"; + + private static final String E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST = "aql:self.eAllContents(diagram::DEdge)->select(e | e.targetNode.target.eClass().name ='Para')->last()"; + + private static final String E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST = "aql:self.eAllContents(diagram::DEdge)->select(e | e.sourceNode.target.eClass().name ='Para')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST = "aql:self.eAllContents(diagram::DNode)->select(e | e.target.eClass().name ='Para')->last()"; + + private static final String E_ALL_CONTENTS_TARGET_E_CLASS_NAME_INFO_N_LAST = "aql:self.eAllContents()->select(e | e.target.eClass().name ='Info')->last()"; + + private static final String E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_LAST = "aql:self.eAllContents(diagram::DNodeContainer)->select(e | e.target.eClass().name ='Chapter')->last()"; + /** Interpreter which can be used by subclasses to avoid instantiating more. */ protected static IInterpreter INTERPRETER; @@ -805,7 +835,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod EObject chapter = null; session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - chapter = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name==\"Chapter\"].nLast()%>"); + chapter = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_CHAPTER_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject chapter."); e.printStackTrace(); @@ -824,7 +854,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - info = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents()[target.eClass.name==\"Info\"].nLast()%>"); + info = INTERPRETER.evaluateEObject(evoluateDiagram, E_ALL_CONTENTS_TARGET_E_CLASS_NAME_INFO_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject info"); e.printStackTrace(); @@ -860,7 +890,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - note = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Para\"].nLast()%>"); + note = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject chapter note."); e.printStackTrace(); @@ -869,7 +899,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod createdElts.add(note); try { - edgeFromNote = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.target.eClass.name == \"Para\"].nLast()%>"); + edgeFromNote = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -878,7 +908,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod createdElts.add(edgeFromNote); try { - edgeToNote = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[targetNode.target.eClass.name == \"Para\"].nLast()%>"); + edgeToNote = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge."); e.printStackTrace(); @@ -910,7 +940,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - bigSection = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name==\"Sect1\"].nLast()%>"); + bigSection = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject big section."); e.printStackTrace(); @@ -938,7 +968,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - title = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass().name == \"Title\"].nGet(0)%>"); + title = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_TITLE_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject title."); e.printStackTrace(); @@ -965,7 +995,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - bigSection = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name==\"Sect1\"].nLast()%>"); + bigSection = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject big section."); e.printStackTrace(); @@ -993,7 +1023,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - mediumSection = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect2\"].nLast()%>"); + mediumSection = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject medium section."); e.printStackTrace(); @@ -1023,7 +1053,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - tinySection = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect3\"].nLast()%>"); + tinySection = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT3_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject tiny section."); e.printStackTrace(); @@ -1053,7 +1083,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod EdgeTarget res = null; try { - bigSect = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name==\"Sect1\"].nGet(0)%>"); + bigSect = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_CONTAINER_TARGET_E_CLASS_NAME_SECT1_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject big section."); e.printStackTrace(); @@ -1065,7 +1095,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - medSect = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect2\"].nGet(1)%>"); + medSect = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT2_N_GET_1); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject medium section."); e.printStackTrace(); @@ -1098,7 +1128,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - tinyNote = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect3\"].eAllContents(\"DNode\")[target.eClass.name==\"Para\"].nLast()%>"); + tinyNote = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT3_E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_PARA_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject tiny note."); e.printStackTrace(); @@ -1139,7 +1169,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod EObject edge = null; try { - edge = INTERPRETER.evaluateEObject(obviousDiagram, "<%eAllContents(\"DEdge\")[sourceNode.eClass().name == \"DNodeContainer\" && targetNode.eClass().name == \"DNodeContainer\"].nGet(0)%>"); + edge = INTERPRETER.evaluateEObject(obviousDiagram, E_ALL_CONTENTS_D_EDGE_SOURCE_NODE_E_CLASS_NAME_D_NODE_CONTAINER_TARGET_NODE_E_CLASS_NAME_D_NODE_CONTAINER_N_GET_0); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject edge between two chapters."); e.printStackTrace(); @@ -1190,14 +1220,14 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - chapter = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Chapter\"].nLast()%>"); + chapter = INTERPRETER.evaluateEObject(evoluateDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_CHAPTER_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject chapter."); e.printStackTrace(); } try { - tinySect = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DNode\")[target.eClass.name==\"Sect3\"].nLast()%>"); + tinySect = INTERPRETER.evaluateEObject(evoluateDiagram, E_ALL_CONTENTS_D_NODE_TARGET_E_CLASS_NAME_SECT3_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject tiny section."); e.printStackTrace(); @@ -1210,7 +1240,7 @@ public class DocbookTestCase extends SiriusDiagramTestCase implements DocBookMod session.getTransactionalEditingDomain().getCommandStack().execute(command); try { - note = INTERPRETER.evaluateEObject(evoluateDiagram, "<%eAllContents(\"DEdge\")[target.eClass.name==\"Para\"].nLast()%>"); + note = INTERPRETER.evaluateEObject(evoluateDiagram, E_ALL_CONTENTS_D_EDGE_TARGET_E_CLASS_NAME_PARA_N_LAST); } catch (final EvaluationException e) { fail("Exception while trying to get the EObject note."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/InterpreterVariablesTestCase.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/InterpreterVariablesTestCase.java index 0f1bdac1b7..1c42e96962 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/InterpreterVariablesTestCase.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/InterpreterVariablesTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -31,7 +31,7 @@ public class InterpreterVariablesTestCase extends TestCase { /** * */ - private static final String ELEMENT_VARIABLE = "<%$element%>"; + private static final String ELEMENT_VARIABLE = "aql:element"; /** * @@ -64,7 +64,7 @@ public class InterpreterVariablesTestCase extends TestCase { */ public void testSettingVariable() throws Exception { interpreter.setVariable(IInterpreterSiriusVariables.SOURCE, claz); - EObject result = interpreter.evaluateEObject(pak, "<%$source%>"); + EObject result = interpreter.evaluateEObject(pak, "aql:source"); assertSame(THE_RETURNED_VALUE_IS_NOT_THE_VARIABLE, claz, result); } @@ -77,7 +77,7 @@ public class InterpreterVariablesTestCase extends TestCase { public void testSettingMultipleVariables() throws Exception { interpreter.setVariable(IInterpreterSiriusVariables.SOURCE, claz); interpreter.setVariable(IInterpreterSiriusVariables.TARGET, claz); - boolean result = interpreter.evaluateBoolean(pak, "<%$source == $target%>"); + boolean result = interpreter.evaluateBoolean(pak, "aql:source = target"); assertTrue("The expresion using variable has not been correctly evaluated", result); } @@ -107,7 +107,7 @@ public class InterpreterVariablesTestCase extends TestCase { */ public void testVariableUsage() throws Exception { interpreter.setVariable(IInterpreterSiriusVariables.SOURCE, claz); - boolean result = interpreter.evaluateBoolean(claz, "<%$source == self%>"); + boolean result = interpreter.evaluateBoolean(claz, "aql:source = self"); assertEquals("The expresion using variable has not been correctly evaluated", true, result); } @@ -116,7 +116,7 @@ public class InterpreterVariablesTestCase extends TestCase { */ public void testNonExistingVariable() { try { - interpreter.evaluateBoolean(claz, "<%$dummy == self%>"); + interpreter.evaluateBoolean(claz, "var:dummy"); fail("No exception has been thrown when accessing a non existing variable"); } catch (final EvaluationException e) { // Here, The test is OK. diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/CompoundInterpreterTestCase.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/CompoundInterpreterTestCase.java index 8332cb977a..17d19def87 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/CompoundInterpreterTestCase.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/CompoundInterpreterTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Obeo. + * Copyright (c) 2014,2015 Obeo. * 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 @@ -89,8 +89,8 @@ public class CompoundInterpreterTestCase extends TestCase { List<ContentProposal> proposals = getProposals(firstChar); ContentProposalConverter converter = new ContentProposalConverter(firstChar); - // The following assert is valid for: "[/]" "<%%>" "ocl:" "var:" - // "service:" and "feature" + // The following assert is valid for: "aql:" "[/]" "ocl:" "var:" + // "service:" and "feature:" assertEquals("Proposals should contains only one proposal", 1, proposals.size()); // Proposals are interpreter prefixes diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoMTLInterpreterTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoMTLInterpreterTests.java index e5d0c868a6..7d7885c34a 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoMTLInterpreterTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoMTLInterpreterTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -54,7 +54,7 @@ public class AcceleoMTLInterpreterTests extends TestCase { IInterpreterProvider provider = new AcceleoMTLInterpreterProvider(); assertFalse("The expression is not a mtl expression.", provider.provides("string")); - assertFalse("The expression is an Acceleo 2 expression, not a mtl expression.", provider.provides("<%incomplete[expression]%>")); + assertFalse("The expression is an AQL expression, not a mtl expression.", provider.provides("aql:'incomplete' + '[' + 'expression'+ ']'")); assertTrue("The expression looks like a mtl expression.", provider.provides("[expression/]")); assertTrue("The expression looks like a mtl expression.", provider.provides("['an' + expression/]")); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/IInterpreterValidationExpressionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/IInterpreterValidationExpressionTest.java index 026d0fb3dd..e24532d266 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/IInterpreterValidationExpressionTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/IInterpreterValidationExpressionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -146,14 +146,13 @@ public class IInterpreterValidationExpressionTest extends SiriusDiagramTestCase } /** - * Ensures that Acceleo2 expressions validation never raise any error, as - * expression cannot be statically validated due to language restrictions. + * Ensures that AQL expressions validation are raising error */ - public void testAValidationExpressionWithAcceleo2() { + public void testAValidationExpressionWithAQL() { Layer acceleo2Layer = getLayer(diagramEntitiesAcceleo2, "Default"); ContainerMapping nodeMapping = getContainerMapping(acceleo2Layer, "EC EClass"); - ensureExpressionValidationRaisedExpectedErrors(nodeMapping, "semanticCandidatesExpression", "<%invalidFeatureExpression%>"); - ensureExpressionValidationRaisedExpectedErrors(nodeMapping, "semanticElements", "<%invalidFeatureExpression%>"); + ensureExpressionValidationRaisedExpectedErrors(nodeMapping, "semanticCandidatesExpression", "aql:self.invalidFeatureExpression","Feature invalidFeatureExpression not found in EClass EPackage"); + ensureExpressionValidationRaisedExpectedErrors(nodeMapping, "semanticElements", "aql:self.invalidFeatureExpression","Feature invalidFeatureExpression not found in EClass EPackage","Feature invalidFeatureExpression not found in EClass EClass"); } /** diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java index 89e861dfa6..67c632467d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -79,7 +79,7 @@ public class ModelContributionTest { Viewpoint vSource = createSampleSirius("source"); NodeMapping targetNode = (NodeMapping) Iterables.find(AllContents.of(vTarget), Predicates.instanceOf(NodeMapping.class)); NodeMapping sourceNode = (NodeMapping) Iterables.find(AllContents.of(vSource), Predicates.instanceOf(NodeMapping.class)); - String expression = "<%aComplicatedExpressionThatMakesSenseToReuse%>"; + String expression = "aql:aComplicatedExpressionThatMakesSenseToReuse"; sourceNode.setSemanticCandidatesExpression(expression); Contribution contrib = new ContributionBuilder().from(sourceNode).to(targetNode).set("semanticCandidatesExpression").build(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java index 34d653b3db..9b25adfc45 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -91,7 +91,7 @@ public class ReferenceResolverTest { @Test public void computed_reference_with_valid_expression_but_not_context_resolves_to_empty_option() { ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression("<%self%>"); + ref.setValueExpression("aql:self"); Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); assertHasNoValue(result); } @@ -100,7 +100,7 @@ public class ReferenceResolverTest { public void computed_reference_with_self_expression_resolves_to_context() { EObject self = EcoreFactory.eINSTANCE.createEObject(); ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression("<%self%>"); + ref.setValueExpression("aql:self"); Map<String, Object> context = Maps.newHashMap(); context.put("self", self); Option<EObject> result = resolver.resolve(ref, context); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/ChangeContextOperationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/ChangeContextOperationTest.java index fbd086ad4f..4203d67c3e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/ChangeContextOperationTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/ChangeContextOperationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -56,10 +56,10 @@ public class ChangeContextOperationTest extends TestCase { private class Nominal extends Case { public void check() throws Exception { - task = changeContextTask(rootContext, "<%eContents.nFirst%>"); + task = changeContextTask(rootContext, "aql:self.eContents()->first()"); super.check(); EObject contextAfter = rootContext.getNextPush(); - EObject firstElement = iRegistry.getInterpreter(root).evaluateEObject(root, "<%eContents.nFirst%>"); + EObject firstElement = iRegistry.getInterpreter(root).evaluateEObject(root, "aql:self.eContents()->first()"); assertEquals("The change context operation did not push the right context.", contextAfter, firstElement); } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateInstanceOperationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateInstanceOperationTest.java index 1d6b9e7ed6..6859a0d8d5 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateInstanceOperationTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateInstanceOperationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -72,7 +72,7 @@ public class CreateInstanceOperationTest extends TestCase { root = task.getContext().getNextPush(); task.execute(); IInterpreter interpreter = iRegistry.getInterpreter(root); - assertNotNull("The $" + variableName + " should be available to reference the created instance", interpreter.evaluateEObject(root, "<%$" + variableName + "%>")); + assertNotNull("The " + variableName + " variable should be available to reference the created instance", interpreter.evaluateEObject(root, "aql:" + variableName)); } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateViewOperationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateViewOperationTest.java index d9fce54a8a..283ab359c1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateViewOperationTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/CreateViewOperationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -79,9 +79,9 @@ public class CreateViewOperationTest extends TestCase { viewpointCommand.getTasks().add(task); domain.getCommandStack().execute(viewpointCommand); IInterpreter interpreter = session.getInterpreter(); - assertNotNull("The $" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", - interpreter.evaluateEObject(rootContext.getCurrentTarget(), "<%$" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + "%>")); - assertNotNull("The $" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", + assertNotNull("The variable" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", + interpreter.evaluateEObject(rootContext.getCurrentTarget(), "aql:" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); + assertNotNull("The variable" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", interpreter.getVariable(ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); } } @@ -95,7 +95,7 @@ public class CreateViewOperationTest extends TestCase { session.getInterpreter().setVariable("elementView", diagram); - task = createViewTask(rootContext, mapping, "<%$elementView.eContainer(\"DDiagram\")%>"); + task = createViewTask(rootContext, mapping, "aql:elementView.eContainerOrSelf(diagram::DDiagram)"); super.check(); rootContext.getNextPush(); @@ -145,7 +145,7 @@ public class CreateViewOperationTest extends TestCase { private class NoMapping extends Case { public void check(DiagramElementMapping mapping) throws Exception { - task = createViewTask(rootContext, mapping, "<%$elementView.eContainer(\"DDiagram\")%>"); + task = createViewTask(rootContext, mapping, "aql:elementView.eContainerOrSelf(diagram::DDiagram)"); task.execute(); // TODO VP-874 check we have the requested business exception @@ -251,7 +251,7 @@ public class CreateViewOperationTest extends TestCase { */ public void testBadContainerViewExpression() throws Exception { try { - new NoContainerViewExpression().check("<%eContainer(\"EPackage\")%>"); + new NoContainerViewExpression().check("aql:self.eContainerOrSelf(ecore::EPackage)"); } catch (ClassCastException e) { // TODO VP-874 : A business exception should be returned instead of // a @@ -265,7 +265,7 @@ public class CreateViewOperationTest extends TestCase { * @throws Exception */ public void testBadContainerViewExpression2() throws Exception { - new NoContainerViewExpression().check("<%eContainer(\"EPackage\")%>"); + new NoContainerViewExpression().check("aql:self.eContainerOrSelf(ecore::EPackage)"); } /** diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/OperationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/OperationTest.java index 3bb06e5fb7..4031e204c1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/OperationTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/operations/OperationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -84,7 +84,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with Book as first and last element. try { - book = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer()%>"); + book = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject book."); e.printStackTrace(); @@ -111,7 +111,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (final EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -124,7 +124,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of sect1 in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\").nSize()%>"); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->size()"); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -147,7 +147,7 @@ public class OperationTest extends DocbookTestCase { // check that one instance of sect1 as been created. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -165,7 +165,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with book as first and last element. try { - book = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer()%>"); + book = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject book."); e.printStackTrace(); @@ -174,7 +174,7 @@ public class OperationTest extends DocbookTestCase { CommandContext context = new CommandContext(book, null); // definition and execution of the change context operation. - String browseChapter = "<%eContents().nFirst()%>"; + String browseChapter = "aql:self.eContents()->first()"; op.setBrowseExpression(browseChapter); final AbstractOperationTask task = new ChangeContextTask(context, accessor, op, INTERPRETER); @@ -193,7 +193,7 @@ public class OperationTest extends DocbookTestCase { EObject chapter = null; try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -218,7 +218,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -231,7 +231,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"newChapterID\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='newChapterID')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -254,7 +254,7 @@ public class OperationTest extends DocbookTestCase { // check that there is one instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"newChapterID\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='newChapterID')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -276,7 +276,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with book as first and last element. try { - book = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer()%>"); + book = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject book."); e.printStackTrace(); @@ -288,7 +288,7 @@ public class OperationTest extends DocbookTestCase { // check that there is only one instance of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -310,7 +310,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now two instances of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -327,11 +327,11 @@ public class OperationTest extends DocbookTestCase { EObject book = null; int instanceCount = -1; op.setFeatureName("chapter"); - op.setElementExpression("<%eContents().nFirst()%>"); + op.setElementExpression("aql:self.eContents()->first()"); // definition of a new context with book as first and last element. try { - book = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer()%>"); + book = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject book."); e.printStackTrace(); @@ -343,7 +343,7 @@ public class OperationTest extends DocbookTestCase { // check that there is one instance of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -365,7 +365,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now no instance of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -384,7 +384,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -396,7 +396,7 @@ public class OperationTest extends DocbookTestCase { // check that there is one instance of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -418,7 +418,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now no instance of chapter in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -436,7 +436,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -475,7 +475,7 @@ public class OperationTest extends DocbookTestCase { // check that there is one sect1 in my book. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the eObject sect1."); e.printStackTrace(); @@ -484,7 +484,7 @@ public class OperationTest extends DocbookTestCase { // check that there are two chapters in my book. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -493,7 +493,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no sect1 referenced under the second chapter. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nLast().eContents().filter(\"Sect1\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->last().eContents()->filter(docbook::Sect1)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -504,7 +504,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with sect1 as first and last element. try { - sect1 = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\").nFirst()%>"); + sect1 = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject sect1."); e.printStackTrace(); @@ -514,7 +514,7 @@ public class OperationTest extends DocbookTestCase { final MoveElement op = ToolFactory.eINSTANCE.createMoveElement(); op.setFeatureName("sect1"); - op.setNewContainerExpression("<%getRootContainer().eAllContents(\"Chapter\").nLast()%>"); + op.setNewContainerExpression("aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->last()"); final AbstractOperationTask task = new MoveElementTask(sect1context, accessor, op, session.getInterpreter()); @@ -534,7 +534,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now one sect1 referenced under the second // chapter. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\").nLast().eContents().filter(\"Sect1\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->last().eContents()->filter(docbook::Sect1)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -554,7 +554,7 @@ public class OperationTest extends DocbookTestCase { final DNodeContainer chapterView = createChapter(); try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -571,11 +571,11 @@ public class OperationTest extends DocbookTestCase { }); final CreateEdgeView op = org.eclipse.sirius.diagram.description.tool.ToolFactory.eINSTANCE.createCreateEdgeView(); - String acceleoExp = "<%eAllContents(\"DNodeContainer\").nFirst().target%>"; + String acceleoExp = "aql:self.eAllContents(diagram::DNodeContainer)->first().target"; op.setMapping(edgeMapping); op.setSourceExpression(acceleoExp); op.setTargetExpression(acceleoExp); - op.setContainerViewExpression("<%current()%>"); + op.setContainerViewExpression("aql:self"); assertNotNull("Not possible to catch the diagram.", obviousDiagram); CommandContext context = new CommandContext(obviousDiagram, null); @@ -585,7 +585,7 @@ public class OperationTest extends DocbookTestCase { // check that there is only one egde view before executing the // CreateViewTask. try { - instanceCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the edge."); e.printStackTrace(); @@ -607,7 +607,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now two edge views. try { - instanceCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DEdge\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the edge."); e.printStackTrace(); @@ -620,7 +620,7 @@ public class OperationTest extends DocbookTestCase { * condition of the if is true. */ public void testIFOperation() { - testIf("<%current.eClass.name == \"Chapter\"%>", 0, 1); + testIf("aql:self.eClass().name = 'Chapter'", 0, 1); } /** @@ -629,7 +629,7 @@ public class OperationTest extends DocbookTestCase { */ public void testIFOperationConditionError() { setErrorCatchActive(true); - testIf("<%ifConditionWithError%>", 0, 0); + testIf("var:ifConditionWithError", 0, 0); assertTrue(doesAnErrorOccurs()); } @@ -639,7 +639,7 @@ public class OperationTest extends DocbookTestCase { * true condition expression, only the first check true is executed. */ public void testSwitchOperation() { - testSwitch("<%current.eClass.name == \"Chapter\"%>", 0, 1, 0, 0); + testSwitch("aql:self.eClass().name = 'Chapter'", 0, 1, 0, 0); } /** @@ -647,7 +647,7 @@ public class OperationTest extends DocbookTestCase { * is executed. */ public void testSwitchOperationDefault() { - testSwitch("<%current.eClass.name == \"UnexistingClassName\"%>", 0, 0, 0, 1); + testSwitch("aql:self.eClass().name = 'UnexistingClassName'", 0, 0, 0, 1); } /** @@ -656,7 +656,7 @@ public class OperationTest extends DocbookTestCase { */ public void testSwitchOperationConditionError() { setErrorCatchActive(true); - testSwitch("<%switchConditionWithError%>", 0, 0, 0, 1); + testSwitch("var:switchConditionWithError", 0, 0, 0, 1); assertTrue(doesAnErrorOccurs()); } @@ -677,13 +677,13 @@ public class OperationTest extends DocbookTestCase { setop.setFeatureName("id"); setop.setValueExpression("new id"); - forop.setExpression("<%eContents().filter(\"Sect1\")%>"); + forop.setExpression("aql:self.eContents()->filter(docbook::Sect1)"); forop.setIteratorName("it"); forop.getSubModelOperations().add(setop); // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -702,7 +702,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of sect1 with an id equal to "new id" // in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\")[id==\"new id\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->select( s | s.id='new id')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -719,7 +719,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now 3 instances of sect1 in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\").nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -731,7 +731,7 @@ public class OperationTest extends DocbookTestCase { // check that there is now 3 instances of sect1 with an id equal to "new // id" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Sect1\")[id==\"new id\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Sect1)->select( s | s.id='new id')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -766,7 +766,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -795,7 +795,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"newChapterID\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='newChapterID')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -809,14 +809,14 @@ public class OperationTest extends DocbookTestCase { // check that there is one instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"newChapterID\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='newChapterID')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); } assertEquals("Wrong count of element having the wanted value.", valueIf, instanceCount); - ifop.setConditionExpression("<%current.eClass.name != \"Chapter\"%>"); + ifop.setConditionExpression("aql:self.eClass().name <> 'Chapter'"); iftask = new IfTask(context, accessor, ifop, session.getInterpreter()); iftask.getChildrenTasks().add(shallNotBeExecutedTask); command.getTasks().clear(); @@ -883,7 +883,7 @@ public class OperationTest extends DocbookTestCase { // definition of a new context with chapter as first and last element. try { - chapter = INTERPRETER.evaluateEObject(semanticModel, "<%getRootContainer().eContents().nFirst()%>"); + chapter = INTERPRETER.evaluateEObject(semanticModel, "aql:self.eResource().getContents()->first().eContents()->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the eObject chapter."); e.printStackTrace(); @@ -895,7 +895,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"" + labelId1 + "\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='" + labelId1 + "')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -909,7 +909,7 @@ public class OperationTest extends DocbookTestCase { // check that there is one instance of chapter with an id equal to // "newChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"" + labelId1 + "\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='" + labelId1 + "')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -919,7 +919,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of chapter with an id equal to // "newChapterID2" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"" + labelId2 + "\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='" + labelId2 + "')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); @@ -929,7 +929,7 @@ public class OperationTest extends DocbookTestCase { // check that there is no instance of chapter with an id equal to // "defaultChapterID" in the model. try { - instanceCount = INTERPRETER.evaluateInteger(semanticModel, "<%getRootContainer().eAllContents(\"Chapter\")[id==\"" + labelIdDefault + "\"].nSize()%>").intValue(); + instanceCount = INTERPRETER.evaluateInteger(semanticModel, "aql:self.eResource().getContents()->first().eAllContents(docbook::Chapter)->select(c | c.id='" + labelIdDefault + "')->size()").intValue(); } catch (EvaluationException e) { fail("Exception while trying to get the instance count."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/refresh/DiagramSynchronizerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/refresh/DiagramSynchronizerTest.java index f72dd173d3..f3e7a53953 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/refresh/DiagramSynchronizerTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/refresh/DiagramSynchronizerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -508,7 +508,7 @@ public class DiagramSynchronizerTest extends AbstractSynchronizerTest { assertNotNull("The edge with a path is not found", pathEdge); - Collection<EObject> allpackages = interpreter.evaluateCollection(((Model) semanticModel), "<%eAllContents(\"Package\")%>"); + Collection<EObject> allpackages = interpreter.evaluateCollection(((Model) semanticModel), "aql:self.eAllContents(uml::Package)"); assertEquals("the path'ed elements should be all the model packages", allpackages.size(), pathEdge.getPath().size()); } @@ -541,7 +541,7 @@ public class DiagramSynchronizerTest extends AbstractSynchronizerTest { assertNotNull("The edge with a path is not found", pathEdge); - Collection<EObject> allpackages = interpreter.evaluateCollection(((Model) semanticModel), "<%eAllContents(\"Package\") + eAllContents(\"Package\").nLast%>"); + Collection<EObject> allpackages = interpreter.evaluateCollection(((Model) semanticModel), "aql:self.eAllContents(uml::Package) + Sequence{self.eAllContents(uml::Package)->last()}"); assertEquals("the path'ed elements should be all the model packages", allpackages.size(), pathEdge.getPath().size()); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/sequence/vsm/interpreted/expression/variables/AbstractToolDescription_Precondition_AbstractVariable_Access_Tests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/sequence/vsm/interpreted/expression/variables/AbstractToolDescription_Precondition_AbstractVariable_Access_Tests.java index 2e0e0ee530..3cc64940b2 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/sequence/vsm/interpreted/expression/variables/AbstractToolDescription_Precondition_AbstractVariable_Access_Tests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/sequence/vsm/interpreted/expression/variables/AbstractToolDescription_Precondition_AbstractVariable_Access_Tests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -446,7 +446,7 @@ public class AbstractToolDescription_Precondition_AbstractVariable_Access_Tests * specific variables. */ private String getAcceleoPreconditionWithAllVariables(List<AbstractVariable> variables) { - String precondition = "<% "; + String precondition = "aql:"; Iterator<AbstractVariable> iterator = variables.iterator(); if (!iterator.hasNext()) { return null; @@ -454,14 +454,13 @@ public class AbstractToolDescription_Precondition_AbstractVariable_Access_Tests while (iterator.hasNext()) { AbstractVariable variable = iterator.next(); String variableName = variable.getName(); - String affirmation = " $" + variableName + "!= null"; - String negation = "!" + affirmation; - precondition += affirmation + " || " + negation; + String affirmation = " " + variableName + "<> null"; + String negation = " not (" + affirmation + ")"; + precondition += affirmation + " or " + negation; if (variables.indexOf(variable) < variables.size() - 1) { - precondition += " && "; + precondition += " and "; } } - precondition += "%>"; return precondition; } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/style/WorkspaceImageTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/style/WorkspaceImageTest.java index 97cde78087..5d01848799 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/style/WorkspaceImageTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/style/WorkspaceImageTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -124,7 +124,7 @@ public class WorkspaceImageTest extends SiriusDiagramTestCase { } /** - * Check nodes created with "<%-1%>" as size computation expression. + * Check nodes created with "-1" as size computation expression. * * @throws Exception */ diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/CreationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/CreationTest.java index 3fa603c201..15ae1c4dc3 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/CreationTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/CreationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -41,10 +41,10 @@ public class CreationTest extends DocbookTestCase { public void testAvailableVariablesOnPrecondition() { TestCommandBuilder testBuilder = new TestCommandBuilder(); AbstractToolDescription tool = ToolFactory.eINSTANCE.createNodeCreationDescription(); - tool.setPrecondition("<%" + "$" + IInterpreterSiriusVariables.CONTAINER + "!= null %>"); + tool.setPrecondition("aql:" + IInterpreterSiriusVariables.CONTAINER + "<> null"); assertTrue(testBuilder.testPrecondition(obviousDiagram, tool)); - tool.setPrecondition("<%" + "$" + IInterpreterSiriusVariables.CONTAINER_VIEW + "!= null %>"); + tool.setPrecondition("aql:" + IInterpreterSiriusVariables.CONTAINER_VIEW + "<> null"); assertTrue(testBuilder.testPrecondition(obviousDiagram, tool)); } @@ -79,7 +79,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNodeContainer\")%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer)"); } catch (final EvaluationException e) { fail("Exception while trying to fetch the created container nodes."); } @@ -96,7 +96,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNodeContainer\")[target.eClass.name==\"Chapter\"].eContents()[eClass.name==\"DNodeContainer\"]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer)->select( e | e.target.eClass().name ='Chapter').eContents()->select(e | e.eClass().name='DNodeContainer')"); } catch (final EvaluationException e) { fail("Exception while trying to fetch the created container nodes."); } @@ -113,7 +113,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNodeContainer\").ownedDiagramElements[eClass.name==\"DNode\"]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer).ownedDiagramElements->select( e | e.eClass().name='DNode')"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_NODE); } @@ -130,7 +130,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eContents()[eClass.name==\"DNode\"]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eContents()->select(e |e.eClass().name='DNode')"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_NODE); } @@ -147,7 +147,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNode\").eAllContents(\"DNode\")%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DNode).eAllContents(diagram::DNode)"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_NODE); } @@ -164,7 +164,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNodeContainer\").ownedBorderedNodes[eClass.name==\"DNode\"]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DNodeContainer).ownedBorderedNodes->select(e | e.eClass().name='DNode')"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_NODE); } @@ -181,10 +181,10 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\")[(sourceNode.eClass.name == \"DNode\") && (sourceNode.parent.eClass.name != \"DNode\") && " - + "((sourceNode.parent.eClass.name != \"DNodeContainer\") || !(sourceNode.parent.ownedBorderedNodes.nContains(sourceNode))) && " - + "(targetNode.eClass.name == \"DNode\") && (targetNode.parent.eClass.name != \"DNode\") && " - + "((targetNode.parent.eClass.name != \"DNodeContainer\") || !(targetNode.parent.ownedBorderedNodes.nContains(targetNode)))]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select(e | (e.sourceNode.eClass().name = 'DNode') and (e.sourceNode.eContainer().eClass().name <> 'DNode') and " + + "((e.sourceNode.eContainer().eClass().name <> 'DNodeContainer') or not(e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode))) and " + + "(e.targetNode.eClass().name = 'DNode') and (e.targetNode.eContainer().eClass().name <> 'DNode') and " + + "((e.targetNode.eContainer().eClass().name <> 'DNodeContainer') or not(e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode))))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -202,10 +202,10 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\")[((sourceNode.eClass.name == \"DNode\") && ((sourceNode.parent.eClass.name == \"DNode\") || " - + "(sourceNode.parent.ownedBorderedNodes.nContains(sourceNode))) && (targetNode.eClass.name == \"DNodeContainer\")) || " - + "((targetNode.eClass.name == \"DNode\") && ((targetNode.parent.eClass.name == \"DNode\") || " - + "(targetNode.parent.ownedBorderedNodes.nContains(targetNode))) && (sourceNode.eClass.name == \"DNodeContainer\"))]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | ((e.sourceNode.eClass().name = 'DNode') and ((e.sourceNode.eContainer().eClass().name = 'DNode') or " + + "(e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode))) and (e.targetNode.eClass().name = 'DNodeContainer')) or " + + "((e.targetNode.eClass().name = 'DNode') and ((e.targetNode.eContainer().eClass().name = 'DNode') or " + + "(e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode))) and (e.sourceNode.eClass().name = 'DNodeContainer')))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -222,7 +222,7 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\")[(sourceNode.eClass.name == \"DNodeContainer\") && (targetNode.eClass.name == \"DNodeContainer\")]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select(e | (e.sourceNode.eClass().name = 'DNodeContainer') and (e.targetNode.eClass().name = 'DNodeContainer'))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -240,10 +240,10 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\")[(sourceNode.eClass.name == \"DNode\") && ((sourceNode.parent.eClass.name == \"DNode\") || " - + "((sourceNode.parent.eClass.name == \"DNodeContainer\") && (sourceNode.parent.ownedBorderedNodes.nContains(sourceNode)))) && " - + "(targetNode.eClass.name == \"DNode\") && ((targetNode.parent.eClass.name == \"DNode\") || " - + "((targetNode.parent.eClass.name == \"DNodeContainer\") && (targetNode.parent.ownedBorderedNodes.nContains(targetNode))))]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | (e.sourceNode.eClass().name = 'DNode') and ((e.sourceNode.eContainer().eClass().name = 'DNode') or " + + "((e.sourceNode.eContainer().eClass().name = 'DNodeContainer') and (e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode)))) and " + + "(e.targetNode.eClass().name = 'DNode') and ((e.targetNode.eContainer().eClass().name = 'DNode') or " + + "((e.targetNode.eContainer().eClass().name = 'DNodeContainer') and (e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode)))))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -265,7 +265,7 @@ public class CreationTest extends DocbookTestCase { .evaluateCollection( obviousDiagram, - "<%eAllContents(\"DEdge\")[(((sourceNode.eClass.name == \"DNode\" && sourceNode.parent.eClass.name == \"DNode\") || (sourceNode.parent.eClass.name == \"DNodeContainer\" && sourceNode.parent.ownedBorderedNodes.nContains(sourceNode))) && targetNode.eClass.name == \"DNode\" && targetNode.parent.eClass.name != \"DNode\" && (targetNode.parent.eClass.name != \"DNodeContainer\" || !targetNode.parent.ownedBorderedNodes.nContains(targetNode))) || (((targetNode.eClass.name == \"DNode\" && targetNode.parent.eClass.name == \"DNode\") || (targetNode.parent.eClass.name == \"DNodeContainer\" && targetNode.parent.ownedBorderedNodes.nContains(targetNode))) && sourceNode.eClass.name == \"DNode\" && sourceNode.parent.eClass.name != \"DNode\" && (sourceNode.parent.eClass.name != \"DNodeContainer\" || !sourceNode.parent.ownedBorderedNodes.nContains(sourceNode)))]%>"); + "aql:self.eAllContents(diagram::DEdge)->select( e | (((e.sourceNode.eClass().name = 'DNode' and e.sourceNode.eContainer().eClass().name = 'DNode') or (e.sourceNode.eContainer().eClass().name = 'DNodeContainer' and e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode))) and e.targetNode.eClass().name = 'DNode' and e.targetNode.eContainer().eClass().name <> 'DNode' and (e.targetNode.eContainer().eClass().name <> 'DNodeContainer' or not (e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode)))) or (((e.targetNode.eClass().name = 'DNode' and e.targetNode.eContainer().eClass().name = 'DNode') or (e.targetNode.eContainer().eClass().name = 'DNodeContainer' and e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode))) and e.sourceNode.eClass().name = 'DNode' and e.sourceNode.eContainer().eClass().name <> 'DNode' and (e.sourceNode.eContainer().eClass().name <> 'DNodeContainer' or not(e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode)))))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -283,11 +283,11 @@ public class CreationTest extends DocbookTestCase { final List<EObject> containers = Lists.newArrayList(); Collection<EObject> nodes = null; try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\")[(((sourceNode.eClass.name == \"DNode\") && !(sourceNode.parent.eClass.name == \"DNode\") && " - + "(!(sourceNode.parent.eClass.name == \"DNodeContainer\") || !(sourceNode.parent.ownedBorderedNodes.nContains(sourceNode)))) && " - + "(targetNode.eClass.name == \"DNodeContainer\")) || (((targetNode.eClass.name == \"DNode\") && !(targetNode.parent.eClass.name == \"DNode\") " - + "&& (!(targetNode.parent.eClass.name == \"DNodeContainer\") || !(targetNode.parent.ownedBorderedNodes.nContains(targetNode)))) && " - + "(sourceNode.eClass.name == \"DNodeContainer\"))]%>"); + nodes = INTERPRETER.evaluateCollection(obviousDiagram, "aql:self.eAllContents(diagram::DEdge)->select( e | (((e.sourceNode.eClass().name = 'DNode') and not(e.sourceNode.eContainer().eClass().name = 'DNode') and " + + "(not(e.sourceNode.eContainer().eClass().name = 'DNodeContainer') or not(e.sourceNode.eContainer().ownedBorderedNodes->includes(e.sourceNode)))) and " + + "(e.targetNode.eClass().name = 'DNodeContainer')) or (((e.targetNode.eClass().name = 'DNode') and not(e.targetNode.eContainer().eClass().name = 'DNode') " + + "and (not(e.targetNode.eContainer().eClass().name = 'DNodeContainer') or not(e.targetNode.eContainer().ownedBorderedNodes->includes(e.targetNode)))) and " + + "(e.sourceNode.eClass().name = 'DNodeContainer')))"); } catch (final EvaluationException e) { fail(EXCEPTION_FETCH_EDGE); } @@ -295,81 +295,5 @@ public class CreationTest extends DocbookTestCase { assertEquals("wrong number of DEdge between nodes and border node created in Diagram", 2, containers.size()); } - /** - * check that medium section creation and diagram creation throw navigation - * link creates one and only one navigation link in the description diagram. - */ - public void testCreateNavigationLinkThrowNode() { - int navLinkCount = -1; - final DNode mediumSection = createMediumSection(); - final AbstractCommand command = (AbstractCommand) createDiagramThrowNodeNavigationLinkCommand(obviousDiagram, mediumSection); - assertTrue("Could not create diagram throw node navigation link", command.canExecute()); - session.getTransactionalEditingDomain().getCommandStack().execute(command); - try { - navLinkCount = INTERPRETER.evaluateInteger(obviousDiagram, "<%eAllContents(\"DNode\").eAllContents(\"DNavigationLink\").nSize()%>").intValue(); - } catch (final EvaluationException e) { - fail(EXCEPTION_FETCH_EDGE); - } - assertEquals("wrong number of DNavigationLink throw node created in Diagram", 0, navLinkCount); - } - - /** - * check that chapter creation and diagram creation throw navigation link - * creates one and only one navigation link in the description diagram. - */ - public void testCreateNavigationLinkThrowNodeContainer() { - final DNodeContainer chapter = createChapter(); - final AbstractCommand command = (AbstractCommand) createDiagramThrowContainerNavigationLinkCommand(obviousDiagram, chapter); - assertTrue("Could not create diagram throw container navigation link", command.canExecute()); - session.getTransactionalEditingDomain().getCommandStack().execute(command); - final List<EObject> containers = Lists.newArrayList(); - Collection<EObject> nodes = null; - try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNodeContainer\").eAllContents(\"DNavigationLink\")%>"); - } catch (final EvaluationException e) { - fail(EXCEPTION_FETCH_EDGE); - } - containers.addAll(nodes); - assertEquals("wrong number of DNavigationLink throw node container created in Diagram", 0, containers.size()); - } - /** - * check that medium section creation and diagram creation throw navigation - * link creates one and only one navigation link in the description diagram. - */ - public void testCreateNavigationLinkThrowBorderedNode() { - final DNode title = createChapterReturnTitle(); - final AbstractCommand command = (AbstractCommand) createDiagramThrowNodeNavigationLinkCommand(obviousDiagram, title); - assertTrue("Could not create diagram throw node navigation link", command.canExecute()); - session.getTransactionalEditingDomain().getCommandStack().execute(command); - final List<EObject> containers = Lists.newArrayList(); - Collection<EObject> nodes = null; - try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DNavigationLink\")%>"); - } catch (final EvaluationException e) { - fail(EXCEPTION_FETCH_EDGE); - } - containers.addAll(nodes); - assertEquals("wrong number of DNavigationLink created in Diagram", 0, containers.size()); - } - - /** - * check that two chapters creation and diagram creation throw navigation - * link creates one and only one navigation link in the description diagram. - */ - public void testCreateNavigationLinkThrowEdge() { - final DEdge edge = createTwoChapters(); - final AbstractCommand command = (AbstractCommand) createDiagramThrowEdgeNavigationLinkCommand(obviousDiagram, edge); - assertTrue("Could not create diagram throw edge navigation link", command.canExecute()); - session.getTransactionalEditingDomain().getCommandStack().execute(command); - final List<EObject> containers = Lists.newArrayList(); - Collection<EObject> nodes = null; - try { - nodes = INTERPRETER.evaluateCollection(obviousDiagram, "<%eAllContents(\"DEdge\").eAllContents(\"DNavigationLink\")%>"); - } catch (final EvaluationException e) { - fail(EXCEPTION_FETCH_EDGE); - } - containers.addAll(nodes); - assertEquals("wrong number of DNavigationLink throw edge created in Diagram", 0, containers.size()); - } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java index d66f2a3cfd..c89d54dca2 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -68,7 +68,7 @@ public class DoubleClicCommandBuilderForceRefreshTest extends SiriusDiagramTestC ChangeContext cc = org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createChangeContext(); dc.setInitialOperation(io); io.setFirstModelOperations(cc); - cc.setBrowseExpression("<%current%>"); + cc.setBrowseExpression("aql:self"); Command cmd = getDoubleClicCommand(dc); checkDoubleClicCommand(cmd, false); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/dialect/DialectManagerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/dialect/DialectManagerTest.java index 06dd116810..61567f95bc 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/dialect/DialectManagerTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/dialect/DialectManagerTest.java @@ -55,7 +55,7 @@ public class DialectManagerTest extends TestCase { assertEquals("we should have one possible representation", 1, descriptions.size()); final TableDescription tableDescription = findTableDescription(dialectGroup, "Class Table"); - tableDescription.setPreconditionExpression("<%false%>"); + tableDescription.setPreconditionExpression("aql:false"); descriptions = DialectManager.INSTANCE.getAvailableRepresentationDescriptions(currentVp, class1); assertEquals("we should have zero possible representation", 0, descriptions.size()); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableNoDomainSynchronizerVSMWithEditorTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableNoDomainSynchronizerVSMWithEditorTest.java index c75f9f38b9..636d28a08d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableNoDomainSynchronizerVSMWithEditorTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableNoDomainSynchronizerVSMWithEditorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -269,7 +269,7 @@ public class DCrossTableNoDomainSynchronizerVSMWithEditorTest extends TableTestC session.getTransactionalEditingDomain().getCommandStack().execute(new SiriusCommand(session.getTransactionalEditingDomain(), commandName) { protected void doExecute() { lineToAdd.setName("Attribut3"); - lineToAdd.setHeaderLabelExpression("3-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'3-' + self.name"); ((CrossTableDescription) tableDescription).getAllLineMappings().get(0).getOwnedSubLines().add(lineToAdd); }; }); @@ -418,7 +418,7 @@ public class DCrossTableNoDomainSynchronizerVSMWithEditorTest extends TableTestC session.getTransactionalEditingDomain().getCommandStack().execute(new SiriusCommand(session.getTransactionalEditingDomain()) { protected void doExecute() { lineToAdd.setName("SousAttribut4"); - lineToAdd.setHeaderLabelExpression("S4-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'S4-' + self.name"); ((CrossTableDescription) tableDescription).getAllLineMappings().get(0).getOwnedSubLines().get(0).getOwnedSubLines().add(lineToAdd); }; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableSynchronizerVSMWithEditorTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableSynchronizerVSMWithEditorTest.java index 6b83835a0c..9ad5df3b6b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableSynchronizerVSMWithEditorTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCrossTableSynchronizerVSMWithEditorTest.java @@ -261,7 +261,7 @@ public class DCrossTableSynchronizerVSMWithEditorTest extends TableTestCase { session.getTransactionalEditingDomain().getCommandStack().execute(new SiriusCommand(session.getTransactionalEditingDomain(), commandName) { protected void doExecute() { lineToAdd.setName("Attribut3"); - lineToAdd.setHeaderLabelExpression("3-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'3-' + self.name"); ((CrossTableDescription) tableDescription).getAllLineMappings().get(0).getOwnedSubLines().add(lineToAdd); }; }); @@ -414,7 +414,7 @@ public class DCrossTableSynchronizerVSMWithEditorTest extends TableTestCase { session.getTransactionalEditingDomain().getCommandStack().execute(new SiriusCommand(session.getTransactionalEditingDomain()) { protected void doExecute() { lineToAdd.setName("SousAttribut4"); - lineToAdd.setHeaderLabelExpression("S4-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'S4-' + self.name"); ((CrossTableDescription) tableDescription).getAllLineMappings().get(0).getOwnedSubLines().get(0).getOwnedSubLines().add(lineToAdd); }; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableCellStylesTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableCellStylesTest.java index 031e8679ee..e248ed533e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableCellStylesTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableCellStylesTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -77,7 +77,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the isAbstract column DColumn isAbstractColumn = null; try { - isAbstractColumn = (DColumn) interpreter.evaluateEObject(newTable, "<%columns[label == \"" + COLUMN_LABEL_IS_ABSTARCT + "\"]%>"); + isAbstractColumn = (DColumn) interpreter.evaluateEObject(newTable, "aql:self.columns->select(c | c.label = '" + COLUMN_LABEL_IS_ABSTARCT + "' )->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isAbstract column."); e.printStackTrace(); @@ -86,9 +86,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class1 DLine class1Line = null; - String acceleoRequestForClass1Line = "lines[label == \"Class : Class1\"]"; + String acceleoRequestForClass1Line = "self.lines->select( l | l.label = 'Class : Class1')->first()"; try { - class1Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + "%>"); + class1Line = (DLine) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class1."); e.printStackTrace(); @@ -99,7 +99,7 @@ public class DTableCellStylesTest extends TableTestCase { // Class1 Line DCell cell = null; try { - cell = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ABSTARCT + "\"]%>"); + cell = (DCell) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line + ".cells->select(c | c.column.label = '" + COLUMN_LABEL_IS_ABSTARCT + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isAbstract cell of the Class1 line."); e.printStackTrace(); @@ -147,7 +147,8 @@ public class DTableCellStylesTest extends TableTestCase { // Get the isActive column DColumn isActiveColumn = null; try { - isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "<%columns[label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "aql:self.columns->select( c |c.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); + } catch (EvaluationException e) { fail("Exception while trying to get the isActive column."); e.printStackTrace(); @@ -156,9 +157,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class1 DLine class1Line = null; - String acceleoRequestForClass1Line = "lines[label == \"Class : Class1\"]"; + String acceleoRequestForClass1Line = "self.lines->select( l | l.label = 'Class : Class1')->first()"; try { - class1Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + "%>"); + class1Line = (DLine) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class1."); e.printStackTrace(); @@ -168,7 +169,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class1 DCell cellForClasse1 = null; try { - cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line + ".cells->select(c | c.column.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class1 line."); e.printStackTrace(); @@ -183,9 +184,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class2 DLine class2Line = null; - String acceleoRequestForClass2Line = "lines[label == \"Class : Class2\"]"; + String acceleoRequestForClass2Line = "lines->select(l |l.label = 'Class : Class2')->first()"; try { - class2Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + "%>"); + class2Line = (DLine) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line ); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class2."); e.printStackTrace(); @@ -195,7 +196,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class2 DCell cellForClasse2 = null; try { - cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line + ".cells->select(c | c.column.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class2 line."); e.printStackTrace(); @@ -255,7 +256,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the isActive column DColumn isActiveColumn = null; try { - isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "<%columns[label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "aql:self.columns->select( c |c.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive column."); e.printStackTrace(); @@ -264,9 +265,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class1 DLine class1Line = null; - String acceleoRequestForClass1Line = "lines[label == \"Class : Class1\"]"; + String acceleoRequestForClass1Line = "self.lines->select( l | l.label = 'Class : Class1')->first()"; try { - class1Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + "%>"); + class1Line = (DLine) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class1."); e.printStackTrace(); @@ -276,7 +277,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class1 DCell cellForClasse1 = null; try { - cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line + ".cells->select(c | c.column.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class1 line."); e.printStackTrace(); @@ -289,9 +290,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class2 DLine class2Line = null; - String acceleoRequestForClass2Line = "lines[label == \"Class : Class2\"]"; + String acceleoRequestForClass2Line = "lines->select(l |l.label = 'Class : Class2')->first()"; try { - class2Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + "%>"); + class2Line = (DLine) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line + ""); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class2."); e.printStackTrace(); @@ -301,7 +302,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class2 DCell cellForClasse2 = null; try { - cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line + ".cells->select( c | c.column.label ='" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class2 line."); e.printStackTrace(); @@ -355,7 +356,8 @@ public class DTableCellStylesTest extends TableTestCase { // Get the isActive column DColumn isActiveColumn = null; try { - isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "<%columns[label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + isActiveColumn = (DColumn) interpreter.evaluateEObject(newTable, "aql:self.columns->select( c |c.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); + } catch (EvaluationException e) { fail("Exception while trying to get the isActive column."); e.printStackTrace(); @@ -364,9 +366,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class1 DLine class1Line = null; - String acceleoRequestForClass1Line = "lines[label == \"Class : Class1\"]"; + String acceleoRequestForClass1Line = "self.lines->select( l | l.label = 'Class : Class1')->first()"; try { - class1Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + "%>"); + class1Line = (DLine) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class1."); e.printStackTrace(); @@ -376,7 +378,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class1 DCell cellForClasse1 = null; try { - cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass1Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse1 = (DCell) interpreter.evaluateEObject(newTable, "aql:" + acceleoRequestForClass1Line + ".cells->select(c | c.column.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class1 line."); e.printStackTrace(); @@ -390,9 +392,9 @@ public class DTableCellStylesTest extends TableTestCase { // Get the line corresponding to the Class Class2 DLine class2Line = null; - String acceleoRequestForClass2Line = "lines[label == \"Class : Class2\"]"; + String acceleoRequestForClass2Line = "lines->select(l |l.label = 'Class : Class2')->first()"; try { - class2Line = (DLine) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + "%>"); + class2Line = (DLine) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line); } catch (EvaluationException e) { fail("Exception while trying to get the line corresponding to the Class Class2."); e.printStackTrace(); @@ -402,7 +404,7 @@ public class DTableCellStylesTest extends TableTestCase { // Get the foreground style of the cell of the isActive column of Class2 DCell cellForClasse2 = null; try { - cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "<%" + acceleoRequestForClass2Line + ".cells[column.label == \"" + COLUMN_LABEL_IS_ACTIVE + "\"]%>"); + cellForClasse2 = (DCell) interpreter.evaluateEObject(newTable, "aql:self." + acceleoRequestForClass2Line + ".cells->select( c | c.column.label = '" + COLUMN_LABEL_IS_ACTIVE + "')->first()"); } catch (EvaluationException e) { fail("Exception while trying to get the isActive cell of the Class2 line."); e.printStackTrace(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerTest.java index cddf7d62f7..193113c123 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -411,7 +411,7 @@ public class DTableSynchronizerTest extends TableTestCase { /** {@inheritDoc} */ @Override protected void doExecute() { - mapping.setPreconditionExpression("<%false%>"); + mapping.setPreconditionExpression("aql:false"); } }); @@ -465,7 +465,7 @@ public class DTableSynchronizerTest extends TableTestCase { /** {@inheritDoc} */ @Override protected void doExecute() { - mapping.setPreconditionExpression("<%false%>"); + mapping.setPreconditionExpression("aql:false"); } }); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerVSMWithEditorTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerVSMWithEditorTest.java index 11062462c2..30bafbc236 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerVSMWithEditorTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DTableSynchronizerVSMWithEditorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. * 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 @@ -328,7 +328,7 @@ public class DTableSynchronizerVSMWithEditorTest extends TableTestCase { session.getTransactionalEditingDomain().getCommandStack().execute(new SiriusCommand(session.getTransactionalEditingDomain(), commandName) { protected void doExecute() { lineToAdd.setName("Attribut3"); - lineToAdd.setHeaderLabelExpression("3-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'3-' + self.name"); ((EditionTableDescription) tableDescription).getAllLineMappings().get(0).getOwnedSubLines().add(lineToAdd); }; }); @@ -479,7 +479,7 @@ public class DTableSynchronizerVSMWithEditorTest extends TableTestCase { protected void doExecute() { lineToAdd.setName("SousAttribut4"); - lineToAdd.setHeaderLabelExpression("S4-<%name%>"); + lineToAdd.setHeaderLabelExpression("aql:'S4-' + self.name"); ((EditionTableDescription) tableDescription).getOwnedLineMappings().get(0).getOwnedSubLines().get(0).getOwnedSubLines().add(lineToAdd); }; |
