Skip to content

Commit

Permalink
#408 Added rangePathIndexes to Database class
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed May 18, 2020
1 parent 778e34f commit ba3bc7d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/marklogic/mgmt/api/database/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ public class Database extends Resource {
@XmlElement(name = "path-namespace")
private List<PathNamespace> pathNamespace;

@XmlElementWrapper(name = "range-path-indexes")
@XmlElement(name = "range-path-index")
private List<PathIndex> rangePathIndex;

@XmlElementWrapper(name = "fields")
private List<Field> field;

Expand Down Expand Up @@ -1169,4 +1173,12 @@ public List<FragmentParent> getFragmentParent() {
public void setFragmentParent(List<FragmentParent> fragmentParent) {
this.fragmentParent = fragmentParent;
}

public List<PathIndex> getRangePathIndex() {
return rangePathIndex;
}

public void setRangePathIndex(List<PathIndex> rangePathIndex) {
this.rangePathIndex = rangePathIndex;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.marklogic.mgmt.api.database;

import com.marklogic.mgmt.api.API;
import com.marklogic.mgmt.mapper.DefaultResourceMapper;
import com.marklogic.mgmt.util.ObjectMapperFactory;
import org.junit.Assert;
import org.junit.Test;

Expand All @@ -19,4 +21,17 @@ public void xmlSmokeTest() {
assertEquals("my-triggers", d.getTriggersDatabase());
assertEquals("my-schemas", d.getSchemaDatabase());
}

@Test
public void rangePathIndexes() {
String json = "{\"range-path-index\":[" +
"{\"scalar-type\":\"string\", \"path-expression\":\"/firstPath\", \"collation\":\"http://marklogic.com/collation/\", \"range-value-positions\":false, \"invalid-values\":\"reject\"}, " +
"{\"scalar-type\":\"string\", \"path-expression\":\"/secondPath\", \"collation\":\"http://marklogic.com/collation/codepoint\", \"range-value-positions\":false, \"invalid-values\":\"reject\"}" +
"]}";

Database d = new DefaultResourceMapper(new API(null, ObjectMapperFactory.getObjectMapper())).readResource(json, Database.class);
assertEquals(2, d.getRangePathIndex().size());
assertEquals("/firstPath", d.getRangePathIndex().get(0).getPathExpression());
assertEquals("/secondPath", d.getRangePathIndex().get(1).getPathExpression());
}
}

0 comments on commit ba3bc7d

Please sign in to comment.