Skip to content

Commit

Permalink
1.5: Merged revision 713037 (JCR-1851). Ignored revisions 712984 and …
Browse files Browse the repository at this point in the history
…712985.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/branches/1.5@718214 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jukka committed Nov 17, 2008
1 parent a8c6c2b commit 3f55ec2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Expand Up @@ -101,14 +101,16 @@ public Credentials getReadOnlyCredentials() throws RepositoryException {
public SessionInfo getAdminSessionInfo() throws RepositoryException {
// force assignment of repoStub
getRepositoryService();
String wspName = repoServiceStub.getProperty(RepositoryServiceStub.PROP_WORKSPACE);
String propName = RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_WORKSPACE;
String wspName = repoServiceStub.getProperty(propName);
return getRepositoryService().obtain(getAdminCredentials(), wspName);
}

public SessionInfo getReadOnlySessionInfo() throws RepositoryException {
// force assignment of repoStub
getRepositoryService();
String wspName = repoServiceStub.getProperty(RepositoryServiceStub.PROP_WORKSPACE);
String propName = RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_WORKSPACE;
String wspName = repoServiceStub.getProperty(propName);
return getRepositoryService().obtain(getReadOnlyCredentials(), wspName);
}
}
Expand Up @@ -58,7 +58,18 @@ public void testGetWorkspaceNames() throws RepositoryException {
assertTrue("Workspace names must contain at least a single workspace", workspaceNames.length > 0);

String wspName = getProperty(RepositoryServiceStub.PROP_WORKSPACE);
assertTrue("Workspace name used for retrieving the SessionInfo must be included in the available workspaces.", Arrays.asList(workspaceNames).contains(wspName));
if (wspName != null) {
assertTrue("Workspace name used for retrieving the SessionInfo must be included in the available workspaces.", Arrays.asList(workspaceNames).contains(wspName));
}
}

public void testNullWorkspaceName() throws RepositoryException {
SessionInfo sInfo = service.obtain(helper.getAdminCredentials(), null);
try {
assertNotNull(sInfo.getWorkspaceName());
} finally {
service.dispose(sInfo);
}
}

// TODO: add more tests
Expand Down
Expand Up @@ -42,7 +42,11 @@ protected void tearDown() throws Exception {
}

public void testGetWorkspaceName() {
assertEquals(workspaceName, sessionInfo.getWorkspaceName());
if (workspaceName == null) {
assertNotNull(sessionInfo.getWorkspaceName());
} else {
assertEquals(workspaceName, sessionInfo.getWorkspaceName());
}
}

// TODO: add more tests
Expand Down

0 comments on commit 3f55ec2

Please sign in to comment.