Skip to content

Commit 2eabb30

Browse files
committed
CronService: renamed fields with long names.
Reported by PMD. No functional changes.
1 parent 2b21fca commit 2eabb30

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/main/java/ru/mystamps/web/service/CronService.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,19 @@
3939
@Service
4040
public class CronService {
4141

42-
public static final int PURGE_UNACTIVATED_REQUEST_AFTER_DAYS = 3;
42+
public static final int PURGE_AFTER_DAYS = 3;
4343

44-
private static final long CHECK_UNACTIVATED_REQUESTS_PERIOD = 12 * DateUtils.MILLIS_PER_HOUR;
44+
private static final long CHECK_PERIOD = 12 * DateUtils.MILLIS_PER_HOUR;
4545

4646
private static final Logger LOG = LoggerFactory.getLogger(CronService.class);
4747

4848
@Inject
4949
private UsersActivationDao usersActivationDao;
5050

51-
@Scheduled(fixedDelay = CHECK_UNACTIVATED_REQUESTS_PERIOD)
51+
@Scheduled(fixedDelay = CHECK_PERIOD)
5252
@Transactional
5353
public void purgeUsersActivations() {
54-
final Date expiredSince = DateUtils.addDays(
55-
new Date(),
56-
-PURGE_UNACTIVATED_REQUEST_AFTER_DAYS
57-
);
54+
final Date expiredSince = DateUtils.addDays(new Date(), -PURGE_AFTER_DAYS);
5855

5956
final List<UsersActivation> expiredActivations =
6057
usersActivationDao.findByCreatedAtLessThan(expiredSince);

src/test/java/ru/mystamps/web/service/CronServiceTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ public void purgeUsersActivationsShouldPassExpiredDateToDao() {
8686

8787
final Calendar calendar = new GregorianCalendar();
8888
calendar.setTime(new Date());
89-
calendar.add(
90-
Calendar.DAY_OF_MONTH,
91-
-(CronService.PURGE_UNACTIVATED_REQUEST_AFTER_DAYS)
92-
);
89+
calendar.add(Calendar.DAY_OF_MONTH, -(CronService.PURGE_AFTER_DAYS));
9390

9491
// Truncate seconds in dates to prevent test fail due to different milliseconds in dates
9592
final Date expectedDate = DateUtils.truncate(calendar.getTime(), Calendar.SECOND);

0 commit comments

Comments
 (0)