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:
parent
8b9c9a3c95
commit
32dafe7d0c
|
@ -70,14 +70,17 @@ public class AggregatedJobUsageRecordTest extends ScopedTest {
|
||||||
logger.debug("JobUsageRecord 2 : {}", jobUsageRecord2);
|
logger.debug("JobUsageRecord 2 : {}", jobUsageRecord2);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
long firstDuration = jobUsageRecord.getDuration();
|
long firstDuration = jobUsageRecord.getDuration();
|
||||||
long secondDuration = jobUsageRecord2.getDuration();
|
long secondDuration = jobUsageRecord2.getDuration();
|
||||||
|
*/
|
||||||
|
|
||||||
aggregated.aggregate(jobUsageRecord2);
|
aggregated.aggregate(jobUsageRecord2);
|
||||||
logger.debug("jobUsageRecord2 Converted to Aggregated: {}", aggregated);
|
logger.debug("jobUsageRecord2 Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
logger.debug("jobUsageRecord2 Converted to Aggregated post validate: {}", aggregated);
|
logger.debug("jobUsageRecord2 Converted to Aggregated post validate: {}", aggregated);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Assert.assertTrue(aggregated.getDuration() == ((firstDuration + secondDuration)/2));
|
Assert.assertTrue(aggregated.getDuration() == ((firstDuration + secondDuration)/2));
|
||||||
Assert.assertTrue(aggregated.getOperationCount() == 2);
|
Assert.assertTrue(aggregated.getOperationCount() == 2);
|
||||||
|
|
|
@ -103,7 +103,8 @@ public class AggregatedStorageStatusRecordTest extends ScopedTest {
|
||||||
logger.debug("StorageVolumeUsageRecord Converted to Aggregated: {}", converted);
|
logger.debug("StorageVolumeUsageRecord Converted to Aggregated: {}", converted);
|
||||||
converted.validate();
|
converted.validate();
|
||||||
|
|
||||||
long firstDataVolume = aggregated.getDataVolume();
|
|
||||||
|
//long firstDataVolume = aggregated.getDataVolume();
|
||||||
long secondDataVolume = converted.getDataVolume();
|
long secondDataVolume = converted.getDataVolume();
|
||||||
|
|
||||||
long secondDataCount =storageVolumeUsageRecord2.getDataCount();
|
long secondDataCount =storageVolumeUsageRecord2.getDataCount();
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.documentstore.records.Record;
|
||||||
import org.gcube.documentstore.records.RecordUtility;
|
import org.gcube.documentstore.records.RecordUtility;
|
||||||
import org.gcube.documentstore.records.implementation.AbstractRecord;
|
import org.gcube.documentstore.records.implementation.AbstractRecord;
|
||||||
import org.gcube.testutility.ScopedTest;
|
import org.gcube.testutility.ScopedTest;
|
||||||
|
import org.gcube.testutility.TestUsageRecord;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -24,6 +25,7 @@ public class MyTest extends ScopedTest {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(MyTest.class);
|
private static Logger logger = LoggerFactory.getLogger(MyTest.class);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception{
|
public void test() throws Exception{
|
||||||
File f = new File("test.log");
|
File f = new File("test.log");
|
||||||
|
@ -35,19 +37,16 @@ public class MyTest extends ScopedTest {
|
||||||
DSMapper.registerSubtypes(AbstractServiceUsageRecord.class);
|
DSMapper.registerSubtypes(AbstractServiceUsageRecord.class);
|
||||||
DSMapper.registerSubtypes(ServiceUsageRecord.class);
|
DSMapper.registerSubtypes(ServiceUsageRecord.class);
|
||||||
|
|
||||||
/*
|
|
||||||
Record record = TestUsageRecord.createTestServiceUsageRecord();
|
Record record = TestUsageRecord.createTestServiceUsageRecord();
|
||||||
|
|
||||||
FallbackPersistenceBackend fallbackPersistenceBackend = new FallbackPersistenceBackend(f);
|
FallbackPersistenceBackend fallbackPersistenceBackend = new FallbackPersistenceBackend(f);
|
||||||
|
|
||||||
fallbackPersistenceBackend.reallyAccount(record);
|
fallbackPersistenceBackend.reallyAccount(record);
|
||||||
*/
|
|
||||||
/*
|
|
||||||
try(BufferedReader br = new BufferedReader(new FileReader(f))) {
|
try(BufferedReader br = new BufferedReader(new FileReader(f))) {
|
||||||
for(String line; (line = br.readLine()) != null; ) {
|
for(String line; (line = br.readLine()) != null; ) {
|
||||||
try {
|
try {
|
||||||
Record record = RecordUtility.getRecord(ServiceUsageRecord.class, line);
|
Record r = RecordUtility.getRecord(line);
|
||||||
logger.debug(record.toString());
|
logger.debug(r.toString());
|
||||||
} catch(Exception e){
|
} 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);
|
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) {
|
} catch (IOException e) {
|
||||||
logger.error("IOException", e);
|
logger.error("IOException", e);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.gcube.accounting.persistence.AccountingPersistence;
|
import org.gcube.accounting.persistence.AccountingPersistence;
|
||||||
|
|
Loading…
Reference in New Issue