Search in sources :

Example 1 with CliArgumentException

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

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

the class OakUpgrade method main.

public static void main(String... args) throws IOException {
    OptionSet options = OptionParserFactory.create().parse(args);
    try {
        MigrationCliArguments cliArguments = new MigrationCliArguments(options);
        if (cliArguments.hasOption(OptionParserFactory.HELP) || cliArguments.getArguments().isEmpty()) {
            CliUtils.displayUsage();
            return;
        }
        migrate(cliArguments);
    } catch (CliArgumentException e) {
        if (e.getMessage() != null) {
            System.err.println(e.getMessage());
        }
        System.exit(e.getExitCode());
    }
}
Also used : CliArgumentException(org.apache.jackrabbit.oak.upgrade.cli.parser.CliArgumentException) OptionSet(joptsimple.OptionSet) MigrationCliArguments(org.apache.jackrabbit.oak.upgrade.cli.parser.MigrationCliArguments)

Aggregations

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