-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix de-/serialization for AAS with extension(s) (#136)
* Added test for AAS with extension * fix HasExtension serialization for JSON * Add minimal and maximal example for extension * adds Java respresentation of test cases in core * adds corresponding unit tests in dataformat-json * Removes obsolete test case * Adds license text for admin-shell-io examples & Moves files to separate folder --------- Signed-off-by: Frank Schnicke <frank.schnicke@iese.fraunhofer.de> Co-authored-by: Alexander Gordt <alexander.gordt@objective-partner.com> Co-authored-by: Frank Schnicke <frank.schnicke@iese.fraunhofer.de>
- Loading branch information
1 parent
85c60a9
commit 80ae3e9
Showing
17 changed files
with
488 additions
and
117 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/Examples.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2023 jab. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.eclipse.digitaltwin.aas4j.v3.dataformat.core; | ||
|
||
import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXSD; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.Environment; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetInformation; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEnvironment; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultExtension; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey; | ||
import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference; | ||
|
||
public class Examples { | ||
|
||
public static final Environment EXTENSION_MINIMAL = new DefaultEnvironment.Builder() | ||
.assetAdministrationShells(new DefaultAssetAdministrationShell.Builder() | ||
.id("something_142922d6") | ||
.extensions(new DefaultExtension.Builder() | ||
.name("something_aae6caf4") | ||
.build()) | ||
.assetInformation(new DefaultAssetInformation.Builder() | ||
.assetKind(AssetKind.NOT_APPLICABLE) | ||
.globalAssetID("something_eea66fa1") | ||
.build()) | ||
.build()) | ||
.build(); | ||
|
||
public static final Environment EXTENSION_MAXIMAL = new DefaultEnvironment.Builder() | ||
.assetAdministrationShells(new DefaultAssetAdministrationShell.Builder() | ||
.id("something_142922d6") | ||
.extensions(new DefaultExtension.Builder() | ||
.name("something_aae6caf4") | ||
.value("10233") | ||
.valueType(DataTypeDefXSD.UNSIGNED_SHORT) | ||
.refersTo(new DefaultReference.Builder() | ||
.keys(new DefaultKey.Builder() | ||
.type(KeyTypes.SUBMODEL) | ||
.value("urn:another-example01:f7faa581") | ||
.build()) | ||
.type(ReferenceTypes.MODEL_REFERENCE) | ||
.build()) | ||
.semanticID(new DefaultReference.Builder() | ||
.keys(new DefaultKey.Builder() | ||
.type(KeyTypes.GLOBAL_REFERENCE) | ||
.value("urn:another-company07:4d1bd2cb") | ||
.build()) | ||
.type(ReferenceTypes.EXTERNAL_REFERENCE) | ||
.build()) | ||
.supplementalSemanticIds(new DefaultReference.Builder() | ||
.keys(new DefaultKey.Builder() | ||
.type(KeyTypes.GLOBAL_REFERENCE) | ||
.value("urn:an-example13:be48ff29") | ||
.build()) | ||
.type(ReferenceTypes.EXTERNAL_REFERENCE) | ||
.build()) | ||
.build()) | ||
.assetInformation(new DefaultAssetInformation.Builder() | ||
.assetKind(AssetKind.NOT_APPLICABLE) | ||
.globalAssetID("something_eea66fa1") | ||
.build()) | ||
.build()) | ||
.build(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
dataformat-json/src/test/resources/admin-shell-io/Extension/Maximal.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"assetAdministrationShells": [ | ||
{ | ||
"assetInformation": { | ||
"assetKind": "NotApplicable", | ||
"globalAssetId": "something_eea66fa1" | ||
}, | ||
"extensions": [ | ||
{ | ||
"name": "something_aae6caf4", | ||
"refersTo": [ | ||
{ | ||
"keys": [ | ||
{ | ||
"type": "Submodel", | ||
"value": "urn:another-example01:f7faa581" | ||
} | ||
], | ||
"type": "ModelReference" | ||
} | ||
], | ||
"semanticId": { | ||
"keys": [ | ||
{ | ||
"type": "GlobalReference", | ||
"value": "urn:another-company07:4d1bd2cb" | ||
} | ||
], | ||
"type": "ExternalReference" | ||
}, | ||
"supplementalSemanticIds": [ | ||
{ | ||
"keys": [ | ||
{ | ||
"type": "GlobalReference", | ||
"value": "urn:an-example13:be48ff29" | ||
} | ||
], | ||
"type": "ExternalReference" | ||
} | ||
], | ||
"value": "10233", | ||
"valueType": "xs:unsignedShort" | ||
} | ||
], | ||
"id": "something_142922d6", | ||
"modelType": "AssetAdministrationShell" | ||
} | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
dataformat-json/src/test/resources/admin-shell-io/Extension/Minimal.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"assetAdministrationShells": [ | ||
{ | ||
"assetInformation": { | ||
"assetKind": "NotApplicable", | ||
"globalAssetId": "something_eea66fa1" | ||
}, | ||
"extensions": [ | ||
{ | ||
"name": "something_aae6caf4" | ||
} | ||
], | ||
"id": "something_142922d6", | ||
"modelType": "AssetAdministrationShell" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The files contained in this directory are taken without any modification from https://github.com/admin-shell-io/aas-specs/ where they are made available under the CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/). |
Oops, something went wrong.