Search in sources :

Example 6 with RepositoryConfig

use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.

the class SameNodeSiblingsTest method migrate.

private DocumentNodeStore migrate(SourceDataCreator sourceDataCreator) throws RepositoryException, IOException {
    RepositoryConfig config = RepositoryConfig.install(crx2RepoDir);
    RepositoryImpl repository = RepositoryImpl.create(config);
    try {
        Session session = repository.login(CREDENTIALS);
        sourceDataCreator.create(session);
        session.logout();
    } finally {
        repository.shutdown();
    }
    // re-create the config
    config = RepositoryConfig.install(crx2RepoDir);
    RepositoryContext context = RepositoryContext.create(config);
    DocumentNodeStore target = new DocumentMK.Builder().getNodeStore();
    try {
        RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
        upgrade.copy(null);
    } finally {
        context.getRepository().shutdown();
    }
    return target;
}
Also used : RepositoryConfig(org.apache.jackrabbit.core.config.RepositoryConfig) RepositoryContext(org.apache.jackrabbit.core.RepositoryContext) RepositoryImpl(org.apache.jackrabbit.core.RepositoryImpl) DocumentMK(org.apache.jackrabbit.oak.plugins.document.DocumentMK) DocumentNodeStore(org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore) Session(javax.jcr.Session)

Example 7 with RepositoryConfig

use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.

the class IncludeExcludeUpgradeTest method doUpgradeRepository.

@Override
protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException, IOException {
    final RepositoryConfig config = RepositoryConfig.create(source);
    final RepositoryContext context = RepositoryContext.create(config);
    try {
        final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
        upgrade.setIncludes("/content/foo/en", "/content/assets/foo", "/content/other");
        upgrade.setExcludes("/content/assets/foo/2013", "/content/assets/foo/2012", "/content/assets/foo/2011", "/content/assets/foo/2010");
        upgrade.setExcludeFragments("oak-mount-libs-xyz");
        upgrade.setFragmentPaths("/content/other/path");
        upgrade.copy(null);
    } finally {
        context.getRepository().shutdown();
    }
}
Also used : RepositoryConfig(org.apache.jackrabbit.core.config.RepositoryConfig) RepositoryContext(org.apache.jackrabbit.core.RepositoryContext)

Example 8 with RepositoryConfig

use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.

the class UpgradeFromTwoSourcesTest method doUpgradeRepository.

private void doUpgradeRepository(File source, NodeStore target, String... includes) throws RepositoryException {
    final RepositoryConfig config = RepositoryConfig.create(source);
    final RepositoryContext context = RepositoryContext.create(config);
    try {
        final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target);
        upgrade.setIncludes(includes);
        upgrade.copy(null);
    } finally {
        context.getRepository().shutdown();
    }
}
Also used : RepositoryConfig(org.apache.jackrabbit.core.config.RepositoryConfig) RepositoryContext(org.apache.jackrabbit.core.RepositoryContext)

Example 9 with RepositoryConfig

use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.

the class RepeatedRepositoryUpgradeTest method doUpgradeRepository.

protected void doUpgradeRepository(File source, NodeStore target, boolean skipInit) throws RepositoryException, IOException {
    final RepositoryConfig config = RepositoryConfig.create(source);
    final RepositoryContext context = RepositoryContext.create(config);
    try {
        final RepositoryUpgrade repositoryUpgrade = new RepositoryUpgrade(context, target);
        repositoryUpgrade.setSkipInitialization(skipInit);
        repositoryUpgrade.copy(new RepositoryInitializer() {

            @Override
            public void initialize(@Nonnull NodeBuilder builder) {
                builder.child("foo").child("bar");
            }
        });
    } finally {
        context.getRepository().shutdown();
    }
}
Also used : RepositoryConfig(org.apache.jackrabbit.core.config.RepositoryConfig) RepositoryContext(org.apache.jackrabbit.core.RepositoryContext) RepositoryInitializer(org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Example 10 with RepositoryConfig

use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.

the class LongNameTest method assertNoLongNamesTest.

@Test
public void assertNoLongNamesTest() throws IOException, RepositoryException {
    RepositoryConfig config = createCrx2Config(crx2RepoDir);
    RepositoryContext context = RepositoryContext.create(config);
    try {
        RepositoryUpgrade upgrade = new RepositoryUpgrade(context, new MemoryNodeStore());
        try {
            upgrade.assertNoLongNames();
            fail("Exception should be thrown");
        } catch (RepositoryException e) {
        // that's fine
        }
    } finally {
        context.getRepository().shutdown();
    }
}
Also used : RepositoryConfig(org.apache.jackrabbit.core.config.RepositoryConfig) RepositoryContext(org.apache.jackrabbit.core.RepositoryContext) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) RepositoryException(javax.jcr.RepositoryException) Test(org.junit.Test)

Aggregations

RepositoryConfig (org.apache.jackrabbit.core.config.RepositoryConfig)23 File (java.io.File)10 RepositoryContext (org.apache.jackrabbit.core.RepositoryContext)7 RepositoryImpl (org.apache.jackrabbit.core.RepositoryImpl)6 RepositoryException (javax.jcr.RepositoryException)5 InputStream (java.io.InputStream)4 Repository (javax.jcr.Repository)4 Session (javax.jcr.Session)4 OutputStream (java.io.OutputStream)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Group (org.apache.jackrabbit.api.security.user.Group)2 User (org.apache.jackrabbit.api.security.user.User)2 RepositoryInitializer (org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer)2 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)2 Stopwatch (com.google.common.base.Stopwatch)1 FileOutputStream (java.io.FileOutputStream)1 Method (java.lang.reflect.Method)1 Properties (java.util.Properties)1 ZipFile (java.util.zip.ZipFile)1