use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class UnsignedReadTest method test_259_UnsignedReadFailRead.
/**
* Attempt a read that should fail because ENTIRE_RECORD was removed.
*/
@Test
public void test_259_UnsignedReadFailRead() {
try {
try {
String result = clientCommands.fieldRead(unsignedReadTestGuid.getGuid(), unreadAbleReadFieldName, null);
Utils.failWithStackTrace("Result of read of westy's " + unreadAbleReadFieldName + " in " + unsignedReadTestGuid.entityName + " as world readable was " + result + " which is wrong because it should have been rejected in UnsignedRead.");
} catch (ClientException e) {
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception while testing for denied unsigned access in UnsignedRead: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class MultiFieldLookupTest method test_01_JSONUpdate.
/**
*
*/
@Test
public void test_01_JSONUpdate() {
try {
westyEntry = clientCommands.guidCreate(masterGuid, "westy" + RandomString.randomString(12));
System.out.println("Created: " + westyEntry);
} catch (ClientException | IOException e) {
Utils.failWithStackTrace("Exception when we were not expecting it: " + e);
}
try {
JSONObject json = new JSONObject();
json.put("name", "frank");
json.put("occupation", "busboy");
json.put("location", "work");
json.put("friends", new ArrayList<>(Arrays.asList("Joe", "Sam", "Billy")));
JSONObject subJson = new JSONObject();
subJson.put("einy", "floop");
subJson.put("meiny", "bloop");
json.put("gibberish", subJson);
clientCommands.update(westyEntry, json);
} catch (JSONException | IOException | ClientException e) {
Utils.failWithStackTrace("Exception while updating JSON: " + e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class RemoveGuidTest method test_10_RemoveGuidUsingAccount.
/**
*
*/
@Test
public void test_10_RemoveGuidUsingAccount() {
String guidName = "testGUID" + RandomString.randomString(12);
GuidEntry guid = null;
try {
guid = clientCommands.guidCreate(masterGuid, guidName);
} catch (ClientException | IOException e) {
Utils.failWithStackTrace("Exception while creating testGuid: " + e);
}
if (guid != null) {
System.out.println("testGuid is " + guid.toString());
try {
clientCommands.guidRemove(masterGuid, guid.getGuid());
} catch (ClientException | IOException e) {
Utils.failWithStackTrace("Exception while removing testGuid (" + guid.toString() + "): " + e);
}
try {
clientCommands.lookupGuidRecord(guid.getGuid());
Utils.failWithStackTrace("Lookup testGuid should have throw an exception.");
} catch (ClientException e) {
} catch (IOException e) {
Utils.failWithStackTrace("Exception while doing Lookup testGuid: " + e);
}
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class UnsignedReadTest method test_263_UnsignedReadFailMissingField.
/**
*
*/
@Test
public void test_263_UnsignedReadFailMissingField() {
String missingFieldName = "missingField" + RandomString.randomString(12);
try {
try {
String result = clientCommands.fieldRead(unsignedReadTestGuid.getGuid(), missingFieldName, null);
Utils.failWithStackTrace("Result of read of test guid's nonexistant field " + missingFieldName + " in " + unsignedReadTestGuid.entityName + " as world readable was " + result + " which is wrong because it should have failed.");
} catch (ClientException e) {
// The normal result
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception while testing for denied unsigned access in UnsignedRead: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class UnsignedReadTest method test_251_UnsignedReadDefaultAccountGuidRead.
/**
* Tests for the default ACL list working with unsigned read.
* Attempts to read the field.
*/
@Test
public void test_251_UnsignedReadDefaultAccountGuidRead() {
try {
String response = clientCommands.fieldRead(unsignedReadAccountGuid.getGuid(), "aRandomFieldForUnsignedRead", null);
Assert.assertEquals("aRandomValue", response);
} catch (ClientException | IOException e) {
Utils.failWithStackTrace("Exception writing field UnsignedReadDefaultMasterWrite: ", e);
}
}
Aggregations