@SuppressWarnings("deprecation")
  @Test
  public void shouldAllowSpecifyingOptions() throws Exception {
    configuration
        .repositorySource("Source2")
        .usingClass(InMemoryRepositorySource.class.getName())
        .loadedFromClasspath()
        .setDescription("description")
        .and()
        .repository("JCR Repository")
        .setSource("Source2")
        .setOption(Option.JAAS_LOGIN_CONFIG_NAME, "test");

    engine = configuration.build();
    engine.start();

    // Verify that the graph has been updated correctly ...
    Graph config = engine.getGraph(JcrConfiguration.DEFAULT_CONFIGURATION_SOURCE_NAME);
    Subgraph subgraph = config.getSubgraphOfDepth(6).at("/");
    assertThat(subgraph.getNode("/mode:sources"), is(notNullValue()));
    assertThat(subgraph.getNode("/mode:sources/Source2"), is(notNullValue()));
    assertThat(
        subgraph.getNode("/mode:sources/Source2"),
        hasProperty(ModeShapeLexicon.CLASSNAME, InMemoryRepositorySource.class.getName()));
    assertThat(subgraph.getNode("/mode:repositories"), is(notNullValue()));
    assertThat(subgraph.getNode("/mode:repositories/JCR Repository"), is(notNullValue()));
    assertThat(
        subgraph.getNode("/mode:repositories/JCR Repository"),
        hasProperty(ModeShapeLexicon.SOURCE_NAME, "Source2"));
    assertThat(
        subgraph.getNode("/mode:repositories/JCR Repository/mode:options"), is(notNullValue()));
    assertThat(
        subgraph.getNode("/mode:repositories/JCR Repository/mode:options/JAAS_LOGIN_CONFIG_NAME"),
        hasProperty(ModeShapeLexicon.VALUE, "test"));

    JcrRepository repository = engine.getRepository("JCR Repository");

    Map<Option, String> options = new HashMap<Option, String>();
    options.put(Option.JAAS_LOGIN_CONFIG_NAME, "test");
    options.put(Option.PROJECT_NODE_TYPES, DefaultOption.PROJECT_NODE_TYPES);
    options.put(Option.READ_DEPTH, DefaultOption.READ_DEPTH);
    options.put(Option.INDEX_READ_DEPTH, DefaultOption.INDEX_READ_DEPTH);
    options.put(Option.ANONYMOUS_USER_ROLES, DefaultOption.ANONYMOUS_USER_ROLES);
    options.put(
        Option.TABLES_INCLUDE_COLUMNS_FOR_INHERITED_PROPERTIES,
        DefaultOption.TABLES_INCLUDE_COLUMNS_FOR_INHERITED_PROPERTIES);
    options.put(Option.QUERY_EXECUTION_ENABLED, DefaultOption.QUERY_EXECUTION_ENABLED);
    options.put(Option.QUERY_INDEX_DIRECTORY, DefaultOption.QUERY_INDEX_DIRECTORY);
    options.put(
        Option.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY,
        DefaultOption.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY);
    options.put(
        Option.PERFORM_REFERENTIAL_INTEGRITY_CHECKS,
        DefaultOption.PERFORM_REFERENTIAL_INTEGRITY_CHECKS);
    options.put(
        Option.EXPOSE_WORKSPACE_NAMES_IN_DESCRIPTOR,
        DefaultOption.EXPOSE_WORKSPACE_NAMES_IN_DESCRIPTOR);
    options.put(Option.VERSION_HISTORY_STRUCTURE, DefaultOption.VERSION_HISTORY_STRUCTURE);
    options.put(Option.REPOSITORY_JNDI_LOCATION, DefaultOption.REPOSITORY_JNDI_LOCATION);
    options.put(
        Option.USE_ANONYMOUS_ACCESS_ON_FAILED_LOGIN,
        DefaultOption.USE_ANONYMOUS_ACCESS_ON_FAILED_LOGIN);
    options.put(
        Option.REBUILD_QUERY_INDEX_ON_STARTUP, DefaultOption.REBUILD_QUERY_INDEX_ON_STARTUP);
    options.put(
        Option.QUERY_INDEXES_REBUILT_SYNCHRONOUSLY,
        DefaultOption.QUERY_INDEXES_REBUILT_SYNCHRONOUSLY);
    String defaultRemoveDerivedValue = DefaultOption.REMOVE_DERIVED_CONTENT_WITH_ORIGINAL;
    if (engine.getSequencingService().getSequencers().isEmpty()) {
      defaultRemoveDerivedValue = Boolean.FALSE.toString();
    }
    options.put(Option.REMOVE_DERIVED_CONTENT_WITH_ORIGINAL, defaultRemoveDerivedValue);
    options.put(
        Option.USE_SECURITY_CONTEXT_CREDENTIALS, DefaultOption.USE_SECURITY_CONTEXT_CREDENTIALS);
    assertThat(repository.getOptions(), is(options));
  }