use of org.forgerock.json.resource.Connection in project OpenAM by OpenRock.
the class TrustedDevicesResourceTest method shouldNotDeleteTrustedDeviceWhenNotFound.
@Test(expectedExceptions = NotFoundException.class)
public void shouldNotDeleteTrustedDeviceWhenNotFound() throws ResourceException {
//Given
DeleteRequest request = Requests.newDeleteRequest("UUID_3");
Connection connection = newInternalConnection(newCollection(resource));
List<JsonValue> devices = new ArrayList<JsonValue>();
devices.add(json(object(field("uuid", "UUID_1"), field("name", "NAME_1"))));
devices.add(json(object(field("uuid", "UUID_2"), field("name", "NAME_2"))));
given(dao.getDeviceProfiles(anyString(), anyString())).willReturn(devices);
//When
connection.delete(ctx(), request);
//Then
//Expected NotFoundException
}
use of org.forgerock.json.resource.Connection in project OpenAM by OpenRock.
the class ElevatedConnectionFactoryWrapper method getConnection.
@Override
public Connection getConnection() throws ResourceException {
Connection connection = connectionFactory.getConnection();
SSOToken ssoToken = ssoTokenPrivilegedAction.run();
return new ElevatedConnection(connection, ssoToken);
}
Aggregations