Search in sources :

Example 16 with ClientException

use of com.aliyuncs.fc.exceptions.ClientException in project fc-java-sdk by aliyun.

the class FunctionComputeClientTest method testListTriggersValidate.

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

Example 17 with ClientException

use of com.aliyuncs.fc.exceptions.ClientException in project fc-java-sdk by aliyun.

the class FunctionComputeClientTest method testInvokeFunctionValidate.

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

Example 18 with ClientException

use of com.aliyuncs.fc.exceptions.ClientException in project fc-java-sdk by aliyun.

the class FunctionComputeClientTest method testGetFunctionValidate.

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

Example 19 with ClientException

use of com.aliyuncs.fc.exceptions.ClientException in project fc-java-sdk by aliyun.

the class FunctionComputeClientTest method testGetServiceValidate.

@Test
public void testGetServiceValidate() {
    try {
        GetServiceRequest request = new GetServiceRequest(null);
        client.getService(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
    try {
        GetServiceRequest request = new GetServiceRequest("");
        client.getService(request);
        fail("ClientException is expected");
    } catch (ClientException e) {
        assertTrue(e.getMessage().contains(VALIDATE_MSG));
    }
}
Also used : GetServiceRequest(com.aliyuncs.fc.request.GetServiceRequest) ClientException(com.aliyuncs.fc.exceptions.ClientException) Test(org.junit.Test)

Example 20 with ClientException

use of com.aliyuncs.fc.exceptions.ClientException 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)26 Test (org.junit.Test)13 IOException (java.io.IOException)6 Gson (com.google.gson.Gson)5 ServerException (com.aliyuncs.fc.exceptions.ServerException)4 FunctionComputeClient (com.aliyuncs.fc.client.FunctionComputeClient)3 PrepareUrl (com.aliyuncs.fc.model.PrepareUrl)3 JsonParseException (com.google.gson.JsonParseException)3 SocketTimeoutException (java.net.SocketTimeoutException)3 InvalidKeyException (java.security.InvalidKeyException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 HttpResponse (com.aliyuncs.fc.http.HttpResponse)2 CreateServiceRequest (com.aliyuncs.fc.request.CreateServiceRequest)2 GetServiceRequest (com.aliyuncs.fc.request.GetServiceRequest)2 URISyntaxException (java.net.URISyntaxException)2 DefaultAcsClient (com.aliyuncs.DefaultAcsClient)1 IAcsClient (com.aliyuncs.IAcsClient)1 BasicSessionCredentials (com.aliyuncs.auth.BasicSessionCredentials)1 SignURLConfig (com.aliyuncs.fc.auth.SignURLConfig)1 Config (com.aliyuncs.fc.config.Config)1