use of org.edgegallery.developer.exception.IllegalRequestException in project developer-be by EdgeGallery.
the class MepHostServiceTest method testUploadHostConfigFileBadWithErrName.
@Test
public void testUploadHostConfigFileBadWithErrName() throws Exception {
try {
MultipartFile uploadFile = new MockMultipartFile("test-icon.png", "test-icon.png", null, MepHostServiceTest.class.getClassLoader().getResourceAsStream("testdata/test-icon.png"));
mepHostService.uploadConfigFile(UUID.randomUUID().toString(), uploadFile);
} catch (IllegalRequestException e) {
Assert.assertEquals("upload file should not have suffix", e.getMessage());
}
}
use of org.edgegallery.developer.exception.IllegalRequestException in project developer-be by EdgeGallery.
the class VMImageServiceTest method testUpdateVmImageBadWithRepeatName.
@Test
public void testUpdateVmImageBadWithRepeatName() {
try {
AccessUserUtil.setUser("d1bb89fe-1a9d-42e9-911e-7b038c3480b9", "developer", "common");
VMImage vmImage = new VMImage();
vmImage.setName("Ubuntu16.04");
vmImageService.updateVmImage(vmImage, 1);
} catch (IllegalRequestException e) {
Assert.assertEquals("name can not duplicate.", e.getMessage());
}
}
use of org.edgegallery.developer.exception.IllegalRequestException in project developer-be by EdgeGallery.
the class VMImageServiceTest method testCreateVmImageBadWithEmptyName.
@Test
public void testCreateVmImageBadWithEmptyName() {
try {
AccessUserUtil.setUser("d1bb89fe-1a9d-42e9-911e-7b038c3480b9", "developer", Consts.ROLE_DEVELOPER_ADMIN);
VMImage vmImage = new VMImage();
vmImageService.createVmImage(vmImage);
} catch (IllegalRequestException e) {
Assert.assertEquals("VmImage name is empty.", e.getMessage());
}
}
use of org.edgegallery.developer.exception.IllegalRequestException in project developer-be by EdgeGallery.
the class VMImageServiceTest method testUpdateVmImageBadWithEmptyName.
@Test
public void testUpdateVmImageBadWithEmptyName() {
try {
AccessUserUtil.setUser("d1bb89fe-1a9d-42e9-911e-7b038c3480b9", "developer", "common");
VMImage vmImage = new VMImage();
vmImageService.updateVmImage(vmImage, 1);
} catch (IllegalRequestException e) {
Assert.assertEquals("vmImage name or queried userId is empty.", e.getMessage());
}
}
use of org.edgegallery.developer.exception.IllegalRequestException in project developer-be by EdgeGallery.
the class UploadServiceTest method testUploadFileBadWithErrFileType.
@Test
public void testUploadFileBadWithErrFileType() throws Exception {
try {
MultipartFile uploadFile = new MockMultipartFile("test-icon.png", "test-icon.png", null, UploadServiceTest.class.getClassLoader().getResourceAsStream("testdata/test-icon.png"));
uploadFileService.uploadFile(null, "text", uploadFile);
} catch (IllegalRequestException e) {
Assert.assertEquals("fileType is error,must be one of [icon,md,api,script]", e.getMessage());
}
}
Aggregations