refs #2358: Remove reflections dependency from accounting-lib

https://support.d4science.org/issues/2358

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@124717 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-03-01 15:20:48 +00:00
parent 66cafac399
commit 8a2d672b6d
2 changed files with 11 additions and 2 deletions

View File

@ -22,12 +22,16 @@ public class AccountingPersistenceFactory {
protected final static Map<String, AccountingPersistence> persistences;
static {
persistences = new HashMap<String, AccountingPersistence>();
public static void initAccountingPackages(){
PersistenceBackendFactory.addRecordPackage(ServiceUsageRecord.class.getPackage());
PersistenceBackendFactory.addRecordPackage(AggregatedServiceUsageRecord.class.getPackage());
}
static {
persistences = new HashMap<String, AccountingPersistence>();
initAccountingPackages();
}
public static void setFallbackLocation(String path){
PersistenceBackendFactory.setFallbackLocation(path);
}

View File

@ -17,6 +17,7 @@ import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.TaskUsageRecord;
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
import org.gcube.documentstore.exception.InvalidValueException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -59,6 +60,10 @@ public class TestUsageRecord {
private final static long MIN_DURATION = 60; // millisec
private final static long MAX_DURATION = 1000; // millisec
static {
AccountingPersistenceFactory.initAccountingPackages();
}
/**
* Generate A Random long in a range between min and max.
* This function is internally used to set random duration.