Search in sources :

Example 1 with DoubleValue

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

the class ElementValueMapperTest method testRangeToValueMapping.

@Test
public void testRangeToValueMapping() {
    RangeValue expected = RangeValue.builder().min(new DoubleValue(2.3)).max(new DoubleValue(5.1)).build();
    SubmodelElement input = new DefaultRange.Builder().valueType(expected.getMin().getDataType().getName()).min(expected.getMin().asString()).max(expected.getMax().asString()).build();
    ElementValue actual = ElementValueMapper.toValue(input);
    Assert.assertEquals(expected, actual);
}
Also used : SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) DoubleValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.primitive.DoubleValue) 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) RangeValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.RangeValue) Test(org.junit.Test)

Example 2 with DoubleValue

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

the class ElementValueMapperTest method testRangeSetValueMapping.

@Test
public void testRangeSetValueMapping() {
    SubmodelElement actual = new DefaultRange.Builder().build();
    RangeValue value = RangeValue.builder().min(new DoubleValue(2.3)).max(new DoubleValue(5.1)).build();
    SubmodelElement expected = new DefaultRange.Builder().valueType(value.getMin().getDataType().getName()).min(value.getMin().asString()).max(value.getMax().asString()).build();
    ElementValueMapper.setValue(actual, value);
    Assert.assertEquals(expected, actual);
}
Also used : SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) DefaultRange(io.adminshell.aas.v3.model.impl.DefaultRange) DoubleValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.primitive.DoubleValue) RangeValue(de.fraunhofer.iosb.ilt.faaast.service.model.value.RangeValue) Test(org.junit.Test)

Aggregations

RangeValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.RangeValue)2 DoubleValue (de.fraunhofer.iosb.ilt.faaast.service.model.value.primitive.DoubleValue)2 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)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 DefaultRange (io.adminshell.aas.v3.model.impl.DefaultRange)1