Deprecated not needed properties to reduce data and improve aggregation
This commit is contained in:
parent
b2a8885fe3
commit
372b5a2e5d
|
@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for Accounting Library
|
||||
|
||||
## [v4.1.0-SNAPSHOT]
|
||||
|
||||
- Deprecated not needed properties to reduce data and improve aggregation
|
||||
- Improved regex to comply with new version of Thredds called methods [#18053]
|
||||
|
||||
|
||||
## [v4.0.0] [r.5.0.0] -
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.1.0-SNAPSHOT</version>
|
||||
<name>Accounting Library</name>
|
||||
<description>Accounting Library</description>
|
||||
|
||||
|
|
|
@ -123,8 +123,7 @@ public abstract class AbstractStorageStatusRecord extends BasicUsageRecord {
|
|||
|
||||
@Deprecated
|
||||
public void setDataServiceClass(String dataServiceClass) throws InvalidValueException {
|
||||
setResourceProperty(DATA_SERVICECLASS, AbstractStorageUsageRecord.NOT_NEEDED);
|
||||
// setResourceProperty(DATA_SERVICECLASS, dataServiceClass);
|
||||
setResourceProperty(DATA_SERVICECLASS, dataServiceClass);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -135,8 +134,7 @@ public abstract class AbstractStorageStatusRecord extends BasicUsageRecord {
|
|||
|
||||
@Deprecated
|
||||
public void setDataServiceName(String dataServiceName) throws InvalidValueException {
|
||||
setResourceProperty(DATA_SERVICENAME, AbstractStorageUsageRecord.NOT_NEEDED);
|
||||
// setResourceProperty(DATA_SERVICENAME, dataServiceName);
|
||||
setResourceProperty(DATA_SERVICENAME, dataServiceName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -147,8 +145,7 @@ public abstract class AbstractStorageStatusRecord extends BasicUsageRecord {
|
|||
|
||||
@Deprecated
|
||||
public void setDataServiceId(String dataServiceId) throws InvalidValueException {
|
||||
setResourceProperty(DATA_SERVICEID, AbstractStorageUsageRecord.NOT_NEEDED);
|
||||
// setResourceProperty(DATA_SERVICEID, dataServiceId);
|
||||
setResourceProperty(DATA_SERVICEID, dataServiceId);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
|
|
|
@ -24,8 +24,6 @@ import org.gcube.documentstore.records.implementation.validations.annotations.Va
|
|||
*/
|
||||
public abstract class AbstractStorageUsageRecord extends BasicUsageRecord {
|
||||
|
||||
protected static final String NOT_NEEDED = "NOT_NEEDED";
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
|
@ -143,8 +141,7 @@ public abstract class AbstractStorageUsageRecord extends BasicUsageRecord {
|
|||
*/
|
||||
@Deprecated
|
||||
public void setResourceScope(String scope) throws InvalidValueException {
|
||||
setResourceProperty(RESOURCE_SCOPE, NOT_NEEDED);
|
||||
// setResourceProperty(RESOURCE_SCOPE, scope);
|
||||
setResourceProperty(RESOURCE_SCOPE, scope);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
|
@ -164,12 +161,7 @@ public abstract class AbstractStorageUsageRecord extends BasicUsageRecord {
|
|||
|
||||
@Deprecated
|
||||
public void setResourceURI(URI resourceURI) throws InvalidValueException {
|
||||
try {
|
||||
setResourceProperty(RESOURCE_URI, new URI(NOT_NEEDED));
|
||||
}catch (Exception e) {
|
||||
setResourceProperty(RESOURCE_URI, NOT_NEEDED);
|
||||
}
|
||||
// setResourceProperty(RESOURCE_URI, resourceURI);
|
||||
setResourceProperty(RESOURCE_URI, resourceURI);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
|
|
|
@ -54,30 +54,30 @@ public class AggregatedStorageStatusRecordTest extends ContextTest {
|
|||
public void secondAsNotAggregated() throws InvalidValueException, NotAggregatableRecordsExceptions {
|
||||
SecurityTokenProvider.instance.reset();
|
||||
ScopeProvider.instance.reset();
|
||||
StorageStatusRecord storageVolumeUsageRecord = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
Assert.assertTrue(storageVolumeUsageRecord.getScope()==null);
|
||||
storageVolumeUsageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
StorageStatusRecord storageStatusUsageRecord = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
Assert.assertTrue(storageStatusUsageRecord.getScope()==null);
|
||||
storageStatusUsageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
storageVolumeUsageRecord.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
||||
storageVolumeUsageRecord.validate();
|
||||
logger.debug("StorageVolumeUsageRecord : {}", storageVolumeUsageRecord);
|
||||
storageStatusUsageRecord.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
||||
storageStatusUsageRecord.validate();
|
||||
logger.debug("StorageVolumeUsageRecord : {}", storageStatusUsageRecord);
|
||||
|
||||
AggregatedStorageStatusRecord aggregated = new AggregatedStorageStatusRecord(storageVolumeUsageRecord);
|
||||
AggregatedStorageStatusRecord aggregated = new AggregatedStorageStatusRecord(storageStatusUsageRecord);
|
||||
logger.debug("StorageVolumeUsageRecord Converted to Aggregated: {}", aggregated);
|
||||
aggregated.validate();
|
||||
|
||||
StorageStatusRecord storageVolumeUsageRecord2 = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
storageVolumeUsageRecord2.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
StorageStatusRecord storageStatusUsageRecord2 = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
storageStatusUsageRecord2.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
|
||||
storageVolumeUsageRecord2.validate();
|
||||
logger.debug("StorageVolumeUsageRecord 2 : {}", storageVolumeUsageRecord2);
|
||||
storageStatusUsageRecord2.validate();
|
||||
logger.debug("StorageVolumeUsageRecord 2 : {}", storageStatusUsageRecord2);
|
||||
|
||||
|
||||
long secondDataVolume = storageVolumeUsageRecord2.getDataVolume();
|
||||
long secondDataVolume = storageStatusUsageRecord2.getDataVolume();
|
||||
|
||||
long secondDataCount = storageVolumeUsageRecord2.getDataCount();
|
||||
long secondDataCount = storageStatusUsageRecord2.getDataCount();
|
||||
|
||||
aggregated.aggregate(storageVolumeUsageRecord2);
|
||||
aggregated.aggregate(storageStatusUsageRecord2);
|
||||
logger.debug("Resulting Aggregated StorageVolumeUsageRecord: {}", aggregated);
|
||||
aggregated.validate();
|
||||
|
||||
|
@ -87,11 +87,16 @@ public class AggregatedStorageStatusRecordTest extends ContextTest {
|
|||
Assert.assertFalse(aggregated.getResourceProperties().containsKey(TestUsageRecord.TEST_PROPERTY_NAME));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void secondAsAggregated() throws InvalidValueException, NotAggregatableRecordsExceptions {
|
||||
SecurityTokenProvider.instance.reset();
|
||||
ScopeProvider.instance.reset();
|
||||
StorageStatusRecord storageStatusUsageRecord = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
storageStatusUsageRecord.setDataServiceClass("DataServiceClass1");
|
||||
storageStatusUsageRecord.setDataServiceName("DataServiceName1");
|
||||
storageStatusUsageRecord.setDataServiceId("DataServiceId1");
|
||||
|
||||
Assert.assertTrue(storageStatusUsageRecord.getScope()==null);
|
||||
storageStatusUsageRecord.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
storageStatusUsageRecord.validate();
|
||||
|
@ -102,6 +107,10 @@ public class AggregatedStorageStatusRecordTest extends ContextTest {
|
|||
aggregated.validate();
|
||||
|
||||
StorageStatusRecord storageVolumeUsageRecord2 = TestUsageRecord.createTestStorageVolumeUsageRecord();
|
||||
storageVolumeUsageRecord2.setDataServiceClass("DataServiceClass2");
|
||||
storageVolumeUsageRecord2.setDataServiceName("DataServiceName2");
|
||||
storageVolumeUsageRecord2.setDataServiceId("DataServiceId2");
|
||||
|
||||
Assert.assertTrue(storageVolumeUsageRecord2.getScope()==null);
|
||||
storageVolumeUsageRecord2.setScope(TestUsageRecord.TEST_SCOPE);
|
||||
storageVolumeUsageRecord2.setResourceProperty(TestUsageRecord.TEST_PROPERTY_NAME, TestUsageRecord.TEST_PROPERTY_VALUE);
|
||||
|
|
Loading…
Reference in New Issue