Skip to content

Commit e218f20

Browse files
committed
Changes to accomodate boot strap host changes
1 parent 570cf34 commit e218f20

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

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

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public static String getBootStrapHostFromML() {
9191
if(!jnode.isNull()){
9292

9393
if(jnode.has(propName)){
94-
// System.out.println(jnode.withArray(propName).get(0).asText());
95-
return jnode.withArray(propName).get(0).asText();
94+
System.out.println("Bootstrap Host: " + jnode.withArray(propName).get(0).get("bootstrap-host-name").asText());
95+
return jnode.withArray(propName).get(0).get("bootstrap-host-name").asText();
9696
}
9797
else{
9898
System.out.println("Missing "+propName+" field from properties end point so sending java conanical host name\n"+jnode.toString());
@@ -1580,6 +1580,56 @@ else if (respEntity != null) {
15801580

15811581
}
15821582

1583+
/*
1584+
* Create a temporal collection
1585+
* @dbName Database Name
1586+
* @collectionName Collection Name (name of temporal collection that needs to be created)
1587+
* @systemAxisName Name of System axis
1588+
* @validAxisName Name of Valid axis
1589+
*/
1590+
public static void updateTemporalCollectionForLSQT(String dbName, String collectionName, boolean enable)
1591+
throws Exception
1592+
{
1593+
ObjectMapper mapper = new ObjectMapper();
1594+
ObjectNode rootNode = mapper.createObjectNode();
1595+
rootNode.put( "lsqt-enabled", enable);
1596+
1597+
System.out.println(rootNode.toString());
1598+
1599+
1600+
DefaultHttpClient client = new DefaultHttpClient();
1601+
client.getCredentialsProvider().setCredentials(
1602+
new AuthScope("localhost", 8002),
1603+
new UsernamePasswordCredentials("admin", "admin"));
1604+
1605+
HttpPut put = new HttpPut("http://localhost:8002/manage/v2/databases/"+ dbName + "/temporal/collections/lsqt/properties?collection=" + collectionName);
1606+
1607+
put.addHeader("Content-type", "application/json");
1608+
put.addHeader("accept", "application/json");
1609+
put.setEntity(new StringEntity(rootNode.toString()));
1610+
1611+
HttpResponse response = client.execute(put);
1612+
HttpEntity respEntity = response.getEntity();
1613+
if( response.getStatusLine().getStatusCode() == 400)
1614+
{
1615+
HttpEntity entity = response.getEntity();
1616+
String responseString = EntityUtils.toString(entity, "UTF-8");
1617+
System.out.println(responseString);
1618+
}
1619+
else if (respEntity != null) {
1620+
// EntityUtils to get the response content
1621+
String content = EntityUtils.toString(respEntity);
1622+
System.out.println(content);
1623+
1624+
System.out.println("Temporal collection: " + collectionName + " created");
1625+
System.out.println("==============================================================");
1626+
}
1627+
else {
1628+
System.out.println("No Proper Response");
1629+
}
1630+
1631+
}
1632+
15831633
/*
15841634
* Delete a temporal collection
15851635
* @dbName Database Name

0 commit comments

Comments
 (0)