use of javax.jcr.Repository in project jackrabbit-oak by apache.
the class RevisionGCTest method run.
@Override
public void run(Iterable<RepositoryFixture> fixtures) {
for (RepositoryFixture fixture : fixtures) {
if (fixture.isAvailable(1)) {
System.out.format("%s: RevisionGC benchmark%n", fixture);
try {
final AtomicReference<Oak> whiteboardRef = new AtomicReference<Oak>();
Repository[] cluster;
if (fixture instanceof OakRepositoryFixture) {
cluster = ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {
@Override
public Jcr customize(Oak oak) {
whiteboardRef.set(oak);
return new Jcr(oak);
}
});
} else {
System.err.format("%s: RevisionGC benchmark only runs on Oak%n", fixture);
return;
}
try {
run(cluster[0], getNodeStore(whiteboardRef.get()));
} finally {
fixture.tearDownCluster();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of javax.jcr.Repository in project jackrabbit-oak by apache.
the class ObservationTest method run.
@Override
public void run(Iterable<RepositoryFixture> fixtures) {
for (RepositoryFixture fixture : fixtures) {
if (fixture.isAvailable(1)) {
System.out.format("%s: Observation throughput benchmark%n", fixture);
try {
final AtomicReference<Whiteboard> whiteboardRef = new AtomicReference<Whiteboard>();
Repository[] cluster;
if (fixture instanceof OakRepositoryFixture) {
cluster = ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {
@Override
public Jcr customize(Oak oak) {
whiteboardRef.set(oak.getWhiteboard());
return new Jcr(oak);
}
});
} else {
cluster = fixture.setUpCluster(1);
}
try {
run(cluster[0], whiteboardRef.get());
} finally {
fixture.tearDownCluster();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of javax.jcr.Repository in project jackrabbit-oak by apache.
the class RepositoryTest method loginInvalidWorkspace.
@Test(expected = NoSuchWorkspaceException.class)
public void loginInvalidWorkspace() throws RepositoryException {
Repository repository = getRepository();
repository.login(new GuestCredentials(), "invalid");
}
use of javax.jcr.Repository in project jackrabbit-oak by apache.
the class ValidNamesTest method tearDown.
@After
public void tearDown() throws RepositoryException {
Session s = testNode.getSession();
s.removeItem(TEST_PATH);
s.save();
Repository r = s.getRepository();
s.logout();
dispose(r);
}
use of javax.jcr.Repository in project jackrabbit-oak by apache.
the class JsonIndexCommand method openSession.
public static Session openSession(NodeStore nodeStore) throws RepositoryException {
if (nodeStore == null) {
return null;
}
StatisticsProvider statisticsProvider = StatisticsProvider.NOOP;
Oak oak = new Oak(nodeStore).with(ManagementFactory.getPlatformMBeanServer());
oak.getWhiteboard().register(StatisticsProvider.class, statisticsProvider, Collections.emptyMap());
LuceneIndexProvider provider = createLuceneIndexProvider();
oak.with((QueryIndexProvider) provider).with((Observer) provider).with(createLuceneIndexEditorProvider());
Jcr jcr = new Jcr(oak);
Repository repository = jcr.createRepository();
return repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
}
Aggregations