use of javax.jcr.Repository in project jackrabbit by apache.
the class TestHelper method getSearchManager.
public static SearchManager getSearchManager(Session session) throws NotExecutableException, RepositoryException {
Repository r = session.getRepository();
if (!(r instanceof RepositoryImpl)) {
throw new NotExecutableException();
}
RepositoryImpl ri = (RepositoryImpl) r;
return ri.getSearchManager(session.getWorkspace().getName());
}
use of javax.jcr.Repository in project jackrabbit by apache.
the class ConnectionFactoryTest method testExceptionHandling.
/**
* Tests if a NoSuchWorkspaceException is thrown if a wrong workspace name is given to login
*/
public void testExceptionHandling() throws Exception {
Object cf = mcf.createConnectionFactory();
Repository repository = (Repository) cf;
try {
repository.login(JCR_SUPERUSER, "xxx");
} catch (Exception e) {
assertTrue(e instanceof NoSuchWorkspaceException);
}
}
use of javax.jcr.Repository in project jackrabbit by apache.
the class RepositoryFactoryImplTest method testGetSpi2davRepository.
public void testGetSpi2davRepository() throws RepositoryException {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("org.apache.jackrabbit.spi.RepositoryServiceFactory", "org.apache.jackrabbit.spi2dav.Spi2davRepositoryServiceFactory");
parameters.put("org.apache.jackrabbit.spi2dav.uri", "http://localhost/");
try {
Repository repo = factory.getRepository(parameters);
assertNotNull(repo);
} catch (RepositoryException e) {
// factory is working correctly, it is safe to ignore them.
if (!(ConnectException.class.isInstance(e.getCause()) || DavException.class.isInstance(e.getCause()))) {
throw e;
}
}
}
use of javax.jcr.Repository in project jackrabbit by apache.
the class RepositoryFactoryImplTest method testGetRepositoryWithLogger.
public void testGetRepositoryWithLogger() throws RepositoryException {
List<Object> lwprovider = new ArrayList<Object>();
lwprovider.add(null);
lwprovider.add(true);
lwprovider.add(new Slf4jLogWriterProvider());
Map<String, Object> params = new HashMap<String, Object>();
params.put("org.apache.jackrabbit.jcr2spi.RepositoryConfig", RepositoryConfigImpl.INSTANCE);
for (Object aLwprovider : lwprovider) {
params.put("org.apache.jackrabbit.spi.commons.logging.LogWriterProvider", aLwprovider);
Repository repo = factory.getRepository(params);
assertNotNull(repo);
}
}
use of javax.jcr.Repository in project jackrabbit by apache.
the class RepositoryFactoryImplTest method testGetRepositoryUnknownParams.
public void testGetRepositoryUnknownParams() throws RepositoryException {
Repository repo = factory.getRepository(Collections.emptyMap());
assertNull(repo);
}
Aggregations