Refine search
/** * Test the persistence of a property modified with a String parameter and * saved from the Session Requires a single-value String (PROP_VALUE_2) */ public void testStringSession() throws RepositoryException { property1.setValue(PROP_VALUE_2); superuser.save(); assertEquals("String node property not saved", PROP_VALUE_2, property1.getString()); }
/** * Set the autoexport:enabled property to false in the repository. This method should only be called in an exception * handler, as it assumes the current session state is garbage and aggressively clears it. * @throws RepositoryException */ private void disableAutoExportJcrProperty() throws RepositoryException { // this method is almost certainly being called while current session state is somehow unreliable // therefore, before attempting to work with the repo, we should attempt to reset to a good state eventProcessorSession.refresh(false); final Property autoExportEnableProperty = autoExportConfigNode.getProperty(AutoExportConstants.CONFIG_ENABLED_PROPERTY_NAME); autoExportEnableProperty.setValue(false); eventProcessorSession.save(); }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveMultiValueSession() throws RepositoryException { property2.setValue((Value[]) null); superuser.save(); try { node.getProperty(propertyName2); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveBooleanSession() throws RepositoryException { property1.setValue((Value) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveDoubleSession() throws RepositoryException { property1.setValue((Value) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Decimal has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveNodeSession() throws RepositoryException { property1.setValue((Value) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveMultiStringSession() throws RepositoryException { property2.setValue((String[]) null); superuser.save(); try { node.getProperty(propertyName2); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveDoubleSession() throws RepositoryException { property1.setValue((Value) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Double has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveCalendarSession() throws RepositoryException { property1.setValue((Calendar) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Calendar has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveValueSession() throws RepositoryException { Value sv = null; property1.setValue(sv); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveLongSession() throws RepositoryException { property1.setValue((Value) null); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null Value has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } } }
/** * Test the deletion of a property by assigning it a null value, saved from * the Session */ public void testRemoveStringSession() throws RepositoryException { String sv = null; property1.setValue(sv); superuser.save(); try { node.getProperty(propertyName1); fail("The property should not exist anymore, as a null String has been assigned"); } catch (PathNotFoundException e) { //success : the property has been deleted by assigning it a null value } }
/** * Test the deletion of a value in a multi-value property */ public void testNullMultiValue() throws RepositoryException { property2.setValue(new Value[]{null, sv2}); superuser.save(); assertEquals("Null value not removed", Arrays.asList(property2.getValues()), Arrays.asList(new Value[]{sv2})); }
/** * Test the persistence of a property modified with an multi-value Value * parameter and saved from the Session Requires a multi-value Value (mv2) */ public void testMultiValueSession() throws RepositoryException { property2.setValue(mv2); superuser.save(); assertEquals("Node property not saved", Arrays.asList(mv2), Arrays.asList(property2.getValues())); }
/** * Removes node property. * * @param nodePath Absolute path to node. * @param propertyName Property name. * @throws RepositoryException if problem with jcr repository occurred */ public void removeNodeProperty(String nodePath, String propertyName) throws RepositoryException { LOG.debug("Removing property '{}' from node '{}'", propertyName, nodePath); session.refresh(true); session.getNode(nodePath).getProperty(propertyName).setValue((String) null); session.save(); }
/** * Test the persistence of a property modified with a Value parameter, and * saved from the parent Node Requires a single-value Value (sv2) */ public void testValueParent() throws RepositoryException { property1.setValue(sv2); testRootNode.getSession().save(); assertEquals("Value node property not saved", sv2, property1.getValue()); }
/** * Test the persistence of a property modified with an multi-value String * parameter and saved from the Session Requires a multi-value String (mv) */ public void testMultiStringSession() throws RepositoryException { String[] mv = new String[]{PROP_VALUE_1, PROP_VALUE_2}; property2.setValue(mv); superuser.save(); Value[] values = property2.getValues(); List<String> strValues = new ArrayList<String>(); for (int i = 0; i < values.length; i++) { strValues.add(values[i].getString()); } assertEquals("Node property not saved", Arrays.asList(mv), strValues); }
/** * Test the persistence of a property modified with a Value parameter and * saved from the Session Requires a single-value Value (sv2) */ public void testValueSession() throws RepositoryException { property1.setValue(sv2); superuser.save(); assertEquals("Value node property not saved", sv2, property1.getValue()); }