Fixing tests

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@149202 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-05-29 13:46:04 +00:00
parent 8b9c9a3c95
commit 32dafe7d0c
4 changed files with 13 additions and 12 deletions

View File

@ -70,14 +70,17 @@ public class AggregatedJobUsageRecordTest extends ScopedTest {
logger.debug("JobUsageRecord 2 : {}", jobUsageRecord2);
/*
long firstDuration = jobUsageRecord.getDuration();
long secondDuration = jobUsageRecord2.getDuration();
*/
aggregated.aggregate(jobUsageRecord2);
logger.debug("jobUsageRecord2 Converted to Aggregated: {}", aggregated);
aggregated.validate();
logger.debug("jobUsageRecord2 Converted to Aggregated post validate: {}", aggregated);
/*
Assert.assertTrue(aggregated.getDuration() == ((firstDuration + secondDuration)/2));
Assert.assertTrue(aggregated.getOperationCount() == 2);

View File

@ -103,7 +103,8 @@ public class AggregatedStorageStatusRecordTest extends ScopedTest {
logger.debug("StorageVolumeUsageRecord Converted to Aggregated: {}", converted);
converted.validate();
long firstDataVolume = aggregated.getDataVolume();
//long firstDataVolume = aggregated.getDataVolume();
long secondDataVolume = converted.getDataVolume();
long secondDataCount =storageVolumeUsageRecord2.getDataCount();

View File

@ -16,6 +16,7 @@ import org.gcube.documentstore.records.Record;
import org.gcube.documentstore.records.RecordUtility;
import org.gcube.documentstore.records.implementation.AbstractRecord;
import org.gcube.testutility.ScopedTest;
import org.gcube.testutility.TestUsageRecord;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -24,6 +25,7 @@ public class MyTest extends ScopedTest {
private static Logger logger = LoggerFactory.getLogger(MyTest.class);
@SuppressWarnings("unchecked")
@Test
public void test() throws Exception{
File f = new File("test.log");
@ -35,19 +37,16 @@ public class MyTest extends ScopedTest {
DSMapper.registerSubtypes(AbstractServiceUsageRecord.class);
DSMapper.registerSubtypes(ServiceUsageRecord.class);
/*
Record record = TestUsageRecord.createTestServiceUsageRecord();
FallbackPersistenceBackend fallbackPersistenceBackend = new FallbackPersistenceBackend(f);
fallbackPersistenceBackend.reallyAccount(record);
*/
/*
try(BufferedReader br = new BufferedReader(new FileReader(f))) {
for(String line; (line = br.readLine()) != null; ) {
try {
Record record = RecordUtility.getRecord(ServiceUsageRecord.class, line);
logger.debug(record.toString());
Record r = RecordUtility.getRecord(line);
logger.debug(r.toString());
} catch(Exception e){
logger.error("Was not possible parse line {} to obtain a valid Record. Going to writing back this line as string fallback file.", line, e);
@ -58,7 +57,7 @@ public class MyTest extends ScopedTest {
} catch (IOException e) {
logger.error("IOException", e);
}
*/
}

View File

@ -6,8 +6,6 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.gcube.accounting.persistence.AccountingPersistence;