use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyType.
@Test
public void testCreatePolicyWithInValidPolicyType() {
FilePolicyCreateParam param = new FilePolicyCreateParam();
param.setPolicyName(filePolicyName);
param.setPolicyDescription(filePolicyName);
param.setApplyAt(FilePolicy.FilePolicyApplyLevel.vpool.toString());
param.setPolicyType("Some_invalid_string");
ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyScheduleDayOfWeek.
@Test
public void testCreatePolicyWithInValidPolicyScheduleDayOfWeek() {
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("WEEKS");
// Invalid day of month
policySchedule.setScheduleDayOfWeek("invalid day");
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());
}
use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testCreateSnapshotPolicyWithoutParams.
@Test
public void testCreateSnapshotPolicyWithoutParams() {
FilePolicyCreateParam param = new FilePolicyCreateParam();
setFilePolicyMandatoryParams(param);
ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
Assert.assertEquals(createFilePolicyResp.toString(), HttpStatus.SC_BAD_REQUEST, createFilePolicyResp.getStatus());
}
use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testFileSnapshotPolicyCreate.
@Test
public void testFileSnapshotPolicyCreate() {
FilePolicyCreateParam param = new FilePolicyCreateParam();
param.setPolicyName(filePolicyName);
param.setPolicyDescription(filePolicyName);
param.setPolicyType(FilePolicyType.file_snapshot.name());
param.setApplyAt(FilePolicy.FilePolicyApplyLevel.vpool.toString());
FilePolicyScheduleParams policySchedule = new FilePolicyScheduleParams();
policySchedule.setScheduleFrequency("DAYS");
policySchedule.setScheduleRepeat(6L);
policySchedule.setScheduleTime("12:00");
FileSnapshotPolicyParam snapshotPolicyParam = new FileSnapshotPolicyParam();
snapshotPolicyParam.setSnapshotNamePattern("snapshot policy 1");
snapshotPolicyParam.setPolicySchedule(policySchedule);
FileSnapshotPolicyExpireParam snapshotExpireParams = new FileSnapshotPolicyExpireParam();
snapshotExpireParams.setExpireType(SnapshotExpireType.NEVER.toString());
snapshotPolicyParam.setSnapshotExpireParams(snapshotExpireParams);
param.setSnapshotPolicyPrams(snapshotPolicyParam);
ClientResponse createFilePolicyResp = rSys.path(FILE_POLICIES).post(ClientResponse.class, param);
Assert.assertEquals(HttpStatus.SC_OK, createFilePolicyResp.getStatus());
FilePolicyCreateResp createdFilePolicy = createFilePolicyResp.getEntity(FilePolicyCreateResp.class);
Assert.assertTrue(filePolicyName.equals(createdFilePolicy.getName()));
createdFileSnapshotPolicyURI = createdFilePolicy.getId();
System.out.println("New snapshot policy ID: " + createdFileSnapshotPolicyURI);
}
use of com.emc.storageos.model.file.policy.FilePolicyCreateParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method testCreatePolicyWithInValidPolicyScheduleFrequency.
@Test
public void testCreatePolicyWithInValidPolicyScheduleFrequency() {
FilePolicyCreateParam param = new FilePolicyCreateParam();
setFilePolicyMandatoryParams(param);
FilePolicyScheduleParams policySchedule = new FilePolicyScheduleParams();
policySchedule.setScheduleRepeat(6L);
policySchedule.setScheduleTime("12:00");
policySchedule.setScheduleFrequency("some_invalid_value");
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());
}
Aggregations