refs #200: Create accouting-lib library
https://support.d4science.org/issues/200 Fixing model git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115552 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
42dafd82ab
commit
73c7b93111
|
@ -8,8 +8,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*/
|
||||
public interface AggregatedUsageRecord<T extends AggregatedUsageRecord<T, B>, B extends SingleUsageRecord> extends SingleUsageRecord {
|
||||
|
||||
public interface AggregatedUsageRecord<T extends AggregatedUsageRecord<T, B>, B extends SingleUsageRecord> {
|
||||
|
||||
public T getAggregatedUsageRecord(B usageRecord) throws InvalidValueException ;
|
||||
|
||||
|
|
|
@ -52,9 +52,8 @@ public abstract class AggregationStrategy<T extends AggregatedUsageRecord<T, B>,
|
|||
protected boolean isAggregable(UsageRecord record) {
|
||||
for(String field : aggregationField){
|
||||
Serializable recordValue = record.getResourceProperty(field);
|
||||
Serializable thisValue = t.getResourceProperty(field);
|
||||
Serializable thisValue = ((BasicUsageRecord) t).getResourceProperty(field);
|
||||
|
||||
// TODO Check THIS
|
||||
if(!recordValue.equals(thisValue)){
|
||||
return false;
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ public abstract class AggregationStrategy<T extends AggregatedUsageRecord<T, B>,
|
|||
Calendar newCreationTime = Calendar.getInstance();
|
||||
t = reallyAggregate(convertedRecord);
|
||||
|
||||
t.setCreationTime(newCreationTime);
|
||||
((BasicUsageRecord) t).setCreationTime(newCreationTime);
|
||||
|
||||
return t;
|
||||
}catch(NotAggregatableRecordsExceptions e){
|
||||
|
|
|
@ -25,15 +25,12 @@ public class PersistenceTest {
|
|||
public void test() throws Exception {
|
||||
Persistence.setFallbackLocation(System.getProperty("user.home"));
|
||||
Persistence.getInstance();
|
||||
//Persistence persistence = Persistence.getInstance();
|
||||
//persistence.connect();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stressTest() throws Exception {
|
||||
Persistence.setFallbackLocation(System.getProperty("user.home"));
|
||||
Persistence persistence = Persistence.getInstance();
|
||||
//persistence.connect();
|
||||
int quantity = 3000;
|
||||
Calendar startTestTime = new GregorianCalendar();
|
||||
for(int i=0; i< quantity; i++){
|
||||
|
|
Loading…
Reference in New Issue