Renamed classes to avoid name and import conflicts
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@117529 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
268dafea5a
commit
9995c4873b
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-lib</artifactId>
|
<artifactId>accounting-lib</artifactId>
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<name>Accounting Library</name>
|
<name>Accounting Library</name>
|
||||||
<description>Accounting Library</description>
|
<description>Accounting Library</description>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -7,13 +7,15 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractJobUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.JobUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Class is for library internal use only
|
* This Class is for library internal use only
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*/
|
*/
|
||||||
public class JobUsageRecord extends org.gcube.accounting.datamodel.basetypes.JobUsageRecord implements AggregatedUsageRecord<JobUsageRecord, org.gcube.accounting.datamodel.usagerecords.JobUsageRecord> {
|
public class AggregatedJobUsageRecord extends AbstractJobUsageRecord implements AggregatedUsageRecord<AggregatedJobUsageRecord, JobUsageRecord> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -24,12 +26,12 @@ public class JobUsageRecord extends org.gcube.accounting.datamodel.basetypes.Job
|
||||||
this.resourceProperties.put(AGGREGATED, true);
|
this.resourceProperties.put(AGGREGATED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobUsageRecord(){
|
public AggregatedJobUsageRecord(){
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
public AggregatedJobUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -38,8 +40,7 @@ public class JobUsageRecord extends org.gcube.accounting.datamodel.basetypes.Job
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JobUsageRecord getAggregatedUsageRecord(
|
public AggregatedJobUsageRecord getAggregatedUsageRecord(JobUsageRecord b)
|
||||||
org.gcube.accounting.datamodel.usagerecords.JobUsageRecord b)
|
|
||||||
throws InvalidValueException {
|
throws InvalidValueException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
|
@ -7,13 +7,15 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractPortletUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Class is for library internal use only
|
* This Class is for library internal use only
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*/
|
*/
|
||||||
public class TaskUsageRecord extends org.gcube.accounting.datamodel.basetypes.TaskUsageRecord implements AggregatedUsageRecord<TaskUsageRecord, org.gcube.accounting.datamodel.usagerecords.TaskUsageRecord> {
|
public class AggregatedPortletUsageRecord extends AbstractPortletUsageRecord implements AggregatedUsageRecord<AggregatedPortletUsageRecord, PortletUsageRecord> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,12 +27,12 @@ public class TaskUsageRecord extends org.gcube.accounting.datamodel.basetypes.Ta
|
||||||
this.resourceProperties.put(AGGREGATED, true);
|
this.resourceProperties.put(AGGREGATED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskUsageRecord(){
|
public AggregatedPortletUsageRecord(){
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
public AggregatedPortletUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -39,8 +41,7 @@ public class TaskUsageRecord extends org.gcube.accounting.datamodel.basetypes.Ta
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TaskUsageRecord getAggregatedUsageRecord(
|
public AggregatedPortletUsageRecord getAggregatedUsageRecord(PortletUsageRecord usageRecord)
|
||||||
org.gcube.accounting.datamodel.usagerecords.TaskUsageRecord usageRecord)
|
|
||||||
throws InvalidValueException {
|
throws InvalidValueException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
|
@ -8,8 +8,10 @@ import java.util.Calendar;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.decorators.AggregatedField;
|
import org.gcube.accounting.datamodel.decorators.AggregatedField;
|
||||||
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
|
@ -17,7 +19,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* This Class is for library internal use only
|
* This Class is for library internal use only
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*/
|
*/
|
||||||
public class ServiceUsageRecord extends org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord implements AggregatedUsageRecord<ServiceUsageRecord, org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord> {
|
public class AggregatedServiceUsageRecord extends AbstractServiceUsageRecord implements AggregatedUsageRecord<AggregatedServiceUsageRecord, ServiceUsageRecord> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -26,7 +28,7 @@ public class ServiceUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
|
|
||||||
// Redefining DURATION to Set @AggregatedField
|
// Redefining DURATION to Set @AggregatedField
|
||||||
@RequiredField @ValidLong @AggregatedField
|
@RequiredField @ValidLong @AggregatedField
|
||||||
public static final String DURATION = org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.DURATION;
|
public static final String DURATION = org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.DURATION;
|
||||||
|
|
||||||
@RequiredField @ValidLong @AggregatedField
|
@RequiredField @ValidLong @AggregatedField
|
||||||
public static final String MAX_INVOCATION_TIME = "maxInvocationTime";
|
public static final String MAX_INVOCATION_TIME = "maxInvocationTime";
|
||||||
|
@ -37,17 +39,17 @@ public class ServiceUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
this.resourceProperties.put(AGGREGATED, true);
|
this.resourceProperties.put(AGGREGATED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceUsageRecord(){
|
public AggregatedServiceUsageRecord(){
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
protected AggregatedServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceUsageRecord(org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord record) throws InvalidValueException{
|
public AggregatedServiceUsageRecord(org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord record) throws InvalidValueException{
|
||||||
super(record.getResourceProperties());
|
super(record.getResourceProperties());
|
||||||
this.setOperationCount(1);
|
this.setOperationCount(1);
|
||||||
long duration = record.getDuration();
|
long duration = record.getDuration();
|
||||||
|
@ -90,10 +92,9 @@ public class ServiceUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ServiceUsageRecord getAggregatedUsageRecord(
|
public AggregatedServiceUsageRecord getAggregatedUsageRecord(ServiceUsageRecord usageRecord)
|
||||||
org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord usageRecord)
|
|
||||||
throws InvalidValueException {
|
throws InvalidValueException {
|
||||||
return new ServiceUsageRecord(usageRecord);
|
return new AggregatedServiceUsageRecord(usageRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,8 +8,10 @@ import java.util.Calendar;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.decorators.AggregatedField;
|
import org.gcube.accounting.datamodel.decorators.AggregatedField;
|
||||||
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
|
@ -17,7 +19,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* This Class is for library internal use only
|
* This Class is for library internal use only
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*/
|
*/
|
||||||
public class StorageUsageRecord extends org.gcube.accounting.datamodel.basetypes.StorageUsageRecord implements AggregatedUsageRecord<StorageUsageRecord, org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord> {
|
public class AggregatedStorageUsageRecord extends AbstractStorageUsageRecord implements AggregatedUsageRecord<AggregatedStorageUsageRecord, StorageUsageRecord> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -26,23 +28,23 @@ public class StorageUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
|
|
||||||
// Redefining DATA_VOLUME to Set @AggregatedField
|
// Redefining DATA_VOLUME to Set @AggregatedField
|
||||||
@RequiredField @ValidLong @AggregatedField
|
@RequiredField @ValidLong @AggregatedField
|
||||||
public static final String DATA_VOLUME = org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.DATA_VOLUME;
|
public static final String DATA_VOLUME = org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DATA_VOLUME;
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
this.resourceProperties.put(AGGREGATED, true);
|
this.resourceProperties.put(AGGREGATED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageUsageRecord() {
|
public AggregatedStorageUsageRecord() {
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
public AggregatedStorageUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageUsageRecord(org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord record) throws InvalidValueException{
|
public AggregatedStorageUsageRecord(org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord record) throws InvalidValueException{
|
||||||
super(record.getResourceProperties());
|
super(record.getResourceProperties());
|
||||||
this.setOperationCount(1);
|
this.setOperationCount(1);
|
||||||
Calendar creationTime = record.getCreationTime();
|
Calendar creationTime = record.getCreationTime();
|
||||||
|
@ -67,10 +69,9 @@ public class StorageUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public StorageUsageRecord getAggregatedUsageRecord(
|
public AggregatedStorageUsageRecord getAggregatedUsageRecord(StorageUsageRecord usageRecord)
|
||||||
org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord usageRecord)
|
|
||||||
throws InvalidValueException {
|
throws InvalidValueException {
|
||||||
return new StorageUsageRecord(usageRecord);
|
return new AggregatedStorageUsageRecord(usageRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,13 +7,15 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractTaskUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.TaskUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Class is for library internal use only
|
* This Class is for library internal use only
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*/
|
*/
|
||||||
public class PortletUsageRecord extends org.gcube.accounting.datamodel.basetypes.PortletUsageRecord implements AggregatedUsageRecord<PortletUsageRecord, org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord> {
|
public class AggregatedTaskUsageRecord extends AbstractTaskUsageRecord implements AggregatedUsageRecord<AggregatedTaskUsageRecord, TaskUsageRecord> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,12 +27,12 @@ public class PortletUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
this.resourceProperties.put(AGGREGATED, true);
|
this.resourceProperties.put(AGGREGATED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortletUsageRecord(){
|
public AggregatedTaskUsageRecord(){
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortletUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
public AggregatedTaskUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -39,8 +41,7 @@ public class PortletUsageRecord extends org.gcube.accounting.datamodel.basetypes
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PortletUsageRecord getAggregatedUsageRecord(
|
public AggregatedTaskUsageRecord getAggregatedUsageRecord(TaskUsageRecord usageRecord)
|
||||||
org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord usageRecord)
|
|
||||||
throws InvalidValueException {
|
throws InvalidValueException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
|
@ -7,6 +7,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.accounting.aggregation.AggregatedServiceUsageRecord;
|
||||||
|
import org.gcube.accounting.aggregation.strategy.ServiceUsageRecordAggregationStrategy;
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.AggregationStrategy;
|
import org.gcube.accounting.datamodel.AggregationStrategy;
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
@ -49,15 +51,15 @@ public abstract class AggregationScheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
protected Class<? extends AggregatedUsageRecord> getAggregatedUsageRecordClass(String usageRecordName) throws ClassNotFoundException {
|
protected Class<? extends AggregatedUsageRecord> getAggregatedUsageRecordClass(String usageRecordType) throws ClassNotFoundException {
|
||||||
Class<? extends AggregatedUsageRecord> clz;
|
Class<? extends AggregatedUsageRecord> clz;
|
||||||
String aggregatedURFullyQualifiedName;
|
String aggregatedURFullyQualifiedName;
|
||||||
try {
|
try {
|
||||||
Package aggregatedPackage = org.gcube.accounting.aggregation.ServiceUsageRecord.class.getPackage();
|
Package aggregatedPackage = AggregatedServiceUsageRecord.class.getPackage();
|
||||||
aggregatedURFullyQualifiedName = String.format("%s.%s", aggregatedPackage.getName(), usageRecordName);
|
aggregatedURFullyQualifiedName = String.format("%s.Aggregated%s", aggregatedPackage.getName(), usageRecordType);
|
||||||
clz = (Class<? extends AggregatedUsageRecord>) Class.forName(aggregatedURFullyQualifiedName);
|
clz = (Class<? extends AggregatedUsageRecord>) Class.forName(aggregatedURFullyQualifiedName);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
logger.error("Unable To find the Aggregation Class for {}", usageRecordName);
|
logger.error("Unable To find the Aggregation Class for {}", usageRecordType);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return clz;
|
return clz;
|
||||||
|
@ -65,8 +67,8 @@ public abstract class AggregationScheduler {
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
protected AggregatedUsageRecord instantiateAggregatedUsageRecord(UsageRecord usageRecord) throws Exception{
|
protected AggregatedUsageRecord instantiateAggregatedUsageRecord(UsageRecord usageRecord) throws Exception{
|
||||||
String usageRecordName = usageRecord.getClass().getSimpleName();
|
String usageRecordType = usageRecord.getUsageRecordType();
|
||||||
Class<? extends AggregatedUsageRecord> clz = getAggregatedUsageRecordClass(usageRecordName);
|
Class<? extends AggregatedUsageRecord> clz = getAggregatedUsageRecordClass(usageRecordType);
|
||||||
Class[] argTypes = { usageRecord.getClass() };
|
Class[] argTypes = { usageRecord.getClass() };
|
||||||
Constructor<? extends AggregatedUsageRecord> constructor = clz.getDeclaredConstructor(argTypes);
|
Constructor<? extends AggregatedUsageRecord> constructor = clz.getDeclaredConstructor(argTypes);
|
||||||
Object[] arguments = {usageRecord};
|
Object[] arguments = {usageRecord};
|
||||||
|
@ -75,15 +77,15 @@ public abstract class AggregationScheduler {
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
protected Class<? extends AggregationStrategy> getAggregattionStrategyUsageRecordClass(String usageRecordName) throws ClassNotFoundException {
|
protected Class<? extends AggregationStrategy> getAggregattionStrategyUsageRecordClass(String usageRecordType) throws ClassNotFoundException {
|
||||||
Class<? extends AggregationStrategy> clz;
|
Class<? extends AggregationStrategy> clz;
|
||||||
String aggregationStrategyName;
|
String aggregationStrategyName;
|
||||||
try {
|
try {
|
||||||
Package aggregationStrategyPackage = org.gcube.accounting.aggregation.strategy.ServiceUsageRecordAggregationStrategy.class.getPackage();
|
Package aggregationStrategyPackage = ServiceUsageRecordAggregationStrategy.class.getPackage();
|
||||||
aggregationStrategyName = String.format("%s.%s%s", aggregationStrategyPackage.getName(), usageRecordName, AggregationStrategy.class.getSimpleName());
|
aggregationStrategyName = String.format("%s.%s%s", aggregationStrategyPackage.getName(), usageRecordType, AggregationStrategy.class.getSimpleName());
|
||||||
clz = (Class<? extends AggregationStrategy>) Class.forName(aggregationStrategyName);
|
clz = (Class<? extends AggregationStrategy>) Class.forName(aggregationStrategyName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Unable To find the Aggregation Strategy Class for {}", usageRecordName);
|
logger.error("Unable To find the Aggregation Strategy Class for {}", usageRecordType);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return clz;
|
return clz;
|
||||||
|
@ -91,8 +93,8 @@ public abstract class AggregationScheduler {
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
protected AggregationStrategy instantiateAggregationStrategy(AggregatedUsageRecord aggregatedUsageRecord) throws Exception{
|
protected AggregationStrategy instantiateAggregationStrategy(AggregatedUsageRecord aggregatedUsageRecord) throws Exception{
|
||||||
String usageRecordName = aggregatedUsageRecord.getClass().getSimpleName();
|
String usageRecordType = aggregatedUsageRecord.getUsageRecordType();
|
||||||
Class<? extends AggregationStrategy> clz = getAggregattionStrategyUsageRecordClass(usageRecordName);
|
Class<? extends AggregationStrategy> clz = getAggregattionStrategyUsageRecordClass(usageRecordType);
|
||||||
Class[] argTypes = { aggregatedUsageRecord.getClass() };
|
Class[] argTypes = { aggregatedUsageRecord.getClass() };
|
||||||
Constructor<? extends AggregationStrategy> constructor = clz.getDeclaredConstructor(argTypes);
|
Constructor<? extends AggregationStrategy> constructor = clz.getDeclaredConstructor(argTypes);
|
||||||
Object[] arguments = {aggregatedUsageRecord};
|
Object[] arguments = {aggregatedUsageRecord};
|
||||||
|
@ -102,12 +104,12 @@ public abstract class AggregationScheduler {
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
protected void madeAggregation(UsageRecord usageRecord){
|
protected void madeAggregation(UsageRecord usageRecord){
|
||||||
String usageRecordName = usageRecord.getClass().getSimpleName();
|
String usageRecordType = usageRecord.getUsageRecordType();
|
||||||
|
|
||||||
List<AggregationStrategy> aggregationStrategies;
|
List<AggregationStrategy> aggregationStrategies;
|
||||||
|
|
||||||
if(this.records.containsKey(usageRecordName)){
|
if(this.records.containsKey(usageRecordType)){
|
||||||
aggregationStrategies = this.records.get(usageRecordName);
|
aggregationStrategies = this.records.get(usageRecordType);
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for(AggregationStrategy aggregationStrategy : aggregationStrategies){
|
for(AggregationStrategy aggregationStrategy : aggregationStrategies){
|
||||||
try {
|
try {
|
||||||
|
@ -123,7 +125,7 @@ public abstract class AggregationScheduler {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
aggregationStrategies = new ArrayList<AggregationStrategy>();
|
aggregationStrategies = new ArrayList<AggregationStrategy>();
|
||||||
this.records.put(usageRecordName, aggregationStrategies);
|
this.records.put(usageRecordType, aggregationStrategies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +141,7 @@ public abstract class AggregationScheduler {
|
||||||
// org.gcube.accounting.datamodel.aggregation package
|
// org.gcube.accounting.datamodel.aggregation package
|
||||||
aggregatedUsageRecord = instantiateAggregatedUsageRecord(usageRecord);
|
aggregatedUsageRecord = instantiateAggregatedUsageRecord(usageRecord);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to Istantiate the Aggregation Class for {}. The Record will be persisted as is (Better than nothing).", usageRecordName);
|
logger.error("Unable to Istantiate the Aggregation Class for {}. The Record will be persisted as is (Better than nothing).", usageRecordType);
|
||||||
unaggregableRecords.add(usageRecord);
|
unaggregableRecords.add(usageRecord);
|
||||||
totalBufferedRecords++;
|
totalBufferedRecords++;
|
||||||
return;
|
return;
|
||||||
|
@ -152,7 +154,7 @@ public abstract class AggregationScheduler {
|
||||||
aggregationStrategies.add(aggregationStrategy);
|
aggregationStrategies.add(aggregationStrategy);
|
||||||
totalBufferedRecords++;
|
totalBufferedRecords++;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to Istantiate the Aggregation Strategy Class for {}. The Record will be persisted as is (Better than nothing).", usageRecordName);
|
logger.error("Unable to Istantiate the Aggregation Strategy Class for {}. The Record will be persisted as is (Better than nothing).", usageRecordType);
|
||||||
unaggregableRecords.add(usageRecord);
|
unaggregableRecords.add(usageRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,36 +3,37 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.aggregation.strategy;
|
package org.gcube.accounting.aggregation.strategy;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregation.ServiceUsageRecord;
|
import org.gcube.accounting.aggregation.AggregatedServiceUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.AggregationStrategy;
|
import org.gcube.accounting.datamodel.AggregationStrategy;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ServiceUsageRecordAggregationStrategy extends AggregationStrategy<ServiceUsageRecord, org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord>{
|
public class ServiceUsageRecordAggregationStrategy extends AggregationStrategy<AggregatedServiceUsageRecord, ServiceUsageRecord>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param serviceUsageRecord
|
* @param serviceUsageRecord
|
||||||
*/
|
*/
|
||||||
public ServiceUsageRecordAggregationStrategy(ServiceUsageRecord serviceUsageRecord) {
|
public ServiceUsageRecordAggregationStrategy(AggregatedServiceUsageRecord serviceUsageRecord) {
|
||||||
super(serviceUsageRecord);
|
super(serviceUsageRecord);
|
||||||
this.aggregationField.add(ServiceUsageRecord.CALLER_HOST);
|
this.aggregationField.add(AggregatedServiceUsageRecord.CALLER_HOST);
|
||||||
this.aggregationField.add(ServiceUsageRecord.HOST);
|
this.aggregationField.add(AggregatedServiceUsageRecord.HOST);
|
||||||
this.aggregationField.add(ServiceUsageRecord.SERVICE_CLASS);
|
this.aggregationField.add(AggregatedServiceUsageRecord.SERVICE_CLASS);
|
||||||
this.aggregationField.add(ServiceUsageRecord.SERVICE_NAME);
|
this.aggregationField.add(AggregatedServiceUsageRecord.SERVICE_NAME);
|
||||||
this.aggregationField.add(ServiceUsageRecord.CALLED_METHOD);
|
this.aggregationField.add(AggregatedServiceUsageRecord.CALLED_METHOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long durationWeightedAverage(ServiceUsageRecord record){
|
protected long durationWeightedAverage(AggregatedServiceUsageRecord record){
|
||||||
long tDuration = t.getDuration() * t.getOperationCount();
|
long tDuration = t.getDuration() * t.getOperationCount();
|
||||||
long recordDuration = record.getDuration() * record.getOperationCount();
|
long recordDuration = record.getDuration() * record.getOperationCount();
|
||||||
long totalOperationCount = t.getOperationCount() + record.getOperationCount();
|
long totalOperationCount = t.getOperationCount() + record.getOperationCount();
|
||||||
return (tDuration + recordDuration) / totalOperationCount;
|
return (tDuration + recordDuration) / totalOperationCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServiceUsageRecord reallyAggregate(ServiceUsageRecord record)
|
protected AggregatedServiceUsageRecord reallyAggregate(AggregatedServiceUsageRecord record)
|
||||||
throws NotAggregatableRecordsExceptions {
|
throws NotAggregatableRecordsExceptions {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,30 +3,31 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.aggregation.strategy;
|
package org.gcube.accounting.aggregation.strategy;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregation.StorageUsageRecord;
|
import org.gcube.accounting.aggregation.AggregatedStorageUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.AggregationStrategy;
|
import org.gcube.accounting.datamodel.AggregationStrategy;
|
||||||
|
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class StorageUsageRecordAggregationStrategy extends AggregationStrategy<StorageUsageRecord, org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord>{
|
public class StorageUsageRecordAggregationStrategy extends AggregationStrategy<AggregatedStorageUsageRecord, StorageUsageRecord>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param serviceUsageRecord
|
* @param serviceUsageRecord
|
||||||
*/
|
*/
|
||||||
public StorageUsageRecordAggregationStrategy(StorageUsageRecord storageUsageRecord) {
|
public StorageUsageRecordAggregationStrategy(AggregatedStorageUsageRecord storageUsageRecord) {
|
||||||
super(storageUsageRecord);
|
super(storageUsageRecord);
|
||||||
this.aggregationField.add(StorageUsageRecord.RESOURCE_OWNER);
|
this.aggregationField.add(AggregatedStorageUsageRecord.RESOURCE_OWNER);
|
||||||
this.aggregationField.add(StorageUsageRecord.RESOURCE_SCOPE);
|
this.aggregationField.add(AggregatedStorageUsageRecord.RESOURCE_SCOPE);
|
||||||
this.aggregationField.add(StorageUsageRecord.RESOURCE_URI);
|
this.aggregationField.add(AggregatedStorageUsageRecord.RESOURCE_URI);
|
||||||
this.aggregationField.add(StorageUsageRecord.PROVIDER_URI);
|
this.aggregationField.add(AggregatedStorageUsageRecord.PROVIDER_URI);
|
||||||
this.aggregationField.add(StorageUsageRecord.OPERATION_TYPE);
|
this.aggregationField.add(AggregatedStorageUsageRecord.OPERATION_TYPE);
|
||||||
this.aggregationField.add(StorageUsageRecord.DATA_TYPE);
|
this.aggregationField.add(AggregatedStorageUsageRecord.DATA_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StorageUsageRecord reallyAggregate(StorageUsageRecord record)
|
protected AggregatedStorageUsageRecord reallyAggregate(AggregatedStorageUsageRecord record)
|
||||||
throws NotAggregatableRecordsExceptions {
|
throws NotAggregatableRecordsExceptions {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -205,7 +205,7 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable {
|
||||||
public BasicUsageRecord(){
|
public BasicUsageRecord(){
|
||||||
init();
|
init();
|
||||||
this.resourceProperties.put(ID, UUID.randomUUID().toString());
|
this.resourceProperties.put(ID, UUID.randomUUID().toString());
|
||||||
this.resourceProperties.put(USAGE_RECORD_TYPE, this.getClass().getSimpleName());
|
this.setUsageRecordType();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
this.resourceProperties.put(CREATION_TIME, calendar.getTimeInMillis());
|
this.resourceProperties.put(CREATION_TIME, calendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
@ -215,6 +215,20 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable {
|
||||||
setResourceProperties(properties);
|
setResourceProperties(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUsageRecordType() {
|
||||||
|
return (String) this.resourceProperties.get(USAGE_RECORD_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract String giveMeUsageRecordType();
|
||||||
|
|
||||||
|
protected void setUsageRecordType(){
|
||||||
|
this.resourceProperties.put(USAGE_RECORD_TYPE, this.giveMeUsageRecordType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -496,7 +510,7 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable {
|
||||||
|
|
||||||
Class<? extends UsageRecord> utilityClass = org.gcube.accounting.datamodel.usagerecords.JobUsageRecord.class;
|
Class<? extends UsageRecord> utilityClass = org.gcube.accounting.datamodel.usagerecords.JobUsageRecord.class;
|
||||||
if(aggregated){
|
if(aggregated){
|
||||||
utilityClass = org.gcube.accounting.aggregation.JobUsageRecord.class;
|
utilityClass = org.gcube.accounting.aggregation.AggregatedJobUsageRecord.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
String classCanonicalName = utilityClass.getCanonicalName();
|
String classCanonicalName = utilityClass.getCanonicalName();
|
||||||
|
|
|
@ -438,5 +438,14 @@ public class RawUsageRecord extends BasicUsageRecord implements SingleUsageRecor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
// This implementation is just a placeholder
|
||||||
|
return this.getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,12 @@ public interface UsageRecord extends Comparable<UsageRecord> {
|
||||||
*/
|
*/
|
||||||
public Set<String> getRequiredFields();
|
public Set<String> getRequiredFields();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the Usage Record Type
|
||||||
|
* @return {#UsageRecord} Type
|
||||||
|
*/
|
||||||
|
public String getUsageRecordType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the unique id for this {#UsageRecord}
|
* Return the unique id for this {#UsageRecord}
|
||||||
* @return {#UsageRecord} Unique ID
|
* @return {#UsageRecord} Unique ID
|
||||||
|
|
|
@ -29,9 +29,9 @@ import org.slf4j.LoggerFactory;
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JobUsageRecord extends BasicUsageRecord {
|
public abstract class AbstractJobUsageRecord extends BasicUsageRecord {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobUsageRecord.class);
|
private static Logger logger = LoggerFactory.getLogger(AbstractJobUsageRecord.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -80,14 +80,24 @@ public abstract class JobUsageRecord extends BasicUsageRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public JobUsageRecord(){
|
public AbstractJobUsageRecord(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
public AbstractJobUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
return AbstractJobUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Job Id
|
* @return the Job Id
|
||||||
*/
|
*/
|
|
@ -25,7 +25,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class PortletUsageRecord extends BasicUsageRecord {
|
public abstract class AbstractPortletUsageRecord extends BasicUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -55,14 +55,24 @@ public abstract class PortletUsageRecord extends BasicUsageRecord {
|
||||||
@NotEmptyIfNotNull
|
@NotEmptyIfNotNull
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
|
|
||||||
public PortletUsageRecord(){
|
public AbstractPortletUsageRecord(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortletUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
public AbstractPortletUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
return AbstractPortletUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||||
|
}
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
* Use {@link #getConsumerId()} instead
|
* Use {@link #getConsumerId()} instead
|
||||||
* @return the Consumer ID
|
* @return the Consumer ID
|
|
@ -16,7 +16,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class ServiceUsageRecord extends BasicUsageRecord {
|
public abstract class AbstractServiceUsageRecord extends BasicUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -59,14 +59,24 @@ public abstract class ServiceUsageRecord extends BasicUsageRecord {
|
||||||
@RequiredField @ValidLong
|
@RequiredField @ValidLong
|
||||||
public static final String DURATION = "duration";
|
public static final String DURATION = "duration";
|
||||||
|
|
||||||
public ServiceUsageRecord(){
|
public AbstractServiceUsageRecord(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
public AbstractServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
return AbstractServiceUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||||
|
}
|
||||||
|
|
||||||
public String getCallerHost() {
|
public String getCallerHost() {
|
||||||
return (String) this.resourceProperties.get(CALLER_HOST);
|
return (String) this.resourceProperties.get(CALLER_HOST);
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class StorageUsageRecord extends BasicUsageRecord {
|
public abstract class AbstractStorageUsageRecord extends BasicUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -103,14 +103,24 @@ public abstract class StorageUsageRecord extends BasicUsageRecord {
|
||||||
@NotEmptyIfNotNull
|
@NotEmptyIfNotNull
|
||||||
public static final String QUALIFIER = "qualifier";
|
public static final String QUALIFIER = "qualifier";
|
||||||
|
|
||||||
public StorageUsageRecord() {
|
public AbstractStorageUsageRecord() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
public AbstractStorageUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
return AbstractStorageUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the identity id of the storage resource owner
|
* Return the identity id of the storage resource owner
|
||||||
* @return the identity id of the accounting owner
|
* @return the identity id of the accounting owner
|
|
@ -20,7 +20,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
||||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class TaskUsageRecord extends BasicUsageRecord {
|
public abstract class AbstractTaskUsageRecord extends BasicUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
@ -66,14 +66,24 @@ public abstract class TaskUsageRecord extends BasicUsageRecord {
|
||||||
@ValidInteger
|
@ValidInteger
|
||||||
public static final String PROCESSORS = "processors";
|
public static final String PROCESSORS = "processors";
|
||||||
|
|
||||||
public TaskUsageRecord(){
|
public AbstractTaskUsageRecord(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
public AbstractTaskUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String giveMeUsageRecordType() {
|
||||||
|
return AbstractTaskUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Job Id
|
* @return the Job Id
|
||||||
*/
|
*/
|
|
@ -132,8 +132,8 @@ public class TestUsageRecord {
|
||||||
usageRecord.setResourceURI(new URI(TEST_RESOURCE_URI));
|
usageRecord.setResourceURI(new URI(TEST_RESOURCE_URI));
|
||||||
usageRecord.setProviderURI(new URI(TEST_PROVIDER_URI));
|
usageRecord.setProviderURI(new URI(TEST_PROVIDER_URI));
|
||||||
|
|
||||||
usageRecord.setOperationType(StorageUsageRecord.OperationType.READ);
|
usageRecord.setOperationType(AbstractStorageUsageRecord.OperationType.READ);
|
||||||
usageRecord.setDataType(StorageUsageRecord.DataType.STORAGE);
|
usageRecord.setDataType(AbstractStorageUsageRecord.DataType.STORAGE);
|
||||||
|
|
||||||
usageRecord.setDataVolume(generateRandomLong(MIN_DATA_VOLUME, MAX_DATA_VOLUME));
|
usageRecord.setDataVolume(generateRandomLong(MIN_DATA_VOLUME, MAX_DATA_VOLUME));
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractJobUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
public class JobUsageRecord extends org.gcube.accounting.datamodel.basetypes.JobUsageRecord implements SingleUsageRecord {
|
public class JobUsageRecord extends AbstractJobUsageRecord implements SingleUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractPortletUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
public class PortletUsageRecord extends org.gcube.accounting.datamodel.basetypes.PortletUsageRecord implements SingleUsageRecord {
|
public class PortletUsageRecord extends AbstractPortletUsageRecord implements SingleUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
public class ServiceUsageRecord extends org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord implements SingleUsageRecord {
|
public class ServiceUsageRecord extends AbstractServiceUsageRecord implements SingleUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
public class StorageUsageRecord extends org.gcube.accounting.datamodel.basetypes.StorageUsageRecord implements SingleUsageRecord {
|
public class StorageUsageRecord extends AbstractStorageUsageRecord implements SingleUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
|
import org.gcube.accounting.datamodel.basetypes.AbstractTaskUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
public class TaskUsageRecord extends org.gcube.accounting.datamodel.basetypes.TaskUsageRecord implements SingleUsageRecord {
|
public class TaskUsageRecord extends AbstractTaskUsageRecord implements SingleUsageRecord {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated Serial Version UID
|
* Generated Serial Version UID
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.accounting.datamodel.validations.validators;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.UsageRecord;
|
import org.gcube.accounting.datamodel.UsageRecord;
|
||||||
import org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.DataType;
|
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DataType;
|
||||||
import org.gcube.accounting.datamodel.decorators.FieldAction;
|
import org.gcube.accounting.datamodel.decorators.FieldAction;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.UsageRecord;
|
import org.gcube.accounting.datamodel.UsageRecord;
|
||||||
import org.gcube.accounting.datamodel.UsageRecord.OperationResult;
|
import org.gcube.accounting.datamodel.UsageRecord.OperationResult;
|
||||||
import org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.OperationType;
|
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.OperationType;
|
||||||
import org.gcube.accounting.datamodel.decorators.FieldAction;
|
import org.gcube.accounting.datamodel.decorators.FieldAction;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,12 @@ public class ServiceUsageRecordTest {
|
||||||
public void testRequiredFields() throws InvalidValueException {
|
public void testRequiredFields() throws InvalidValueException {
|
||||||
org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord serviceUsageRecord = TestUsageRecord.createTestServiceUsageRecordAutomaticScope();
|
org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord serviceUsageRecord = TestUsageRecord.createTestServiceUsageRecordAutomaticScope();
|
||||||
|
|
||||||
ServiceUsageRecord aggregatedServiceUsageRecord = new ServiceUsageRecord(serviceUsageRecord);
|
AggregatedServiceUsageRecord aggregatedServiceUsageRecord = new AggregatedServiceUsageRecord(serviceUsageRecord);
|
||||||
|
|
||||||
Set<String> expectedRequiredFields = org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecordTest.getExpectedRequiredFields();
|
Set<String> expectedRequiredFields = org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecordTest.getExpectedRequiredFields();
|
||||||
expectedRequiredFields.add(ServiceUsageRecord.DURATION);
|
expectedRequiredFields.add(AggregatedServiceUsageRecord.DURATION);
|
||||||
expectedRequiredFields.add(ServiceUsageRecord.MAX_INVOCATION_TIME);
|
expectedRequiredFields.add(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||||
expectedRequiredFields.add(ServiceUsageRecord.MIN_INVOCATION_TIME);
|
expectedRequiredFields.add(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||||
|
|
||||||
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
logger.debug("Expected Required Fields : {}", expectedRequiredFields);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.aggregation.strategy;
|
package org.gcube.accounting.aggregation.strategy;
|
||||||
|
|
||||||
|
import org.gcube.accounting.aggregation.AggregatedServiceUsageRecord;
|
||||||
import org.gcube.accounting.aggregation.strategy.ServiceUsageRecordAggregationStrategy;
|
import org.gcube.accounting.aggregation.strategy.ServiceUsageRecordAggregationStrategy;
|
||||||
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
||||||
|
@ -31,8 +32,7 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
AggregatedServiceUsageRecord aggregated = new AggregatedServiceUsageRecord(serviceUsageRecord);
|
||||||
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
|
|
||||||
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
||||||
|
|
||||||
|
Assert.assertTrue(aggregated.getUsageRecordType().compareTo(ServiceUsageRecord.class.getSimpleName())==0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +72,7 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
AggregatedServiceUsageRecord aggregated = new AggregatedServiceUsageRecord(serviceUsageRecord);
|
||||||
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -80,8 +80,7 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord2.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
serviceUsageRecord2.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
||||||
serviceUsageRecord2.validate();
|
serviceUsageRecord2.validate();
|
||||||
logger.debug("ServiceUsageRecord 2 : {}", serviceUsageRecord2);
|
logger.debug("ServiceUsageRecord 2 : {}", serviceUsageRecord2);
|
||||||
org.gcube.accounting.aggregation.ServiceUsageRecord converted =
|
AggregatedServiceUsageRecord converted = new AggregatedServiceUsageRecord(serviceUsageRecord2);
|
||||||
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord2);
|
|
||||||
logger.debug("ServiceUsageRecord 2 Converted to Aggregated: {}", converted);
|
logger.debug("ServiceUsageRecord 2 Converted to Aggregated: {}", converted);
|
||||||
converted.validate();
|
converted.validate();
|
||||||
|
|
||||||
|
@ -105,6 +104,8 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
Assert.assertTrue(aggregated.getMinInvocationTime() == firstduration);
|
Assert.assertTrue(aggregated.getMinInvocationTime() == firstduration);
|
||||||
}
|
}
|
||||||
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
||||||
|
|
||||||
|
Assert.assertTrue(aggregated.getUsageRecordType().compareTo(ServiceUsageRecord.class.getSimpleName())==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long durationWeightedAverage(int numberA, long durationA, int numberB, long durationB){
|
protected long durationWeightedAverage(int numberA, long durationA, int numberB, long durationB){
|
||||||
|
@ -119,8 +120,7 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
AggregatedServiceUsageRecord aggregated = new AggregatedServiceUsageRecord(serviceUsageRecord);
|
||||||
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -161,6 +161,8 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert.assertTrue(aggregated.getUsageRecordType().compareTo(ServiceUsageRecord.class.getSimpleName())==0);
|
||||||
|
|
||||||
logger.debug("Resulting Aggregated ServiceUsageRecord: {}", aggregated);
|
logger.debug("Resulting Aggregated ServiceUsageRecord: {}", aggregated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.AggregatedStorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.AggregatedStorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.AggregatedStorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.AggregatedStorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord2.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
storageUsageRecord2.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
||||||
storageUsageRecord2.validate();
|
storageUsageRecord2.validate();
|
||||||
logger.debug("StorageUsageRecord 2 : {}", storageUsageRecord2);
|
logger.debug("StorageUsageRecord 2 : {}", storageUsageRecord2);
|
||||||
org.gcube.accounting.aggregation.StorageUsageRecord converted =
|
org.gcube.accounting.aggregation.AggregatedStorageUsageRecord converted =
|
||||||
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord2);
|
new org.gcube.accounting.aggregation.AggregatedStorageUsageRecord(storageUsageRecord2);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", converted);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", converted);
|
||||||
converted.validate();
|
converted.validate();
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.AggregatedStorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.AggregatedStorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ public class ServiceUsageRecordTest {
|
||||||
expectedRequiredFields.add(BasicUsageRecordUtility.USAGE_RECORD_TYPE);
|
expectedRequiredFields.add(BasicUsageRecordUtility.USAGE_RECORD_TYPE);
|
||||||
expectedRequiredFields.add(BasicUsageRecord.SCOPE);
|
expectedRequiredFields.add(BasicUsageRecord.SCOPE);
|
||||||
expectedRequiredFields.add(BasicUsageRecord.OPERATION_RESULT);
|
expectedRequiredFields.add(BasicUsageRecord.OPERATION_RESULT);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.CALLER_HOST);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.CALLER_HOST);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.HOST);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.HOST);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.SERVICE_CLASS);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.SERVICE_CLASS);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.SERVICE_NAME);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.SERVICE_NAME);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.CALLED_METHOD);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.CALLED_METHOD);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.ServiceUsageRecord.DURATION);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord.DURATION);
|
||||||
return expectedRequiredFields;
|
return expectedRequiredFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ public class StorageUsageRecordTest {
|
||||||
expectedRequiredFields.add(BasicUsageRecordUtility.USAGE_RECORD_TYPE);
|
expectedRequiredFields.add(BasicUsageRecordUtility.USAGE_RECORD_TYPE);
|
||||||
expectedRequiredFields.add(BasicUsageRecord.SCOPE);
|
expectedRequiredFields.add(BasicUsageRecord.SCOPE);
|
||||||
expectedRequiredFields.add(BasicUsageRecord.OPERATION_RESULT);
|
expectedRequiredFields.add(BasicUsageRecord.OPERATION_RESULT);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.RESOURCE_OWNER);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.RESOURCE_OWNER);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.RESOURCE_SCOPE);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.RESOURCE_SCOPE);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.RESOURCE_URI);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.RESOURCE_URI);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.PROVIDER_URI);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.PROVIDER_URI);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.OPERATION_TYPE);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.OPERATION_TYPE);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.DATA_TYPE);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DATA_TYPE);
|
||||||
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.StorageUsageRecord.DATA_VOLUME);
|
expectedRequiredFields.add(org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DATA_VOLUME);
|
||||||
return expectedRequiredFields;
|
return expectedRequiredFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue