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());
}
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()));
}
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.");
}
Aggregations