IndexDefinitionBuilder { public NodeState build() { setReindexFlagIfRequired(); setRefreshFlagIfRequired(); return builder.getNodeState(); } IndexDefinitionBuilder();  IndexDefinitionBuilder(NodeBuilder nodeBuilder);  IndexDefinitionBuilder(NodeBuilder nodeBuilder, boolean autoManageReindexFlag); IndexDefinitionBuilder evaluatePathRestrictions(); IndexDefinitionBuilder includedPaths(String... paths); IndexDefinitionBuilder excludedPaths(String... paths); IndexDefinitionBuilder queryPaths(String... paths); IndexDefinitionBuilder supersedes(String... paths); IndexDefinitionBuilder noAsync(); IndexDefinitionBuilder deprecated(); IndexDefinitionBuilder async(String... asyncVals); IndexDefinitionBuilder tags(String... tagVals); IndexDefinitionBuilder codec(String codecName); IndexDefinitionBuilder mergePolicy(String mergePolicy); IndexDefinitionBuilder addTags(String... additionalTagVals); IndexDefinitionBuilder nodeTypeIndex(); Tree getBuilderTree(); NodeState build(); Tree build(Tree tree); Node build(Node node); boolean isReindexRequired(); IndexRule indexRule(String type); boolean hasIndexRule(String type); AggregateRule aggregateRule(String type); AggregateRule aggregateRule(String primaryType, String... includes);  }
@Test public void defaultvSetup() throws Exception{ NodeState state = builder.build(); assertEquals("async", state.getString("async")); assertEquals("fulltext", state.getString("type")); }
@Test public void mergeExisting() throws Exception{ nodeBuilder.setProperty("foo", "bar"); builder = new IndexDefinitionBuilder(nodeBuilder); NodeState state = builder.build(); assertEquals("bar", state.getString("foo")); assertEquals("async", state.getString("async")); }
@Test public void typeNotChangedIfSet() throws Exception{ NodeState state = builder.build(); assertEquals("fulltext", state.getString("type")); NodeBuilder updated = state.builder(); updated.setProperty("type", "disabled"); IndexDefinitionBuilder newBuilder = new IndexDefinitionBuilder(updated); NodeState updatedState = newBuilder.build(); assertEquals("disabled", updatedState.getString("type")); updated.setProperty("type", "foo"); assertEquals("fulltext", new IndexDefinitionBuilder(updated).build().getString("type")); }