use of com.epam.ta.reportportal.exception.ReportPortalException in project commons-dao by reportportal.
the class TestItemRepositoryTest method findByPath.
@Test
void findByPath() {
TestItem testItem = testItemRepository.findById(1L).orElseThrow(() -> new ReportPortalException(ErrorType.TEST_ITEM_NOT_FOUND, 1L));
assertTrue(testItemRepository.findByPath(testItem.getPath()).isPresent());
}
use of com.epam.ta.reportportal.exception.ReportPortalException in project commons-dao by reportportal.
the class WidgetSortUtils method transformToField.
private static Field<Object> transformToField(FilterTarget filterTarget, Sort.Order order, String tableName) {
BusinessRule.expect(filterTarget, Objects::nonNull).verify(ErrorType.UNCLASSIFIED_REPORT_PORTAL_ERROR, "Provided value shouldn't be null");
String filterCriteria;
if (order.getProperty().startsWith(STATISTICS_KEY)) {
filterCriteria = order.getProperty();
} else {
filterCriteria = filterTarget.getCriteriaByFilter(order.getProperty()).orElseThrow(() -> new ReportPortalException(ErrorType.INCORRECT_SORTING_PARAMETERS, order.getProperty())).getFilterCriteria();
}
return field(name(tableName, filterCriteria));
}
use of com.epam.ta.reportportal.exception.ReportPortalException in project commons-dao by reportportal.
the class AttachmentDataStoreServiceTest method saveLoadAndDeleteThumbnailTest.
@Test
void saveLoadAndDeleteThumbnailTest() throws IOException {
InputStream inputStream = new ClassPathResource("meh.jpg").getInputStream();
String thumbnailId = attachmentDataStoreService.saveThumbnail(random.nextLong() + "thumbnail.jpg", inputStream);
Optional<InputStream> loadedData = attachmentDataStoreService.load(thumbnailId);
assertTrue(loadedData.isPresent());
assertTrue(Files.exists(Paths.get(storageRootPath, attachmentDataStoreService.dataEncoder.decode(thumbnailId))));
attachmentDataStoreService.delete(thumbnailId);
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> attachmentDataStoreService.load(thumbnailId));
assertEquals("Unable to load binary data by id 'Unable to find file'", exception.getMessage());
assertFalse(Files.exists(Paths.get(storageRootPath, attachmentDataStoreService.dataEncoder.decode(thumbnailId))));
}
use of com.epam.ta.reportportal.exception.ReportPortalException in project commons-dao by reportportal.
the class UserDataStoreServiceTest method saveLoadAndDeleteTest.
@Test
void saveLoadAndDeleteTest() throws IOException {
InputStream inputStream = new ClassPathResource("meh.jpg").getInputStream();
String fileId = userDataStoreService.save(random.nextLong() + "meh.jpg", inputStream);
Optional<InputStream> loadedData = userDataStoreService.load(fileId);
assertTrue(loadedData.isPresent());
assertTrue(Files.exists(Paths.get(storageRootPath, userDataStoreService.dataEncoder.decode(fileId))));
userDataStoreService.delete(fileId);
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> userDataStoreService.load(fileId));
assertEquals("Unable to load binary data by id 'Unable to find file'", exception.getMessage());
assertFalse(Files.exists(Paths.get(storageRootPath, userDataStoreService.dataEncoder.decode(fileId))));
}
use of com.epam.ta.reportportal.exception.ReportPortalException in project service-authorization by reportportal.
the class AuthConfigRepositoryImpl method updateExisting.
private Update updateExisting(Object object) {
try {
Update update = new Update();
PropertyUtils.describe(object).entrySet().stream().filter(e -> null != e.getValue()).forEach(it -> update.set(it.getKey(), it.getValue()));
return update;
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new ReportPortalException("Error during auth config update", e);
}
}
Aggregations