From: <jbo...@li...> - 2005-12-17 17:03:37
|
Author: adamw Date: 2005-12-17 12:03:21 -0500 (Sat, 17 Dec 2005) New Revision: 1835 Removed: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/CommitTest.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/DirectoryTest.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/PropertiesTest.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StandaloneTest.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StaticTest.java Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Resource.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnDirectory.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnNode.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnResource.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnHistoricNode.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResource.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResourceProxy.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyDirectoryOperation.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyFileOperation.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/ trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/PropertiesTest.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-45 : done Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -71,7 +71,10 @@ /** * Gets an output stream for writing data to the node. The stream will be * automatically closed upon invocation of any of the getContent...() - * methods, getLenght() or the save() method. + * methods, getLenght() or the save() method. Using this method for setting + * content instead of the other ones, is an indication to the + * implementation that the content will be large, so a temporary file could + * be used instead of a in-memory object. * * @return An output stream for writing data to the node. */ Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Resource.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Resource.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Resource.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -83,6 +83,15 @@ * @throws RepositoryException */ public String getProperty(String propertyName) throws RepositoryException; + + /** + * Deletes the the given property. + * + * @param propertyName + * Name of the property to delete. + * @throws RepositoryException + */ + public void deleteProperty(String propertyName) throws RepositoryException; /** * Sets the value of the given property. Only after saving this change will be Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnDirectory.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnDirectory.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnDirectory.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -54,7 +54,7 @@ public void addOperations(Collection<ResourceOperation> ops) { if (checkForChanges()) { ops.add(new ModifyDirectoryOperation(getId(), getFullPath(), - getModifiedProperties())); + getModifiedProperties(), getDeletedProperties())); } } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnNode.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnNode.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnNode.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -85,7 +85,8 @@ if (checkForChanges()) { ops.add(new ModifyFileOperation(getId(), getFullPath(), content.getChanged() ? getLength() : -1, - getModifiedProperties(), getNodeContent())); + getModifiedProperties(), getDeletedProperties(), + getNodeContent())); } } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnResource.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnResource.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnResource.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -54,6 +54,10 @@ * modified for this resource and have to be written upon save. */ private Map<String, String> modifiedProperties; + /** + * <code>deletedProperties</code> - a set of names of deleted properties. + */ + private Set<String> deletedProperties; private SvnService service; @@ -75,6 +79,7 @@ fullName = pathParams[2]; modifiedProperties = new HashMap<String, String>(); + deletedProperties = new HashSet<String>(); service = SvnTools.getService(); } @@ -95,7 +100,7 @@ * @return True if there are any changes in properties. */ public boolean checkForChanges() { - return modifiedProperties.size() > 0; + return modifiedProperties.size() > 0 || deletedProperties.size() > 0; } public void notifySaved() { @@ -118,8 +123,14 @@ return modifiedProperties; } - public void setModifiedProperties(Map<String, String> properties) { + public Set<String> getDeletedProperties() { + return deletedProperties; + } + + public void setModifiedProperties(Map<String, String> properties, + Set<String> deletedProperties) { modifiedProperties = properties; + this.deletedProperties = deletedProperties; } public boolean switchable() { @@ -175,6 +186,10 @@ return modifiedProperties.get(name); } + if (deletedProperties.contains(name)) { + return null; + } + return getPropertyInternal(name); } @@ -182,14 +197,31 @@ Map<String, String> ret = getPropertiesInternal(); ret.putAll(modifiedProperties); + for (String deletedPropertyName : deletedProperties) { + ret.remove(deletedPropertyName); + } return ret; } public void setProperty(String name, String value) { - modifiedProperties.put(name, value); + if (value == null) { + /* + * Checking if the user doesn't try to delete the property using + * this method. + */ + deleteProperty(name); + } else { + deletedProperties.remove(name); + modifiedProperties.put(name, value); + } } + public void deleteProperty(String name) { + deletedProperties.add(name); + modifiedProperties.remove(name); + } + public String getName() { return name; } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnHistoricNode.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnHistoricNode.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnHistoricNode.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -177,6 +177,11 @@ } @Override + public void deleteProperty(String name) { + throw new NodeReadOnly(); + } + + @Override public void moveTo(Directory d, String logMessage) { throw new NodeReadOnly(); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResource.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResource.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResource.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Map; +import java.util.Set; import org.jboss.shotoku.Resource; import org.jboss.shotoku.exceptions.DeleteException; @@ -47,5 +48,7 @@ public SvnContentManager getSvnCm(); public Map<String, String> getModifiedProperties(); - public void setModifiedProperties(Map<String, String> properties); + public Set<String> getDeletedProperties(); + public void setModifiedProperties(Map<String, String> properties, + Set<String> deletedProperties); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResourceProxy.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResourceProxy.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnResourceProxy.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Map; +import java.util.Set; import org.jboss.shotoku.Directory; import org.jboss.shotoku.exceptions.CopyException; @@ -90,7 +91,8 @@ if (oldResource != null) { currentResource.setModifiedProperties( - oldResource.getModifiedProperties()); + oldResource.getModifiedProperties(), + oldResource.getDeletedProperties()); } isRepoResource = false; @@ -102,7 +104,8 @@ if (oldResource != null) { currentResource.setModifiedProperties( - oldResource.getModifiedProperties()); + oldResource.getModifiedProperties(), + oldResource.getDeletedProperties()); } isRepoResource = true; @@ -186,10 +189,15 @@ return currentResource.getModifiedProperties(); } - public void setModifiedProperties(Map<String, String> properties) { - currentResource.setModifiedProperties(properties); + public Set<String> getDeletedProperties() { + return currentResource.getDeletedProperties(); } + public void setModifiedProperties(Map<String, String> properties, + Set<String> deletedProperties) { + currentResource.setModifiedProperties(properties, deletedProperties); + } + public void notifySaved() { // First notifying about save .. currentResource.notifySaved(); @@ -252,6 +260,11 @@ public void setProperty(String name, String value) { currentResource.setProperty(name, value); } + + public void deleteProperty(String name) { + checkSwitch(); + currentResource.deleteProperty(name); + } public Map<String, String> getProperties() throws RepositoryException { checkSwitch(); Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyDirectoryOperation.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyDirectoryOperation.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyDirectoryOperation.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -22,6 +22,7 @@ package org.jboss.shotoku.svn.operations; import java.util.Map; +import java.util.Set; import org.jboss.shotoku.svn.SvnService; import org.jboss.shotoku.tools.Tools; @@ -33,12 +34,14 @@ */ public class ModifyDirectoryOperation extends ResourceOperation { private Map<String, String> properties; + private Set<String> deletedProperties; public ModifyDirectoryOperation(String id, String path, - Map<String, String> properties) { + Map<String, String> properties, Set<String> deletedProperties) { super(id, path, OpCode.MODIFY_DIRECTORY); this.properties = properties; + this.deletedProperties = deletedProperties; } public void execute(PathsStack stack) throws SVNException { @@ -46,8 +49,13 @@ ISVNEditor editor = stack.getEditor(); - for (String key : properties.keySet()) + for (String key : properties.keySet()) { editor.changeDirProperty(key, properties.get(key)); + } + + for (String key : deletedProperties) { + editor.changeDirProperty(key, null); + } } public void addModifiedPaths(SvnService service) { Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyFileOperation.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyFileOperation.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/operations/ModifyFileOperation.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.OutputStream; import java.util.Map; +import java.util.Set; import org.jboss.shotoku.exceptions.RepositoryException; import org.jboss.shotoku.svn.SvnService; @@ -40,14 +41,17 @@ public class ModifyFileOperation extends ResourceOperation { private long contentLength; private Map<String, String> properties; + private Set<String> deletedProperties; private NodeContent content; public ModifyFileOperation(String id, String path, long contentLength, - Map<String, String> properties, NodeContent content) { + Map<String, String> properties, Set<String> deletedProperties, + NodeContent content) { super(id, path, OpCode.MODIFY_FILE); this.contentLength = contentLength; this.properties = properties; + this.deletedProperties = deletedProperties; this.content = content; } @@ -60,9 +64,14 @@ stack.addPath(path, true); } - for (String key : properties.keySet()) + for (String key : properties.keySet()) { editor.changeFileProperty(path, key, properties.get(key)); + } + for (String key : deletedProperties) { + editor.changeFileProperty(path, key, null); + } + if (contentLength != -1) { editor.applyTextDelta(path, null); SVNDiffWindow diffWindow = SVNDiffWindowBuilder Property changes on: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test ___________________________________________________________________ Name: svn:ignore + HomeTest.java Deleted: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/CommitTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/CommitTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/CommitTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -1,154 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.shotoku.test; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import org.tmatesoft.svn.core.SVNCommitInfo; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.io.ISVNEditor; -import org.tmatesoft.svn.core.io.ISVNWorkspaceMediator; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -public class CommitTest { - public static void main(String[] argv) throws Exception { - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - - SVNRepository repository = null; - repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded( - "https://cms.labs.jboss.com/trunk/forge/portal-content/shotoku-test")); - ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( - "jbf...@jb...", "rO@B5oPfff"); - repository.setAuthenticationManager(authManager); - - long latestRevision = -1; - latestRevision = repository.getLatestRevision(); - System.out.println("Repository latest revision (before committing): " - + latestRevision); - System.out.println(""); - - ISVNEditor editor = repository.getCommitEditor("zzz", new WorkspaceMediator()); - - editor.openRoot(-1); - editor.openDir("/dir1", -1); - editor.addDir("/dircpy", "dir1/dir3", latestRevision); - - editor.closeDir(); - editor.closeDir(); - editor.closeDir(); - printCommitInfo(editor.closeEdit()); - - /*editor.addFile(filePath, null, -1); - editor.applyTextDelta(filePath, null); - long deltaLength = data.length; - SVNDiffWindow diffWindow = SVNDiffWindowBuilder - .createReplacementDiffWindow(deltaLength); - OutputStream os = editor.textDeltaChunk(filePath, diffWindow); - for (int i = 0; i < deltaLength; i++) { - os.write(data[i]); - } - if (os != null) { - try { - os.close(); - } catch (IOException ioeInternal) { - // - } - } - editor.textDeltaEnd(filePath); - editor.closeFile(filePath, null);*/ - } - - private static void printCommitInfo(SVNCommitInfo commitInfo) { - System.out.println("The last author:" + commitInfo.getAuthor()); - System.out.println("Date:" + commitInfo.getDate().toString()); - System.out.println("Committed to revision " + commitInfo.getNewRevision()); - System.out.println(""); - } -} - -class WorkspaceMediator implements - ISVNWorkspaceMediator { - private Map myTmpFiles = new HashMap(); - - public String getWorkspaceProperty(String path, String name) - throws SVNException { - return null; - } - - public void setWorkspaceProperty(String path, String name, String value) - throws SVNException { - } - - /* - * Creates a temporary file delta storage. id will be used as the - * temporary storage identifier. Returns an OutputStream to write the - * delta data into the temporary storage. - */ - @SuppressWarnings("unchecked") - public OutputStream createTemporaryLocation(String path, Object id) - throws IOException { - ByteArrayOutputStream tempStorageOS = new ByteArrayOutputStream(); - myTmpFiles.put(id, tempStorageOS); - return tempStorageOS; - } - - /* - * Returns an InputStream of the temporary file delta storage identified - * by id to read the delta. - */ - public InputStream getTemporaryLocation(Object id) throws IOException { - return new ByteArrayInputStream(((ByteArrayOutputStream)myTmpFiles.get(id)).toByteArray()); - } - - /* - * Gets the length of the delta that was written to the temporary - * storage identified by id. - */ - public long getLength(Object id) throws IOException { - ByteArrayOutputStream tempStorageOS = (ByteArrayOutputStream)myTmpFiles.get(id); - if (tempStorageOS != null) { - return tempStorageOS.size(); - } - return 0; - } - - /* - * Deletes the temporary file delta storage identified by id. - */ - public void deleteTemporaryLocation(Object id) { - myTmpFiles.remove(id); - } -} - Deleted: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/DirectoryTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/DirectoryTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/DirectoryTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -1,76 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.shotoku.test; - -import java.io.File; - -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.wc.ISVNOptions; -import org.tmatesoft.svn.core.wc.SVNClientManager; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -/** - * @author Adam Warski (ad...@as...) - * @author Damon Sicore (da...@si...) - */ -public class DirectoryTest { - SVNClientManager clientManager; - - public void test() throws Exception { - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - - File dir = new File("/home/adamw/jboss/content/trunk/forge/portal-content/shotoku-test/inject-test-dir"); - dir.mkdir(); - - File file = new File("/home/adamw/jboss/content/trunk/forge/portal-content/shotoku-test/inject-test-node"); - file.createNewFile(); - - ISVNOptions options = SVNWCUtil.createDefaultOptions(true); - clientManager = - SVNClientManager.newInstance(options, "jbf...@jb...", "rO@B5oPfff"); - - try { - clientManager.getWCClient().doAdd(file, true, false, false, false); - clientManager.getCommitClient().doCommit(new File[] { file }, false, "", true, false); - - clientManager.getWCClient().doAdd(dir, true, false, false, false); - clientManager.getCommitClient().doCommit(new File[] { dir }, false, "", true, false); - } finally { - /* CLEANUP */ - try { - clientManager.getWCClient().doDelete(dir, true, false); - clientManager.getCommitClient().doCommit(new File[] { dir }, false, "", true, false); - } catch (Exception e) { } - - try { - clientManager.getWCClient().doDelete(file, true, false); - clientManager.getCommitClient().doCommit(new File[] { file }, false, "", true, false); - } catch (Exception e) { } - } - } - - public static void main(String[] argv) throws Exception { - new DirectoryTest().test(); - } -} Deleted: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/PropertiesTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/PropertiesTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/PropertiesTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -1,94 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.shotoku.test; - -import java.io.File; - -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.wc.ISVNOptions; -import org.tmatesoft.svn.core.wc.ISVNPropertyHandler; -import org.tmatesoft.svn.core.wc.SVNClientManager; -import org.tmatesoft.svn.core.wc.SVNRevision; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -/** - * @author Adam Warski (ad...@as...) - * @author Damon Sicore (da...@si...) - */ -public class PropertiesTest { - SVNClientManager clientManager; - File file; - - private void setProperty(String value) throws Exception { - clientManager.getWCClient().doSetProperty(file, "test", value, true, false, ISVNPropertyHandler.NULL); - } - - private void getProperty() throws Exception { - clientManager.getWCClient().doGetProperty(file, "test", SVNRevision.WORKING, SVNRevision.WORKING, - false); - } - - private void commit() throws Exception { - clientManager.getCommitClient().doCommit(new File[] { file }, false, "", true, false); - } - - private void add() throws Exception { - clientManager.getWCClient().doAdd(file, true, false, false, false); - } - - private void delete() throws Exception { - clientManager.getWCClient().doDelete(file, true, false); - } - - public void test() throws Exception { - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - - file = new File("/home/adamw/jboss/content/trunk/forge/portal-content/shotoku-test/prop-test"); - - ISVNOptions options = SVNWCUtil.createDefaultOptions(true); - clientManager = - SVNClientManager.newInstance(options, "jbf...@jb...", "rO@B5oPfff"); - - file.createNewFile(); - add(); - commit(); - setProperty("1"); - commit(); - setProperty("2"); - commit(); - getProperty(); - getProperty(); - getProperty(); - delete(); - commit(); - file.createNewFile(); - Thread.sleep(1000); - System.out.println( - clientManager.getStatusClient().doStatus(file, false).getContentsStatus().getID()); - } - - public static void main(String[] argv) throws Exception { - new PropertiesTest().test(); - } -} Deleted: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StandaloneTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StandaloneTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StandaloneTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -1,515 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.shotoku.test; - -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.jboss.shotoku.ContentManager; -import org.jboss.shotoku.Directory; -import org.jboss.shotoku.Node; -import org.jboss.shotoku.Resource; -import org.jboss.shotoku.exceptions.DeleteException; -import org.jboss.shotoku.exceptions.RepositoryException; -import org.jboss.shotoku.exceptions.ResourceAlreadyExists; -import org.jboss.shotoku.exceptions.ResourceDoesNotExist; -import org.jboss.shotoku.exceptions.SaveException; -import org.tmatesoft.svn.core.ISVNLogEntryHandler; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNLogEntry; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -public class StandaloneTest { - public static void testRepo() throws SVNException { - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - - SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded( - "https://cms.labs.jboss.com/trunk/forge/portal-content")); - - ISVNAuthenticationManager authManager = - SVNWCUtil.createDefaultAuthenticationManager("jbf...@jb...", - "rO@B5oPfff"); - repository.setAuthenticationManager(authManager); - - repository.log(new String[] { "shotoku-test" }, - 22421, 0, false, false, 1, - new ISVNLogEntryHandler() { - public void handleLogEntry(SVNLogEntry entry) { - System.out.println("A"); - } - }); - } - - public static void testCm() throws RepositoryException, ResourceDoesNotExist, - ResourceAlreadyExists, SaveException { - ContentManager cm = ContentManager.getContentManager("shotoku-test"); - //Directory d = cm.getRootDirectory(); - Set<Resource> toSave = new HashSet<Resource>(); - /*for (Directory c : d.getDirectories()) { - System.out.println(c.getName()); - } - - for (Node n : d.getNodes().toList()) { - System.out.println(n.getFullName()); - }*/ - //System.out.println(cm.getRootDirectory().getNode("history-test.txt").getContent()); - /*Node nn = cm.getRootDirectory().newNode("nowy_node"); - nn.setContent("z\n"); - Node nn2 = cm.getRootDirectory().newNode("nowy_node2"); - nn2.setContent("z2\n"); - - - toSave.add(nn); - toSave.add(nn2); - cm.save(toSave, "zzz");*/ - //cm.getNode("nowy_node").delete(); - //cm.getNode("nowy_node2").delete(); - - Directory nd = cm.getRootDirectory().newDirectory("nowy_kat"); - Node nn3 = nd.newNode("nowy_node3"); - - toSave.add(nd); - toSave.add(nn3); - - cm.save(toSave, "aaa"); - } - - public static void simpleDirTest() throws DeleteException, RepositoryException, ResourceAlreadyExists, SaveException { - ContentManager cm = ContentManager.getContentManager("shotoku-test"); - - try { - Directory newDir = cm.getRootDirectory().newDirectory("new-dir-test"); - newDir.save("new-dir-test"); - Node newNode = newDir.newNode("new-node"); - newNode.save("new-node"); - } finally { - try { - Directory newDir2 = cm.getDirectory("new-dir-test"); - newDir2.delete(); - } catch (ResourceDoesNotExist e) { - // If it does not exist, all the better, no deleting :). - } - } - } - - private final static String TEST_DIR1 = "parent-test-1"; - private final static String TEST_DIR2 = "parent-test-2"; - private final static String TEST_DIR3 = "parent-test-3"; - - public static void testParent() throws Exception { - ContentManager cm = ContentManager.getContentManager("shotoku-test"); - try { - // First creating a simple directory structure. - Directory new1 = cm.getRootDirectory().newDirectory(TEST_DIR1); - new1.save(TEST_DIR1); - - Directory new2 = new1.newDirectory(TEST_DIR2); - new2.save(TEST_DIR2); - - Directory new3 = new2.newDirectory(TEST_DIR3); - new3.save(TEST_DIR3); - - // Now, having this structure, testing the parents. - - // This should be "identical" to new2. - Directory parentNew3 = new3.getParent(); - - // This should be "identical" to new1. - Directory parentNew2 = new2.getParent(); - - // This should be the root directory. - Directory parentNew1 = new1.getParent(); - - // Checking names. - System.out.println(parentNew3.getName().equals(new2.getName())); - System.out.println(parentNew2.getName().equals(new1.getName())); - System.out.println(parentNew1.getName().equals(cm.getRootDirectory().getName())); - - // The parents should have appropriate children - trying to - // get them. - parentNew1.getDirectory(TEST_DIR1); - parentNew2.getDirectory(TEST_DIR2); - parentNew3.getDirectory(TEST_DIR3); - } finally { - try { - cm.getDirectory(TEST_DIR1).delete(); - } catch (Exception e) { - - } - } - } - - private static ContentManager cm; - //private final static String TEST_FILE = "add-delete-test-1"; - private static void checkTestFileNotExists() { - try { - cm.getNode(TEST_FILE); - - // An exception should be thrown. - throw new RuntimeException("ZZZZ"); - } catch (ResourceDoesNotExist e) { - // Getting here means everything is ok. - } - } - public static void addDeleteTest() throws Exception { - - try { - Node n = cm.getRootDirectory().newNode(TEST_FILE); - - checkTestFileNotExists(); - - n.save(TEST_FILE); - - // The file should exist now. - try { - cm.getNode(TEST_FILE); - } catch (ResourceDoesNotExist e) { - throw e; - } - - // Waiting for an update for 20 seconds ... - try { - Thread.sleep(1000 * 20); - } catch (InterruptedException e) { - throw e; - } - - // The file should still exist. - try { - cm.getNode(TEST_FILE); - } catch (ResourceDoesNotExist e) { - throw e; - } - - n.delete(); - - checkTestFileNotExists(); - } finally { - try { - cm.getNode(TEST_FILE).delete(); - } catch (ResourceDoesNotExist e) { - // If it does not exist - doing nothing. - } - } - } - - private final static String TEST_FILE = "content-saving-test-1"; - private final static String TEST_CONTENT_3 = "c"; - - private static void assertNodeContent(Node n, String content) { - System.out.println(content.equals(n.getContent())); - System.out.println(Arrays.equals(content.getBytes(), n.getContentByteArray())); - } - - public static void contentSetTest() throws Exception { - try { - Node n0 = cm.getRootDirectory().newNode(TEST_FILE); - n0.save(TEST_FILE); - - // Getting the test node. - Node n = cm.getNode(TEST_FILE); - - // Modifying the content. - //n.setContent(TEST_CONTENT_3.getBytes()); - n.getOutputStream().write(TEST_CONTENT_3.getBytes()); - n.save(TEST_FILE); - - // Checking if changes are visible. - assertNodeContent(n, TEST_CONTENT_3); - assertNodeContent(cm.getRootDirectory().getNode(TEST_FILE), TEST_CONTENT_3); - } finally { - try { - cm.getNode(TEST_FILE).delete(); - } catch (Throwable e) { - e.printStackTrace(); - System.out.println("Z"); - } - } - } - - public static void addDelDir() throws Exception { - try { - // Creating the directory. - Directory newDir = cm.getRootDirectory().newDirectory("new-dir-test"); - - // Saving the dir - it should be created. - newDir.save("new-dir-test"); - - // Creating some nodes and directories in it. - Node newNode = newDir.newNode("node2"); - newNode.save("node2"); - newNode.setContent("test"); - newNode.save("node2-2"); - - System.out.println(cm.getNode("new-dir-test/node2").getContent()); - } finally { - try { - Directory newDir = cm.getDirectory("new-dir-test"); - newDir.delete(); - } catch (ResourceDoesNotExist e) { - // If it does not exist, all the better, no deleting :). - } - } - } - - //private final static String TEST_DIR = "slash-test-dir"; - private final static String TEST_NESTED_DIR = "a/b/c"; - private final static String TEST_NESTED_NODE = "h/j/k"; - private final static String TEST_CONTENT = "T"; - - public static void testNested() throws Exception { - try { - cm.getRootDirectory().newDirectory(TEST_DIR).save(TEST_DIR); - - ContentManager cm1 = ContentManager.getContentManager("/shotoku-test/"); - cm1.getRootDirectory().getDirectory(TEST_DIR); - - ContentManager cm2 = ContentManager.getContentManager( - "//shotoku-test///" + TEST_DIR + "///"); - cm2.getRootDirectory(); - } finally { - try { - cm.getDirectory(TEST_DIR).delete(); - } catch (ResourceDoesNotExist e) { - - } - } - - try { - cm.getRootDirectory().newDirectory(TEST_DIR).save(TEST_DIR); - - Directory base = cm.getDirectory(TEST_DIR); - base.newDirectory("h").save("h"); - - Node nested = base.newNode(TEST_NESTED_NODE); - System.out.println((TEST_DIR + "/" + TEST_NESTED_NODE).equals(nested.getFullName())); - - nested.setContent(TEST_CONTENT); - nested.save(TEST_NESTED_NODE); - - System.out.println(TEST_CONTENT.equals(base.getDirectory("h"). - getDirectory("j").getNode("k").getContent())); - System.out.println(TEST_CONTENT.equals(base.getNode(TEST_NESTED_NODE).getContent())); - } finally { - try { - cm.getDirectory(TEST_DIR).delete(); - } catch (ResourceDoesNotExist e) { - - } - } - - try { - cm.getRootDirectory().newDirectory(TEST_DIR).save(TEST_DIR); - - Directory base = cm.getDirectory(TEST_DIR); - Directory nested1 = base.newDirectory(TEST_NESTED_DIR); - Node nested2 = base.newNode(TEST_NESTED_NODE); - - System.out.println((TEST_DIR + "/" + TEST_NESTED_DIR).equals(nested1.getFullName())); - System.out.println((TEST_DIR + "/" + TEST_NESTED_NODE).equals(nested2.getFullName())); - - nested1.save(""); - - nested2.setContent(TEST_CONTENT); - nested2.save(""); - - // We should be able to get the directories and node. - base.getDirectory("a").getDirectory("b").getDirectory("c"); - base.getDirectory(TEST_NESTED_DIR); - - System.out.println(TEST_CONTENT.equals(base.getDirectory("h"). - getDirectory("j").getNode("k").getContent())); - System.out.println(TEST_CONTENT.equals(base.getNode(TEST_NESTED_NODE).getContent())); - } finally { - try { - cm.getDirectory(TEST_DIR).delete(); - } catch (ResourceDoesNotExist e) { - - } - } - } - - private final static String TEST_NODE = "inject-test-node"; - private final static String TEST_DIR = "inject-test-dir"; - private final static String TEST_TEXT = "text"; - private final static String TEST_LOG = "log"; - - public static void testInject() throws Exception { - Thread.sleep(1000 * 1); - try { - Node testNode = cm.getRootDirectory().newNode(TEST_NODE); - testNode.setContent(TEST_TEXT); - testNode.save(TEST_LOG); - - Directory testDir = cm.getRootDirectory().newDirectory(TEST_DIR); - testDir.save(TEST_LOG + "2"); - - Thread.sleep(1000 * 20); - - System.out.println(cm.getNode(TEST_NODE).getLogMessage()); - } finally { - try { - cm.getNode(TEST_NODE).delete(); - } catch(ResourceDoesNotExist e) { - - } - - try { - cm.getDirectory(TEST_DIR).delete(); - } catch(ResourceDoesNotExist e) { - - } - } - } - - public static void multiSaveTest() throws Exception { - try { - Directory newDir1 = cm.getRootDirectory().newDirectory(TEST_DIR); - - Directory newDir2 = newDir1.newDirectory("a/b/c"); - Node newNode1 = newDir1.newNode("a/b/d/n1"); - - Directory newDir3 = newDir2.newDirectory("z"); - Node newNode2 = newDir3.newNode("aaa"); - - newNode2.setContent("P"); - - cm.save(newDir1, newDir2, newNode1, newNode2, ""); - - System.out.println("P".equals(cm.getNode(TEST_DIR + "/a/b/c/z/aaa"))); - } finally { - try { - cm.getDirectory(TEST_DIR).delete(); - } catch (ResourceDoesNotExist e) { - // If it does not exist - doing nothing. - } - } - } - - public static void testCopy() throws Exception { - try { - Directory parent = cm.getRootDirectory().newDirectory(TEST_DIR); - Directory dir1 = parent.newDirectory("dir1"); - Directory dir2 = parent.newDirectory("dir2"); - Node n1 = dir1.newNode("node1"); - n1.setContent(TEST_CONTENT); - - cm.save(parent, dir1, dir2, n1, "setup"); - - Directory original = cm.getDirectory(TEST_DIR + "/dir1"); - original.copyTo(cm.getDirectory(TEST_DIR + "/dir2"), "dir3", "copy-dir"); - - System.out.println(TEST_CONTENT.equals(cm.getNode(TEST_DIR + "/dir2/dir3/node1").getContent())); - } finally { - try { - cm.getDirectory(TEST_DIR).delete(); - } catch (ResourceDoesNotExist e) { - - } - } - } - - private static void checkProperties(Node n) { - Map<String, String> props = n.getProperties(); - - System.out.println(props.size()); - } - - public static void propsTest() throws Exception { - try { - Node n0 = cm.getRootDirectory().newNode(TEST_FILE); - n0.save(TEST_FILE); - - Node n = cm.getNode(TEST_FILE); - - /*Random r = new Random(); - for (int i=0; i<3; i++) { - n.setProperty(Integer.toString(r.nextInt() % 3), Integer.toString(r.nextInt() % 2)); - }*/ - n.setProperty("0", "0"); - n.setProperty("1", "2"); - n.save("a"); - - checkProperties(n); - checkProperties(cm.getNode(TEST_FILE)); - - // Waiting for a WC update. - Thread.sleep(1000 * 10); - checkProperties(n); - checkProperties(cm.getNode(TEST_FILE)); - - } finally { - cm.getNode(TEST_FILE).delete(); - } - } - - public static void printMap(Map m) { - for (Object k : m.keySet()) { - System.out.println(k + " : " + m.get(k)); - } - - System.out.println(); - } - - public static void main(String[] argv) throws Exception { - long now = Calendar.getInstance().getTimeInMillis(); - - ContentManager.setup(); - cm = ContentManager.getContentManager("shotoku-test"); - - /*Map<String, String> properties = new HashMap<String, String>(); - OutputStream os = new ByteArrayOutputStream(); - - System.out.println("REV: " + ((SvnContentManager) cm).getRepository().getFile( - "default/polls/database/1289956185", -1, - properties, os)); - - printMap(properties);*/ - - //propsTest(); - //testCopy(); - //multiSaveTest(); - //testInject(); - //testNested(); - //addDelDir(); - //contentSetTest(); - //addDeleteTest(); - //testParent(); - //logMsgTest(); - //simpleDirTest(); - //testModifyContent(); - //testCm(); - //testRepo(); - - System.out.println((Calendar.getInstance().getTimeInMillis() - now) / 1000); - } -} Deleted: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StaticTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StaticTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/test/StaticTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -1,45 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.shotoku.test; - -import java.lang.reflect.InvocationTargetException; - -public class StaticTest { - public static void x() { - System.out.println("Z"); - } - - /** - * @param args - * @throws ClassNotFoundException - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException - * @throws SecurityException - * @throws IllegalArgumentException - */ - public static void main(String[] args) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { - Class.forName("org.jboss.shotoku.test.StaticTest").getMethod("x", new Class[0]). - invoke(Class.forName("org.jboss.shotoku.test.StaticTest"), new Object[0]); - } - -} Modified: trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/PropertiesTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/PropertiesTest.java 2005-12-17 16:35:30 UTC (rev 1834) +++ trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/PropertiesTest.java 2005-12-17 17:03:21 UTC (rev 1835) @@ -118,6 +118,46 @@ checkProperties(cm.getNode(TEST_FILE)); } + public void testPropertyDelete() throws Exception { + Node n = cm.getNode(TEST_FILE); + + n.setProperty("p1", "v1"); + n.setProperty("p2", "v2"); + + n.save(""); + + n.deleteProperty("p2"); + + assertNull(n.getProperty("p2")); + assertTrue("v1".equals(n.getProperty("p1"))); + assertTrue(1 == n.getProperties().size()); + + assertTrue("v1".equals(cm.getNode(TEST_FILE).getProperty("p1"))); + assertTrue("v2".equals(cm.getNode(TEST_FILE).getProperty("p2"))); + assertTrue(2 == cm.getNode(TEST_FILE).getProperties().size()); + + n.save(""); + + assertNull(n.getProperty("p2")); + assertTrue("v1".equals(n.getProperty("p1"))); + assertTrue(1 == n.getProperties().size()); + + assertNull(cm.getNode(TEST_FILE).getProperty("p2")); + assertTrue("v1".equals(cm.getNode(TEST_FILE).getProperty("p1"))); + assertTrue(1 == cm.getNode(TEST_FILE).getProperties().size()); + + // Waiting for a WC update. + Thread.sleep(1000 * 20); + + assertNull(n.getProperty("p2")); + assertTrue("v1".equals(n.getProperty("p1"))); + assertTrue(1 == n.getProperties().size()); + + assertNull(cm.getNode(TEST_FILE).getProperty("p2")); + assertTrue("v1".equals(cm.getNode(TEST_FILE).getProperty("p1"))); + assertTrue(1 == cm.getNode(TEST_FILE).getProperties().size()); + } + @Override protected void tearDown() throws DeleteException, ResourceAlreadyExists, ResourceDoesNotExist { cm.getNode(TEST_FILE).delete(); |