use of org.phoebus.logbook.Property in project phoebus by ControlSystemStudio.
the class LogGroupPropertyTest method testCheckLogEntryGroupProperty.
@Test
public void testCheckLogEntryGroupProperty() {
Map<String, String> attributes1 = new HashMap<>();
attributes1.put(LogGroupProperty.ATTRIBUTE_ID, "id value");
Property property1 = PropertyImpl.of(LogGroupProperty.NAME, attributes1);
OlogLog logEntry = new OlogLog();
logEntry.setProperties(Arrays.asList(property1));
Map<String, String> attributes2 = new HashMap<>();
attributes1.put("another attr", "value");
Property property2 = PropertyImpl.of("another name", attributes2);
OlogLog logEntry2 = new OlogLog();
logEntry2.setProperties(Arrays.asList(property2));
try {
Property property = LogGroupProperty.getLogEntryGroupProperty(Arrays.asList(logEntry, logEntry2));
assertEquals("id value", property.getAttributes().get(LogGroupProperty.ATTRIBUTE_ID));
} catch (LogbookException e) {
fail();
}
}
use of org.phoebus.logbook.Property in project phoebus by ControlSystemStudio.
the class LogPropertiesController method getProperties.
/**
* @return The list of logentry properties
*/
public List<Property> getProperties() {
List<Property> treeProperties = new ArrayList<>();
treeTableView.getRoot().getChildren().stream().forEach(node -> {
Map<String, String> att = node.getChildren().stream().map(TreeItem::getValue).collect(Collectors.toMap(PropertyTreeNode::getName, (PropertyTreeNode prop) -> prop.getValue() == null ? "" : prop.getValue()));
Property property = PropertyImpl.of(node.getValue().getName(), att);
treeProperties.add(property);
});
return treeProperties;
}
use of org.phoebus.logbook.Property in project phoebus by ControlSystemStudio.
the class LogGroupPropertyTest method testHasLogGroup.
@Test
public void testHasLogGroup() {
Map<String, String> attributes1 = new HashMap<>();
attributes1.put(LogGroupProperty.ATTRIBUTE_ID, "id value");
Property property1 = PropertyImpl.of(LogGroupProperty.NAME, attributes1);
Map<String, String> attributes2 = new HashMap<>();
attributes2.put("whatever", "id value");
Property property2 = PropertyImpl.of("whatever", attributes2);
OlogLog logEntry = new OlogLog();
logEntry.setProperties(Arrays.asList(property1, property2));
assertEquals("id value", LogGroupProperty.getLogGroupProperty(logEntry).get().getAttributes().get(LogGroupProperty.ATTRIBUTE_ID));
}
use of org.phoebus.logbook.Property in project phoebus by ControlSystemStudio.
the class LogGroupPropertyTest method testCheckLogEntryGroupPropertyNoEntryHasProperties.
@Test
public void testCheckLogEntryGroupPropertyNoEntryHasProperties() {
Map<String, String> attributes1 = new HashMap<>();
attributes1.put("attr", "id value");
Property property1 = PropertyImpl.of("some name", attributes1);
OlogLog logEntry = new OlogLog();
logEntry.setProperties(Arrays.asList(property1));
Map<String, String> attributes2 = new HashMap<>();
attributes1.put("another attr", "value");
Property property2 = PropertyImpl.of("another name", attributes2);
OlogLog logEntry2 = new OlogLog();
logEntry2.setProperties(Arrays.asList(property2));
try {
Property property = LogGroupProperty.getLogEntryGroupProperty(Arrays.asList(logEntry, logEntry2));
assertNotNull(property.getAttributes().get(LogGroupProperty.ATTRIBUTE_ID));
} catch (LogbookException e) {
fail();
}
}
use of org.phoebus.logbook.Property in project phoebus by ControlSystemStudio.
the class LogGroupPropertyTest method testHasNotLogGroup1.
@Test
public void testHasNotLogGroup1() {
Map<String, String> attributes1 = new HashMap<>();
attributes1.put(LogGroupProperty.ATTRIBUTE_ID, "");
Property property1 = PropertyImpl.of(LogGroupProperty.NAME, attributes1);
OlogLog logEntry = new OlogLog();
logEntry.setProperties(Arrays.asList(property1));
assertTrue(LogGroupProperty.getLogGroupProperty(logEntry).isEmpty());
}
Aggregations