Author: tolusha
Date: 2010-03-26 09:28:05 -0400 (Fri, 26 Mar 2010)
New Revision: 2168
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
EXOJCR-549: add dropRepository test
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2010-03-26
13:04:08 UTC (rev 2167)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2010-03-26
13:28:05 UTC (rev 2168)
@@ -20,9 +20,12 @@
import org.exoplatform.services.jcr.config.ContainerEntry;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
import org.exoplatform.services.jcr.ext.app.SessionProviderService;
import org.exoplatform.services.jcr.ext.app.ThreadLocalSessionProviderService;
@@ -38,6 +41,7 @@
import org.exoplatform.services.jcr.ext.backup.server.bean.response.ShortInfo;
import org.exoplatform.services.jcr.ext.backup.server.bean.response.ShortInfoList;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
+import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.rest.RequestHandler;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.impl.InputHeadersMap;
@@ -66,6 +70,7 @@
import java.util.List;
import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.ws.rs.core.MultivaluedMap;
@@ -1125,6 +1130,35 @@
}
}
+ public void testDropRepository() throws Exception
+ {
+
+ assertNotNull(repositoryService.getRepository("db5"));
+
+ for (String workspaceName :
repositoryService.getRepository("db5").getWorkspaceNames())
+ forceCloseSession("db5", workspaceName);
+
+ try
+ {
+ repositoryService.removeRepository("db5");
+ }
+ catch (Exception e)
+ {
+ fail();
+ }
+ }
+
+ private int forceCloseSession(String repositoryName, String workspaceName) throws
RepositoryException,
+ RepositoryConfigurationException
+ {
+ ManageableRepository mr = repositoryService.getRepository(repositoryName);
+ WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName);
+
+ SessionRegistry sessionRegistry =
(SessionRegistry)wc.getComponent(SessionRegistry.class);
+
+ return sessionRegistry.closeSessions(workspaceName);
+ }
+
protected WorkspaceEntry makeWorkspaceEntry(WorkspaceEntry defWEntry, String repoNmae,
String wsName,
String sourceName)
{
Show replies by date