|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (C) 2021 the Eclipse BaSyx Authors |
| 3 | + * |
| 4 | + * This program and the accompanying materials are made |
| 5 | + * available under the terms of the Eclipse Public License 2.0 |
| 6 | + * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: EPL-2.0 |
| 9 | + ******************************************************************************/ |
| 10 | + |
| 11 | + |
| 12 | +package io.adminshell.aas.v3.model.validator; |
| 13 | + |
| 14 | +import java.util.List; |
| 15 | + |
| 16 | +import io.adminshell.aas.v3.model.AssetAdministrationShell; |
| 17 | +import io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment; |
| 18 | +import io.adminshell.aas.v3.model.AssetKind; |
| 19 | +import io.adminshell.aas.v3.model.ConceptDescription; |
| 20 | +import io.adminshell.aas.v3.model.IdentifierType; |
| 21 | +import io.adminshell.aas.v3.model.KeyElements; |
| 22 | +import io.adminshell.aas.v3.model.KeyType; |
| 23 | +import io.adminshell.aas.v3.model.LangString; |
| 24 | +import io.adminshell.aas.v3.model.Reference; |
| 25 | +import io.adminshell.aas.v3.model.Submodel; |
| 26 | +import io.adminshell.aas.v3.model.SubmodelElement; |
| 27 | +import io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell; |
| 28 | +import io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShellEnvironment; |
| 29 | +import io.adminshell.aas.v3.model.impl.DefaultAssetInformation; |
| 30 | +import io.adminshell.aas.v3.model.impl.DefaultConceptDescription; |
| 31 | +import io.adminshell.aas.v3.model.impl.DefaultIdentifier; |
| 32 | +import io.adminshell.aas.v3.model.impl.DefaultKey; |
| 33 | +import io.adminshell.aas.v3.model.impl.DefaultReference; |
| 34 | +import io.adminshell.aas.v3.model.impl.DefaultSubmodel; |
| 35 | + |
| 36 | +public class ConstraintTestHelper { |
| 37 | + |
| 38 | + public static ConceptDescription createConceptDescription(String idShort, String identifier, String category) { |
| 39 | + return new DefaultConceptDescription.Builder() |
| 40 | + .description(new LangString("TestDescription")) |
| 41 | + .identification(new DefaultIdentifier.Builder().identifier(identifier) |
| 42 | + .idType(IdentifierType.CUSTOM).build()) |
| 43 | + .category(category).idShort(idShort).build(); |
| 44 | + } |
| 45 | + |
| 46 | + public static Submodel createSubmodel(List<SubmodelElement> elements) { |
| 47 | + return new DefaultSubmodel.Builder() |
| 48 | + .identification( |
| 49 | + new DefaultIdentifier.Builder().identifier("submodel").idType(IdentifierType.CUSTOM).build()) |
| 50 | + .idShort("smIdShort") |
| 51 | + .submodelElements(elements) |
| 52 | + .build(); |
| 53 | + } |
| 54 | + |
| 55 | + public static ConceptDescription getIrrelevantConceptDescription() { |
| 56 | + return ConstraintTestHelper.createConceptDescription("irrelevantIdShort", "irrelevant", "COLLECTION"); |
| 57 | + } |
| 58 | + |
| 59 | + public static AssetAdministrationShell getDummyAAS() { |
| 60 | + return new DefaultAssetAdministrationShell.Builder() |
| 61 | + .identification(new DefaultIdentifier.Builder() |
| 62 | + .identifier("dummyAAS") |
| 63 | + .idType(IdentifierType.CUSTOM) |
| 64 | + .build()) |
| 65 | + .idShort("dummyAASIdShort") |
| 66 | + .assetInformation(new DefaultAssetInformation.Builder() |
| 67 | + .assetKind(AssetKind.INSTANCE) |
| 68 | + .build()) |
| 69 | + .build(); |
| 70 | + } |
| 71 | + |
| 72 | + public static AssetAdministrationShellEnvironment createEnvironment(Submodel sm, List<ConceptDescription> conceptDescriptions) { |
| 73 | + return new DefaultAssetAdministrationShellEnvironment.Builder() |
| 74 | + .assetAdministrationShells(getDummyAAS()) |
| 75 | + .submodels(sm) |
| 76 | + .conceptDescriptions(conceptDescriptions) |
| 77 | + .build(); |
| 78 | + } |
| 79 | + |
| 80 | + public static Reference createDummyReference() { |
| 81 | + return new DefaultReference.Builder() |
| 82 | + .key(new DefaultKey.Builder() |
| 83 | + .idType(KeyType.CUSTOM) |
| 84 | + .value("reference") |
| 85 | + .type(KeyElements.GLOBAL_REFERENCE) |
| 86 | + .build()) |
| 87 | + .build(); |
| 88 | + } |
| 89 | +} |
0 commit comments