Search in sources :

Example 1 with GetTriggerRequest

use of com.aliyuncs.fc.request.GetTriggerRequest in project fc-java-sdk by aliyun.

the class FunctionComputeClientTest method testGetTriggerValidate.

@Test
public void testGetTriggerValidate() {
    try {
        GetTriggerRequest request = new GetTriggerRequest(SERVICE_NAME, FUNCTION_NAME, null);
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetTriggerRequest request = new GetTriggerRequest(SERVICE_NAME, FUNCTION_NAME, "");
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetTriggerRequest request = new GetTriggerRequest(SERVICE_NAME, null, TRIGGER_NAME);
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetTriggerRequest request = new GetTriggerRequest(SERVICE_NAME, "", TRIGGER_NAME);
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetTriggerRequest request = new GetTriggerRequest(null, FUNCTION_NAME, TRIGGER_NAME);
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetTriggerRequest request = new GetTriggerRequest("", FUNCTION_NAME, TRIGGER_NAME);
        client.getTrigger(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
}
Also used : GetTriggerRequest(com.aliyuncs.fc.request.GetTriggerRequest) ClientException(com.aliyuncs.fc.exceptions.ClientException) Test(org.junit.Test)

Aggregations

ClientException (com.aliyuncs.fc.exceptions.ClientException)1 GetTriggerRequest (com.aliyuncs.fc.request.GetTriggerRequest)1 Test (org.junit.Test)1