Search in sources :

Example 81 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class CopyCheckpointsTest method prepare.

@Before
@Override
public void prepare() throws Exception {
    NodeStore source = getSourceContainer().open();
    try {
        initContent(source);
    } finally {
        getSourceContainer().close();
    }
    String[] args = getArgs();
    log.info("oak2oak {}", Joiner.on(' ').join(args));
    try {
        MigrationCliArguments cliArgs = new MigrationCliArguments(OptionParserFactory.create().parse(args));
        MigrationOptions options = new MigrationOptions(cliArgs);
        StoreArguments stores = new StoreArguments(options, cliArgs.getArguments());
        DatastoreArguments datastores = new DatastoreArguments(options, stores, stores.srcUsesEmbeddedDatastore());
        OakUpgrade.migrate(options, stores, datastores);
    } catch (RuntimeException e) {
        if (expectedResult == Result.EXCEPTION) {
            return;
        } else {
            throw e;
        }
    }
    if (expectedResult == Result.EXCEPTION) {
        fail("Migration should fail");
    }
    createSession();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StoreArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.StoreArguments) MigrationCliArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationCliArguments) MigrationOptions(org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions) DatastoreArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.DatastoreArguments) Before(org.junit.Before)

Example 82 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class CopyVersionHistorySidegradeTest method performCopy.

@Override
protected Session performCopy(VersionCopySetup setup) throws RepositoryException, IOException {
    final NodeStore targetNodeStore = new MemoryNodeStore();
    final RepositorySidegrade sidegrade = new RepositorySidegrade(sourceNodeStore, targetNodeStore);
    setup.setup(sidegrade.versionCopyConfiguration);
    sidegrade.copy();
    repository = (RepositoryImpl) new Jcr(new Oak(targetNodeStore)).createRepository();
    Session s = repository.login(AbstractRepositoryUpgradeTest.CREDENTIALS);
    sessions.add(s);
    return s;
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Oak(org.apache.jackrabbit.oak.Oak) Session(javax.jcr.Session)

Example 83 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class IgnoreMissingBinariesTest method prepare.

@Before
public void prepare() throws Exception {
    NodeStore source = getSourceContainer().open();
    try {
        initContent(source);
    } finally {
        getSourceContainer().close();
    }
    assertTrue(new File(blob.getDirectory(), "0c/07/02/0c0702b43bfcc7c0bb1329a10bbc6d5c5ef15856afd714c1331495b95f65b292").delete());
    String[] args = getArgs();
    log.info("oak2oak {}", Joiner.on(' ').join(args));
    OakUpgrade.main(args);
    createSession();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) File(java.io.File) Before(org.junit.Before)

Example 84 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class IncludeExcludeSidegradeTest method upgradeRepository.

@Before
public synchronized void upgradeRepository() throws Exception {
    if (targetNodeStore == null) {
        File directory = getTestDirectory();
        File source = new File(directory, "source");
        source.mkdirs();
        FileStore fileStore = fileStoreBuilder(source).build();
        SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
        RepositoryImpl repository = (RepositoryImpl) new Jcr(new Oak(segmentNodeStore)).createRepository();
        Session session = repository.login(CREDENTIALS);
        try {
            createSourceContent(session);
        } finally {
            session.save();
            session.logout();
            repository.shutdown();
            fileStore.close();
        }
        final NodeStore target = getTargetNodeStore();
        doUpgradeRepository(source, target);
        targetNodeStore = target;
    }
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) RepositoryImpl(org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Oak(org.apache.jackrabbit.oak.Oak) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) File(java.io.File) Session(javax.jcr.Session) Before(org.junit.Before)

Example 85 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore 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;
    }
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) RepositoryImpl(org.apache.jackrabbit.core.RepositoryImpl) File(java.io.File) Session(javax.jcr.Session) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession) Before(org.junit.Before)

Aggregations

NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)141 Test (org.junit.Test)81 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)58 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)52 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)29 Blob (org.apache.jackrabbit.oak.api.Blob)24 Before (org.junit.Before)18 FileInputStream (java.io.FileInputStream)16 Hex.encodeHexString (org.apache.commons.codec.binary.Hex.encodeHexString)16 File (java.io.File)14 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)14 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)14 ProxyNodeStore (org.apache.jackrabbit.oak.spi.state.ProxyNodeStore)13 Oak (org.apache.jackrabbit.oak.Oak)10 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)10 StandbyClientSync (org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)10 StandbyServerSync (org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)10 DocumentNodeStore (org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore)9 MemoryStore (org.apache.jackrabbit.oak.segment.memory.MemoryStore)9 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)9