assertThat(repository, is(notNullValue()));
}
@Test
public void shouldAllowSettingUpConfigurationRepositoryWithDifferentWorkspaceName() throws Exception {
InMemoryRepositorySource configSource = new InMemoryRepositorySource();
configSource.setName("config2");
configSource.setRetryLimit(5);
configuration.loadFrom(configSource, "workspaceXYZ");
configuration.repositorySource("Source2")
.usingClass(InMemoryRepositorySource.class.getName())
.loadedFromClasspath()
.setDescription("description")
.and()
.repository("JCR Repository")
.setSource("Source2")
.setOption(Option.JAAS_LOGIN_CONFIG_NAME, "test");
configuration.save();
// Save the configuration and start the engine ...
engine = configuration.build();
engine.start();
ConfigurationDefinition configDefn = configuration.getConfigurationDefinition();
assertThat(configDefn.getWorkspace(), is("workspaceXYZ"));
assertThat(configDefn.getPath(), is(path("/")));
// Get a graph to the configuration source ...
RepositorySource configReposSource = engine.getRepositoryService().getRepositoryLibrary().getSource("config2");
assertThat(configReposSource, is(notNullValue()));
assertThat(configReposSource, is(instanceOf(InMemoryRepositorySource.class)));
assertThat(configReposSource.getName(), is("config2"));
InMemoryRepositorySource configSource2 = (InMemoryRepositorySource)configReposSource;
assertThat(configSource2.getDefaultWorkspaceName(), is("")); // didn't change this
Graph graph = engine.getGraph("config2");
assertThat(graph, is(notNullValue()));
assertThat(graph.getNodeAt("/"), is(notNullValue()));
assertThat(graph.getNodeAt("/dna:sources"), is(notNullValue()));