fixed tests
This commit is contained in:
parent
1b500a2f3d
commit
695bf798f9
|
@ -56,18 +56,21 @@ public class AccountingDataHarvesterJupyterTest extends ContextTest {
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
//@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testJupyterAccessesHarvester() throws Exception {
|
public void testJupyterAccessesHarvester() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// ContextTest.setContextByName(ROOT);
|
ContextTest.setContextByName(ROOT);
|
||||||
// AccountingDao dao = getAccountingDao();
|
AccountingDao dao = getAccountingDao();
|
||||||
|
|
||||||
List<Date> starts = new ArrayList<>();
|
List<Date> starts = new ArrayList<>();
|
||||||
starts.add(DateUtils.getStartCalendar(2021, Calendar.JANUARY, 1).getTime());
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.JANUARY, 1).getTime());
|
||||||
starts.add(DateUtils.getStartCalendar(2021, Calendar.FEBRUARY, 1).getTime());
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.FEBRUARY, 1).getTime());
|
||||||
starts.add(DateUtils.getStartCalendar(2021, Calendar.MARCH, 1).getTime());
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.MARCH, 1).getTime());
|
||||||
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.APRIL, 1).getTime());
|
||||||
|
//starts.add(DateUtils.getStartCalendar(2021, Calendar.MAY, 1).getTime());
|
||||||
|
|
||||||
|
|
||||||
AggregationType measureType = AggregationType.MONTHLY;
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
|
@ -96,7 +99,7 @@ public class AccountingDataHarvesterJupyterTest 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 (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(e.getLocalizedMessage(), e);
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
|
|
|
@ -91,8 +91,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
//@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void launch() {
|
public void launch() {
|
||||||
try {
|
try {
|
||||||
|
@ -109,17 +109,12 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
inputs.put(AccountingDashboardHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true);
|
inputs.put(AccountingDashboardHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true);
|
||||||
inputs.put(AccountingDashboardHarvesterPlugin.RERUN_INPUT_PARAMETER, true);
|
inputs.put(AccountingDashboardHarvesterPlugin.RERUN_INPUT_PARAMETER, true);
|
||||||
inputs.put(AccountingDashboardHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, true);
|
inputs.put(AccountingDashboardHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, true);
|
||||||
inputs.put(AccountingDashboardHarvesterPlugin.PARTIAL_HARVESTING, false);
|
inputs.put(AccountingDashboardHarvesterPlugin.PARTIAL_HARVESTING, true);
|
||||||
|
|
||||||
/*
|
Calendar from = DateUtils.getStartCalendar(2021, Calendar.JANUARY, 1);
|
||||||
* Calendar from = DateUtils.getStartCalendar(2020, Calendar.MAY,
|
String fromDate = DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime());
|
||||||
* 1); String fromDate =
|
logger.trace("{} is {}", AccountingDashboardHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate);
|
||||||
* DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime());
|
inputs.put(AccountingDashboardHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate);
|
||||||
* logger.trace("{} is {}",
|
|
||||||
* AccountingDashboardHarvesterPlugin.START_DATE_INPUT_PARAMETER,
|
|
||||||
* fromDate); inputs.put(AccountingDashboardHarvesterPlugin.
|
|
||||||
* START_DATE_INPUT_PARAMETER, fromDate);
|
|
||||||
*/
|
|
||||||
|
|
||||||
accountingDataHarvesterPlugin.launch(inputs);
|
accountingDataHarvesterPlugin.launch(inputs);
|
||||||
|
|
||||||
|
@ -153,13 +148,12 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
inputs.put(AccountingDashboardHarvesterPlugin.PARTIAL_HARVESTING, false);
|
inputs.put(AccountingDashboardHarvesterPlugin.PARTIAL_HARVESTING, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calendar from = DateUtils.getStartCalendar(2016,
|
* Calendar from = DateUtils.getStartCalendar(2016, Calendar.SEPTEMBER, 1);
|
||||||
* Calendar.SEPTEMBER, 1); String fromDate =
|
* String fromDate = DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime());
|
||||||
* DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime());
|
|
||||||
* logger.trace("{} is {}",
|
* logger.trace("{} is {}",
|
||||||
* AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER,
|
* AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate);
|
||||||
* fromDate); inputs.put(AccountingDataHarvesterPlugin.
|
* inputs.put(AccountingDataHarvesterPlugin. START_DATE_INPUT_PARAMETER,
|
||||||
* START_DATE_INPUT_PARAMETER, fromDate);
|
* fromDate);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 3rd of the month for MONTHLY Harvesting at 10:00
|
// 3rd of the month for MONTHLY Harvesting at 10:00
|
||||||
|
@ -184,8 +178,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
//@Ignore
|
||||||
//@Test
|
@Test
|
||||||
public void launchOldData() {
|
public void launchOldData() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -587,7 +581,52 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMethodInvocationOldData() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
ContextTest.setContextByName(ROOT);
|
||||||
|
AccountingDao dao = getAccountingDao();
|
||||||
|
|
||||||
|
List<Date> starts = new ArrayList<>();
|
||||||
|
starts.add(DateUtils.getStartCalendar(2021, Calendar.APRIL, 1).getTime());
|
||||||
|
|
||||||
|
AggregationType measureType = AggregationType.MONTHLY;
|
||||||
|
|
||||||
|
ContextAuthorization contextAuthorization = new ContextAuthorization();
|
||||||
|
SortedSet<String> contexts = contextAuthorization.getContexts();
|
||||||
|
|
||||||
|
List<AccountingRecord> accountingRecords = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Date start : starts) {
|
||||||
|
Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
||||||
|
|
||||||
|
MethodInvocationHarvester methodInvocationHarvester = new MethodInvocationHarvester(start, end);
|
||||||
|
|
||||||
|
for (String context : contexts) {
|
||||||
|
// Setting the token for the context
|
||||||
|
ContextTest.setContext(contextAuthorization.getTokenForContext(context));
|
||||||
|
|
||||||
|
|
||||||
|
List<AccountingRecord> harvested = methodInvocationHarvester.getAccountingRecords();
|
||||||
|
accountingRecords.addAll(harvested);
|
||||||
|
|
||||||
|
logger.debug("{} - {}", context, harvested);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("Going to insert {}", accountingRecords);
|
||||||
|
|
||||||
|
ContextTest.setContextByName(ROOT);
|
||||||
|
dao.insertRecords(accountingRecords.toArray(new AccountingRecord[1]));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected AccountingDao getAccountingDao() throws ObjectNotFound, Exception {
|
protected AccountingDao getAccountingDao() throws ObjectNotFound, Exception {
|
||||||
AccountingDao dao = AccountingDao.get();
|
AccountingDao dao = AccountingDao.get();
|
||||||
|
|
||||||
|
@ -761,7 +800,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testCoreServicesHarvester() {
|
public void testCoreServicesHarvester() {
|
||||||
|
@ -797,7 +836,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testCatalogueHarvester() {
|
public void testCatalogueHarvester() {
|
||||||
|
@ -812,9 +851,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
|
||||||
Date end = DateUtils.getStartCalendar(2020, Calendar.FEBRUARY, 1).getTime();
|
Date end = DateUtils.getStartCalendar(2020, Calendar.FEBRUARY, 1).getTime();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Date start = DateUtils.getPreviousPeriod(measureType,
|
* Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date
|
||||||
* false).getTime(); Date end =
|
* end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
||||||
* DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ScopeBean scopeBean = new ScopeBean(context);
|
ScopeBean scopeBean = new ScopeBean(context);
|
||||||
|
|
Loading…
Reference in New Issue