Fixed model

This commit is contained in:
Luca Frosini 2021-04-13 21:29:32 +02:00
parent 36f28b4ecb
commit 7b2feecd6f
2 changed files with 20 additions and 8 deletions

View File

@ -16,7 +16,6 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractStorageStatusRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.JobUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
@ -124,9 +123,7 @@ public class TestUsageRecord {
usageRecord.setOperationResult(TEST_OPERATION_RESULT);
usageRecord.setResourceOwner(TEST_RESOUCE_OWNER);
usageRecord.setResourceScope(TEST_RESOUCE_SCOPE);
usageRecord.setResourceURI(new URI(TEST_RESOURCE_URI));
usageRecord.setProviderURI(new URI(TEST_PROVIDER_URI));
usageRecord.setOperationType(AbstractStorageUsageRecord.OperationType.READ);
@ -155,11 +152,8 @@ public class TestUsageRecord {
usageRecord.setConsumerId(TEST_CONSUMER_ID);
usageRecord.setOperationResult(TEST_OPERATION_RESULT);
usageRecord.setDataVolume(generateRandomLong(MIN_DATA_VOLUME, MAX_DATA_VOLUME));
usageRecord.setDataType(AbstractStorageStatusRecord.DataType.STORAGE);
usageRecord.setDataType(AbstractStorageUsageRecord.DataType.STORAGE);
usageRecord.setDataCount(generateRandomLong(MIN_DATA_VOLUME, MAX_DATA_VOLUME));
usageRecord.setDataServiceClass("dataServiceClass");
usageRecord.setDataServiceName("dataServiceName");
usageRecord.setDataServiceId("dataServiceId");
usageRecord.setProviderId(new URI(TEST_PROVIDER_URI));
} catch (InvalidValueException | URISyntaxException e) {

View File

@ -0,0 +1,18 @@
alter table storage_usage_record alter column resource_scope drop not null;
alter table storage_usage_record alter column resource_scope set default 'NOT_NEEDED';
alter table storage_usage_record alter column resource_uri drop not null;
alter table storage_usage_record alter column resource_uri set default 'NOT_NEEDED';
update storage_usage_record set resource_scope='NOT_NEEDED', resource_uri='NOT_NEEDED';
alter table storage_status_record alter column data_service_id drop not null;
alter table storage_status_record alter column data_service_id set default 'NOT_NEEDED';
alter table storage_status_record alter column data_service_class drop not null;
alter table storage_status_record alter column data_service_class set default 'NOT_NEEDED';
alter table storage_status_record alter column data_service_name drop not null;
alter table storage_status_record alter column data_service_name set default 'NOT_NEEDED';
update storage_status_record set data_service_id='NOT_NEEDED', data_service_class='NOT_NEEDED', data_service_name='NOT_NEEDED';