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;
}
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);
}
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);
}
Aggregations