use of io.adminshell.aas.v3.dataformat.json.JsonSerializer in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGetSubmodelsWithSemanticId.
@Test
public void testGetSubmodelsWithSemanticId() throws SerializationException {
Submodel expected = environment.getSubmodels().get(1);
String semnaticId = Base64.getUrlEncoder().encodeToString(new JsonSerializer().write(expected.getSemanticId()).getBytes(StandardCharsets.UTF_8));
List<Submodel> actual = getListCall(HTTP_SUBMODELS + "?semanticId=" + semnaticId, Submodel.class);
Assert.assertEquals(List.of(expected), actual);
}
use of io.adminshell.aas.v3.dataformat.json.JsonSerializer in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGetSpecificSubmodelContent.
@Test
public void testGetSpecificSubmodelContent() throws SerializationException, IOException, DeserializationException {
Submodel expected = environment.getSubmodels().get(3);
String identifier = Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8));
String url = HTTP_SUBMODELS + "/" + identifier + "/submodel?content=normal";
HttpResponse response = getCall(url);
Submodel actual = retrieveResourceFromResponse(response, Submodel.class);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
Assert.assertEquals(expected, actual);
String finalUrl = url;
setUpEventCheck(expected, ElementReadEventMessage.class, () -> getCall(finalUrl));
// TODO: Fix value serialization of DefaultOperation
/*
* url = HTTP_SUBMODELS + "/" + identifier + "/submodel?content=value";
* response = getCall(url);
* Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
* Assert.assertEquals(new JsonSerializer().write(expected, new
* OutputModifier.Builder().content(Content.Value).build()),
* EntityUtils.toString(response.getEntity()));
*/
}
use of io.adminshell.aas.v3.dataformat.json.JsonSerializer in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGetSubmodelsEvent.
@Test
public void testGetSubmodelsEvent() throws SerializationException {
Submodel expected = environment.getSubmodels().get(1);
String semnaticId = Base64.getUrlEncoder().encodeToString(new JsonSerializer().write(expected.getSemanticId()).getBytes(StandardCharsets.UTF_8));
setUpEventCheck(expected, ElementReadEventMessage.class, () -> getListCall(HTTP_SUBMODELS + "?semanticId=" + semnaticId));
}
Aggregations