use of io.adminshell.aas.v3.model.impl.DefaultIdentifier in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testParamContentReference.
@Test
public void testParamContentReference() throws Exception {
Identifier id = new DefaultIdentifier();
when(serviceContext.execute(any())).thenReturn(GetAssetAdministrationShellResponse.builder().statusCode(StatusCode.Success).build());
ContentResponse response = execute(HttpMethod.GET, "/shells/" + EncodingHelper.base64UrlEncode(id.toString()) + "/aas?content=reference");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
use of io.adminshell.aas.v3.model.impl.DefaultIdentifier in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testParamContentNormal.
@Test
public void testParamContentNormal() throws Exception {
Identifier id = new DefaultIdentifier();
when(serviceContext.execute(any())).thenReturn(GetAssetAdministrationShellResponse.builder().statusCode(StatusCode.Success).build());
ContentResponse response = execute(HttpMethod.GET, "/shells/" + EncodingHelper.base64UrlEncode(id.toString()) + "/aas?content=normal");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
use of io.adminshell.aas.v3.model.impl.DefaultIdentifier in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testParamContentTrimmed.
@Test
public void testParamContentTrimmed() throws Exception {
Identifier id = new DefaultIdentifier();
when(serviceContext.execute(any())).thenReturn(GetAssetAdministrationShellResponse.builder().statusCode(StatusCode.Success).build());
ContentResponse response = execute(HttpMethod.GET, "/shells/" + EncodingHelper.base64UrlEncode(id.toString()) + "/aas?content=trimmed");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
use of io.adminshell.aas.v3.model.impl.DefaultIdentifier in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testResultNotFound.
@Test
public void testResultNotFound() throws Exception {
when(serviceContext.execute(any())).thenReturn(GetSubmodelElementByPathResponse.builder().statusCode(StatusCode.ClientErrorResourceNotFound).payload(null).build());
Identifier id = new DefaultIdentifier();
Message message = Message.builder().text(HttpStatus.getMessage(404)).messageType(MessageType.Error).code(HttpStatus.getMessage(404)).timestamp(new Date()).build();
Result result = Result.builder().message(message).success(false).build();
ContentResponse response = execute(HttpMethod.GET, "/submodels/" + EncodingHelper.base64UrlEncode(id.toString()) + "/submodel/submodel-elements/Invalid");
Result actual = deserializer.read(new String(response.getContent()), Result.class);
actual.getMessage().get(0).setTimestamp(message.getTimestamp());
Assert.assertEquals(result, actual);
}
use of io.adminshell.aas.v3.model.impl.DefaultIdentifier in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointTest method testParamContentLevelBogus.
@Test
public void testParamContentLevelBogus() throws Exception {
Identifier id = new DefaultIdentifier();
when(serviceContext.execute(any())).thenReturn(GetAssetAdministrationShellResponse.builder().statusCode(StatusCode.Success).build());
ContentResponse response = execute(HttpMethod.GET, "/shells/" + EncodingHelper.base64UrlEncode(id.toString()) + "/aas?content=bogus&level=bogus");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
Aggregations