use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class HttpClientTest method test_972_Http_SelectPass.
/**
*
*/
@Test
public void test_972_Http_SelectPass() {
try {
JSONArray result = httpClient.selectQuery(masterGuid, buildQuery(createIndexTestField, AREA_EXTENT));
for (int i = 0; i < result.length(); i++) {
System.out.println(result.get(i).toString());
}
// best we can do should be at least 5, but possibly more objects in results
Assert.assertThat(result.length(), Matchers.greaterThanOrEqualTo(1));
} catch (JSONException | IOException | ClientException e) {
Utils.failWithStackTrace("Exception executing second selectNear: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class HttpClientTest method test_934_ReadDeep.
/**
*
*/
@Test
public void test_934_ReadDeep() {
try {
String actual = httpClient.fieldRead(httpOneEntry.getGuid(), "flapjack.sally.right", httpOneEntry);
Assert.assertEquals("seven", actual);
} catch (IOException | ClientException e) {
Utils.failWithStackTrace("Exception while reading \"flapjack.sally.right\": ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class HttpClientTest method test_980_Http_GroupCreate.
/**
*
*/
@Test
public void test_980_Http_GroupCreate() {
String mygroupName = "mygroup" + RandomString.randomString(12);
try {
try {
httpClient.lookupGuid(mygroupName);
Utils.failWithStackTrace(mygroupName + " entity should not exist");
} catch (ClientException e) {
}
guidToDeleteEntry = httpClient.guidCreate(masterGuid, "deleteMe" + RandomString.randomString(12));
mygroupEntry = httpClient.guidCreate(masterGuid, mygroupName);
} catch (IOException | ClientException | NoSuchAlgorithmException e) {
Utils.failWithStackTrace("Exception while creating guids: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class HttpClientTest method test_913_Http_CheckFieldsFail.
/**
*
*/
@Test
public void test_913_Http_CheckFieldsFail() {
try {
try {
String result = httpClient.fieldRead(httpOneEntry.getGuid(), "environment", httpTwoEntry);
Utils.failWithStackTrace("Result of read of httpOneEntry's environment by httpTwoEntry is " + result + " which is wrong because it should have been rejected.");
} catch (ClientException e) {
} catch (IOException e) {
Utils.failWithStackTrace("Exception during read of westy's environment by sam: ", e);
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception in Http_CheckFieldsFail: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class SecureCommandTest method test_15_SecureRead.
/**
* Remove the account.
*/
@Test
public void test_15_SecureRead() {
GuidEntry masterGuid = GuidUtils.getGUIDKeys(globalAccountName);
try {
client.execute(GNSCommand.guidCreate(masterGuid, "whatever"));
GuidEntry testGuid = GuidUtils.lookupGuidEntryFromDatabase(client, "whatever");
client.execute(GNSCommand.fieldUpdate(testGuid, "fred", "value"));
JSONObject actual = client.execute(GNSCommand.readSecure(testGuid.getGuid())).getResultJSONObject();
JSONAssert.assertEquals(new JSONObject().put("fred", "value"), actual, JSONCompareMode.STRICT);
client.execute(GNSCommand.guidRemove(masterGuid, testGuid.getGuid()));
} catch (ClientException | IOException | JSONException e) {
Utils.failWithStackTrace("Exception while removing account record: ", e);
}
}
Aggregations