Skip to content

Commit d8a76fb

Browse files
Ajit GeorgeAjit George
authored andcommitted
Added method to insert range path index into the database.
1 parent 125f1d0 commit d8a76fb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test-complete/src/test/java/com/marklogic/javaclient/ConnectedRESTQA.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,4 +1686,32 @@ public static void setupServerRequestLogging(DatabaseClient client,boolean flag)
16861686
scm.setServerRequestLogging(flag);
16871687
scm.writeConfiguration();
16881688
}
1689+
1690+
/*
1691+
* This method inserts a path range index, in a JsonNode object, into the database.
1692+
*
1693+
*/
1694+
public static void setPathRangeIndexInDatabase(String dbName, JsonNode jnode) throws IOException
1695+
{
1696+
try {
1697+
DefaultHttpClient client = new DefaultHttpClient();
1698+
client.getCredentialsProvider().setCredentials(
1699+
new AuthScope("localhost", 8002),
1700+
new UsernamePasswordCredentials("admin", "admin"));
1701+
1702+
HttpPut put = new HttpPut("http://localhost:8002"+ "/manage/v2/databases/"+dbName+"/properties?format=json");
1703+
put.addHeader("Content-type", "application/json");
1704+
put.setEntity(new StringEntity(jnode.toString()));
1705+
1706+
HttpResponse response = client.execute(put);
1707+
HttpEntity respEntity = response.getEntity();
1708+
if(respEntity != null){
1709+
String content = EntityUtils.toString(respEntity);
1710+
System.out.println(content);
1711+
}
1712+
}catch (Exception e) {
1713+
// writing error to Log
1714+
e.printStackTrace();
1715+
}
1716+
}
16891717
}

0 commit comments

Comments
 (0)