use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGETSpecificShell.
@Test
public void testGETSpecificShell() throws IOException, DeserializationException {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
HttpResponse actual = getCall(HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)));
Assert.assertEquals(expected, retrieveResourceFromResponse(actual, AssetAdministrationShell.class));
Assert.assertEquals(HttpStatus.SC_OK, actual.getStatusLine().getStatusCode());
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testPUT_AASShell.
@Test
public void testPUT_AASShell() throws IOException, DeserializationException {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
expected.setIdShort("changed");
String url = HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)) + "/aas";
HttpResponse response = putCall(url, expected);
Assert.assertEquals(expected, retrieveResourceFromResponse(response, AssetAdministrationShell.class));
// TODO: StatusCode of spec seems to be wrong 204
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
AssetAdministrationShell actual = getCall(url, AssetAdministrationShell.class);
Assert.assertEquals(expected, actual);
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGETShellsWithAssetIds.
@Test
public void testGETShellsWithAssetIds() throws IOException, DeserializationException {
String assetIdValue = "https://acplt.org/Test_Asset";
List<AssetAdministrationShell> expected = environment.getAssetAdministrationShells().stream().filter(x -> x.getAssetInformation().getGlobalAssetId().getKeys().stream().anyMatch(y -> y.getValue().equalsIgnoreCase(assetIdValue))).collect(Collectors.toList());
String assetIdsParameter = "[{\"key\": \"globalAssetId\",\"value\":\"" + assetIdValue + "\"}]";
HttpResponse response = getListCall(HTTP_SHELLS + "?assetIds=" + Base64.getUrlEncoder().encodeToString(assetIdsParameter.getBytes(StandardCharsets.UTF_8)));
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
List<AssetAdministrationShell> actual = retrieveResourceFromResponseList(response, AssetAdministrationShell.class);
Assert.assertEquals(expected, actual);
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testPUTAssetInformation.
@Test
public void testPUTAssetInformation() throws IOException, DeserializationException {
AssetAdministrationShell aas = environment.getAssetAdministrationShells().get(1);
AssetInformation expected = aas.getAssetInformation();
expected.setAssetKind(AssetKind.TYPE);
String url = HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(aas.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)) + "/aas/asset-information";
HttpResponse response = putCall(url, expected);
// TODO: StatusCode of spec seems to be wrong 204
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
AssetInformation actual = getCall(url, AssetInformation.class);
Assert.assertEquals(expected, actual);
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testPUTSpecificShellEvent.
@Test
public void testPUTSpecificShellEvent() {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
expected.setIdShort("changed");
String url = HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8));
setUpEventCheck(expected, ElementUpdateEventMessage.class, () -> putCall(url, expected, AssetAdministrationShell.class));
}
Aggregations