Search in sources :

Example 16 with AmazonDynamoDBException

use of com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException in project athenz by yahoo.

the class DynamoDBWorkloadRecordStoreConnectionTest method testUpdateWorkloadRecordException.

@Test
public void testUpdateWorkloadRecordException() {
    WorkloadRecord workloadRecord = new WorkloadRecord();
    Mockito.doThrow(new AmazonDynamoDBException("invalid operation")).when(table).updateItem(ArgumentMatchers.any(UpdateItemSpec.class));
    DynamoDBWorkloadRecordStoreConnection dbConn = getDBConnection();
    boolean requestSuccess = dbConn.updateWorkloadRecord(workloadRecord);
    Assert.assertFalse(requestSuccess);
    dbConn.close();
}
Also used : AmazonDynamoDBException(com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException) UpdateItemSpec(com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec) WorkloadRecord(com.yahoo.athenz.common.server.workload.WorkloadRecord) Test(org.testng.annotations.Test)

Aggregations

AmazonDynamoDBException (com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException)16 Test (org.testng.annotations.Test)13 UpdateItemSpec (com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec)4 X509CertRecord (com.yahoo.athenz.common.server.cert.X509CertRecord)4 WorkloadRecord (com.yahoo.athenz.common.server.workload.WorkloadRecord)4 AmazonDynamoDB (com.amazonaws.services.dynamodbv2.AmazonDynamoDB)3 QuerySpec (com.amazonaws.services.dynamodbv2.document.spec.QuerySpec)3 AttributeValue (com.amazonaws.services.dynamodbv2.model.AttributeValue)3 SSHCertRecord (com.yahoo.athenz.common.server.ssh.SSHCertRecord)3 DeleteItemSpec (com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec)2 DynamoDBMapper (com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper)1 QueryRequest (com.amazonaws.services.dynamodbv2.model.QueryRequest)1 QueryResult (com.amazonaws.services.dynamodbv2.model.QueryResult)1 ScanRequest (com.amazonaws.services.dynamodbv2.model.ScanRequest)1 ScanResult (com.amazonaws.services.dynamodbv2.model.ScanResult)1 HashMap (java.util.HashMap)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1