use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class UnsignedReadTest method test_262_UnsignedReadFailAgain.
/**
* Insures that we still can't read the non-world-readable field without a guid.
*/
@Test
public void test_262_UnsignedReadFailAgain() {
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 UnsignedWriteTest method test_03_UnsignedWrite.
/**
*
*/
@Test
public void test_03_UnsignedWrite() {
String unsignedWriteFieldName = "allwriteaccess";
String standardWriteFieldName = "standardwriteaccess";
try {
clientCommands.fieldCreateOneElementList(westyEntry.getGuid(), unsignedWriteFieldName, "default", westyEntry);
// make it writeable by everyone
clientCommands.aclAdd(AclAccessType.WRITE_WHITELIST, westyEntry, unsignedWriteFieldName, GNSProtocol.ALL_GUIDS.toString());
clientCommands.fieldReplaceFirstElement(westyEntry.getGuid(), unsignedWriteFieldName, "funkadelicwrite", westyEntry);
Assert.assertEquals("funkadelicwrite", clientCommands.fieldReadArrayFirstElement(westyEntry.getGuid(), unsignedWriteFieldName, westyEntry));
clientCommands.fieldCreateOneElementList(westyEntry.getGuid(), standardWriteFieldName, "bummer", westyEntry);
try {
clientCommands.fieldReplaceFirstElement(westyEntry.getGuid(), standardWriteFieldName, "funkadelicwrite", null);
Utils.failWithStackTrace("Write of westy's field " + standardWriteFieldName + " as world readable should have been rejected.");
} catch (ClientException e) {
// normal result
}
} catch (IOException | ClientException e) {
Utils.failWithStackTrace("Exception when we were not expecting it: " + e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class DottedReadTest method test_20_Update.
/**
*
*/
@Test
public void test_20_Update() {
try {
JSONObject json = new JSONObject();
JSONObject subJson = new JSONObject();
subJson.put("sally", "red");
subJson.put("sammy", "green");
JSONObject subsubJson = new JSONObject();
subsubJson.put("right", "seven");
subsubJson.put("left", "eight");
subJson.put("sally", subsubJson);
json.put("flapjack", subJson);
clientCommands.update(westyEntry, json);
} catch (JSONException | IOException | ClientException e) {
Utils.failWithStackTrace("Exception while adding field \"flapjack\": " + e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class GroupAddTest method test_210_GroupCreate.
/**
*
*/
@Test
public void test_210_GroupCreate() {
String mygroupName = "mygroup" + RandomString.randomString(12);
try {
try {
clientCommands.lookupGuid(mygroupName);
Utils.failWithStackTrace(mygroupName + " entity should not exist");
} catch (ClientException e) {
}
mygroupEntry = clientCommands.guidCreate(masterGuid, mygroupName);
} catch (Exception e) {
Utils.failWithStackTrace("Exception while creating guids: ", e);
}
}
use of edu.umass.cs.gnscommon.exceptions.client.ClientException in project GNS by MobilityFirst.
the class GroupAddTest method test_211_GroupAdd.
/**
*
*/
@Test
public void test_211_GroupAdd() {
try {
JSONArray guids = new JSONArray(Arrays.asList(westyEntry.getGuid(), samEntry.getGuid(), guidToDeleteEntry.getGuid()));
clientCommands.groupAddGuids(mygroupEntry.getGuid(), guids, mygroupEntry);
} catch (IOException | ClientException e) {
Utils.failWithStackTrace("Exception while adding to groups: ", e);
}
}
Aggregations