use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class AclDefaultsTest method test_113_ACLCheckForAllFieldsMissing.
/**
*
*/
@Test
public void test_113_ACLCheckForAllFieldsMissing() {
try {
JSONArray expected = new JSONArray();
JSONAssert.assertEquals(expected, clientCommands.aclGet(AclAccessType.READ_WHITELIST, masterGuid, GNSProtocol.ENTIRE_RECORD.toString(), masterGuid.getGuid()), true);
} catch (ClientException | IOException | JSONException e) {
Utils.failWithStackTrace("Exception while checking ALL_FIELDS in ACLCheckForAllFieldsMissing: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class AclDefaultsTest method test_139_ACLNotReadOtherGuidFieldTest.
/**
*
*/
@Test
public void test_139_ACLNotReadOtherGuidFieldTest() {
try {
try {
String result = clientCommands.fieldRead(westyEntry.getGuid(), "environment", samEntry);
Utils.failWithStackTrace("Result of read of westy's environment by sam is " + result + " which is wrong because it should have been rejected.");
} catch (ClientException e) {
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception while reading fields in ACLNotReadOtherGuidFieldTest: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class AclDefaultsTest method test_148_ACLTestReadsThree.
/**
*
*/
@Test
public void test_148_ACLTestReadsThree() {
try {
try {
String result = clientCommands.fieldRead(barneyEntry.getGuid(), "address", samEntry);
Utils.failWithStackTrace("Result of read of barney's address by sam is " + result + " which is wrong because it should have been rejected.");
} catch (ClientException e) {
if (e.getCode() == ResponseCode.ACCESS_ERROR) {
System.out.print("This was expected for null querier trying to ReadUnsigned " + barneyEntry.getGuid() + "'s address: " + e);
}
} catch (IOException e) {
Utils.failWithStackTrace("Exception while Sam reading Barney' address: ", e);
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception when we were not expecting it in ACLTestReadsThree: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class AclDefaultsTest method test_149_ACLALLFields.
/**
*
*/
@Test
public void test_149_ACLALLFields() {
String superUserName = "superuser" + RandomString.randomString(12);
try {
try {
clientCommands.lookupGuid(superUserName);
Utils.failWithStackTrace(superUserName + " entity should not exist");
} catch (ClientException e) {
}
GuidEntry superuserEntry = clientCommands.guidCreate(masterGuid, superUserName);
// let superuser read any of barney's fields
clientCommands.aclAdd(AclAccessType.READ_WHITELIST, barneyEntry, GNSProtocol.ENTIRE_RECORD.toString(), superuserEntry.getGuid());
Assert.assertEquals("413-555-1234", clientCommands.fieldRead(barneyEntry.getGuid(), "cell", superuserEntry));
Assert.assertEquals("100 Main Street", clientCommands.fieldRead(barneyEntry.getGuid(), "address", superuserEntry));
try {
clientCommands.guidRemove(masterGuid, superuserEntry.getGuid());
} catch (IOException | ClientException e) {
Utils.failWithStackTrace("Exception while deleting superuserEntry in ACLALLFields: ", e);
}
} catch (IOException | ClientException e) {
Utils.failWithStackTrace("Exception when we were not expecting it in ACLALLFields: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class AclDefaultsTest method test_138_ACLNotReadOtherGuidAllFieldsTest.
/**
*
*/
@Test
public void test_138_ACLNotReadOtherGuidAllFieldsTest() {
try {
try {
String result = clientCommands.fieldRead(westyEntry.getGuid(), GNSProtocol.ENTIRE_RECORD.toString(), samEntry);
Utils.failWithStackTrace("Result of read of all of westy's fields by sam is " + result + " which is wrong because it should have been rejected.");
} catch (ClientException e) {
}
} catch (Exception e) {
Utils.failWithStackTrace("Exception while reading fields in ACLNotReadOtherGuidAllFieldsTest: ", e);
}
}
Aggregations