diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 58b1520e03c5ee664a6596787ec4e45b5e0b7581..c064cd8247c7ce1381050b6d5ba58e08062e2db8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,7 +32,7 @@ variables:
TTF_CI_TARGET_BRANCH: "ttf-034"
DEV_CI_TARGET_BRANCH: "dev"
MAIN_CI_TARGET_BRANCH: "master"
- CI_TARGET_BRANCH: ${DEV_CI_TARGET_BRANCH}
+ CI_TARGET_BRANCH: "${TTF_CI_TARGET_BRANCH}"
SITE_LOCATION: "updatesite/org.etsi.mts.tdl.updatesite/target"
ARCHIVE_NAME: "org.etsi.mts.tdl.updatesite-1.0.0-SNAPSHOT.zip"
SITE_ARCHIVE: "${SITE_LOCATION}/${ARCHIVE_NAME}"
@@ -43,7 +43,7 @@ variables:
PACKAGE_NAME_MAIN: "TOP IDE Build"
BETA_KEY: "beta"
MAIN_KEY: "stable"
- RELEASE_KEY: "stable"
+ RELEASE_KEY: "beta"
RELEASE_PATH: "public/updatesite/${RELEASE_KEY}"
RELEASE_PAGE: "https://top.etsi.org/ide/updatesite/${RELEASE_KEY}"
STANDALONE_LOCATION: "plugins/org.etsi.mts.tdl.standalone/target"
@@ -77,6 +77,7 @@ variables:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_BRANCH == $CI_TARGET_BRANCH
+ - if: $CI_COMMIT_BRANCH == $DEV_CI_TARGET_BRANCH
- if: $CI_PIPELINE_SOURCE == "web"
when: always
- if: $CI_COMMIT_TAG
@@ -144,6 +145,12 @@ build-job: # This job runs in the build stage, which runs first.
rules:
- !reference [.default_rules, rules]
script:
+ # Test zip installation
+ # - rm -rf /var/lib/apt/lists/*
+ # - apt update
+ # - apt-cache gencaches
+ # - apt install -y zip unzip
+ # - zip --help
- echo "Compiling the code..."
- echo "BUILD_JOB_ID=$CI_JOB_ID" >> build.env
- cat build.env
@@ -221,27 +228,35 @@ upload-job:
pages:
stage: upload
# image: curlimages/curl:latest
+ # image: alpine
needs:
- job: prepare-job
artifacts: true
- job: build-job
artifacts: true
script:
- # Get the previous GitLab Pages content
- # - set +e
- # - curl --fail "$CI_PAGES_URL/content.zip" -o "content.zip"
- # - if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
- # - set -e
+ # Get the previous GitLab Pages content (otherwise other beta/stable branch gets removed..)
+ - rm -rf /var/lib/apt/lists/*
+ - apt update
+ - apt-cache gencaches
+ - apt install -y zip unzip
+ - zip --help
+ - set +e
+ - curl --fail "$CI_PAGES_URL/content.zip" -o "content.zip"
+ - if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
+ - set -e
+ # - ls -la $RELEASE_PATH
+ # Cleanup content? -> remove content in release path?
# Add/update content
- # TODO: differentiate on branch?
- echo $CI_PAGES_URL
- echo $RELEASE_PATH
- mkdir -p $RELEASE_PATH
+ - rm -rf $RELEASE_PATH/*
- cp -r -f $SITE_PATH/* $RELEASE_PATH
- ls -la $RELEASE_PATH
# Zip the content and publish the zip again
- # - zip -r "content.zip" "public"
- # - mv "content.zip" "public/"
+ - zip -r "content.zip" "public"
+ - mv "content.zip" "public/"
# - mv $SITE_ARCHIVE $RELEASE_PATH/content.zip
artifacts:
paths:
@@ -259,6 +274,8 @@ release-job:
artifacts: true
- job: build-job
artifacts: true
+ - job: pages
+ artifacts: true
rules:
- !reference [.default_rules, rules]
script:
diff --git a/features/org.etsi.mts.tdl.execution.feature/.project b/features/org.etsi.mts.tdl.execution.feature/.project
new file mode 100644
index 0000000000000000000000000000000000000000..64a248ec85b2b95c3e053f717207d155d472b000
--- /dev/null
+++ b/features/org.etsi.mts.tdl.execution.feature/.project
@@ -0,0 +1,23 @@
+
+
+ org.etsi.mts.tdl.execution.feature
+
+
+
+
+
+ org.eclipse.pde.FeatureBuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.pde.FeatureNature
+
+
diff --git a/features/org.etsi.mts.tdl.execution.feature/build.properties b/features/org.etsi.mts.tdl.execution.feature/build.properties
new file mode 100644
index 0000000000000000000000000000000000000000..64f93a9f0b7328eb563aa5ad6cec7f828020e124
--- /dev/null
+++ b/features/org.etsi.mts.tdl.execution.feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/features/org.etsi.mts.tdl.execution.feature/feature.xml b/features/org.etsi.mts.tdl.execution.feature/feature.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cc7ae3386e79bfebae4855e421f485a905be81de
--- /dev/null
+++ b/features/org.etsi.mts.tdl.execution.feature/feature.xml
@@ -0,0 +1,318 @@
+
+
+
+
+ Provides TDL execution capabilities via JUnit code generation (prototype).
+
+
+
+ Eclipse Public License - v 1.0
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS
+ECLIPSE PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+OF THE PROGRAM
+CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+1. DEFINITIONS
+"Contribution" means:
+a) in the case of the initial Contributor, the initial code and
+documentation
+distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+i) changes to the Program, and
+ii) additions to the Program;
+where such changes and/or additions to the Program originate
+from and are
+distributed by that particular Contributor. A Contribution 'originates'
+from a Contributor if it was added to the Program by such Contributor
+itself or anyone acting on such Contributor's behalf. Contributions
+do not
+include additions to the Program which: (i) are separate modules
+of
+software distributed in conjunction with the Program under their
+own
+license agreement, and (ii) are not derivative works of the Program.
+"Contributor" means any person or entity that distributes the
+Program.
+"Licensed Patents" mean patent claims licensable by a Contributor
+which are
+necessarily infringed by the use or sale of its Contribution
+alone or when
+combined with the Program.
+"Program" means the Contributions distributed in accordance with
+this
+Agreement.
+"Recipient" means anyone who receives the Program under this
+Agreement,
+including all Contributors.
+2. GRANT OF RIGHTS
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants
+Recipient a non-exclusive, worldwide, royalty-free copyright
+license to
+reproduce, prepare derivative works of, publicly display, publicly
+perform, distribute and sublicense the Contribution of such Contributor,
+if any, and such derivative works, in source code and object
+code form.
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants
+Recipient a non-exclusive, worldwide, royalty-free patent license
+under
+Licensed Patents to make, use, sell, offer to sell, import and
+otherwise
+transfer the Contribution of such Contributor, if any, in source
+code and
+object code form. This patent license shall apply to the combination
+of
+the Contribution and the Program if, at the time the Contribution
+is
+added by the Contributor, such addition of the Contribution causes
+such
+combination to be covered by the Licensed Patents. The patent
+license
+shall not apply to any other combinations which include the Contribution.
+No hardware per se is licensed hereunder.
+c) Recipient understands that although each Contributor grants
+the licenses
+to its Contributions set forth herein, no assurances are provided
+by any
+Contributor that the Program does not infringe the patent or
+other
+intellectual property rights of any other entity. Each Contributor
+disclaims any liability to Recipient for claims brought by any
+other
+entity based on infringement of intellectual property rights
+or
+otherwise. As a condition to exercising the rights and licenses
+granted
+hereunder, each Recipient hereby assumes sole responsibility
+to secure
+any other intellectual property rights needed, if any. For example,
+if a
+third party patent license is required to allow Recipient to
+distribute
+the Program, it is Recipient's responsibility to acquire that
+license
+before distributing the Program.
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+3. REQUIREMENTS
+A Contributor may choose to distribute the Program in object
+code form under
+its own license agreement, provided that:
+a) it complies with the terms and conditions of this Agreement;
+and
+b) its license agreement:
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties
+or
+conditions of merchantability and fitness for a particular purpose;
+ii) effectively excludes on behalf of all Contributors all liability
+for
+damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+iii) states that any provisions which differ from this Agreement
+are
+offered by that Contributor alone and not by any other party;
+and
+iv) states that source code for the Program is available from
+such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+When the Program is made available in source code form:
+a) it must be made available under this Agreement; and
+b) a copy of this Agreement must be included with each copy of
+the Program.
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+Each Contributor must identify itself as the originator of its
+Contribution,
+if
+any, in a manner that reasonably allows subsequent Recipients
+to identify the
+originator of the Contribution.
+4. COMMERCIAL DISTRIBUTION
+Commercial distributors of software may accept certain responsibilities
+with
+respect to end users, business partners and the like. While this
+license is
+intended to facilitate the commercial use of the Program, the
+Contributor who
+includes the Program in a commercial product offering should
+do so in a manner
+which does not create potential liability for other Contributors.
+Therefore,
+if a Contributor includes the Program in a commercial product
+offering, such
+Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify
+every other Contributor ("Indemnified Contributor") against any
+losses,
+damages and costs (collectively "Losses") arising from claims,
+lawsuits and
+other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of
+such Commercial
+Contributor in connection with its distribution of the Program
+in a commercial
+product offering. The obligations in this section do not apply
+to any claims
+or Losses relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor
+must:
+a) promptly notify the Commercial Contributor in writing of such
+claim, and
+b) allow the Commercial Contributor to control, and cooperate
+with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in
+any such claim at
+its own expense.
+For example, a Contributor might include the Program in a commercial
+product
+offering, Product X. That Contributor is then a Commercial Contributor.
+If
+that Commercial Contributor then makes performance claims, or
+offers
+warranties related to Product X, those performance claims and
+warranties are
+such Commercial Contributor's responsibility alone. Under this
+section, the
+Commercial Contributor would have to defend claims against the
+other
+Contributors related to those performance claims and warranties,
+and if a
+court requires any other Contributor to pay any damages as a
+result, the
+Commercial Contributor must pay those damages.
+5. NO WARRANTY
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM
+IS PROVIDED ON AN
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS
+OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each
+Recipient is solely responsible for determining the appropriateness
+of using
+and distributing the Program and assumes all risks associated
+with its
+exercise of rights under this Agreement , including but not limited
+to the
+risks and costs of program errors, compliance with applicable
+laws, damage to
+or loss of data, programs or equipment, and unavailability or
+interruption of
+operations.
+6. DISCLAIMER OF LIABILITY
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY
+CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT
+LIMITATION
+LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM
+OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY
+OF SUCH DAMAGES.
+7. GENERAL
+If any provision of this Agreement is invalid or unenforceable
+under
+applicable law, it shall not affect the validity or enforceability
+of the
+remainder of the terms of this Agreement, and without further
+action by the
+parties hereto, such provision shall be reformed to the minimum
+extent
+necessary to make such provision valid and enforceable.
+If Recipient institutes patent litigation against any entity
+(including a
+cross-claim or counterclaim in a lawsuit) alleging that the Program
+itself
+(excluding combinations of the Program with other software or
+hardware)
+infringes such Recipient's patent(s), then such Recipient's rights
+granted
+under Section 2(b) shall terminate as of the date such litigation
+is filed.
+All Recipient's rights under this Agreement shall terminate if
+it fails to
+comply with any of the material terms or conditions of this Agreement
+and does
+not cure such failure in a reasonable period of time after becoming
+aware of
+such noncompliance. If all Recipient's rights under this Agreement
+terminate,
+Recipient agrees to cease use and distribution of the Program
+as soon as
+reasonably practicable. However, Recipient's obligations under
+this Agreement
+and any licenses granted by Recipient relating to the Program
+shall continue
+and survive.
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in
+order to avoid inconsistency the Agreement is copyrighted and
+may only be
+modified in the following manner. The Agreement Steward reserves
+the right to
+publish new versions (including revisions) of this Agreement
+from time to
+time. No one other than the Agreement Steward has the right to
+modify this
+Agreement. The Eclipse Foundation is the initial Agreement Steward.
+The
+Eclipse Foundation may assign the responsibility to serve as
+the Agreement
+Steward to a suitable separate entity. Each new version of the
+Agreement will
+be given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version
+of the
+Agreement under which it was received. In addition, after a new
+version of the
+Agreement is published, Contributor may elect to distribute the
+Program
+(including its Contributions) under the new version. Except as
+expressly
+stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or
+licenses to the intellectual property of any Contributor under
+this Agreement,
+whether expressly, by implication, estoppel or otherwise. All
+rights in the
+Program not expressly granted under this Agreement are reserved.
+This Agreement is governed by the laws of the State of New York
+and the
+intellectual property laws of the United States of America. No
+party to this
+Agreement will bring a legal action under this Agreement more
+than one year
+after the cause of action arose. Each party waives its rights
+to a jury trial in
+any resulting litigation.
+
+
+
+
+
+
+
+
+
diff --git a/features/org.etsi.mts.tdl.execution.feature/pom.xml b/features/org.etsi.mts.tdl.execution.feature/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b3bf16ce1aeabebcb51c80d5545f5594673f5ac6
--- /dev/null
+++ b/features/org.etsi.mts.tdl.execution.feature/pom.xml
@@ -0,0 +1,18 @@
+
+
+ 4.0.0
+
+
+ org.etsi.mts.tdl
+ org.etsi.mts.tdl.parent
+ 1.0.0-SNAPSHOT
+ ../../org.etsi.mts.tdl.parent
+
+
+
+ org.etsi.mts.tdl.execution.feature
+ eclipse-feature
+
+ TDL Execution Support Feature
+
\ No newline at end of file
diff --git a/plugins/org.etsi.mts.tdl.TPLan2.ide/xtend-gen/.gitignore b/plugins/org.etsi.mts.tdl.TPLan2.ide/xtend-gen/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..78d910160c4b6a2be02b1060dfbc5a0ec2526bb1
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.TPLan2.ide/xtend-gen/.gitignore
@@ -0,0 +1,2 @@
+/*
+!.gitignore
diff --git a/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java b/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java
index cbe41097114442a492c5802377e935ae1ac0793b..8462282e879e29babc900181f80c119cbf79bc5e 100644
--- a/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java
+++ b/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java
@@ -431,9 +431,17 @@ public class Generator {
LinkedHashMap map = new LinkedHashMap<>();
map.put(Placeholders.NAME, tpd.getName());
//TODO: what if 0? what if more than 1?
- map.put(Placeholders.DESCRIPTION, tpd.getTestObjective().get(0).getDescription().replaceAll("\"", ""));
- String uri = String.join("\n", tpd.getTestObjective().get(0).getObjectiveURI()).trim();
- map.put(Placeholders.URI, uri.replaceAll("\"",""));
+ //TODO: make more robust
+ if (tpd.getTestObjective().size() == 1) {
+ map.put(Placeholders.DESCRIPTION, tpd.getTestObjective().get(0).getDescription().replaceAll("\"", ""));
+ String uri = String.join("\n", tpd.getTestObjective().get(0).getObjectiveURI()).trim();
+ map.put(Placeholders.URI, uri.replaceAll("\"",""));
+ } else {
+ //TODO: handle more adequately
+ String error = "N/A (multiple or no Test Objectives linked)";
+ map.put(Placeholders.DESCRIPTION, error);
+ map.put(Placeholders.URI, error);
+ }
TestConfiguration configuration = tpd.getTestConfiguration();
String config = "";
if (configuration != null) {
diff --git a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/debug.eol b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/debug.eol
index 7d708f94f7d69096493572ba6ff3985930a2e797..6d5e55b84177a921a423f757ec7f6b281d784476 100644
--- a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/debug.eol
+++ b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/debug.eol
@@ -9,6 +9,17 @@ operation Any debugAnnotations() : Boolean {
(" Comments: "+self.comment).println();
return true;
}
+operation Any debugElement(prefix : String) {
+ var pattern = ".+\\.(.+)Impl.+(\\(?)";
+ (prefix+self.toString().replaceAll(pattern, "$1 $2")).println();
+ for (c in self.eContents()) {
+ c.debugElement(prefix+" ");
+ }
+ for (c in self.eCrossReferences()) {
+ (prefix+"->"+c.toString().replaceAll(pattern, "$1 $2")).println();
+ //c.debugElement(prefix+" ");
+ }
+}
operation Any debugTimeConstraintVariables() : Boolean {
var expressionConstraint =
diff --git a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/reusable.eol b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/reusable.eol
index 5ddd1a6e79ee96e18886b8d4fb1cc55e2e6d532b..0dd65491f7dcb5334bca6b745331b7030861c759 100644
--- a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/reusable.eol
+++ b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/reusable.eol
@@ -84,82 +84,80 @@ operation String getStringValue() : TTCN!Value {
return v;
}
+operation TDL!DataUse getDataInstance() : TDL!DataInstance {
+ if (self.isKindOf(TDL!DataInstanceUse)) {
+ return self.dataInstance;
+ } else if (self.isKindOf(TDL!DataElementUse) and self.dataElement.isKindOf(TDL!DataInstance)) {
+ return self.dataElement;
+ } else {
+ (" TODO: "+self.~rule+" : Not Implemented Yet : "+self.type).log(1);
+ return null;
+ }
+}
+
operation Any transformSingleMemberAssignment(m : TDL!Member, mad : TDL!DataUse) : TTCN!TemplateBody {
+ ("transformSingleMemberAssignment: "+self.name+"::"+m.name).log(1);
var body = new TTCN!TemplateBody();
- if (mad.isDefined() and mad.isKindOf(TDL!DataInstanceUse)) {
- if (mad.dataInstance.isDefined() and mad.argument.isEmpty()) {
- body.simple = new TTCN!SimpleSpec();
- body.simple.expr = new TTCN!Value();
- body.simple.expr.ref = new TTCN!ReferencedValue();
- body.simple.expr.ref.head = new TTCN!Head();
-
- //Template ->target = BaseTemplate reference
- //Constant ->target = SingleConstDef reference
- var e = mad.dataInstance.equivalent();
- if (e.isKindOf(TTCN!TemplateDef)) {
- body.simple.expr.ref.head.target = e.base;
- } else if (e.isKindOf(TTCN!ConstDef)) {
- body.simple.expr.ref.head.target = e.defs.list.get(0);
- } else {
- //what else can it be?
- }
-
- //reduction
- //use extended field references
- var useEFR = mad.reduction.exists(mr|mr.collectionIndex.isDefined());
-
- if (useEFR) {
- for (mr in mad.reduction) {
- if (mr.member.isDefined()) {
- var efr = new TTCN!ExtendedFieldReference();
- efr.field = mr.member.equivalent();
-
- body.simple.expr.ref.fields.add(efr);
- }
- if (mr.collectionIndex.isDefined()
- and mr.collectionIndex.dataInstance.isDefined()) {
- var efr = new TTCN!ExtendedFieldReference();
- efr.array = new TTCN!Value();
- efr.array.ref = new TTCN!ReferencedValue();
- efr.array.ref.head = new TTCN!Head();
-
- var ci = mr.collectionIndex.dataInstance.equivalent();
- if (ci.isKindOf(TTCN!TemplateDef)) {
- efr.array.ref.head.target = ci.base;
- } else if (ci.isKindOf(TTCN!ConstDef)) {
- efr.array.ref.head.target = ci.defs.list.get(0);
- } else {
- //what else can it be?
- }
-
- body.simple.expr.ref.fields.add(efr);
- }
- }
- } else {
- var t = body.simple.expr.ref.head;
- for (mr in mad.reduction) {
- if (mr.member.isDefined()) {
- t.tail = new TTCN!RefValueTail();
- t.tail.value = mr.member.equivalent();
-
- }
- t = t.tail;
- }
- }
-
+ if (mad.isDefined()) {
+ var di = mad.getDataInstance();
+ if (di.isDefined()) {
+ //TODO: add support for DataElementUse
+ if (mad.argument.isEmpty()) {
+ var e = di.equivalent();
+ body.simple = new TTCN!SimpleSpec();
+ body.simple.expr = new TTCN!Value();
+ body.simple.expr.ref = e.getReferencedValue();
+
+ //reduction
+ //use extended field references
+ var useEFR = mad.reduction.exists(mr|mr.collectionIndex.isDefined());
+
+ if (useEFR) {
+ for (mr in mad.reduction) {
+ if (mr.member.isDefined()) {
+ var efr = new TTCN!ExtendedFieldReference();
+ efr.field = mr.member.equivalent();
+ body.simple.expr.ref.fields.add(efr);
+ }
+ if (mr.collectionIndex.isDefined()
+ and mr.collectionIndex.getDataInstance().isDefined()) {
+ var ci = mr.collectionIndex.getDataInstance().equivalent();
+ var efr = new TTCN!ExtendedFieldReference();
+ efr.array = new TTCN!Value();
+ efr.array.ref = ci.getReferencedValue();
+ body.simple.expr.ref.fields.add(efr);
+ }
+ }
+ } else {
+ var t = body.simple.expr.ref.head;
+ for (mr in mad.reduction) {
+ if (mr.member.isDefined()) {
+ t.tail = new TTCN!RefValueTail();
+ t.tail.value = mr.member.equivalent();
+
+ }
+ t = t.tail;
+ }
+ }
+
+ } else {
+ //nested anonymous definitions
+ //or overriding
+ (" : TODO: "+mad.item).log(1);
+ if (mad.item.isDefined()) {
+ body = self.transformDefaultMatchingSymbol(m, mad);
+ } else {
+ body.field = mad.transformWildcardMemberAssignment();
+ }
+ }
} else {
- //nested anonymous definitions
- //or overriding
- (" : "+mad.item).log(1);
- if (mad.item.isDefined()) {
- body = self.transformDefaultMatchingSymbol(m, mad);
- } else {
- body.field = mad.transformWildcardMemberAssignment();
- }
+ body = self.transformDefaultMatchingSymbol(m, mad);
}
} else {
body = self.transformDefaultMatchingSymbol(m, mad);
}
+ self.debugElement("Self: ");
+ body.debugElement("Body: ");
return body;
}
@@ -218,42 +216,82 @@ operation TDL!Member getFieldDef(type:TDL!StructuredDataType) : TTCN!StructField
}
}
+operation Any getReferencedValue() : TTCN!ReferencedValue {
+ var v = new TTCN!ReferencedValue();
+ v.head = new TTCN!Head();
+
+ //Template ->target = BaseTemplate reference
+ //Constant ->target = SingleConstDef reference
+ if (self.isKindOf(TTCN!TemplateDef)) {
+ v.head.target = self.base;
+ } else if (self.isKindOf(TTCN!ConstDef)) {
+ v.head.target = self.defs.list.get(0);
+ } else if (self.isKindOf(TTCN!Enumeration)) {
+ v.head.target = self;
+ } else {
+ (" TODO: Not implemented yet: getReferencedValue for"+self).log(1);
+ //what else can it be?
+ }
+ return v;
+}
+
//TODO: deprecated? -> not at present
operation TDL!StructuredDataInstance transformMemberAssignment() : TTCN!CompoundExpression {
var expr;
- ("transformMemberAssignment: "+self.name).println();
+ ("transformMemberAssignment: "+self.name).log(1);
if (not self.memberAssignment.isEmpty()) {
expr = new TTCN!FieldExpressionList();
for (ma in self.memberAssignment) {
var fes = new TTCN!FieldExpressionSpec();
//fes.fieldRef = ma.member.equivalent();
fes.fieldRef = ma.member.getFieldDef(self.dataType);
- (" "+ma.member.name+"->"+fes.fieldRef.eContainer().eContainer().name).println();
+ (" "+ma.member.name+"->"+fes.fieldRef.eContainer().eContainer().name).log(1);
//ma.memberSpec
fes.expr = new TTCN!Value();
- if (ma.memberSpec.isKindOf(TDL!DataInstanceUse)
- and ma.memberSpec.dataInstance.isDefined()) {
- fes.expr.ref = new TTCN!ReferencedValue();
- fes.expr.ref.head = new TTCN!Head();
-
- //Template ->target = BaseTemplate reference
- //Constant ->target = SingleConstDef reference
- var e = ma.memberSpec.dataInstance.equivalent();
- if (e.isKindOf(TTCN!TemplateDef)) {
- fes.expr.ref.head.target = e.base;
- } else if (e.isKindOf(TTCN!ConstDef)) {
- fes.expr.ref.head.target = e.defs.list.get(0);
+ //TODO: other data uses?
+ var di = ma.memberSpec.getDataInstance();
+ if (di.isDefined()) {
+ (di).println();
+ var e = di.equivalent();
+ e.println();
+
+ if (e.isUndefined()) {
+ if (di.dataType.name = "Boolean") {
+ fes.expr.predef = new TTCN!PredefinedValue();
+ fes.expr.predef.boolean = di.name.toString().toLower();
+ }
} else {
- //what else can it be?
+ fes.expr.ref = e.getReferencedValue();
}
//TODO: handle overriding parameters?
+ } else if (ma.memberSpec.isKindOf(TDL!LiteralValueUse)) {
+ //TODO: extract
+ fes.expr.predef = new TTCN!PredefinedValue();
+ if (ma.memberSpec.intValue.isDefined()) {
+ fes.expr.predef.integer = ma.memberSpec.intValue.toString();
+ } else if (ma.memberSpec.boolValue.isDefined()) {
+ fes.expr.predef.boolean = ma.memberSpec.boolValue.toString();
+ } else {
+ fes.expr.predef.charString = "\""+ma.memberSpec.value+"\"";
+ }
+ } else if (ma.memberSpec.isKindOf(TDL!SpecialValueUse)) {
+ fes.expr.predef = new TTCN!PredefinedValue();
+ if (ma.memberSpec.isKindOf(TDL!OmitValue)) {
+ fes.expr.predef.omit = "omit";
+ } else if (ma.memberSpec.isKindOf(TDL!AnyValue)) {
+ fes.expr.predef.charString = "TODO: ? (AnyValue)";
+ } else if (ma.memberSpec.isKindOf(TDL!AnyValueOrOmit)) {
+ fes.expr.predef.charString = "TODO: * (AnyValueOrOmit)";
+ }
+
} else {
//TODO: handle DataElementUse, others
fes.expr.predef = new TTCN!PredefinedValue();
fes.expr.predef.charString = "\"TODO: Not Implemented Yet\"";
+ (" NOT IMPLEMENTED YET: "+ma.memberSpec).log(1);
+
}
-
expr.specs.add(fes);
}
//TODO: handle unassigned members? -> add guards to corresponding rule
@@ -267,6 +305,7 @@ operation TDL!StructuredDataInstance transformMemberAssignment() : TTCN!Compound
(" TODO: "+self.~rule+" : What is going on here: "+self).log(1);
expr = new TTCN!ArrayExpression();
}
+ expr.debugElement("Expr:");
return expr;
}
@@ -276,6 +315,7 @@ operation TDL!StaticDataUse transformWildcardMemberAssignment() : TTCN!FieldSpec
//unassignedMember?
//argument -> ParameterBinding (parameter:Member, dataUse:DataUse)
//reduction? -> MemberReference
+ ("transformWildcardMemberAssignment: "+self.name).log(1);
var field = new TTCN!FieldSpecList();
var t;
if (self.dataInstance.isDefined()) {
@@ -306,6 +346,7 @@ operation TDL!StaticDataUse transformWildcardMemberAssignment() : TTCN!FieldSpec
var ma = self.argument.selectOne(a|a.parameter = m);
//default: no wildcard, defined
//in case not defined, check for inherited
+ ma.println();
if (ma.isDefined()) {
mad = ma.dataUse;
} else if (ma.isUndefined()
@@ -326,20 +367,37 @@ operation TDL!StaticDataUse transformWildcardMemberAssignment() : TTCN!FieldSpec
return field;
}
+//operation TDL!StructuredDataInstance transformWildcardMemberAssignment() : TTCN!FieldSpecList {
+// ("transformWildcardMemberAssignment: "+self.name).log(1);
+// var field = new TTCN!FieldSpecList();
+// for (m in self.dataType.allMembers()) { //TODO: why all? why not only assigned?
+//// for (ma in self.memberAssignment) {
+// var fs = new TTCN!FieldSpec();
+// fs.ref = m.equivalent();
+//
+// var ma = self.memberAssignment.selectOne(ma|ma.member = m);
+// var mad;
+// if (ma.isDefined()) {
+// mad = ma.memberSpec;
+// }
+//
+// fs.body = new TTCN!TemplateBody();
+// fs.body = self.transformSingleMemberAssignment(m, mad);
+// field.spec.add(fs);
+// }
+// return field;
+//}
+
+//TODO: reactivate or differentiate above
operation TDL!StructuredDataInstance transformWildcardMemberAssignment() : TTCN!FieldSpecList {
+ ("transformWildcardMemberAssignmentX: "+self.name).log(1);
var field = new TTCN!FieldSpecList();
- for (m in self.dataType.allMembers()) {
+ for (ma in self.memberAssignment) {
var fs = new TTCN!FieldSpec();
- fs.ref = m.equivalent();
-
- var ma = self.memberAssignment.selectOne(ma|ma.member = m);
- var mad;
- if (ma.isDefined()) {
- mad = ma.memberSpec;
- }
+ fs.ref = ma.member.equivalent();
fs.body = new TTCN!TemplateBody();
- fs.body = self.transformSingleMemberAssignment(m, mad);
+ fs.body = self.transformSingleMemberAssignment(ma.member, ma.memberSpec);
field.spec.add(fs);
}
return field;
@@ -560,6 +618,64 @@ operation TDL!DataInstanceUse getTemplateBody() : TTCN!TemplateBody {
return self.getTemplateBody(false);
}
+operation TDL!DataElementUse getTemplateBody() : TTCN!TemplateBody {
+ return self.getTemplateBody(false);
+}
+
+//TODO: refactor, copied from below
+operation TDL!DataElementUse getTemplateBody(flat : Boolean) : TTCN!TemplateBody {
+ var tb = new TTCN!TemplateBody();
+ tb.simple = new TTCN!SimpleSpec();
+ tb.simple.expr = new TTCN!Value();
+ if (useDataMapping) {
+ var mapping = TDL!DataElementMapping.allInstances().select(m|m.mappableDataElement = self.dataElement).first(); //TODO: extract parameter
+ tb.simple.expr.predef = new TTCN!PredefinedValue();
+ if (mapping.isDefined()) {
+ //t.ref = new TTCN!TypeReference();
+ //TODO: check if defined
+ //t.ref.head = mapping.elementURI;
+ tb.simple.expr.predef.charString = mapping.elementURI.replaceAll("\"","");
+ } else {
+ tb.simple.expr.predef.charString = "MAP_"+self.dataInstance.name;
+ }
+ } else {
+ if (self.dataElement.isDefined() and self.dataElement.isKindOf(TDL!DataInstance)) {
+ tb.simple.expr.ref = new TTCN!ReferencedValue();
+ tb.simple.expr.ref.head = new TTCN!Head();
+ tb.simple.expr.ref.head.target = self.dataElement.equivalent().base;
+ } else if (self.dataElement.isDefined() and self.dataElement.isKindOf(TDL!DataType)) { //TODO:differentiate structured vs simple vs collection
+ if (flat) {
+ (" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
+ tb.simple.expr.predef = new TTCN!PredefinedValue();
+ tb.simple.expr.predef.charString = "\"TODO_INLINE_DATA_ELEMENT_FOR_"+self.dataElement.name+"\"";
+ } else if (self.argument.isEmpty()) {
+ //TODO: make sure type is present
+ tb.simple.expr = new TTCN!ArrayExpression();
+ } else {
+ tb.simple=null;
+ tb.~type = self.dataElement.getTTCNType();
+ tb.field = new TTCN!FieldSpecList();
+
+ for (a in self.argument) {
+ var fs = new TTCN!FieldSpec();
+ fs.ref = a.parameter.equivalent();
+ fs.body = a.dataUse.getTemplateBody(true); //TODO: expand?
+ tb.field.spec.add(fs);
+ }
+ }
+
+ } else if (self.item.isDefined()) {
+ (" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
+ tb.simple.expr.predef = new TTCN!PredefinedValue();
+ tb.simple.expr.predef.charString = "\"TODO_INLINE_COLLECTION\"";
+ } else {
+ (" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
+ }
+ }
+ return tb;
+
+}
+
operation TDL!DataInstanceUse getTemplateBody(flat : Boolean) : TTCN!TemplateBody {
var tb = new TTCN!TemplateBody();
tb.simple = new TTCN!SimpleSpec();
@@ -673,24 +789,15 @@ operation String getVerdictStatement() : TTCN!FunctionStatement {
}
operation TDL!DataUse getVerdictStatement() : TTCN!FunctionStatement {
- var sfs = new TTCN!FunctionStatement();
- sfs.verdict = new TTCN!SetLocalVerdict();
- sfs.verdict.expression = new TTCN!Value();
+ var verdictName = "pass"; //TODO: more reasonable default?
//TODO: handle corresponding verdict properly
if (self.isKindOf(TDL!DataInstanceUse)) {
- sfs.verdict.expression.predef = new TTCN!PredefinedValue();
- if (self.dataInstance.name = "pass") {
- sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#pass;
- } else if (self.dataInstance.name = "fail") {
- sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#fail;
- } else if (self.dataInstance.name = "inconclusive") {
- sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#inconc;
- } else {
- //TODO
- }
+ verdictName = self.dataInstance.name;
+ } else if (self.isKindOf(TDL!DataElementUse)) { //TODO: check that it is a dataInstance of type Verdict?
+ verdictName = self.dataElement.name;
} else {
//TODO
- }
- return sfs;
+ }
+ return verdictName.getVerdictStatement();
}
diff --git a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/ttcn3mapping.etl b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/ttcn3mapping.etl
index 3670f4fbbce485d5ae3e77be265dd99baa0cca52..82743e5090b026e816e08496436aa934ae3dc615 100644
--- a/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/ttcn3mapping.etl
+++ b/plugins/org.etsi.mts.tdl.ttcn3/epsilon/ttcn3/ttcn3mapping.etl
@@ -236,11 +236,17 @@ rule EnumDT2E
t.structured.enumDef = e;
e.list = new TTCN!EnumerationList();
- for (v in dt.value) {
- var literal = new TTCN!Enumeration();
- literal.name = v.TTCNname();
- e.list.enums.add(literal);
- }
+}
+
+rule EnumInstance2E
+ transform di : TDL!SimpleDataInstance
+ to e : TTCN!Enumeration {
+ guard : not useDataMapping and di.eContainer.isKindOf(TDL!EnumDataType)
+
+ e.name = di.TTCNname();
+
+ var ep = di.dataType.equivalent();
+ ep.list.enums.add(e);
}
@@ -828,6 +834,8 @@ rule StructuredDI2TD
di.~rule = self;
+ (di.name).log(1);
+
var md = new TTCN!ModuleDefinition();
md.def = td;
var m = di.eContainer.equivalent();
@@ -862,11 +870,11 @@ rule StructuredDI2TD
// or ma.memberSpec.isKindOf(TDL!AnyValueOrOmit))).log(1);
tb.field = di.transformWildcardMemberAssignment();
} else {
- ("Simple: "+di.name).log(1);
+ ("Structure -> Simple: "+di.name).log(1);
tb.simple = new TTCN!SimpleSpec();
tb.simple.expr = di.transformMemberAssignment();
}
-
+
}
rule StructuredDI2C