use of org.apache.jackrabbit.oak.jcr.Jcr in project jackrabbit-oak by apache.
the class ExternalIdentityImporterTest method before.
@Before
public void before() throws Exception {
securityProvider = new TestSecurityProvider(getConfigurationParameters(), new ExternalPrincipalConfiguration());
QueryEngineSettings queryEngineSettings = new QueryEngineSettings();
queryEngineSettings.setFailTraversal(true);
Jcr jcr = new Jcr();
jcr.with(securityProvider);
jcr.with(queryEngineSettings);
repo = jcr.createRepository();
}
use of org.apache.jackrabbit.oak.jcr.Jcr in project jackrabbit-oak by apache.
the class AbstractRandomizedTest method setUp.
@Before
public void setUp() throws Exception {
jackrabbitRepository = JcrUtils.getRepository(new File("target", "jackrabbit").toURI().toURL().toString());
oakRepository = new Jcr().createRepository();
writeSessions.add((JackrabbitSession) jackrabbitRepository.login(new SimpleCredentials("admin", "admin".toCharArray())));
writeSessions.add((JackrabbitSession) oakRepository.login(new SimpleCredentials("admin", "admin".toCharArray())));
setupAuthorizables();
setupContent();
readSessions.add(jackrabbitRepository.login(new SimpleCredentials(userId, userId.toCharArray())));
readSessions.add(oakRepository.login(new SimpleCredentials(userId, userId.toCharArray())));
}
use of org.apache.jackrabbit.oak.jcr.Jcr in project jackrabbit-oak by apache.
the class ImportIgnoreTest method before.
@Before
public void before() throws Exception {
String importBehavior = getImportBehavior();
SecurityProvider securityProvider;
if (importBehavior != null) {
Map<String, String> params = new HashMap<String, String>();
params.put(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, getImportBehavior());
ConfigurationParameters config = ConfigurationParameters.of(AuthorizationConfiguration.NAME, ConfigurationParameters.of(params));
securityProvider = new SecurityProviderImpl(config);
} else {
securityProvider = new SecurityProviderImpl();
}
QueryEngineSettings queryEngineSettings = new QueryEngineSettings();
queryEngineSettings.setFailTraversal(true);
Jcr jcr = new Jcr();
jcr.with(securityProvider);
jcr.with(queryEngineSettings);
repo = jcr.createRepository();
adminSession = repo.login(new SimpleCredentials(UserConstants.DEFAULT_ADMIN_ID, UserConstants.DEFAULT_ADMIN_ID.toCharArray()));
target = adminSession.getRootNode().addNode("nodeName1");
target.addMixin("rep:AccessControllable");
adminSession.save();
}
use of org.apache.jackrabbit.oak.jcr.Jcr in project jackrabbit-oak by apache.
the class AbstractImportTest method before.
@Before
public void before() throws Exception {
ConfigurationParameters config = getConfigurationParameters();
if (config != null) {
securityProvider = new SecurityProviderImpl(config);
} else {
securityProvider = new SecurityProviderImpl();
}
QueryEngineSettings queryEngineSettings = new QueryEngineSettings();
queryEngineSettings.setFailTraversal(true);
Jcr jcr = new Jcr();
jcr.with(securityProvider);
jcr.with(queryEngineSettings);
repo = jcr.createRepository();
adminSession = repo.login(new SimpleCredentials(UserConstants.DEFAULT_ADMIN_ID, UserConstants.DEFAULT_ADMIN_ID.toCharArray()));
if (!(adminSession instanceof JackrabbitSession)) {
throw new NotExecutableException();
}
userMgr = ((JackrabbitSession) adminSession).getUserManager();
preTestAuthorizables.clear();
Iterator<Authorizable> iter = userMgr.findAuthorizables("rep:principalName", null);
while (iter.hasNext()) {
String id = iter.next().getID();
preTestAuthorizables.add(id);
}
// make sure the target node for group-import exists
Authorizable administrators = userMgr.getAuthorizable(ADMINISTRATORS);
if (userMgr.getAuthorizable(ADMINISTRATORS) == null) {
userMgr.createGroup(new PrincipalImpl(ADMINISTRATORS));
} else if (!administrators.isGroup()) {
throw new NotExecutableException("Expected " + administrators.getID() + " to be a group.");
}
adminSession.save();
}
use of org.apache.jackrabbit.oak.jcr.Jcr in project jackrabbit by apache.
the class BackwardsCompatibilityIT method testBackwardsCompatibility.
public void testBackwardsCompatibility() throws Exception {
// Force loading of the Derby JDBC driver
new EmbeddedDriver();
File target = new File("target/backwards-compatibility-test");
FileUtils.deleteDirectory(target);
target.mkdirs();
File source = new File("src/test/resources/compatibility.zip");
unpack(source, target);
for (File dir : target.listFiles()) {
if (dir.isDirectory()) {
log.info("Testing backwards compatibility with {}", dir);
checkJackrabbitRepository(dir);
NodeStore store = new SegmentNodeStore();
RepositoryUpgrade.copy(dir, store);
checkRepositoryContent(new Jcr(new Oak(store)).createRepository());
}
}
}
Aggregations