Search in sources :

Example 1 with CopyTemplateCmdByAdmin

use of org.apache.cloudstack.api.command.admin.template.CopyTemplateCmdByAdmin in project cloudstack by apache.

the class CopyTemplateCmdByAdminTest method testDestZoneidAndDestZoneIdListBothPresent.

@Test
public void testDestZoneidAndDestZoneIdListBothPresent() throws ResourceAllocationException {
    try {
        copyTemplateCmdByAdmin = new CopyTemplateCmdByAdmin();
        copyTemplateCmdByAdmin.destZoneId = -1L;
        copyTemplateCmdByAdmin.destZoneIds = new ArrayList<>();
        copyTemplateCmdByAdmin.destZoneIds.add(-1L);
        copyTemplateCmdByAdmin.execute();
    } catch (ServerApiException e) {
        if (e.getErrorCode() != ApiErrorCode.PARAM_ERROR) {
            Assert.fail("Api should fail when both destzoneid and destzoneids are passed");
        }
    }
}
Also used : CopyTemplateCmdByAdmin(org.apache.cloudstack.api.command.admin.template.CopyTemplateCmdByAdmin) ServerApiException(org.apache.cloudstack.api.ServerApiException) Test(org.junit.Test)

Example 2 with CopyTemplateCmdByAdmin

use of org.apache.cloudstack.api.command.admin.template.CopyTemplateCmdByAdmin in project cloudstack by apache.

the class CopyTemplateCmdByAdminTest method testZoneidAndZoneIdListEmpty.

@Test
public void testZoneidAndZoneIdListEmpty() throws ResourceAllocationException {
    try {
        copyTemplateCmdByAdmin = new CopyTemplateCmdByAdmin();
        copyTemplateCmdByAdmin.execute();
    } catch (ServerApiException e) {
        if (e.getErrorCode() != ApiErrorCode.PARAM_ERROR) {
            Assert.fail("API should fail when no parameters are passed.");
        }
    }
}
Also used : CopyTemplateCmdByAdmin(org.apache.cloudstack.api.command.admin.template.CopyTemplateCmdByAdmin) ServerApiException(org.apache.cloudstack.api.ServerApiException) Test(org.junit.Test)

Aggregations

ServerApiException (org.apache.cloudstack.api.ServerApiException)2 CopyTemplateCmdByAdmin (org.apache.cloudstack.api.command.admin.template.CopyTemplateCmdByAdmin)2 Test (org.junit.Test)2