Fixing end date
This commit is contained in:
parent
e3c8c42dbe
commit
ab8ad166d8
|
@ -206,7 +206,7 @@ public class AccountingDashboardHarvesterPlugin extends Plugin {
|
||||||
start = DateUtils.getPreviousPeriod(aggregationType, partialHarvesting).getTime();
|
start = DateUtils.getPreviousPeriod(aggregationType, partialHarvesting).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1, partialHarvesting);
|
end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1);
|
||||||
|
|
||||||
logger.debug("Harvesting from {} to {} (ReRun:{} - GetVREUsers:{} - DryRun:{})", DateUtils.format(start),
|
logger.debug("Harvesting from {} to {} (ReRun:{} - GetVREUsers:{} - DryRun:{})", DateUtils.format(start),
|
||||||
DateUtils.format(end), reRun, getVREUsers, dryRun);
|
DateUtils.format(end), reRun, getVREUsers, dryRun);
|
||||||
|
|
|
@ -97,13 +97,10 @@ public class DateUtils {
|
||||||
return aggregationStartCalendar;
|
return aggregationStartCalendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date getEndDateFromStartDate(AggregationType aggregationType, Date startDate, int offset, boolean partialHarvesting) {
|
public static Date getEndDateFromStartDate(AggregationType aggregationType, Date startDate, int offset) {
|
||||||
Calendar aggregationEndDate = getUTCCalendarInstance();
|
Calendar aggregationEndDate = getUTCCalendarInstance();
|
||||||
if(!partialHarvesting) {
|
aggregationEndDate.setTimeInMillis(startDate.getTime());
|
||||||
aggregationEndDate.setTimeInMillis(startDate.getTime());
|
aggregationEndDate.add(aggregationType.getCalendarField(), offset);
|
||||||
aggregationEndDate.add(aggregationType.getCalendarField(), offset);
|
|
||||||
//aggregationEndDate.add(Calendar.MILLISECOND, -1);
|
|
||||||
}
|
|
||||||
return aggregationEndDate.getTime();
|
return aggregationEndDate.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +110,6 @@ public class DateUtils {
|
||||||
return calendar;
|
return calendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OLD functions of Eric Perrone (ISTI - CNR) */
|
|
||||||
|
|
||||||
public static String format(Date date) {
|
public static String format(Date date) {
|
||||||
return DateUtils.LAUNCH_DATE_FORMAT.format(date);
|
return DateUtils.LAUNCH_DATE_FORMAT.format(date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class AccountingDataHarvesterJupyterTest extends ContextTest {
|
||||||
|
|
||||||
|
|
||||||
for (Date start : starts) {
|
for (Date start : starts) {
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
ContextTest.setContextByName(ROOT);
|
ContextTest.setContextByName(ROOT);
|
||||||
JupyterAccessesHarvester jupyterAccessesHarvester = new JupyterAccessesHarvester(start, end);
|
JupyterAccessesHarvester jupyterAccessesHarvester = new JupyterAccessesHarvester(start, end);
|
||||||
|
|
|
@ -238,7 +238,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
while (from.before(runbeforeDate)) {
|
while (from.before(runbeforeDate)) {
|
||||||
Date start = from.getTime();
|
Date start = from.getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1);
|
||||||
|
|
||||||
logger.debug("Harvesting from {} to {}", DateUtils.format(start), DateUtils.format(end));
|
logger.debug("Harvesting from {} to {}", DateUtils.format(start), DateUtils.format(end));
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
Date start = DateUtils.getStartCalendar(2018, Calendar.MARCH, 1).getTime();
|
Date start = DateUtils.getStartCalendar(2018, Calendar.MARCH, 1).getTime();
|
||||||
// start = DateUtils.getPreviousPeriod(measureType).getTime();
|
// start = DateUtils.getPreviousPeriod(measureType).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1);
|
||||||
|
|
||||||
logger.info("\n\n\n");
|
logger.info("\n\n\n");
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
List<AccountingRecord> accountingRecords = new ArrayList<>();
|
List<AccountingRecord> accountingRecords = new ArrayList<>();
|
||||||
|
|
||||||
for (Date start : starts) {
|
for (Date start : starts) {
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
ContextTest.setContextByName(ROOT);
|
ContextTest.setContextByName(ROOT);
|
||||||
VREAccessesHarvester vreAccessesHarvester = new VREAccessesHarvester(start, end);
|
VREAccessesHarvester vreAccessesHarvester = new VREAccessesHarvester(start, end);
|
||||||
|
@ -432,7 +432,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
// 1).getTime();
|
// 1).getTime();
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
||||||
accountingDataHarvesterPlugin.getConfigParameters();
|
accountingDataHarvesterPlugin.getConfigParameters();
|
||||||
|
@ -522,7 +522,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
Calendar from = DateUtils.getStartCalendar(2018, Calendar.JUNE, 1);
|
Calendar from = DateUtils.getStartCalendar(2018, Calendar.JUNE, 1);
|
||||||
Date start = from.getTime();
|
Date start = from.getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(aggregationType, start, 1);
|
||||||
|
|
||||||
logger.debug("Harvesting Social Interaction from {} to {}", DateUtils.format(start), DateUtils.format(end));
|
logger.debug("Harvesting Social Interaction from {} to {}", DateUtils.format(start), DateUtils.format(end));
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
AggregationType measureType = AggregationType.MONTHLY;
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
||||||
List<AccountingRecord> accountingRecords = methodInvocationHarvester.getAccountingRecords();
|
List<AccountingRecord> accountingRecords = methodInvocationHarvester.getAccountingRecords();
|
||||||
|
@ -590,8 +590,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
AccountingDao dao = getAccountingDao();
|
AccountingDao dao = getAccountingDao();
|
||||||
|
|
||||||
List<Date> starts = new ArrayList<>();
|
List<Date> starts = new ArrayList<>();
|
||||||
starts.add(DateUtils.getStartCalendar(2021, Calendar.APRIL, 1).getTime());
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.JULY, 1).getTime());
|
||||||
starts.add(DateUtils.getStartCalendar(2021, Calendar.MAY, 1).getTime());
|
|
||||||
|
|
||||||
AggregationType measureType = AggregationType.MONTHLY;
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
|
@ -609,7 +608,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
List<AccountingRecord> accountingRecords = new ArrayList<>();
|
List<AccountingRecord> accountingRecords = new ArrayList<>();
|
||||||
|
|
||||||
for (Date start : starts) {
|
for (Date start : starts) {
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
||||||
|
|
||||||
|
@ -637,7 +636,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
logger.debug("Going to insert {}", accountingRecords);
|
logger.debug("Going to insert {}", accountingRecords);
|
||||||
|
|
||||||
ContextTest.setContextByName(ROOT);
|
ContextTest.setContextByName(ROOT);
|
||||||
dao.insertRecords(accountingRecords.toArray(new AccountingRecord[1]));
|
// dao.insertRecords(accountingRecords.toArray(new AccountingRecord[1]));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
|
@ -701,7 +700,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
for (Date start : starts) {
|
for (Date start : starts) {
|
||||||
|
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
TagMeMethodInvocationHarvester methodInvocationHarvester = new TagMeMethodInvocationHarvester(start,
|
TagMeMethodInvocationHarvester methodInvocationHarvester = new TagMeMethodInvocationHarvester(start,
|
||||||
end);
|
end);
|
||||||
|
@ -739,7 +738,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
AggregationType measureType = AggregationType.MONTHLY;
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
VREUsersHarvester vreUsersHarvester = new VREUsersHarvester(start, end);
|
VREUsersHarvester vreUsersHarvester = new VREUsersHarvester(start, end);
|
||||||
List<AccountingRecord> harvested = vreUsersHarvester.getAccountingRecords();
|
List<AccountingRecord> harvested = vreUsersHarvester.getAccountingRecords();
|
||||||
|
@ -766,7 +765,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
AggregationType measureType = AggregationType.MONTHLY;
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
SortedSet<String> contexts = getContexts();
|
SortedSet<String> contexts = getContexts();
|
||||||
|
|
||||||
|
@ -800,7 +799,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
// 1).getTime();
|
// 1).getTime();
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
||||||
accountingDataHarvesterPlugin.getConfigParameters();
|
accountingDataHarvesterPlugin.getConfigParameters();
|
||||||
|
@ -831,7 +830,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
Date start = DateUtils.getStartCalendar(2017, Calendar.MAY, 1).getTime();
|
Date start = DateUtils.getStartCalendar(2017, Calendar.MAY, 1).getTime();
|
||||||
Date finalEnd = DateUtils.getStartCalendar(2020, Calendar.MAY, 1).getTime();
|
Date finalEnd = DateUtils.getStartCalendar(2020, Calendar.MAY, 1).getTime();
|
||||||
|
|
||||||
Date end = DateUtils.getEndDateFromStartDate(AggregationType.MONTHLY, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(AggregationType.MONTHLY, start, 1);
|
||||||
|
|
||||||
ScopeBean scopeBean = new ScopeBean(context);
|
ScopeBean scopeBean = new ScopeBean(context);
|
||||||
logger.debug("FullName {} - Name {}", scopeBean.toString(), scopeBean.name());
|
logger.debug("FullName {} - Name {}", scopeBean.toString(), scopeBean.name());
|
||||||
|
@ -846,7 +845,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
|
|
||||||
Thread.sleep(TimeUnit.SECONDS.toMillis(90));
|
Thread.sleep(TimeUnit.SECONDS.toMillis(90));
|
||||||
start = end;
|
start = end;
|
||||||
end = DateUtils.getEndDateFromStartDate(AggregationType.MONTHLY, start, 1, false);
|
end = DateUtils.getEndDateFromStartDate(AggregationType.MONTHLY, start, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -905,7 +904,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
// 1).getTime();
|
// 1).getTime();
|
||||||
|
|
||||||
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
|
||||||
accountingDataHarvesterPlugin.getConfigParameters();
|
accountingDataHarvesterPlugin.getConfigParameters();
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class AccountingDataHarvesterRStudioTest extends ContextTest {
|
||||||
|
|
||||||
|
|
||||||
for (Date start : starts) {
|
for (Date start : starts) {
|
||||||
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1);
|
||||||
|
|
||||||
ContextTest.setContextByName(ROOT);
|
ContextTest.setContextByName(ROOT);
|
||||||
RStudioAccessesHarvester rstudioAccessesHarvester = new RStudioAccessesHarvester(start, end);
|
RStudioAccessesHarvester rstudioAccessesHarvester = new RStudioAccessesHarvester(start, end);
|
||||||
|
|
Loading…
Reference in New Issue