Reorganizing tests
This commit is contained in:
parent
3194c529d5
commit
13282e6236
|
@ -162,7 +162,7 @@ public class ContextTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
setContextByName(DEFAULT_TEST_SCOPE);
|
setContextByName(ROOT_PROD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -77,170 +77,56 @@ public class AccountingAggregatorPluginTest extends ContextTest {
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Test
|
@Test
|
||||||
public void aggregateJobUsageRecord() throws Exception {
|
public void aggregateAllServiceUsageRecord() throws Exception {
|
||||||
ContextTest.setContextByName(GCUBE);
|
String recordType = ServiceUsageRecord.class.newInstance().getRecordType();
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
aggregateEverything(recordType);
|
||||||
|
|
||||||
String recordType = JobUsageRecord.class.newInstance().getRecordType();
|
|
||||||
|
|
||||||
boolean allAgregationTypes = true;
|
|
||||||
boolean forceRerun = false;
|
|
||||||
boolean forceEarlyAggregation = false;
|
|
||||||
|
|
||||||
if (!allAgregationTypes) {
|
|
||||||
AggregationType aggregationType = AggregationType.DAILY;
|
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 10);
|
|
||||||
// Calendar aggregationEndCalendar =
|
|
||||||
// Utility.getEndCalendarFromStartCalendar(aggregationType,
|
|
||||||
// aggregationStartCalendar, 1);
|
|
||||||
Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 11);
|
|
||||||
|
|
||||||
|
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRerun, forceEarlyAggregation);
|
|
||||||
} else {
|
|
||||||
for (AggregationType at : AggregationType.values()) {
|
|
||||||
aggregate(recordType, at, null, null, forceRerun, forceEarlyAggregation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Test
|
|
||||||
public void aggregateStorageStatusRecord() throws Exception {
|
|
||||||
ContextTest.setContextByName(GCUBE);
|
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
|
||||||
|
|
||||||
String recordType = StorageStatusRecord.class.newInstance().getRecordType();
|
|
||||||
|
|
||||||
boolean allAgregationTypes = false;
|
|
||||||
boolean forceRerun = false;
|
|
||||||
boolean forceEarlyAggregation = false;
|
|
||||||
|
|
||||||
if (!allAgregationTypes) {
|
|
||||||
AggregationType aggregationType = AggregationType.DAILY;
|
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 10);
|
|
||||||
// Calendar aggregationEndCalendar =
|
|
||||||
// Utility.getEndCalendarFromStartCalendar(aggregationType,
|
|
||||||
// aggregationStartCalendar, 1);
|
|
||||||
Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 11);
|
|
||||||
|
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRerun, forceEarlyAggregation);
|
|
||||||
} else {
|
|
||||||
for (AggregationType at : AggregationType.values()) {
|
|
||||||
aggregate(recordType, at, null, null, forceRerun, forceEarlyAggregation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@Test
|
|
||||||
public void aggregateStorageUsageRecord() throws Exception {
|
|
||||||
ContextTest.setContextByName(GCUBE);
|
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
|
||||||
|
|
||||||
String recordType = StorageUsageRecord.class.newInstance().getRecordType();
|
|
||||||
|
|
||||||
boolean allAgregationTypes = false;
|
|
||||||
boolean forceRerun = false;
|
|
||||||
boolean forceEarlyAggregation = false;
|
|
||||||
|
|
||||||
|
|
||||||
if (!allAgregationTypes) {
|
|
||||||
AggregationType aggregationType = AggregationType.DAILY;
|
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 10);
|
|
||||||
// Calendar aggregationEndCalendar =
|
|
||||||
// Utility.getEndCalendarFromStartCalendar(aggregationType,
|
|
||||||
// aggregationStartCalendar, 1);
|
|
||||||
Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2021, Calendar.NOVEMBER, 11);
|
|
||||||
|
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRerun, forceEarlyAggregation);
|
|
||||||
} else {
|
|
||||||
for (AggregationType at : AggregationType.values()) {
|
|
||||||
aggregate(recordType, at, null, null, forceRerun, forceEarlyAggregation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @JsonIgnore
|
|
||||||
@Test
|
|
||||||
public void aggregateService() throws Exception {
|
|
||||||
// ContextTest.setContextByName(GCUBE);
|
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
|
||||||
|
|
||||||
String recordType = ServiceUsageRecord.class.newInstance().getRecordType();
|
|
||||||
|
|
||||||
boolean allAgregationTypes = false;
|
|
||||||
boolean forceRerun = true;
|
|
||||||
boolean forceEarlyAggregation = false;
|
|
||||||
|
|
||||||
if (!allAgregationTypes) {
|
|
||||||
AggregationType aggregationType = AggregationType.YEARLY;
|
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2019, Calendar.JANUARY, 1);
|
|
||||||
Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
|
||||||
// Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2015, Calendar.JANUARY, 1);
|
|
||||||
|
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRerun, forceEarlyAggregation);
|
|
||||||
} else {
|
|
||||||
for (AggregationType at : AggregationType.values()) {
|
|
||||||
aggregate(recordType, at, null, null, forceRerun, forceEarlyAggregation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void aggregateAprilService() throws Exception {
|
|
||||||
// ContextTest.setContextByName(GCUBE);
|
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
|
||||||
|
|
||||||
String recordType = ServiceUsageRecord.class.newInstance().getRecordType();
|
|
||||||
|
|
||||||
boolean allAgregationTypes = false;
|
|
||||||
boolean forceRerun = true;
|
|
||||||
boolean forceEarlyAggregation = false;
|
|
||||||
|
|
||||||
if (!allAgregationTypes) {
|
|
||||||
AggregationType aggregationType = AggregationType.MONTHLY;
|
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2023, Calendar.APRIL, 1);
|
|
||||||
Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
|
||||||
// Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2015, Calendar.JANUARY, 1);
|
|
||||||
|
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRerun, forceEarlyAggregation);
|
|
||||||
} else {
|
|
||||||
for (AggregationType at : AggregationType.values()) {
|
|
||||||
aggregate(recordType, at, null, null, forceRerun, forceEarlyAggregation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @JsonIgnore
|
|
||||||
@Test
|
@Test
|
||||||
public void aggregateAllStorageUsageRecord() throws Exception {
|
public void aggregateAllStorageUsageRecord() throws Exception {
|
||||||
// ContextTest.setContextByName(GCUBE);
|
|
||||||
// ContextTest.setContextByName(ROOT_PROD);
|
|
||||||
|
|
||||||
String recordType = StorageUsageRecord.class.newInstance().getRecordType();
|
String recordType = StorageUsageRecord.class.newInstance().getRecordType();
|
||||||
|
aggregateEverything(recordType);
|
||||||
aggregateAll(recordType);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aggregateAll(String recordType) throws Exception {
|
@JsonIgnore
|
||||||
|
@Test
|
||||||
|
public void aggregateAllJobUsageRecord() throws Exception {
|
||||||
|
String recordType = JobUsageRecord.class.newInstance().getRecordType();
|
||||||
|
aggregateEverything(recordType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void aggregateAllStorageStatusRecord() throws Exception {
|
||||||
|
String recordType = StorageStatusRecord.class.newInstance().getRecordType();
|
||||||
|
aggregateOneShot(recordType);
|
||||||
|
// aggregateEverything(recordType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void aggregateOneShot(String recordType) throws Exception {
|
||||||
|
boolean forceRestart = true;
|
||||||
|
boolean forceEarlyAggregation = false;
|
||||||
|
AggregationType aggregationType = AggregationType.YEARLY;
|
||||||
|
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.JANUARY, 1);
|
||||||
|
Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
||||||
|
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void aggregateEverything(String recordType) throws Exception {
|
||||||
|
|
||||||
boolean forceRestart = true;
|
boolean forceRestart = true;
|
||||||
boolean forceEarlyAggregation = false;
|
boolean forceEarlyAggregation = false;
|
||||||
|
|
||||||
|
|
||||||
AggregationType aggregationType = AggregationType.YEARLY;
|
AggregationType aggregationType = AggregationType.YEARLY;
|
||||||
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2020, Calendar.JANUARY, 1);
|
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2015, Calendar.JANUARY, 1);
|
||||||
Calendar end = Utility.getAggregationStartCalendar(2021, Calendar.JANUARY, 1);
|
Calendar end = Utility.getAggregationStartCalendar(2021, Calendar.JANUARY, 1);
|
||||||
// while (aggregationStartCalendar.before(end)) {
|
while (aggregationStartCalendar.before(end)) {
|
||||||
// Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
||||||
// aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation);
|
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation);
|
||||||
// aggregationStartCalendar = Calendar.getInstance();
|
aggregationStartCalendar = Calendar.getInstance();
|
||||||
// aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
||||||
//
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
aggregationType = AggregationType.MONTHLY;
|
aggregationType = AggregationType.MONTHLY;
|
||||||
aggregationStartCalendar = Calendar.getInstance();
|
aggregationStartCalendar = Calendar.getInstance();
|
||||||
|
@ -251,21 +137,17 @@ public class AccountingAggregatorPluginTest extends ContextTest {
|
||||||
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation);
|
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation);
|
||||||
aggregationStartCalendar = Calendar.getInstance();
|
aggregationStartCalendar = Calendar.getInstance();
|
||||||
aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregationType = AggregationType.DAILY;
|
aggregationType = AggregationType.DAILY;
|
||||||
|
aggregationStartCalendar = end;
|
||||||
|
end = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 14);
|
||||||
|
while (aggregationStartCalendar.before(end)) {
|
||||||
|
Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
||||||
|
aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, true);
|
||||||
aggregationStartCalendar = Calendar.getInstance();
|
aggregationStartCalendar = Calendar.getInstance();
|
||||||
aggregationStartCalendar.setTimeInMillis(end.getTimeInMillis());
|
aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
||||||
aggregationStartCalendar = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 6);
|
}
|
||||||
end = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 9);
|
|
||||||
// while (aggregationStartCalendar.before(end)) {
|
|
||||||
// Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1);
|
|
||||||
// aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, true);
|
|
||||||
// aggregationStartCalendar = Calendar.getInstance();
|
|
||||||
// aggregationStartCalendar.setTimeInMillis(aggregationEndCalendar.getTimeInMillis());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
<logger name="org.gcube" level="ERROR" />
|
<logger name="org.gcube" level="ERROR" />
|
||||||
<logger name="org.gcube.accounting.aggregator" level="TRACE" />
|
<logger name="org.gcube.accounting.aggregator" level="INFO" />
|
||||||
|
|
||||||
<root level="WARN">
|
<root level="WARN">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|
Loading…
Reference in New Issue