RepositoryConfiguration { public DocumentOptimization getDocumentOptimization() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { storage = Schematic.newDocument(); } return new DocumentOptimization(storage.getDocument(FieldName.DOCUMENT_OPTIMIZATION)); } RepositoryConfiguration();  RepositoryConfiguration( String name );  RepositoryConfiguration( Document document,
                                    String documentName );  RepositoryConfiguration( String name,
                                    Environment environment );  RepositoryConfiguration( Document document,
                                    String documentName,
                                    Environment environment ); static RepositoryConfiguration read( URL url ); static RepositoryConfiguration read( File file ); static RepositoryConfiguration read( InputStream stream,
                                                String name ); static RepositoryConfiguration read( String resourcePathOrJsonContentString ); String getName(); Document getDocument(); String getJndiName(); Document getPersistenceConfiguration(); long getLockTimeoutMillis(); TransactionManagerLookup getTransactionManagerLookup(); int getWorkspaceCacheSize(); Clustering getClustering(); BinaryStorage getBinaryStorage(); Journaling getJournaling(); InitialContent getInitialContent(); Reindexing getReindexing(); List<String> getNodeTypes(); static String getBuiltInSequencerClassName( String alias ); static String getBuiltInConnectorClassName( String alias ); static String getBuiltInIndexProviderClassName( String alias ); static String getBuiltInTextExtractorClassName( String alias ); boolean isCreatingWorkspacesAllowed(); int getEventBusSize(); String getDefaultWorkspaceName(); Set<String> getPredefinedWorkspaceNames(); Set<String> getAllWorkspaceNames(); Security getSecurity(); MonitoringSystem getMonitoring(); List<Component> getIndexProviders(); Indexes getIndexes(); TextExtraction getTextExtraction(); Sequencing getSequencing(); Federation getFederation(); GarbageCollection getGarbageCollection(); DocumentOptimization getDocumentOptimization(); @Override String toString(); Editor edit(); Problems validate(); Problems validate( Changes changes ); RepositoryConfiguration with( Environment environment ); RepositoryConfiguration withName( String docName ); static final String ROOT_NODE_ID; static final String SYSTEM_WORKSPACE_NAME; static final String DEFAULT_JNDI_PREFIX_OF_NAME; final static Pattern PROJECTION_PATH_EXPRESSION_PATTERN; final static Pattern INDEX_COLUMN_DEFINITIONS_PATTERN; static final String JSON_SCHEMA_URI; static final String JSON_SCHEMA_RESOURCE_PATH; }
@FixFor( "MODE-1988" ) @Test public void shouldNotEnableDocumentOptimizationByDefault() { RepositoryConfiguration config = new RepositoryConfiguration("repoName"); assertThat(config.getDocumentOptimization(), is(notNullValue())); assertThat(config.getDocumentOptimization().isEnabled(), is(false)); }
@FixFor( "MODE-1988" ) @Test public void shouldEnableDocumentOptimizationWithEmptyDocumentOptimizationField() { Document doc = Schematic.newDocument(FieldName.NAME, "repoName", FieldName.STORAGE, Schematic.newDocument(FieldName.DOCUMENT_OPTIMIZATION, Schematic.newDocument())); RepositoryConfiguration config = new RepositoryConfiguration(doc, "repoName"); DocumentOptimization opt = config.getDocumentOptimization(); assertThat(opt, is(notNullValue())); assertThat(opt.isEnabled(), is(false)); }
@FixFor( "MODE-1988" ) @Test public void shouldEnableDocumentOptimizationWithValidChildCountTargetAndToleranceValues() { Document docOpt = Schematic.newDocument(FieldName.OPTIMIZATION_CHILD_COUNT_TARGET, 500, FieldName.OPTIMIZATION_CHILD_COUNT_TOLERANCE, 10); Document doc = Schematic.newDocument(FieldName.NAME, "repoName", FieldName.STORAGE, Schematic.newDocument(FieldName.DOCUMENT_OPTIMIZATION, docOpt)); RepositoryConfiguration config = new RepositoryConfiguration(doc, "repoName"); DocumentOptimization opt = config.getDocumentOptimization(); assertThat(opt, is(notNullValue())); assertThat(opt.isEnabled(), is(true)); assertThat(opt.getIntervalInHours(), is(Default.OPTIMIZATION_INTERVAL_IN_HOURS)); assertThat(opt.getInitialTimeExpression(), is(Default.OPTIMIZATION_INITIAL_TIME)); assertThat(opt.getThreadPoolName(), is(Default.OPTIMIZATION_POOL)); }
@FixFor( "MODE-1988" ) @Test public void shouldDisableDocumentOptimizationWithoutValidChildCountTargetValue() { Document docOpt = Schematic.newDocument(FieldName.OPTIMIZATION_CHILD_COUNT_TOLERANCE, 10); Document doc = Schematic.newDocument(FieldName.NAME, "repoName", FieldName.STORAGE, Schematic.newDocument(FieldName.DOCUMENT_OPTIMIZATION, docOpt)); RepositoryConfiguration config = new RepositoryConfiguration(doc, "repoName"); DocumentOptimization opt = config.getDocumentOptimization(); assertThat(opt, is(notNullValue())); assertThat(opt.isEnabled(), is(false)); }