Search in sources :

Example 1 with DefaultIdentifier

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());
}
Also used : Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Example 2 with DefaultIdentifier

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());
}
Also used : Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Example 3 with DefaultIdentifier

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());
}
Also used : Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Example 4 with DefaultIdentifier

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);
}
Also used : Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Message(de.fraunhofer.iosb.ilt.faaast.service.model.api.Message) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Date(java.util.Date) Result(de.fraunhofer.iosb.ilt.faaast.service.model.api.Result) Test(org.junit.Test)

Example 5 with DefaultIdentifier

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());
}
Also used : Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) ContentResponse(org.eclipse.jetty.client.api.ContentResponse) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Aggregations

Identifier (io.adminshell.aas.v3.model.Identifier)5 DefaultIdentifier (io.adminshell.aas.v3.model.impl.DefaultIdentifier)5 ContentResponse (org.eclipse.jetty.client.api.ContentResponse)5 Test (org.junit.Test)5 Message (de.fraunhofer.iosb.ilt.faaast.service.model.api.Message)1 Result (de.fraunhofer.iosb.ilt.faaast.service.model.api.Result)1 Date (java.util.Date)1