Search in sources :

Example 11 with Asset

use of io.adminshell.aas.v3.model.Asset in project FAAAST-Service by FraunhoferIOSB.

the class IntegrationTestHttpEndpoint method testGETAssetInformation.

@Test
public void testGETAssetInformation() throws IOException, DeserializationException {
    AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
    HttpResponse actual = getCall(HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)) + "/aas/asset-information");
    Assert.assertEquals(expected.getAssetInformation(), retrieveResourceFromResponse(actual, AssetInformation.class));
    Assert.assertEquals(HttpStatus.SC_OK, actual.getStatusLine().getStatusCode());
}
Also used : AssetInformation(io.adminshell.aas.v3.model.AssetInformation) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test)

Example 12 with Asset

use of io.adminshell.aas.v3.model.Asset in project FAAAST-Service by FraunhoferIOSB.

the class IntegrationTestHttpEndpoint method testPutAssetInformationEvent.

@Test
public void testPutAssetInformationEvent() {
    AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
    expected.getAssetInformation().setAssetKind(AssetKind.TYPE);
    String url = HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)) + "/aas/asset-information";
    setUpEventCheck(expected, ElementUpdateEventMessage.class, () -> putCall(url, expected.getAssetInformation()));
}
Also used : DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) LangString(io.adminshell.aas.v3.model.LangString) Test(org.junit.Test)

Example 13 with Asset

use of io.adminshell.aas.v3.model.Asset in project FAAAST-Service by FraunhoferIOSB.

the class Application method validate.

private boolean validate(AssetAdministrationShellEnvironment aasEnv) throws Exception {
    LOGGER.debug("Validate Asset Administration Shell Environment model");
    ShaclValidator shaclValidator = ShaclValidator.getInstance();
    ValidationReport report = shaclValidator.validateGetReport(aasEnv);
    if (report.conforms()) {
        LOGGER.info("Valid Asset Administration Shell Environment model");
        return true;
    }
    LOGGER.error("Invalid Asset Administration Shell Environment model. Found '" + report.getEntries().size() + "' failures");
    ShLib.printReport(report);
    throw new Exception("Invalid Asset Administration Shell Environment model.");
}
Also used : ValidationReport(org.apache.jena.shacl.ValidationReport) ShaclValidator(io.adminshell.aas.v3.model.validator.ShaclValidator)

Aggregations

AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)6 Submodel (io.adminshell.aas.v3.model.Submodel)4 AasUtils (io.adminshell.aas.v3.dataformat.core.util.AasUtils)3 AssetAdministrationShellEnvironment (io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment)3 LangString (io.adminshell.aas.v3.model.LangString)3 Reference (io.adminshell.aas.v3.model.Reference)3 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)3 DefaultAssetAdministrationShell (io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Test (org.junit.Test)3 ObjectData (de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData)2 ResourceNotFoundException (de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException)2 Asset (io.adminshell.aas.v3.model.Asset)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Stream (java.util.stream.Stream)2 UaQualifiedName (com.prosysopc.ua.UaQualifiedName)1 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)1