Author: bcarothers
Date: 2010-01-06 13:43:36 -0500 (Wed, 06 Jan 2010)
New Revision: 1534
Modified:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/svn/SvnAndJcrIntegrationTest.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepository.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepositorySource.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnIntegrationTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNoCreateWorkspaceTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNotWritableTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorWritableTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositorySourceTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRespositoryConnectorReadableTest.java
Log:
DNA-624 Canonicalize Property Names/Behavior in SVN Connector
Applied patch that changes the name of setDirectoryOfDefaultWorkspace to
setDefaultWorkspaceName and changes the behavior of the workspace names as described in
the issue description.
Modified:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/svn/SvnAndJcrIntegrationTest.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/svn/SvnAndJcrIntegrationTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/svn/SvnAndJcrIntegrationTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -51,7 +51,7 @@
@Before
public void beforeEach() throws Exception {
final String repositoryUrl = "http://anonsvn.jboss.org/repos/dna/";
- final String[] predefinedWorkspaceNames = {repositoryUrl + "trunk",
repositoryUrl + "tags", repositoryUrl + "branches"};
+ final String[] predefinedWorkspaceNames = {"trunk", "tags",
"branches"};
final String svnRepositorySource = "svnRepositorySource";
final String repositoryName = "svnRepository";
final JcrConfiguration configuration = new JcrConfiguration();
@@ -61,7 +61,8 @@
.setProperty("username", "anonymous")
.setProperty("repositoryRootUrl", repositoryUrl)
.setProperty("predefinedWorkspaceNames",
predefinedWorkspaceNames)
- .setProperty("directoryForDefaultWorkspace",
predefinedWorkspaceNames[0])
+.setProperty("defaultWorkspaceName",
+
predefinedWorkspaceNames[0])
.setProperty("creatingWorkspacesAllowed", false);
configuration.repository(repositoryName).setSource(svnRepositorySource).setOption(Option.QUERY_EXECUTION_ENABLED,
"false");
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepository.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepository.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepository.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -50,13 +50,11 @@
import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNProperties;
import org.tmatesoft.svn.core.SVNProperty;
-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.fs.FSRepositoryFactory;
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 SvnRepository extends WritablePathRepository {
@@ -89,7 +87,7 @@
doCreateWorkspace(context, workspaceName);
}
- String defaultWorkspaceName = source.getDirectoryForDefaultWorkspace();
+ String defaultWorkspaceName = source.getDefaultWorkspaceName();
if (defaultWorkspaceName != null &&
!workspaces.containsKey(defaultWorkspaceName)) {
doCreateWorkspace(context, defaultWorkspaceName);
}
@@ -161,15 +159,11 @@
UUID rootNodeUuid ) {
super(name, rootNodeUuid);
- try {
- workspaceRoot =
SVNRepositoryFactory.create(SVNURL.parseURIDecoded(name));
+ workspaceRoot = getWorkspaceDirectory(name);
- ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager(source.getUsername(),
-
source.getPassword());
- workspaceRoot.setAuthenticationManager(authManager);
- } catch (SVNException ex) {
- throw new IllegalStateException(ex);
- }
+ ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager(source.getUsername(),
+
source.getPassword());
+ workspaceRoot.setAuthenticationManager(authManager);
}
public Path getLowestExistingPath( Path path ) {
@@ -845,7 +839,10 @@
}
protected SVNRepository getWorkspaceDirectory( String workspaceName ) {
- if (workspaceName == null) workspaceName =
source.getDirectoryForDefaultWorkspace();
+ if (workspaceName == null) workspaceName = source.getDefaultWorkspaceName();
+
+ workspaceName = source.getRepositoryRootUrl() + workspaceName;
+
SVNRepository repository = null;
SVNRepository repos = SvnRepositoryUtil.createRepository(workspaceName,
source.getUsername(), source.getPassword());
if (SvnRepositoryUtil.isDirectory(repos, "")) {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepositorySource.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SvnRepositorySource.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -168,30 +168,28 @@
}
/**
- * Get the file system path to the existing directory that should be used for the
default workspace. If the default is
- * specified as a null String or is not a valid and resolvable path, this source will
consider the default to be the current
- * working directory of this virtual machine, as defined by the <code>new
File(".")</code>.
+ * Get the path to the existing directory that should be used for the default
workspace. This path should be relative to the
+ * {@link #getRepositoryRootUrl() repository root URL}. If the default is specified
as a null String or is not a valid and
+ * resolvable path, this source will consider the default to be the current working
directory of this virtual machine, as
+ * defined by the <code>new File(".")</code>.
*
* @return the file system path to the directory representing the default workspace,
or null if the default should be the
* current working directory
*/
- public String getDirectoryForDefaultWorkspace() {
- return defaultWorkspace;
- }
-
public String getDefaultWorkspaceName() {
return defaultWorkspace;
}
/**
- * Set the file system path to the existing directory that should be used for the
default workspace. If the default is
- * specified as a null String or is not a valid and resolvable path, this source will
consider the default to be the current
- * working directory of this virtual machine, as defined by the <code>new
File(".")</code>.
+ * Set the file system path to the existing directory that should be used for the
default workspace. This path should be
+ * relative to the {@link #getRepositoryRootUrl() repository root URL}. If the
default is specified as a null String or is not
+ * a valid and resolvable path, this source will consider the default to be the
current working directory of this virtual
+ * machine, as defined by the <code>new File(".")</code>.
*
* @param pathToDirectoryForDefaultWorkspace the valid and resolvable file system
path to the directory representing the
* default workspace, or null if the current working directory should be used
as the default workspace
*/
- public synchronized void setDirectoryForDefaultWorkspace( String
pathToDirectoryForDefaultWorkspace ) {
+ public synchronized void setDefaultWorkspaceName( String
pathToDirectoryForDefaultWorkspace ) {
this.defaultWorkspace = pathToDirectoryForDefaultWorkspace;
}
@@ -315,7 +313,7 @@
}
ref.add(new StringRefAddr(RETRY_LIMIT, Integer.toString(getRetryLimit())));
ref.add(new StringRefAddr(ROOT_NODE_UUID, rootNodeUuid.toString()));
- ref.add(new StringRefAddr(DEFAULT_WORKSPACE,
getDirectoryForDefaultWorkspace()));
+ ref.add(new StringRefAddr(DEFAULT_WORKSPACE, getDefaultWorkspaceName()));
ref.add(new StringRefAddr(ALLOW_CREATING_WORKSPACES,
Boolean.toString(isCreatingWorkspacesAllowed())));
String[] workspaceNames = getPredefinedWorkspaceNames();
if (workspaceNames != null && workspaceNames.length != 0) {
@@ -362,7 +360,7 @@
if (password != null) source.setPassword(password);
if (retryLimit != null) source.setRetryLimit(Integer.parseInt(retryLimit));
if (rootNodeUuid != null) source.setRootNodeUuid(rootNodeUuid);
- if (defaultWorkspace != null)
source.setDirectoryForDefaultWorkspace(defaultWorkspace);
+ if (defaultWorkspace != null) source.setDefaultWorkspaceName(defaultWorkspace);
if (createWorkspaces != null)
source.setCreatingWorkspacesAllowed(Boolean.parseBoolean(createWorkspaces));
if (workspaceNames != null && workspaceNames.length != 0)
source.setPredefinedWorkspaceNames(workspaceNames);
return source;
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnIntegrationTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnIntegrationTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnIntegrationTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -27,7 +27,6 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.Map;
-import org.jboss.dna.connector.svn.SvnRepositorySource;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Location;
@@ -53,7 +52,7 @@
@Before
public void beforeEach() {
repositoryUrl = "http://anonsvn.jboss.org/repos/dna/";
- predefinedWorkspaceNames = new String[] {repositoryUrl + "trunk",
repositoryUrl + "tags", repositoryUrl + "branches"};
+ predefinedWorkspaceNames = new String[] {"trunk", "tags",
"branches"};
context = new ExecutionContext();
source = new SvnRepositorySource();
source.setName("svn repository source");
@@ -62,7 +61,7 @@
source.setPassword("");
source.setCreatingWorkspacesAllowed(true);
source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
- source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
source.setCreatingWorkspacesAllowed(false);
source.initialize(new RepositoryContext() {
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNoCreateWorkspaceTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNoCreateWorkspaceTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNoCreateWorkspaceTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -1,6 +1,5 @@
package org.jboss.dna.connector.svn;
-import org.jboss.dna.connector.svn.SvnRepositorySource;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.connector.test.WorkspaceConnectorTest;
@@ -23,14 +22,14 @@
*/
@Override
protected RepositorySource setUpSource() throws Exception {
- String[] predefinedWorkspaceNames = new String[] {url + "trunk", url +
"tags"};
+ String[] predefinedWorkspaceNames = new String[] {"trunk",
"tags"};
SvnRepositorySource source = new SvnRepositorySource();
source.setName("Test Repository");
source.setUsername("sp");
source.setPassword("");
source.setRepositoryRootUrl(url);
source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
- source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
source.setCreatingWorkspacesAllowed(false);
return source;
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNotWritableTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNotWritableTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorNotWritableTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -1,6 +1,5 @@
package org.jboss.dna.connector.svn;
-import org.jboss.dna.connector.svn.SvnRepositorySource;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.connector.test.NotWritableConnectorTest;
@@ -23,14 +22,14 @@
*/
@Override
protected RepositorySource setUpSource() throws Exception {
- String[] predefinedWorkspaceNames = new String[]{url+"trunk",
url+"tags"};
+ String[] predefinedWorkspaceNames = new String[] {"trunk",
"tags"};
SvnRepositorySource source = new SvnRepositorySource();
source.setName("Test Repository");
source.setUsername("sp");
source.setPassword("");
source.setRepositoryRootUrl(url);
source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
- source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
source.setCreatingWorkspacesAllowed(false);
return source;
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorWritableTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorWritableTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositoryConnectorWritableTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -27,7 +27,6 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
-import org.jboss.dna.connector.svn.SvnRepositorySource;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.JcrLexicon;
@@ -63,14 +62,14 @@
@Override
protected RepositorySource setUpSource() throws Exception {
url =
SvnConnectorTestUtil.createURL("src/test/resources/dummy_svn_repos",
"target/copy_of dummy_svn_repos");
- String[] predefinedWorkspaceNames = new String[] {url + "trunk", url +
"tags"};
+ String[] predefinedWorkspaceNames = new String[] {"trunk",
"tags"};
SvnRepositorySource source = new SvnRepositorySource();
source.setName("Test Repository");
source.setUsername("sp");
source.setPassword("");
source.setRepositoryRootUrl(url);
source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
- source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
source.setCreatingWorkspacesAllowed(Boolean.TRUE);
source.setUpdatesAllowed(true);
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositorySourceTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositorySourceTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRepositorySourceTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -265,7 +265,7 @@
assertThat((String)refAttributes.remove(SvnRepositorySource.ALLOW_CREATING_WORKSPACES),
is(Boolean.toString(source.isCreatingWorkspacesAllowed())));
assertThat((String)refAttributes.remove(SvnRepositorySource.DEFAULT_WORKSPACE),
- is(source.getDirectoryForDefaultWorkspace()));
+ is(source.getDefaultWorkspaceName()));
refAttributes.remove(SvnRepositorySource.PREDEFINED_WORKSPACE_NAMES);
assertThat(refAttributes.isEmpty(), is(true));
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRespositoryConnectorReadableTest.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRespositoryConnectorReadableTest.java 2010-01-06
01:14:23 UTC (rev 1533)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SvnRespositoryConnectorReadableTest.java 2010-01-06
18:43:36 UTC (rev 1534)
@@ -27,7 +27,6 @@
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.List;
-import org.jboss.dna.connector.svn.SvnRepositorySource;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.JcrLexicon;
import org.jboss.dna.graph.JcrNtLexicon;
@@ -59,14 +58,14 @@
*/
@Override
protected RepositorySource setUpSource() throws Exception {
- String[] predefinedWorkspaceNames = new String[]{url + "trunk", url +
"tags"};
+ String[] predefinedWorkspaceNames = new String[] {"trunk",
"tags"};
SvnRepositorySource source = new SvnRepositorySource();
source.setName("Test Repository");
source.setUsername("sp");
source.setPassword("");
source.setRepositoryRootUrl(url);
source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
- source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
source.setCreatingWorkspacesAllowed(false);
return source;