X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.server.jcr%2Fsrc%2Forg%2Fargeo%2Fjcr%2Funit%2FAbstractJcrTestCase.java;h=1269a3ee5730243b172896b546ff6191e3974dcc;hb=0d843d64df3f588ad1429905cf5f6e29c65becd3;hp=1d9eedc4d880826210df15837de507dfe63d8688;hpb=a9974420ad58fab72c0f67a8955a296cd546c27e;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.server.jcr/src/org/argeo/jcr/unit/AbstractJcrTestCase.java b/org.argeo.server.jcr/src/org/argeo/jcr/unit/AbstractJcrTestCase.java index 1d9eedc4d..1269a3ee5 100644 --- a/org.argeo.server.jcr/src/org/argeo/jcr/unit/AbstractJcrTestCase.java +++ b/org.argeo.server.jcr/src/org/argeo/jcr/unit/AbstractJcrTestCase.java @@ -26,12 +26,12 @@ import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import junit.framework.TestCase; - import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.ArgeoException; +import org.argeo.jcr.ArgeoJcrException; + +import junit.framework.TestCase; public abstract class AbstractJcrTestCase extends TestCase { private final static Log log = LogFactory.getLog(AbstractJcrTestCase.class); @@ -39,7 +39,7 @@ public abstract class AbstractJcrTestCase extends TestCase { private Repository repository; private Session session = null; - public final static String LOGIN_CONTEXT_TEST_SYSTEM = "TEST_SYSTEM"; + public final static String LOGIN_CONTEXT_TEST_SYSTEM = "TEST_JACKRABBIT_ADMIN"; // protected abstract File getRepositoryFile() throws Exception; @@ -75,7 +75,7 @@ public abstract class AbstractJcrTestCase extends TestCase { lc = new LoginContext(getLoginContext()); lc.login(); } catch (LoginException e) { - throw new ArgeoException("JAAS login failed", e); + throw new ArgeoJcrException("JAAS login failed", e); } session = Subject.doAs(lc.getSubject(), new PrivilegedAction() { @@ -107,7 +107,7 @@ public abstract class AbstractJcrTestCase extends TestCase { return getRepository().login( new SimpleCredentials("demo", "demo".toCharArray())); } catch (Exception e) { - throw new ArgeoException("Cannot login to repository", e); + throw new ArgeoJcrException("Cannot login to repository", e); } } @@ -123,30 +123,6 @@ public abstract class AbstractJcrTestCase extends TestCase { this.repository = repository; } - // public void logout() { - // if (session != null && session.isLive()) - // JcrUtils.logoutQuietly(session); - // } - // - // protected static TestSuite defaultTestSuite(Class - // clss) { - // String testSuiteClassName = - // "org.argeo.jackrabbit.unit.JackrabbitTestSuite"; - // try { - // Class testSuiteClass = AbstractJcrTestCase.class - // .getClassLoader().loadClass(testSuiteClassName); - // if (clss == null) { - // return (TestSuite) testSuiteClass.newInstance(); - // } else { - // return (TestSuite) testSuiteClass.getConstructor(Class.class) - // .newInstance(clss); - // } - // } catch (Exception e) { - // throw new ArgeoException("Cannot find default test suite " - // + testSuiteClassName, e); - // } - // } - protected File getHomeDir() { File homeDir = new File(System.getProperty("java.io.tmpdir"), AbstractJcrTestCase.class.getSimpleName() + "-"