Search in sources :

Example 6 with RetryableDatabaseException

use of com.emc.storageos.db.exceptions.RetryableDatabaseException in project coprhd-controller by CoprHD.

the class DbAuditLogRetrieverTest method auditServiceDBExceptionsTestXML.

@Test
public void auditServiceDBExceptionsTestXML() throws WebApplicationException, IOException, JAXBException {
    deleteIfExists(XmlTestOutputFile);
    DummyDBClient dbClient = new DummyDBClient();
    DbAuditLogRetriever dummyDbAuditLogRetriever = new DbAuditLogRetriever();
    dummyDbAuditLogRetriever.setDbClient(dbClient);
    String timeBucket = "2012-01-02T00";
    AuditLogRequest auditLogRequest = getAuditLogRequest(timeBucket);
    MediaType mediaType = MediaType.APPLICATION_XML_TYPE;
    File of = new File(XmlTestOutputFile);
    OutputStream os = new FileOutputStream(of);
    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(os));
    try {
        dummyDbAuditLogRetriever.getBulkAuditLogs(auditLogRequest, mediaType, out);
    } catch (RetryableDatabaseException e) {
        Assert.assertTrue(e.toString().contains("I/O"));
    } catch (MarshallingExcetion e) {
        Assert.fail(e.getMessage());
    }
    out.close();
}
Also used : MarshallingExcetion(com.emc.storageos.api.service.impl.resource.utils.MarshallingExcetion) DbAuditLogRetriever(com.emc.storageos.api.service.impl.resource.utils.DbAuditLogRetriever) MediaType(javax.ws.rs.core.MediaType) DummyDBClient(com.emc.storageos.api.service.utils.DummyDBClient) AuditLogRequest(com.emc.storageos.security.audit.AuditLogRequest) RetryableDatabaseException(com.emc.storageos.db.exceptions.RetryableDatabaseException) Test(org.junit.Test)

Aggregations

RetryableDatabaseException (com.emc.storageos.db.exceptions.RetryableDatabaseException)6 Controller (com.emc.storageos.Controller)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 AbstractDiscoveredSystemController (com.emc.storageos.impl.AbstractDiscoveredSystemController)4 BlockController (com.emc.storageos.volumecontroller.BlockController)4 DbAuditLogRetriever (com.emc.storageos.api.service.impl.resource.utils.DbAuditLogRetriever)1 MarshallingExcetion (com.emc.storageos.api.service.impl.resource.utils.MarshallingExcetion)1 DummyDBClient (com.emc.storageos.api.service.utils.DummyDBClient)1 DiscoveredSystemObject (com.emc.storageos.db.client.model.DiscoveredSystemObject)1 AuditLogRequest (com.emc.storageos.security.audit.AuditLogRequest)1 URI (java.net.URI)1 MediaType (javax.ws.rs.core.MediaType)1 Test (org.junit.Test)1