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:
Luca Frosini 2015-06-25 14:32:14 +00:00
parent 42dafd82ab
commit 73c7b93111
3 changed files with 3 additions and 8 deletions

View File

@ -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 ;

View File

@ -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){

View File

@ -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++){