Search in sources :

Example 1 with BlobValue

use of de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue in project FAAAST-Service by FraunhoferIOSB.

the class ElementValueMapperTest method testBlobSetValueMapping.

@Test
public void testBlobSetValueMapping() {
    SubmodelElement actual = new DefaultBlob.Builder().build();
    BlobValue value = BlobValue.builder().mimeType("application/json").value("foo").build();
    SubmodelElement expected = new DefaultBlob.Builder().mimeType(value.getMimeType()).value(value.getValue()).build();
    ElementValueMapper.setValue(actual, value);
    Assert.assertEquals(expected, actual);
}
Also used : SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) DefaultBlob(io.adminshell.aas.v3.model.impl.DefaultBlob) BlobValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue) Test(org.junit.Test)

Example 2 with BlobValue

use of de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue in project FAAAST-Service by FraunhoferIOSB.

the class BlobValueMapper method toValue.

@Override
public BlobValue toValue(Blob submodelElement) {
    if (submodelElement == null) {
        return null;
    }
    BlobValue blobValue = new BlobValue();
    blobValue.setValue(submodelElement.getValue());
    blobValue.setMimeType(submodelElement.getMimeType());
    return blobValue;
}
Also used : BlobValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue)

Example 3 with BlobValue

use of de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue in project FAAAST-Service by FraunhoferIOSB.

the class ElementValueMapperTest method testBlobToValueMapping.

@Test
public void testBlobToValueMapping() {
    BlobValue expected = BlobValue.builder().mimeType("application/json").value("foo").build();
    SubmodelElement input = new DefaultBlob.Builder().mimeType(expected.getMimeType()).value(expected.getValue()).build();
    ElementValue actual = ElementValueMapper.toValue(input);
    Assert.assertEquals(expected, actual);
}
Also used : SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) DefaultBlob(io.adminshell.aas.v3.model.impl.DefaultBlob) RelationshipElementValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.RelationshipElementValue) ReferenceElementValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.ReferenceElementValue) ElementValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.ElementValue) AnnotatedRelationshipElementValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.AnnotatedRelationshipElementValue) BlobValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue) Test(org.junit.Test)

Aggregations

BlobValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.BlobValue)3 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)2 DefaultBlob (io.adminshell.aas.v3.model.impl.DefaultBlob)2 Test (org.junit.Test)2 AnnotatedRelationshipElementValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.AnnotatedRelationshipElementValue)1 ElementValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.ElementValue)1 ReferenceElementValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.ReferenceElementValue)1 RelationshipElementValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.RelationshipElementValue)1