Search in sources :

Example 1 with FileValue

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

the class FileValueMapper method toValue.

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

Example 2 with FileValue

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

the class ElementValueMapperTest method testFileToValueMapping.

@Test
public void testFileToValueMapping() throws ValueMappingException {
    FileValue expected = FileValue.builder().mimeType("application/json").value("{}").build();
    SubmodelElement input = new DefaultFile.Builder().mimeType(expected.getMimeType()).value(expected.getValue()).build();
    ElementValue actual = ElementValueMapper.toValue(input);
    Assert.assertEquals(expected, actual);
}
Also used : FileValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.FileValue) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) DefaultFile(io.adminshell.aas.v3.model.impl.DefaultFile) 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) Test(org.junit.Test)

Example 3 with FileValue

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

the class ElementValueMapperTest method testFileSetValueMapping.

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

Aggregations

FileValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.FileValue)3 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)2 DefaultFile (io.adminshell.aas.v3.model.impl.DefaultFile)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