Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
TDL Open Source
TOP IDE
Compare revisions
f1fa50ebbd869ef8b207d515038e0d3a3a805af7...efc78d21c1a9eb43ce5b659be8fa157c43dba2ed
Hide whitespace changes
Inline
Side-by-side
plugins/org.etsi.mts.tdl.standalone/examples/asn1/example-1-library.asn
0 → 100644
View file @
efc78d21
LibraryASN1module DEFINITIONS ::=
BEGIN
Library ::= SEQUENCE {
address UTF8String DEFAULT "Sophia-Antipolis, France",
documents SEQUENCE OF Document
}
Document ::= SEQUENCE {
title UTF8String (SIZE(1..128)),
status ENUMERATED {draft, published, historical},
authors SEQUENCE OF UTF8String,
number CHOICE {
es INTEGER,
eg INTEGER,
tr INTEGER
} OPTIONAL,
updated DATE
}
END
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/asn1/example-1-library.asn-generated.tdltx
0 → 100644
View file @
efc78d21
Package generated_from_example_1_library_asn {
Type String
Type TODO_RESOLVE_REFERENCED
Use "\"example-1-library.asn\"" as SOURCE_MAPPING
Structure Library (
UTF8String address,
Library___documents documents
)
Structure Document (
UTF8String title,
Document___status status,
Document___authors authors,
optional Document___number number,
Date updated
)
Type UTF8String
Collection Library___documents of Document
Structure AsnEnum ( )
Collection Document___authors of UTF8String
Structure Document___number { union } (
Integer es,
Integer eg,
Integer tr
)
Constraint union
Type Integer
Type Date
Enumerated Document___status {
Document___status draft,
Document___status published,
Document___status historical
}
Map Library to "\"Library\"" in SOURCE_MAPPING as Library_MAPPING
Map Document to "\"Document\"" in SOURCE_MAPPING as Document_MAPPING
Package generated_from_LibraryASN1module }
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/asn1/example-1-ssp.asn
0 → 100644
View file @
efc78d21
SSPASN1module DEFINITIONS ::=
BEGIN
NodeDescriptor ::= SEQUENCE
{
aNodeName NodeName, -- Node name
aShortName UUID, -- Short node name
aNode CHOICE
{
aLink SEQUENCE
{
aLinkedFileIdentity NodeIdentity, -- Identity of the linked SSP file
aLinkedFileSize FileSize -- Size of the linked SSP file
},
aFile SEQUENCE
{
aFileSize FileSize -- Size of the SSP file
},
aDirectory SEQUENCE
{
}
},
aMetaData SEQUENCE OF MetaDatum OPTIONAL, -- Optional meta data
aACL SET OF AccessControl OPTIONAL -- Access Control List attribute
}
/* Node identity */
NodeName ::= UTF8String (SIZE(1..16)) -- node name encoded in UTF-8
NodeReference ::= SEQUENCE (SIZE(1..6)) OF NodeName -- pathname and node name
NodeIdentity ::= CHOICE
{
aShortName UUID, -- UUID of file reference using absolute pathname
aNodeReference NodeReference -- Node reference
}
END
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/asn1/example-1-ssp.asn-generated.tdltx
0 → 100644
View file @
efc78d21
Package generated_from_example_1_ssp_asn {
Type String
Type TODO_RESOLVE_REFERENCED
Use "\"example-1-ssp.asn\"" as SOURCE_MAPPING
Type NodeName { UTF8String }
Constraint UTF8String
Collection NodeReference of NodeName
Structure NodeDescriptor (
NodeName aNodeName,
UUID aShortName,
NodeDescriptor___aNode aNode,
optional NodeDescriptor___aMetaData aMetaData,
optional NodeDescriptor___aACL aACL
)
Structure NodeIdentity { union } (
UUID aShortName,
NodeReference aNodeReference
)
Structure UUID ( )
Structure NodeDescriptor___aNode { union } (
NodeDescriptor___aNode___aLink aLink,
NodeDescriptor___aNode___aFile aFile,
NodeDescriptor___aNode___aDirectory aDirectory
)
Constraint union
Structure NodeDescriptor___aNode___aLink (
NodeIdentity aLinkedFileIdentity,
FileSize aLinkedFileSize
)
Structure FileSize ( )
Structure NodeDescriptor___aNode___aFile (
FileSize aFileSize
)
Structure NodeDescriptor___aNode___aDirectory ( )
Collection NodeDescriptor___aMetaData of MetaDatum
Structure MetaDatum ( )
Collection NodeDescriptor___aACL of AccessControl
Structure AccessControl ( )
Map NodeName to "\"NodeName\"" in SOURCE_MAPPING as NodeName_MAPPING
Map NodeReference to "\"NodeReference\"" in SOURCE_MAPPING as NodeReference_MAPPING
Map NodeDescriptor to "\"NodeDescriptor\"" in SOURCE_MAPPING as NodeDescriptor_MAPPING
Map NodeIdentity to "\"NodeIdentity\"" in SOURCE_MAPPING as NodeIdentity_MAPPING
Package generated_from_SSPASN1module }
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdlan2
0 → 100644
View file @
efc78d21
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdltx
0 → 100644
View file @
efc78d21
Package ImportSample {
Import all from Sample
//example test description
Test exampleImported uses base {
terminate
tester::interface sends "hello" {string} to sut::interface
//example constraint violation
tester::interface sends r to sut::interface
//tester::interface sends f to sut::interface
}
}
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdltx.tdl
0 → 100644
View file @
efc78d21
<?xml version="1.0" encoding="ASCII"?>
<tdl:Package
xmi:version=
"2.0"
xmlns:xmi=
"http://www.omg.org/XMI"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:tdl=
"http://www.etsi.org/spec/TDL/1.4.1"
name=
"ImportSample"
>
<packagedElement
xsi:type=
"tdl:TestDescription"
name=
"exampleImported"
isLocallyOrdered=
"true"
>
<testConfiguration
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9"
/>
<behaviourDescription>
<behaviour
xsi:type=
"tdl:CompoundBehaviour"
>
<block>
<behaviour
xsi:type=
"tdl:Stop"
/>
<behaviour
xsi:type=
"tdl:Message"
>
<sourceGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.1"
/>
<target>
<targetGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.0"
/>
</target>
<argument
xsi:type=
"tdl:LiteralValueUse"
value=
"hello"
>
<dataType
xsi:type=
"tdl:SimpleDataType"
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.1"
/>
</argument>
</behaviour>
<behaviour
xsi:type=
"tdl:Message"
>
<sourceGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.1"
/>
<target>
<targetGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.0"
/>
</target>
<argument
xsi:type=
"tdl:DataElementUse"
>
<dataElement
xsi:type=
"tdl:SimpleDataInstance"
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.5"
/>
</argument>
</behaviour>
</block>
</behaviour>
</behaviourDescription>
</packagedElement>
<import>
<importedPackage
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#/"
/>
</import>
</tdl:Package>
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdltx.tdlan2
0 → 100644
View file @
efc78d21
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdltx.tdltx
0 → 100644
View file @
efc78d21
Package ImportSample {
Import all from Sample
Test exampleImported uses base {
terminate
tester::interface sends "hello" { string } to sut::interface
tester::interface sends r to sut::interface
}
}
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/basics/ImportSample.tdltx.tdltx.tdl
0 → 100644
View file @
efc78d21
<?xml version="1.0" encoding="ASCII"?>
<tdl:Package
xmi:version=
"2.0"
xmlns:xmi=
"http://www.omg.org/XMI"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:tdl=
"http://www.etsi.org/spec/TDL/1.4.1"
name=
"ImportSample"
>
<packagedElement
xsi:type=
"tdl:TestDescription"
name=
"exampleImported"
isLocallyOrdered=
"true"
>
<testConfiguration
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9"
/>
<behaviourDescription>
<behaviour
xsi:type=
"tdl:CompoundBehaviour"
>
<block>
<behaviour
xsi:type=
"tdl:Stop"
/>
<behaviour
xsi:type=
"tdl:Message"
>
<sourceGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.1"
/>
<target>
<targetGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.0"
/>
</target>
<argument
xsi:type=
"tdl:LiteralValueUse"
value=
"hello"
>
<dataType
xsi:type=
"tdl:SimpleDataType"
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.1"
/>
</argument>
</behaviour>
<behaviour
xsi:type=
"tdl:Message"
>
<sourceGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.1"
/>
<target>
<targetGate
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.9/@connection.0/@endPoint.0"
/>
</target>
<argument
xsi:type=
"tdl:DataElementUse"
>
<dataElement
xsi:type=
"tdl:SimpleDataInstance"
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#//@packagedElement.5"
/>
</argument>
</behaviour>
</block>
</behaviour>
</behaviourDescription>
</packagedElement>
<import>
<importedPackage
href=
"/Users/philip-iii/Dev/git/etsi-labs/ide/plugins/org.etsi.mts.tdl.standalone/examples/Sample.tdltx#/"
/>
</import>
</tdl:Package>
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdlan2
0 → 100644
View file @
efc78d21
Package Sample {
Type integer;
Type string;
Type float;
Time sec;
sec i;
float r;
string s;
Gate Type http accepts string, integer;
Component Type node having {
gate interface of type http;
}
Test Configuration base {
create SUT sut of type node ;
create Tester tester of type node ;
connect sut.interface to tester.interface ;
}
Test Description Implementation example
uses configuration base {
terminate;
}
}
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdltx
0 → 100644
View file @
efc78d21
Package Sample {
//standard annotations for STO
//Annotation Initial conditions
//Annotation Expected behaviour
//Annotation Final conditions
//Annotation Test Purpose Description
//Annotation when
//Annotation then
//example types
Type integer
Type string
Type float
Time sec
sec i
float r
string s
//example configuration
Message Gate http accepts string, integer
Component node {
gate http interface
}
Configuration base {
node sut as SUT,
node tester as Tester,
connect sut::interface to tester::interface
}
//example test description
Test example uses base {
terminate
//wait for i on tester
//tester::interface sends "hello" {string} to sut::interface
//example constraint violation
//tester::interface sends s to sut::interface
}
}
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdltx.tdl
0 → 100644
View file @
efc78d21
<?xml version="1.0" encoding="ASCII"?>
<tdl:Package
xmi:version=
"2.0"
xmlns:xmi=
"http://www.omg.org/XMI"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:tdl=
"http://www.etsi.org/spec/TDL/1.4.1"
name=
"Sample"
>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"integer"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"string"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"float"
/>
<packagedElement
xsi:type=
"tdl:Time"
name=
"sec"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"i"
dataType=
"//@packagedElement.3"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"r"
dataType=
"//@packagedElement.2"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"s"
dataType=
"//@packagedElement.1"
/>
<packagedElement
xsi:type=
"tdl:GateType"
name=
"http"
dataType=
"//@packagedElement.1 //@packagedElement.0"
/>
<packagedElement
xsi:type=
"tdl:ComponentType"
name=
"node"
>
<gateInstance
name=
"interface"
type=
"//@packagedElement.7"
/>
</packagedElement>
<packagedElement
xsi:type=
"tdl:TestConfiguration"
name=
"base"
>
<componentInstance
name=
"sut"
type=
"//@packagedElement.8"
/>
<componentInstance
name=
"tester"
type=
"//@packagedElement.8"
role=
"Tester"
/>
<connection>
<endPoint
component=
"//@packagedElement.9/@componentInstance.0"
gate=
"//@packagedElement.8/@gateInstance.0"
/>
<endPoint
component=
"//@packagedElement.9/@componentInstance.1"
gate=
"//@packagedElement.8/@gateInstance.0"
/>
</connection>
</packagedElement>
<packagedElement
xsi:type=
"tdl:TestDescription"
name=
"example"
testConfiguration=
"//@packagedElement.9"
isLocallyOrdered=
"true"
>
<behaviourDescription>
<behaviour
xsi:type=
"tdl:CompoundBehaviour"
>
<block>
<behaviour
xsi:type=
"tdl:Stop"
/>
</block>
</behaviour>
</behaviourDescription>
</packagedElement>
</tdl:Package>
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdltx.tdlan2
0 → 100644
View file @
efc78d21
Package Sample {
Type integer;
Type string;
Type float;
Time sec;
sec i;
float r;
string s;
Gate Type http accepts string, integer;
Component Type node having {
gate interface of type http;
}
Test Configuration base {
create SUT sut of type node ;
create Tester tester of type node ;
connect sut.interface to tester.interface ;
}
Test Description Implementation example
uses configuration base {
terminate;
}
}
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdltx.tdltx
0 → 100644
View file @
efc78d21
Package Sample {
Type integer
Type string
Type float
Time sec
sec i
float r
string s
Message Gate http accepts string,integer
Component node {
gate http interface
}
Configuration base {
node sut as SUT,
node tester as Tester,
connect sut::interface to tester::interface
}
Test example uses base {
terminate
}
}
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/basics/Sample.tdltx.tdltx.tdl
0 → 100644
View file @
efc78d21
<?xml version="1.0" encoding="ASCII"?>
<tdl:Package
xmi:version=
"2.0"
xmlns:xmi=
"http://www.omg.org/XMI"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:tdl=
"http://www.etsi.org/spec/TDL/1.4.1"
name=
"Sample"
>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"integer"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"string"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataType"
name=
"float"
/>
<packagedElement
xsi:type=
"tdl:Time"
name=
"sec"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"i"
dataType=
"//@packagedElement.3"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"r"
dataType=
"//@packagedElement.2"
/>
<packagedElement
xsi:type=
"tdl:SimpleDataInstance"
name=
"s"
dataType=
"//@packagedElement.1"
/>
<packagedElement
xsi:type=
"tdl:GateType"
name=
"http"
dataType=
"//@packagedElement.1 //@packagedElement.0"
/>
<packagedElement
xsi:type=
"tdl:ComponentType"
name=
"node"
>
<gateInstance
name=
"interface"
type=
"//@packagedElement.7"
/>
</packagedElement>
<packagedElement
xsi:type=
"tdl:TestConfiguration"
name=
"base"
>
<componentInstance
name=
"sut"
type=
"//@packagedElement.8"
/>
<componentInstance
name=
"tester"
type=
"//@packagedElement.8"
role=
"Tester"
/>
<connection>
<endPoint
component=
"//@packagedElement.9/@componentInstance.0"
gate=
"//@packagedElement.8/@gateInstance.0"
/>
<endPoint
component=
"//@packagedElement.9/@componentInstance.1"
gate=
"//@packagedElement.8/@gateInstance.0"
/>
</connection>
</packagedElement>
<packagedElement
xsi:type=
"tdl:TestDescription"
name=
"example"
testConfiguration=
"//@packagedElement.9"
isLocallyOrdered=
"true"
>
<behaviourDescription>
<behaviour
xsi:type=
"tdl:CompoundBehaviour"
>
<block>
<behaviour
xsi:type=
"tdl:Stop"
/>
</block>
</behaviour>
</behaviourDescription>
</packagedElement>
</tdl:Package>
plugins/org.etsi.mts.tdl.standalone/examples/openapi/ExampleAPI.yaml
0 → 100644
View file @
efc78d21
openapi
:
3.0.3
info
:
title
:
'
Examples
for
RESTful
API
guide'
version
:
'
1.0.0'
externalDocs
:
# Reference to the base document
description
:
'
ETSI
ES
203
647
...'
url
:
'
https://rest.etsi.org'
paths
:
# Resource path relative to server, parameters in curly braces
/resource/{id}
:
# Method
get
:
# Unique case-sensitive identifier
operationId
:
getResource
# Grouping
tags
:
-
Resource management
summary
:
'
Read
a
resource'
description
:
'
Read
full
contents
of
a
resource
with
specific
ID'
parameters
:
# Parameter name used as the key in associative array of parameters
-
name
:
'
id'
# The location of parameter: path, query, header or cookie
in
:
path
required
:
true
description
:
'
Resource
ID'
schema
:
# Primitive type
type
:
string
responses
:
# Response code
200
:
description
:
The requested resource
# Custom headers
headers
:
ETag
:
# Reference to (reusable) header definition
$ref
:
'
#/components/headers/ETag'
# Response body
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/ResourceData'
401
:
# Reference to (reusable) response definition
$ref
:
'
#/components/responses/401'
404
:
$ref
:
'
#/components/responses/404'
/resource
:
# POST JSON object
post
:
# Info excluded
operationId
:
postResource
summary
:
Create new resource
parameters
:
# Reference to (reusable) parameter definition
-
$ref
:
'
#/components/parameters/resourceId'
# Reference to (reusable) header definition
-
$ref
:
'
#/components/parameters/Version'
requestBody
:
description
:
'
Data
for
new
resource'
required
:
true
content
:
# Content media type (Content-Type header value)
application/json
:
schema
:
# Reference to data type
$ref
:
'
#/components/schemas/ResourceData'
responses
:
204
:
# Reference to data type
$ref
:
'
#/components/responses/204'
'
/resource/{id}/file'
:
# Upload a resource file
put
:
# Info excluded
operationId
:
uploadResourceFile
summary
:
Upload a file for a resource
parameters
:
-
$ref
:
'
#/components/parameters/resourceId'
requestBody
:
description
:
'
An
image
file
to
be
attached
to
the
resource'
content
:
multipart/form-data
:
schema
:
type
:
object
properties
:
# Property name (also the name applied to content disposition)
file
:
type
:
string
# Sets content type to application/octet-stream
format
:
binary
encoding
:
# Applies custom encoding to "file" property
file
:
# Override default content type
contentType
:
image/png
responses
:
204
:
$ref
:
'
#/components/responses/204'
# Example search path /search?text=rest&max=5
'
/search'
:
get
:
summary
:
'
Search
resource'
# Description excluded
operationId
:
searchResource
parameters
:
-
name
:
'
text'
in
:
query
required
:
true
description
:
'
Text
to
search
for'
schema
:
type
:
string
-
name
:
'
max'
in
:
query
# Optional parameter
required
:
false
description
:
'
Maximum
number
of
results
expected'
schema
:
type
:
number
-
name
:
'
page'
in
:
query
required
:
false
description
:
'
'
schema
:
type
:
number
responses
:
200
:
# TBD
description
:
'
The
requested
resource'
# Custom headers
headers
:
ETag
:
# Reference to (reusable) header definition
$ref
:
'
#/components/headers/ETag'
# Response body
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/SearchResults'
'
/subscription'
:
post
:
summary
:
'
Subscribe
to
authenticated
notifications'
# Description excluded
operationId
:
subscribeNotifications
requestBody
:
content
:
application/json
:
schema
:
# Subscription containing callbackUrl property
$ref
:
'
#/components/schemas/Subscription'
responses
:
# Subscription was created
201
:
$ref
:
'
#/components/responses/201'
# Out-of-band notifications from server
callbacks
:
# Named callback object (inline or reference)
auth
:
# Local path used by server for callback(s)
'
{$request.body#/callbackUrl}/incoming'
:
post
:
requestBody
:
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/AuthenticatedNotification'
responses
:
204
:
$ref
:
'
#/components/responses/204'
401
:
$ref
:
'
#/components/responses/401'
/service
:
get
:
# Info excluded
operationId
:
getService
# Support for GET request is mandatory for API provider
x-etsi-provision
:
mandatory
parameters
:
-
name
:
'
circuitswitching'
in
:
query
required
:
false
schema
:
type
:
string
x-etsi-capabilities
:
# Parameter only applies to "3G" capability
-
3G
responses
:
200
:
description
:
'
The
requested
service'
content
:
application/json
:
schema
:
type
:
object
properties
:
speed
:
type
:
string
enum
:
-
fast
-
superfast
x-etsi-enum
:
# Enum value "superfast" is optional and
# only applies to "4G" and "5G" capabilities
superfast
:
required
:
false
x-etsi-capabilities
:
-
4G
-
5G
# Optional definitions
security
:
[]
components
:
schemas
:
# Name of data type
SearchResults
:
# Array type
type
:
array
items
:
# Type of array members, reference to ResourceData
$ref
:
'
#/components/schemas/ResourceData'
# No more than 10 results
maxItems
:
10
ResourceData
:
# Structured type
type
:
object
properties
:
# Property name
id
:
# Property type
type
:
string
size
:
type
:
string
enum
:
# Set of allowed values
-
big
-
bigger
-
biggerer
# Default value for non-required property
default
:
big
created
:
# Date-time value encoded as string
type
:
string
format
:
date-time
required
:
# Set of required properties
-
id
Subscription
:
type
:
object
properties
:
credentials
:
$ref
:
'
#/components/schemas/Credentials'
AuthenticatedNotification
:
type
:
object
Credentials
:
type
:
object
properties
:
user
:
type
:
string
responses
:
# Common responses with response code as identifier
201
:
description
:
'
Created'
204
:
description
:
'
No
content'
401
:
description
:
'
Unauthenticated'
404
:
description
:
'
Not
found'
headers
:
Version
:
description
:
'
API
version'
required
:
true
schema
:
type
:
string
# Definition of ETag header
ETag
:
description
:
'
Identifier
for
a
specific
version
of
a
resource'
schema
:
type
:
string
parameters
:
Version
:
name
:
'
Version'
description
:
'
API
version'
in
:
header
required
:
true
schema
:
type
:
string
resourceId
:
name
:
'
id'
in
:
path
required
:
true
description
:
'
Resource
ID'
schema
:
type
:
string
securitySchemes
:
{}
callbacks
:
{}
servers
:
# Recommended structure for API paths
-
url
:
'
{apiRoot}/{apiName}/{apiMajorVersion}/'
variables
:
apiRoot
:
default
:
https://example.com
apiName
:
description
:
Interface name from the base document
default
:
rest-api-guide
apiMajorVersion
:
description
:
Major version of the API from the base document
default
:
v1
tags
:
# Optional descriptions of tags
-
name
:
Resource management
description
:
Operations for managing resources
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/examples/openapi/ExampleAPI.yaml-generated.tdltx
0 → 100644
View file @
efc78d21
Package generated_from_ExampleAPI_yaml {
Type String
Type TODO_RESOLVE_REFERENCED
Use "\"ExampleAPI.yaml\"" as SOURCE_MAPPING
Use "\"generated/java\"" as TARGET_MAPPING
Collection SearchResults of SearchResults___item
Structure SearchResults___item (
string id,
string ^size,
string created
)
Type string
Map SearchResults to "\"#/components/schemas/SearchResults\"" in SOURCE_MAPPING as SearchResults_SOURCE_MAPPING
Map SearchResults to "\"SearchResults\"" in TARGET_MAPPING as SearchResults_TARGET_MAPPING
Structure ResourceData (
string id,
string ^size,
string created
)
Map ResourceData to "\"#/components/schemas/ResourceData\"" in SOURCE_MAPPING as ResourceData_SOURCE_MAPPING
Map ResourceData to "\"ResourceData\"" in TARGET_MAPPING as ResourceData_TARGET_MAPPING
Structure Subscription (
Credentials credentials
)
Structure Credentials (
string user
)
Map Subscription to "\"#/components/schemas/Subscription\"" in SOURCE_MAPPING as Subscription_SOURCE_MAPPING
Map Subscription to "\"Subscription\"" in TARGET_MAPPING as Subscription_TARGET_MAPPING
Structure AuthenticatedNotification ( )
Map AuthenticatedNotification to "\"#/components/schemas/AuthenticatedNotification\"" in SOURCE_MAPPING as AuthenticatedNotification_SOURCE_MAPPING
Map AuthenticatedNotification to "\"AuthenticatedNotification\"" in TARGET_MAPPING as AuthenticatedNotification_TARGET_MAPPING
Map Credentials to "\"#/components/schemas/Credentials\"" in SOURCE_MAPPING as Credentials_SOURCE_MAPPING
Map Credentials to "\"Credentials\"" in TARGET_MAPPING as Credentials_TARGET_MAPPING
}
\ No newline at end of file
plugins/org.etsi.mts.tdl.standalone/src/org/etsi/mts/tdl/standalone/Standalone.java
0 → 100644
View file @
efc78d21
package
org.etsi.mts.tdl.standalone
;
import
java.io.File
;
import
java.io.FilenameFilter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Consumer
;
import
org.eclipse.emf.ecore.resource.Resource
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.eclipse.epsilon.evl.execute.UnsatisfiedConstraint
;
import
org.etsi.mts.tdl.Package
;
import
org.etsi.mts.tdl.asn2tdl.ASN2TDLTranslator
;
import
org.etsi.mts.tdl.constraints.evl.Validator
;
import
org.etsi.mts.tdl.helper.TDLHelper
;
import
org.etsi.mts.tdl.openapi2tdl.next.OpenAPI2TDLTranslatorNext
;
import
org.etsi.mts.tdl.transform.AbstractTranslator
;
public
class
Standalone
{
static
String
sourceExtension
=
"tdltx"
;
static
String
targetExtension
=
"tdltx"
;
static
String
openapiExtension
=
"yaml"
;
static
String
asnExtension
=
"asn"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Standalone
app
=
new
Standalone
();
//folder
String
path
=
"examples/basics"
;
app
.
processElements
(
path
,
app:
:
listElements
);
//TODO: may fail
app
.
processElements
(
path
,
app:
:
validate
);
//TODO: may fail
// app.processElements(path, app::translate);
TDLHelper
.
resetResourceSet
();
path
=
"examples/openapi"
;
app
.
processElements
(
path
,
openapiExtension
,
app:
:
importOpenAPI
);
//NOTE: keep in mind weird errors if legacy OpenAPI importer is imported as well in manifest (especially if it is first)
TDLHelper
.
resetResourceSet
();
path
=
"examples/asn1"
;
app
.
processElements
(
path
,
asnExtension
,
app:
:
importASN1
);
//individual file without dependencies
TDLHelper
.
resetResourceSet
();
path
=
"examples/basics/Sample.tdltx"
;
app
.
processElements
(
path
,
app:
:
listElements
);
//individual file with missing dependencies
TDLHelper
.
resetResourceSet
();
path
=
"examples/basics/ImportSample.tdltx"
;
app
.
processElements
(
path
,
app:
:
listElements
);
//validation will fail due to unresolved items
//TODO: minimal example for TO translation
//TODO: minimal example for TTCN-3 generation
//TODO: clean up keywords automatically
}
private
void
processElements
(
String
path
,
Consumer
<
String
>
operation
)
throws
Exception
{
processElements
(
path
,
sourceExtension
,
operation
);
}
private
void
processElements
(
String
path
,
String
extension
,
Consumer
<
String
>
operation
)
throws
Exception
{
File
target
=
new
File
(
path
);
//TODO: make recursive?
if
(
target
.
isDirectory
())
{
FilenameFilter
filter
=
(
FilenameFilter
)
(
dir
,
name
)
->
name
.
endsWith
(
extension
);
File
[]
files
=
target
.
listFiles
(
filter
);
Arrays
.
sort
(
files
,
(
a
,
b
)
->
a
.
getName
().
compareTo
(
b
.
getName
()));
//load all resources first
if
(
extension
.
contains
(
"tdl"
))
{
for
(
File
f
:
files
)
{
System
.
out
.
println
(
"Loading: "
+
f
.
getAbsolutePath
());
TDLHelper
.
load
(
f
.
getAbsolutePath
());
}
TDLHelper
.
link
();
TDLHelper
.
check
();
}
for
(
File
f
:
files
)
{
System
.
out
.
println
(
"Processing: "
+
f
.
getAbsolutePath
());
operation
.
accept
(
f
.
getAbsolutePath
());
}
}
else
{
if
(
extension
.
contains
(
"tdl"
))
{
System
.
out
.
println
(
"Loading: "
+
target
.
getAbsolutePath
());
TDLHelper
.
load
(
target
.
getAbsolutePath
());
TDLHelper
.
link
();
TDLHelper
.
check
();
}
System
.
out
.
println
(
"Processing: "
+
target
.
getAbsolutePath
());
operation
.
accept
(
target
.
getAbsolutePath
());
}
}
private
void
listElements
(
String
path
)
{
Resource
resource
=
TDLHelper
.
load
(
path
);
Package
p
=
(
Package
)
resource
.
getContents
().
get
(
0
);
System
.
out
.
println
(
"Package: "
+
p
.
getName
());
p
.
getPackagedElement
().
forEach
(
e
->
{
System
.
out
.
println
(
" "
+
e
.
getName
());
System
.
out
.
println
(
" "
+
e
.
eClass
().
getName
()
+
" : "
+
e
.
getQualifiedName
());
});
}
private
void
validate
(
String
path
)
{
Resource
resource
=
TDLHelper
.
load
(
path
);
Validator
validator
=
new
Validator
();
//TODO: make robust against unresolved imports
//TODO: report parsing / resolution errors
try
{
List
<
UnsatisfiedConstraint
>
violations
=
validator
.
validate
(
resource
);
validator
.
dumpViolations
(
violations
,
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
translate
(
String
path
)
{
Resource
resource
=
TDLHelper
.
load
(
path
);
try
{
Resource
target
=
TDLHelper
.
create
(
resource
.
getURI
().
path
()
+
"."
+
targetExtension
);
target
.
getContents
().
addAll
(
EcoreUtil
.
copyAll
(
resource
.
getContents
()));
TDLHelper
.
store
(
target
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
private
void
importData
(
String
path
,
AbstractTranslator
translator
)
{
File
source
=
new
File
(
path
);
try
{
translator
.
setTargetResource
(
TDLHelper
.
create
(
source
.
getAbsolutePath
()+
"-generated."
+
targetExtension
));
translator
.
initTargetResource
(
translator
.
cleanName
(
source
.
getName
()));
translator
.
translate
(
source
.
getAbsolutePath
());
TDLHelper
.
store
(
translator
.
getTargetResource
());
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
private
void
importOpenAPI
(
String
path
)
{
importData
(
path
,
new
OpenAPI2TDLTranslatorNext
());
}
private
void
importASN1
(
String
path
)
{
importData
(
path
,
new
ASN2TDLTranslator
());
}
// private void importOpenAPIAll(String path) {
// File target = new File(path);
// if (target.isDirectory()) {
// FilenameFilter filter = (FilenameFilter) (dir, name) -> name.endsWith(sourceExtension);
// File[] files = target.listFiles(filter);
// Arrays.sort(files, (a, b) -> a.getName().compareTo(b.getName()));
// for (File f : files) {
// importOpenAPISingle(f.getAbsolutePath());
// }
// } else {
// importOpenAPISingle(target.getAbsolutePath());
// }
// }
}
Prev
1
2
Next