/** * Get the immutable configuration for the repository with the supplied name. * * @param repositoryName the name of the deployed repository * @return the repository configuration; never null * @throws IllegalArgumentException if the repository name is null, blank or invalid * @throws NoSuchRepositoryException if there is no repository with the specified name * @throws IllegalStateException if this engine is not {@link #getState() running} */ public final RepositoryConfiguration getRepositoryConfiguration( String repositoryName ) throws NoSuchRepositoryException { return getRepository(repositoryName).getConfiguration(); }
/** * Get the immutable configuration for the repository with the supplied name. * * @param repositoryName the name of the deployed repository * @return the repository configuration; never null * @throws IllegalArgumentException if the repository name is null, blank or invalid * @throws NoSuchRepositoryException if there is no repository with the specified name * @throws IllegalStateException if this engine is not {@link #getState() running} */ public final RepositoryConfiguration getRepositoryConfiguration( String repositoryName ) throws NoSuchRepositoryException { return getRepository(repositoryName).getConfiguration(); }
@FixFor("MODE-1137") @Test public void shouldExportContentWithUnicodeCharactersAsSystemView() throws Exception { Node unicode = session.getRootNode().addNode("unicodeContent"); Node desc = unicode.addNode("descriptionNode"); desc.setProperty("ex1", "étudiant (student)"); desc.setProperty("ex2", "où (where)"); desc.setProperty("ex3", "forêt (forest)"); desc.setProperty("ex4", "naïve (naïve)"); desc.setProperty("ex5", "garçon (boy)"); desc.setProperty("ex6", "multi\nline\nvalue"); desc.setProperty("ex7", "prop \"value\" with quotes"); desc.setProperty("ex7", "values with \n various \t\n : characters"); session.save(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); session.exportSystemView("/unicodeContent", baos, false, false); baos.close(); predefineWorkspace(repository.getConfiguration(), "workspace2"); InputStream istream = new ByteArrayInputStream(baos.toByteArray()); Session session2 = repository.login("workspace2"); session2.getWorkspace().importXML("/", istream, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW); Node desc2 = session2.getNode("/unicodeContent/descriptionNode"); assertSameProperties(desc, desc2); }
RepositoryConfiguration config = repository.getConfiguration(); Problems problems = config.validate(changes); repository.setConfigurationProblems(problems);
@FixFor("MODE-1137") @Test public void shouldExportContentWithUnicodeCharactersAsDocumentView() throws Exception { Node unicode = session.getRootNode().addNode("unicodeContent"); Node desc = unicode.addNode("descriptionNode"); desc.setProperty("ex1", "étudiant (student)"); desc.setProperty("ex2", "où (where)"); desc.setProperty("ex3", "forêt (forest)"); desc.setProperty("ex4", "naïve (naïve)"); desc.setProperty("ex5", "garçon (boy)"); desc.setProperty("ex6", "multi\nline\nvalue"); desc.setProperty("ex7", "prop \"value\" with quotes"); desc.setProperty("ex7", "values with \r various \t\n : characters"); session.save(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); session.exportDocumentView("/unicodeContent", baos, false, false); baos.close(); predefineWorkspace(repository.getConfiguration(), "workspace2"); InputStream istream = new ByteArrayInputStream(baos.toByteArray()); Session session2 = repository.login("workspace2"); session2.getWorkspace().importXML("/", istream, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW); Node desc2 = session2.getNode("/unicodeContent/descriptionNode"); assertSameProperties(desc, desc2); }
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
Editor editor = repository.getConfiguration().edit(); EditableDocument sequencing = editor.getDocument(FieldName.SEQUENCING); EditableDocument sequencers = sequencing.getDocument(FieldName.SEQUENCERS);
@Test public void shouldAllowUpdatingRepositoryConfigurationWhileNotRunning() throws Exception { engine.start(); JcrRepository repository = engine.deploy(config); String name = repository.getName(); assertThat(engine.getRepositoryState(name), is(State.NOT_RUNNING)); assertThat(config.getBinaryStorage().getMinimumBinarySizeInBytes(), is(Default.MINIMUM_BINARY_SIZE_IN_BYTES)); // Change the configuration ... long newLargeValueSizeInBytes = Default.MINIMUM_BINARY_SIZE_IN_BYTES * 2; Editor editor = repository.getConfiguration().edit(); EditableDocument binaryStorage = editor.getOrCreateDocument(FieldName.STORAGE) .getOrCreateDocument(FieldName.BINARY_STORAGE); binaryStorage.setNumber(FieldName.MINIMUM_BINARY_SIZE_IN_BYTES, newLargeValueSizeInBytes); Changes changes = editor.getChanges(); // Apply the changes to the deployed repository ... engine.update(name, changes).get(); // blocks assertThat(engine.getRepositoryState(name), is(State.NOT_RUNNING)); RepositoryConfiguration newConfig = engine.getRepository(name).getConfiguration(); assertThat(newConfig.getBinaryStorage().getMinimumBinarySizeInBytes(), is(newLargeValueSizeInBytes)); }
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
@Test public void shouldAllowUpdatingRepositoryConfigurationWhileRunning() throws Exception { engine.start(); JcrRepository repository = engine.deploy(config); String name = repository.getName(); assertThat(engine.getRepositoryState(name), is(State.NOT_RUNNING)); engine.startRepository(name).get(); // blocks assertThat(engine.getRepositoryState(name), is(State.RUNNING)); long defaultLargeValueSize = Default.MINIMUM_BINARY_SIZE_IN_BYTES; assertThat(config.getBinaryStorage().getMinimumBinarySizeInBytes(), is(defaultLargeValueSize)); assertThat(repository.repositoryCache().largeValueSizeInBytes(), is(defaultLargeValueSize)); // Change the configuration. We'll do something simple, like changing the large value size ... long newLargeValueSizeInBytes = defaultLargeValueSize * 2L; Editor editor = repository.getConfiguration().edit(); EditableDocument binaryStorage = editor.getOrCreateDocument(FieldName.STORAGE) .getOrCreateDocument(FieldName.BINARY_STORAGE); binaryStorage.setNumber(FieldName.MINIMUM_BINARY_SIZE_IN_BYTES, newLargeValueSizeInBytes); Changes changes = editor.getChanges(); // Apply the changes to the deployed repository ... engine.update(name, changes).get(); // blocks assertThat(engine.getRepositoryState(name), is(State.RUNNING)); // Verify the running repository and its configuraiton are using the new value ... RepositoryConfiguration newConfig = engine.getRepository(name).getConfiguration(); assertThat(newConfig.getBinaryStorage().getMinimumBinarySizeInBytes(), is(newLargeValueSizeInBytes)); assertThat(repository.repositoryCache().largeValueSizeInBytes(), is(newLargeValueSizeInBytes)); }
private void storeStringsAndAssert( String stringNode ) throws Exception { Node testRoot = jcrSession().getRootNode().addNode(stringNode); long minStringSize = repository.getConfiguration().getBinaryStorage().getMinimumStringSize(); //the small string should be stored as a string String smallString = randomString(minStringSize - 1); testRoot.setProperty("smallString", smallString); //the large string should be stored as a binary String largeString = randomString(minStringSize + 1); testRoot.setProperty("largeString", largeString); jcrSession().save(); //use a separate session to validate because the original one still caches the properties as string... JcrSession readerSession = repository.login(); try { Property smallStringProperty = readerSession.getProperty("/" + stringNode + "/smallString"); assertEquals("Small string should've been stored as a string", PropertyType.STRING, smallStringProperty.getType()); assertEquals("Incorrect stored string value", smallString, smallStringProperty.getString()); Property largeStringProperty = readerSession.getProperty("/" + stringNode + "/largeString"); assertEquals("Large string should've been stored as a binary", PropertyType.BINARY, largeStringProperty.getType()); String binaryStringValue = IoUtil.read(largeStringProperty.getBinary().getStream()); assertEquals("Incorrect stored string value", largeString, binaryStringValue); } finally { readerSession.logout(); } }
RepositoryConfiguration repository2Config = repository2.getConfiguration();
RepositoryConfiguration repository2Config = repository2.getConfiguration();
RepositoryConfiguration repository2Config = repository2.getConfiguration();
Editor editor = repository.getConfiguration().edit(); EditableDocument externalSources = editor.getDocument(FieldName.EXTERNAL_SOURCES); externalSources.set("files", files.unwrap());