Search in sources :

Example 6 with FilePolicyCreateParam

use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.

the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyScheduleTime.

@Test
public void testCreatePolicyWithInValidPolicyScheduleTime() {
    FilePolicyCreateParam param = new FilePolicyCreateParam();
    setFilePolicyMandatoryParams(param);
    FileSnapshotPolicyParam snapshotPolicyParam = new FileSnapshotPolicyParam();
    FileSnapshotPolicyExpireParam snapshotExpireParams = new FileSnapshotPolicyExpireParam();
    snapshotExpireParams.setExpireType(SnapshotExpireType.NEVER.toString());
    snapshotPolicyParam.setSnapshotExpireParams(snapshotExpireParams);
    FilePolicyScheduleParams policySchedule = new FilePolicyScheduleParams();
    policySchedule.setScheduleRepeat(6L);
    // Invalid TIME
    policySchedule.setScheduleTime("67:00");
    policySchedule.setScheduleFrequency("DAYS");
    snapshotPolicyParam.setPolicySchedule(policySchedule);
    param.setSnapshotPolicyPrams(snapshotPolicyParam);
    ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
    Assert.assertEquals(createFilePolicyResp.toString(), HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FileSnapshotPolicyExpireParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyExpireParam) FilePolicyCreateParam(com.emc.storageos.model.file.policy.FilePolicyCreateParam) FileSnapshotPolicyParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyParam) FilePolicyScheduleParams(com.emc.storageos.model.file.policy.FilePolicyScheduleParams) Test(org.junit.Test)

Example 7 with FilePolicyCreateParam

use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.

the class FilePolicyApiTest method testCreateReplicationPolicyWithoutParams.

@Test
public void testCreateReplicationPolicyWithoutParams() {
    FilePolicyCreateParam param = new FilePolicyCreateParam();
    param.setPolicyName(filePolicyName);
    param.setPolicyDescription(filePolicyName);
    param.setPolicyType(FilePolicyType.file_replication.name());
    param.setApplyAt(FilePolicy.FilePolicyApplyLevel.vpool.toString());
    ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
    Assert.assertEquals(createFilePolicyResp.toString(), HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FilePolicyCreateParam(com.emc.storageos.model.file.policy.FilePolicyCreateParam) Test(org.junit.Test)

Example 8 with FilePolicyCreateParam

use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.

the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyScheduleRepeat.

@Test
public void testCreatePolicyWithInValidPolicyScheduleRepeat() {
    FilePolicyCreateParam param = new FilePolicyCreateParam();
    setFilePolicyMandatoryParams(param);
    FilePolicyScheduleParams policySchedule = new FilePolicyScheduleParams();
    // Value less than 1
    policySchedule.setScheduleRepeat(0L);
    policySchedule.setScheduleTime("12:00");
    policySchedule.setScheduleFrequency("DAYS");
    FileSnapshotPolicyParam snapshotPolicyParam = new FileSnapshotPolicyParam();
    snapshotPolicyParam.setPolicySchedule(policySchedule);
    param.setSnapshotPolicyPrams(snapshotPolicyParam);
    FileSnapshotPolicyExpireParam snapshotExpireParams = new FileSnapshotPolicyExpireParam();
    snapshotExpireParams.setExpireType(SnapshotExpireType.NEVER.toString());
    snapshotPolicyParam.setSnapshotExpireParams(snapshotExpireParams);
    ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
    Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FileSnapshotPolicyExpireParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyExpireParam) FilePolicyCreateParam(com.emc.storageos.model.file.policy.FilePolicyCreateParam) FileSnapshotPolicyParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyParam) FilePolicyScheduleParams(com.emc.storageos.model.file.policy.FilePolicyScheduleParams) Test(org.junit.Test)

Example 9 with FilePolicyCreateParam

use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.

the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyScheduleDayOfMonth.

@Test
public void testCreatePolicyWithInValidPolicyScheduleDayOfMonth() {
    FilePolicyCreateParam param = new FilePolicyCreateParam();
    setFilePolicyMandatoryParams(param);
    FileSnapshotPolicyParam snapshotPolicyParam = new FileSnapshotPolicyParam();
    FileSnapshotPolicyExpireParam snapshotExpireParams = new FileSnapshotPolicyExpireParam();
    snapshotExpireParams.setExpireType(SnapshotExpireType.NEVER.toString());
    snapshotPolicyParam.setSnapshotExpireParams(snapshotExpireParams);
    FilePolicyScheduleParams policySchedule = new FilePolicyScheduleParams();
    policySchedule.setScheduleRepeat(6L);
    policySchedule.setScheduleTime("13:00");
    policySchedule.setScheduleFrequency("MONTHS");
    // Invalid day of month(not in range of 1-31)
    policySchedule.setScheduleDayOfWeek("34");
    snapshotPolicyParam.setPolicySchedule(policySchedule);
    param.setSnapshotPolicyPrams(snapshotPolicyParam);
    ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
    Assert.assertEquals(createFilePolicyResp.toString(), HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FileSnapshotPolicyExpireParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyExpireParam) FilePolicyCreateParam(com.emc.storageos.model.file.policy.FilePolicyCreateParam) FileSnapshotPolicyParam(com.emc.storageos.model.file.policy.FileSnapshotPolicyParam) FilePolicyScheduleParams(com.emc.storageos.model.file.policy.FilePolicyScheduleParams) Test(org.junit.Test)

Example 10 with FilePolicyCreateParam

use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.

the class FilePolicyApiTest method testCreatePolicyWithInValidApplyAt.

@Test
public void testCreatePolicyWithInValidApplyAt() {
    FilePolicyCreateParam param = new FilePolicyCreateParam();
    param.setPolicyName(filePolicyName);
    param.setPolicyDescription(filePolicyName);
    param.setPolicyType(FilePolicyType.file_snapshot.name());
    param.setApplyAt("Some_invalid_string");
    ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
    Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FilePolicyCreateParam(com.emc.storageos.model.file.policy.FilePolicyCreateParam) Test(org.junit.Test)

Aggregations

FilePolicyCreateParam (com.emc.storageos.model.file.policy.FilePolicyCreateParam)14 ClientResponse (com.sun.jersey.api.client.ClientResponse)13 Test (org.junit.Test)13 FilePolicyScheduleParams (com.emc.storageos.model.file.policy.FilePolicyScheduleParams)8 FileSnapshotPolicyExpireParam (com.emc.storageos.model.file.policy.FileSnapshotPolicyExpireParam)8 FileSnapshotPolicyParam (com.emc.storageos.model.file.policy.FileSnapshotPolicyParam)8 FilePolicyCreateResp (com.emc.storageos.model.file.policy.FilePolicyCreateResp)2 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)1 FilePolicyUpdateParam (com.emc.storageos.model.file.policy.FilePolicyUpdateParam)1 FlashException (controllers.util.FlashException)1 URI (java.net.URI)1