@Test public void test_doAction_noProperty() throws RepositoryException { PrintProperty printPropertyAction = new PrintProperty(NOT_DEFINED_PROPERTY); String result = printPropertyAction.doAction(resource); verify(singleValueProperty, never()).isMultiple(); assertTrue(result.contains(NOT_DEFINED_PROPERTY + " not defined")); }
@Override public String doAction(@Nonnull Resource resource) { Node node = resource.adaptTo(Node.class); String output = propertyName + " = "; try { if (node.hasProperty(propertyName)) { Property prop = node.getProperty(propertyName); if (prop.isMultiple()) { Value[] values = prop.getValues(); String[] valuesAsStrings = new String[values.length]; for (int i = 0; i < values.length; i++) { valuesAsStrings[i] = values[i].getString(); } output = output + Arrays.toString(valuesAsStrings); } else { output = output + prop.getValue().getString(); } return output; } return propertyName + " not defined"; } catch (RepositoryException e) { LOG.debug("Cannot read value of [{}]. Reason [{}]", propertyName, e.getMessage()); } return ""; }
PrintProperty implements Action { @Override public String doAction(@Nonnull Resource resource) { Node node = resource.adaptTo(Node.class); String output = propertyName + " = "; try { if (node.hasProperty(propertyName)) { Property prop = node.getProperty(propertyName); if (prop.isMultiple()) { Value[] values = prop.getValues(); String[] valuesAsStrings = new String[values.length]; for (int i = 0; i < values.length; i++) { valuesAsStrings[i] = values[i].getString(); } output = output + Arrays.toString(valuesAsStrings); } else { output = output + prop.getValue().getString(); } return output; } return propertyName + " not defined"; } catch (RepositoryException e) { LOG.debug("Cannot read value of [{}]. Reason [{}]", propertyName, e.getMessage()); } return ""; } }
PrintProperty implements Action { @Override public String doAction(@Nonnull Resource resource) { Node node = resource.adaptTo(Node.class); String output = propertyName + " = "; try { if (node.hasProperty(propertyName)) { Property prop = node.getProperty(propertyName); if (prop.isMultiple()) { Value[] values = prop.getValues(); String[] valuesAsStrings = new String[values.length]; for (int i = 0; i < values.length; i++) { valuesAsStrings[i] = values[i].getString(); } output = output + Arrays.toString(valuesAsStrings); } else { output = output + prop.getValue().getString(); } return output; } return propertyName + " not defined"; } catch (RepositoryException e) { LOG.debug("Cannot read value of [{}]. Reason [{}]", propertyName, e.getMessage()); } return ""; } PrintProperty(String propertyName); }
PrintProperty implements Action { @Override public String doAction(@Nonnull Resource resource) { Node node = resource.adaptTo(Node.class); String output = propertyName + " = "; try { if (node.hasProperty(propertyName)) { Property prop = node.getProperty(propertyName); if (prop.isMultiple()) { Value[] values = prop.getValues(); String[] valuesAsStrings = new String[values.length]; for (int i = 0; i < values.length; i++) { valuesAsStrings[i] = values[i].getString(); } output = output + Arrays.toString(valuesAsStrings); } else { output = output + prop.getValue().getString(); } return output; } return propertyName + " not defined"; } catch (RepositoryException e) { LOG.debug("Cannot read value of [{}]. Reason [{}]", propertyName, e.getMessage()); } return ""; } PrintProperty(String propertyName); @Override String doAction(@Nonnull Resource resource); }
PrintProperty implements Action { @Override public String doAction(@Nonnull Resource resource) { Node node = resource.adaptTo(Node.class); String output = propertyName + " = "; try { if (node.hasProperty(propertyName)) { Property prop = node.getProperty(propertyName); if (prop.isMultiple()) { Value[] values = prop.getValues(); String[] valuesAsStrings = new String[values.length]; for (int i = 0; i < values.length; i++) { valuesAsStrings[i] = values[i].getString(); } output = output + Arrays.toString(valuesAsStrings); } else { output = output + prop.getValue().getString(); } return output; } return propertyName + " not defined"; } catch (RepositoryException e) { LOG.debug("Cannot read value of [{}]. Reason [{}]", propertyName, e.getMessage()); } return ""; } PrintProperty(String propertyName); @Override String doAction(@Nonnull Resource resource);  }