Search in sources :

Example 11 with RequestFailedException

use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.

the class TemplatesTest method testUpdateTemplate.

@Test
public void testUpdateTemplate() {
    MandrillRequestWithCode request = new MandrillRequestWithCode();
    request.setName("template1");
    String newVal = "<html><body>Not template</body></html>";
    request.setCode(newVal);
    MandrillRequestWithName retrieve = new MandrillRequestWithName();
    retrieve.setName("template1");
    try {
        TemplateResponse response = templatesRequest.getTemplateInfo(retrieve);
        String oldVal = response.getCode();
        templatesRequest.updateTemplate(request);
        response = templatesRequest.getTemplateInfo(retrieve);
        assertFalse(oldVal.equals(newVal));
        assertEquals(newVal, response.getCode());
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : MandrillRequestWithName(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) TemplateResponse(com.cribbstechnologies.clients.mandrill.model.response.templates.TemplateResponse) MandrillRequestWithCode(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithCode) Test(org.junit.Test)

Example 12 with RequestFailedException

use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.

the class UrlsTest method testGetTimeSeries.

@Test
public void testGetTimeSeries() {
    MandrillRequestWithUrl request = new MandrillRequestWithUrl();
    request.setUrl("http://www.google.com");
    try {
        UrlListResponse response = urlsRequest.getTimeSeries(request);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) MandrillRequestWithUrl(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithUrl) UrlListResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse) Test(org.junit.Test)

Example 13 with RequestFailedException

use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.

the class UsersTest method testVerifySender.

@Test
public void testVerifySender() {
    MandrillRequestWithEmail emailRequest = new MandrillRequestWithEmail();
    emailRequest.setEmail(props.getProperty("verify.email"));
    try {
        VerifyResponse response = usersRequest.verifySender(emailRequest);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : VerifyResponse(com.cribbstechnologies.clients.mandrill.model.response.users.VerifyResponse) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) MandrillRequestWithEmail(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithEmail) Test(org.junit.Test)

Example 14 with RequestFailedException

use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.

the class UsersTest method testDisableSender.

@Test
public void testDisableSender() {
    MandrillRequestWithDomain domainRequest = new MandrillRequestWithDomain();
    domainRequest.setDomain("google.com");
    try {
        DisableResponse response = usersRequest.disableSender(domainRequest);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) MandrillRequestWithDomain(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain) DisableResponse(com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse) Test(org.junit.Test)

Example 15 with RequestFailedException

use of com.cribbstechnologies.clients.mandrill.exception.RequestFailedException in project Java-Mandrill-Wrapper by cribbstechnologies.

the class UsersTest method testPing2.

@Test
public void testPing2() {
    BaseMandrillRequest baseRequest = new BaseMandrillRequest();
    try {
        PingResponse pingResponse = usersRequest.performPing2(baseRequest);
        assertEquals("PONG!", pingResponse.getPingResponse());
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) BaseMandrillRequest(com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest) PingResponse(com.cribbstechnologies.clients.mandrill.model.response.users.PingResponse) Test(org.junit.Test)

Aggregations

RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)17 Test (org.junit.Test)16 BaseMandrillRequest (com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest)3 MandrillRequestWithName (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName)3 IOException (java.io.IOException)3 HttpPost (org.apache.http.client.methods.HttpPost)3 MandrillRecipient (com.cribbstechnologies.clients.mandrill.model.MandrillRecipient)2 MandrillRequestWithCode (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithCode)2 BaseMandrillStringResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillStringResponse)2 UrlListResponse (com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse)2 JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)2 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)2 MalformedURLException (java.net.MalformedURLException)2 HashMap (java.util.HashMap)2 MandrillError (com.cribbstechnologies.clients.mandrill.model.MandrillError)1 MandrillHtmlMessage (com.cribbstechnologies.clients.mandrill.model.MandrillHtmlMessage)1 MandrillMessage (com.cribbstechnologies.clients.mandrill.model.MandrillMessage)1 MandrillMessageRequest (com.cribbstechnologies.clients.mandrill.model.MandrillMessageRequest)1 MandrillRequestWithDomain (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain)1 MandrillRequestWithEmail (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithEmail)1