use of org.kie.workbench.common.screens.datamodeller.model.persistence.Property in project kie-wb-common by kiegroup.
the class DOM2PersistenceDescriptorVisitor method visitProperties.
private void visitProperties(PersistenceUnitModel persistenceUnit, NodeList nodes) {
List<Property> properties = new ArrayList<Property>();
persistenceUnit.setProperties(properties);
if (nodes != null && nodes.getLength() > 0) {
Element element = (Element) nodes.item(0);
NodeList propertyNodes = element.getElementsByTagName(PersistenceDescriptorXMLMarshaller.PROPERTY);
if (propertyNodes != null && propertyNodes.getLength() > 0) {
for (int i = 0; i < propertyNodes.getLength(); i++) {
visitProperty(properties, (Element) propertyNodes.item(i));
}
}
}
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.Property in project kie-wb-common by kiegroup.
the class DOM2PersistenceDescriptorVisitor method visitProperty.
private void visitProperty(List<Property> properties, Element item) {
Property property = new Property(item.getAttribute(PersistenceDescriptorXMLMarshaller.NAME), item.getAttribute(PersistenceDescriptorXMLMarshaller.VALUE));
properties.add(property);
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.Property in project kie-wb-common by kiegroup.
the class PersistencePresenterTest method testAddProperty.
@Test
public void testAddProperty() {
final Property property = new Property("Name", "Value");
persistencePresenter.add(property);
verify(propertiesListPresenter).add(eq(property));
verify(persistencePresenter).fireChangeEvent();
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.Property in project kie-wb-common by kiegroup.
the class PropertiesItemPresenterTest method testSetup.
@Test
public void testSetup() {
propertiesItemPresenter.setup(new Property("Name", "Value"), mock(PersistencePresenter.class));
verify(view).init(eq(propertiesItemPresenter));
verify(view).setName(eq("Name"));
verify(view).setValue(eq("Value"));
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.Property in project kie-wb-common by kiegroup.
the class PersistenceDescriptorValidatorTest method testValidatePropertyWithMissingName.
@Test
public void testValidatePropertyWithMissingName() {
// add a property with no name
descriptor.getPersistenceUnit().addProperty(new Property(null, "someValue"));
List<ValidationMessage> result = validator.validate(path, descriptor);
ValidationMessage expectedMessage;
// validation for the property with missing name should fail.
expectedMessage = newErrorMessage(PersistenceDescriptorValidationMessages.INDEXED_PROPERTY_NAME_EMPTY_ID, MessageFormat.format(PersistenceDescriptorValidationMessages.INDEXED_PROPERTY_NAME_EMPTY, "3"), "3");
assertTrue(result.contains(expectedMessage));
}
Aggregations