test_class.declarator: connectionFactory = new MongoConnectionFactory()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public MongoConnectionFactory connectionFactory = new MongoConnectionFactory();
test_class.type: MongoConnectionFactory
test_class.var_name: connectionFactory
test_class.declarator: builderProvider = new DocumentMKBuilderProvider()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public DocumentMKBuilderProvider builderProvider = new DocumentMKBuilderProvider();
test_class.type: DocumentMKBuilderProvider
test_class.var_name: builderProvider
test_class.declarator: ns
test_class.modifier: private
test_class.original_string: private DocumentNodeStore ns;
test_class.type: DocumentNodeStore
test_class.var_name: ns
test_class.file: oak-run/src/test/java/org/apache/jackrabbit/oak/run/UnlockUpgradeCommandTest.java
test_class.identifier: UnlockUpgradeCommandTest
test_case.body: @Test
      public void unlockUpgrade() throws Exception {
          ns.dispose();
          // revert format version back to something old
          resetFormatVersion(FormatVersion.valueOf("0.0.1"));
          // execute command
          UnlockUpgradeCommand cmd = new UnlockUpgradeCommand();
          cmd.execute(MongoUtils.URL);
          // verify
  
          FormatVersion v = versionOf(createDocumentNodeStore().getDocumentStore());
          assertEquals(DocumentNodeStore.VERSION, v);
      }
test_case.class_method_signature: UnlockUpgradeCommandTest.unlockUpgrade()
test_case.full_signature: @Test public void unlockUpgrade()
test_case.identifier: unlockUpgrade
test_case.invocations: dispose resetFormatVersion valueOf execute versionOf getDocumentStore createDocumentNodeStore assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void unlockUpgrade()
focal_class.file: oak-run/src/main/java/org/apache/jackrabbit/oak/run/UnlockUpgradeCommand.java
focal_class.identifier: UnlockUpgradeCommand
focal_class.interfaces: implements Command
focal_class.class_method_signature: UnlockUpgradeCommand.execute(String... args)
focal_class.full_signature: @Override public void execute(String... args)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (String... args)
focal_class.return: void
focal_class.signature: void execute(String... args)
focal_method.body: @Override
      public void execute(String... args) throws Exception {
          OptionParser parser = new OptionParser();
          // RDB specific options
          OptionSpec<String> rdbjdbcuser = parser.accepts("rdbjdbcuser", "RDB JDBC user").withOptionalArg().defaultsTo("");
          OptionSpec<String> rdbjdbcpasswd = parser.accepts("rdbjdbcpasswd", "RDB JDBC password").withOptionalArg().defaultsTo("");
  
          OptionSpec<String> nonOption = parser.nonOptions("unlockUpgrade {<jdbc-uri> | <mongodb-uri>}");
          OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp();
  
          OptionSet options = parser.parse(args);
          List<String> nonOptions = nonOption.values(options);
  
          if (options.has(help)) {
              parser.printHelpOn(System.out);
              return;
          }
  
          if (nonOptions.isEmpty()) {
              parser.printHelpOn(System.err);
              return;
          }
  
          DocumentStore store = null;
          try {
              String uri = nonOptions.get(0);
              if (uri.startsWith(MONGODB_PREFIX)) {
                  MongoClientURI clientURI = new MongoClientURI(uri);
                  if (clientURI.getDatabase() == null) {
                      System.err.println("Database missing in MongoDB URI: " + clientURI.getURI());
                  } else {
                      MongoConnection mongo = new MongoConnection(clientURI.getURI());
                      store = new MongoDocumentStore(
                              mongo.getMongoClient(), mongo.getDatabase(),
                              new MongoDocumentNodeStoreBuilder());
                  }
              } else if (uri.startsWith("jdbc")) {
                  DataSource ds = RDBDataSourceFactory.forJdbcUrl(uri,
                          rdbjdbcuser.value(options), rdbjdbcpasswd.value(options));
                  store = new RDBDocumentStore(ds, new DocumentNodeStoreBuilder());
              } else {
                  System.err.println("Unrecognized URI: " + uri);
              }
  
              if (store != null && VERSION.writeTo(store)) {
                  System.out.println("Format version set to " + VERSION);
              }
          } catch (DocumentStoreException e) {
              System.err.println(e.getMessage());
          } finally {
              if (store != null) {
                  store.dispose();
              }
          }
      }
focal_method.class_method_signature: UnlockUpgradeCommand.execute(String... args)
focal_method.full_signature: @Override public void execute(String... args)
focal_method.identifier: execute
focal_method.invocations: defaultsTo withOptionalArg accepts defaultsTo withOptionalArg accepts nonOptions forHelp acceptsAll asList parse values has printHelpOn isEmpty printHelpOn get startsWith getDatabase println getURI getURI getMongoClient getDatabase startsWith forJdbcUrl value value println writeTo println println getMessage dispose
focal_method.modifiers: @Override public
focal_method.parameters: (String... args)
focal_method.return: void
focal_method.signature: void execute(String... args)