use of org.apache.jackrabbit.core.RepositoryImpl in project jackrabbit by apache.
the class DefaultLoginModuleTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
RepositoryConfig rc = ((RepositoryImpl) superuser.getRepository()).getConfig();
String workspaceName = rc.getSecurityConfig().getSecurityManagerConfig().getWorkspaceName();
if (workspaceName == null) {
workspaceName = rc.getDefaultWorkspaceName();
}
securitySession = getHelper().getSuperuserSession(workspaceName);
}
use of org.apache.jackrabbit.core.RepositoryImpl in project jackrabbit by apache.
the class DbClusterTest method test.
public void test() throws RepositoryException {
RepositoryImpl rep1 = RepositoryImpl.create(RepositoryConfig.create(new File("./target/dbClusterTest/node1")));
RepositoryImpl rep2 = RepositoryImpl.create(RepositoryConfig.create(new File("./target/dbClusterTest/node2")));
Session s1 = rep1.login(new SimpleCredentials("admin", "admin".toCharArray()));
Session s2 = rep2.login(new SimpleCredentials("admin", "admin".toCharArray()));
s1.getRootNode().addNode("test1");
s2.getRootNode().addNode("test2");
s1.save();
s2.save();
s1.refresh(true);
s2.refresh(true);
s1.getRootNode().getNode("test2");
s2.getRootNode().getNode("test1");
rep1.shutdown();
rep2.shutdown();
}
use of org.apache.jackrabbit.core.RepositoryImpl in project jackrabbit-oak by apache.
the class RepeatedRepositoryUpgradeTest method upgradeRepository.
@Before
public synchronized void upgradeRepository() throws Exception {
if (!upgradeComplete) {
final File sourceDir = new File(getTestDirectory(), "jackrabbit2");
sourceDir.mkdirs();
RepositoryImpl source = createSourceRepository(sourceDir);
Session session = source.login(CREDENTIALS);
try {
createSourceContent(session);
} finally {
session.save();
session.logout();
source.shutdown();
}
final NodeStore target = getTargetNodeStore();
doUpgradeRepository(sourceDir, target, false);
fileStore.flush();
// re-create source repo
source = createSourceRepository(sourceDir);
session = source.login(CREDENTIALS);
try {
modifySourceContent(session);
} finally {
session.save();
session.logout();
source.shutdown();
}
doUpgradeRepository(sourceDir, target, true);
fileStore.flush();
upgradeComplete = true;
}
}
use of org.apache.jackrabbit.core.RepositoryImpl in project jackrabbit-oak by apache.
the class LongNameTest method prepareSourceRepository.
@BeforeClass
public static void prepareSourceRepository() throws RepositoryException, IOException, InterruptedException {
crx2RepoDir = new File("target", "upgrade-" + Clock.SIMPLE.getTimeIncreasing());
FileUtils.deleteQuietly(crx2RepoDir);
sourceRepositoryConfig = createCrx2Config(crx2RepoDir);
RepositoryContext ctx = RepositoryContext.create(sourceRepositoryConfig);
RepositoryImpl sourceRepository = ctx.getRepository();
Session session = sourceRepository.login(CREDENTIALS);
try {
Assert.assertTrue(TOO_LONG_NAME.getBytes().length > 150);
Assert.assertTrue(NOT_TOO_LONG_NAME.getBytes().length < 150);
Node longNameParent = createParent(session.getRootNode());
Assert.assertTrue(longNameParent.getPath().length() >= 350);
longNameParent.addNode(TOO_LONG_NAME);
longNameParent.addNode(NOT_TOO_LONG_NAME);
session.save();
Assert.assertTrue(longNameParent.hasNode(TOO_LONG_NAME));
Assert.assertTrue(longNameParent.hasNode(NOT_TOO_LONG_NAME));
} finally {
session.logout();
}
sourceRepository.shutdown();
}
use of org.apache.jackrabbit.core.RepositoryImpl in project jackrabbit-oak by apache.
the class AbstractRepositoryUpgradeTest method upgradeRepository.
@Before
public synchronized void upgradeRepository() throws Exception {
if (targetNodeStore == null) {
File directory = getTestDirectory();
File source = new File(directory, "source");
source.mkdirs();
RepositoryImpl repository = createSourceRepository(source);
Session session = repository.login(CREDENTIALS);
try {
createSourceContent(session);
} finally {
session.save();
session.logout();
repository.shutdown();
}
final NodeStore target = getTargetNodeStore();
doUpgradeRepository(source, target);
targetNodeStore = target;
}
}
Aggregations