use of org.eclipse.vorto.service.mapping.spec.SpecWithConfiguration in project vorto by eclipse.
the class ConfigurationMappingTest method testUnknownConfigProperty.
@Test(expected = IllegalArgumentException.class)
public void testUnknownConfigProperty() throws Exception {
IMappingSpecification spec = new SpecWithConfiguration();
ModelValueFactory.createFBPropertyValue(spec.getFunctionBlock("button"), "notExistProperty", true);
}
use of org.eclipse.vorto.service.mapping.spec.SpecWithConfiguration in project vorto by eclipse.
the class ConfigurationMappingTest method testNotExistFunction.
@Test(expected = MappingException.class)
public void testNotExistFunction() throws Exception {
IMappingSpecification spec = new SpecWithConfiguration();
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(spec).build();
PropertyValue newValue = ModelValueFactory.createFBPropertyValue(spec.getFunctionBlock("button"), "enable", true);
PropertyValue oldValue = ModelValueFactory.createFBPropertyValue(spec.getFunctionBlock("button"), "enable", false);
Object mapped = mapper.mapTarget(newValue, Optional.of(oldValue), "button");
assertEquals("1", mapped);
}
use of org.eclipse.vorto.service.mapping.spec.SpecWithConfiguration in project vorto by eclipse.
the class ConfigurationMappingTest method testMapSimpleConfigValue.
@Test
public void testMapSimpleConfigValue() throws Exception {
IMappingSpecification spec = new SpecWithConfiguration();
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(spec).registerConverterFunction(new ClassFunction("button", ConfigurationMappingTest.class)).build();
PropertyValue newValue = ModelValueFactory.createFBPropertyValue(spec.getFunctionBlock("button"), "enable", true);
PropertyValue oldValue = ModelValueFactory.createFBPropertyValue(spec.getFunctionBlock("button"), "enable", false);
Object mapped = mapper.mapTarget(newValue, Optional.of(oldValue), "button");
assertEquals("1", mapped);
}
Aggregations