Alessandro Pieve 8 years ago
parent 9fdb501787
commit 09c3c4df95

@ -340,6 +340,12 @@ AccountingPersistenceBackendQuery {
protected String getDesignDocId(
Class<? extends AggregatedRecord<?,?>> recordClass)
throws InstantiationException, IllegalAccessException {
String getDesigndocid=String.format("%s%s", MAP_REDUCE__DESIGN, recordClass
.newInstance().getRecordType());
logger.debug("use a designDocID"+getDesigndocid);
return String.format("%s%s", MAP_REDUCE__DESIGN, recordClass
.newInstance().getRecordType());
}
@ -707,11 +713,13 @@ AccountingPersistenceBackendQuery {
try {
JsonObject jsonObject = row.value();
//logger.trace("JsonObject : {}", row.value()+" key"+key);
logger.warn("pre"+jsonObject.toString()+" key :"+key);
//logger.warn("pre"+jsonObject.toString()+" key :"+key);
//verify for a not null value
String value = jsonObject.getString(key);
Number n = jsonObject.getDouble(orderingProperty);
if (n==null)
n=0;
logger.trace("pre:{}, key:{}, value:{}, n:{},orderingProperty:{}",jsonObject.toString(),key, value, n, orderingProperty);
NumberedFilter numberedFilter =
new NumberedFilter(key, value, n, orderingProperty);

@ -22,7 +22,6 @@ import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQu
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.JobUsageRecord;
import org.gcube.common.scope.api.ScopeProvider;
import org.json.JSONException;
@ -79,6 +78,7 @@ public class AccountingPersistenceQueryCouchBaseTest {
@Before
public void before() throws Exception{
//ScopeProvider.instance.set("/gcube/devNext/NextNext");
ScopeProvider.instance.set("/gcube/devNext");
AccountingPersistenceBackendQueryConfiguration configuration = new
@ -130,7 +130,7 @@ public class AccountingPersistenceQueryCouchBaseTest {
}
@Test
public void getQuerableKey() throws Exception{
public void getQuerableKeyJob() throws Exception{
SortedSet<String> keys;
keys = AccountingPersistenceQuery.getQuerableKeys(AggregatedJobUsageRecord.class);
@ -140,8 +140,6 @@ public class AccountingPersistenceQueryCouchBaseTest {
}
}
logger.debug("List FilterKeys:" + keys.toString());
}
@Test
@ -169,7 +167,18 @@ public class AccountingPersistenceQueryCouchBaseTest {
logger.debug("Result final{}", set);
}
@Test
public void getQuerableKeyService() throws Exception{
SortedSet<String> keys;
keys = AccountingPersistenceQuery.getQuerableKeys(AggregatedServiceUsageRecord.class);
for (String key : keys) {
if (key != null && !key.isEmpty()) {
logger.debug("key:" +key);
}
}
logger.debug("List FilterKeys:" + keys.toString());
}
public static SortedMap<Calendar, Info> padMap(
SortedMap<Calendar, Info> unpaddedData,