Search in sources :

Example 1 with MigrationOptions

use of org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions in project jackrabbit-oak by apache.

the class CopyBinariesTest 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);
        assertEquals(blobMigrationCase, datastores.getBlobMigrationCase());
    } catch (CliArgumentException e) {
        if (blobMigrationCase == DatastoreArguments.BlobMigrationCase.UNSUPPORTED) {
            return;
        } else {
            throw e;
        }
    }
    createSession();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StoreArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.StoreArguments) CliArgumentException(org.apache.jackrabbit.oak.upgrade.cli.parser.CliArgumentException) 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 2 with MigrationOptions

use of org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions in project jackrabbit-oak by apache.

the class OakUpgrade method migrate.

public static void migrate(MigrationCliArguments argumentParser) throws IOException, CliArgumentException {
    MigrationOptions options = new MigrationOptions(argumentParser);
    options.logOptions();
    StoreArguments stores = new StoreArguments(options, argumentParser.getArguments());
    stores.logOptions();
    boolean srcEmbedded = stores.srcUsesEmbeddedDatastore();
    DatastoreArguments datastores = new DatastoreArguments(options, stores, srcEmbedded);
    migrate(options, stores, datastores);
}
Also used : StoreArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.StoreArguments) MigrationOptions(org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions) DatastoreArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.DatastoreArguments)

Example 3 with MigrationOptions

use of org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions 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)

Aggregations

DatastoreArguments (org.apache.jackrabbit.oak.upgrade.cli.parser.DatastoreArguments)3 MigrationOptions (org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationOptions)3 StoreArguments (org.apache.jackrabbit.oak.upgrade.cli.parser.StoreArguments)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)2 MigrationCliArguments (org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationCliArguments)2 Before (org.junit.Before)2 CliArgumentException (org.apache.jackrabbit.oak.upgrade.cli.parser.CliArgumentException)1