Refs #11233: Add Regex Rules to Accounting Aggregator

Task-Url: https://support.d4science.org/issues/11233

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@164463 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-02-20 17:26:37 +00:00
parent 03c705983d
commit 8873d8843e
3 changed files with 5 additions and 22 deletions

View File

@ -15,12 +15,10 @@ public class AggregatorPersitenceConfiguration extends AccountingPersistenceConf
}
/**
* @param persistence
* The class of the persistence to instantiate
* @throws Exception
* if fails
* @param persistence The class of the persistence to instantiate
* @throws Exception if fails
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "rawtypes" })
public AggregatorPersitenceConfiguration(Class<?> persistence) throws Exception {
super((Class) persistence);
}

View File

@ -6,6 +6,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import org.gcube.accounting.aggregator.RegexRulesAggregator;
import org.gcube.accounting.aggregator.aggregation.AggregationType;
import org.gcube.accounting.aggregator.elaboration.AggregatorManager;
import org.gcube.accounting.aggregator.elaboration.RecoveryManager;
@ -90,6 +91,7 @@ public class AccountingAggregatorPlugin extends Plugin<AccountingAggregatorPlugi
public AccountingAggregatorPlugin(AccountingAggregatorPluginDeclaration pluginDeclaration) {
super(pluginDeclaration);
RegexRulesAggregator.getInstance();
}
private Date getPersistTime(Map<String, Object> inputs, String parameterName) throws ParseException{

View File

@ -8,8 +8,6 @@ import org.gcube.accounting.aggregator.aggregation.AggregationType;
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPlugin.ElaborationType;
import org.gcube.accounting.aggregator.utility.Utility;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.accounting.datamodel.validations.validators.CalledMethodRegexReplaceValidator;
import org.gcube.accounting.datamodel.validations.validators.RegexReplace;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -23,21 +21,6 @@ public class AccountingAggregatorPluginTest extends ScopedTest {
public void aggregate() throws Exception {
setContext(ROOT);
String replace = "/delete/{collection-id}/{item-id}";
RegexReplace regexReplace = new RegexReplace("Index", "FullTextIndexNode",
"/delete/[^\\t\\n\\r\\f\\v]+/[^\\t\\n\\r\\f\\v]+", replace);
CalledMethodRegexReplaceValidator.addRegexReplace(regexReplace);
replace = "GET /access/instance/Configuration/{id}";
regexReplace = new RegexReplace("InformationSystem", "resource-registry",
"/access/instance/Configuration/[^\\t\\n\\r\\f\\v]+", replace);
CalledMethodRegexReplaceValidator.addRegexReplace(regexReplace);
replace = "GET /access/instance/EService/{id}";
regexReplace = new RegexReplace("InformationSystem", "resource-registry",
"/access/instance/EService/[^\\t\\n\\r\\f\\v]+", replace);
CalledMethodRegexReplaceValidator.addRegexReplace(regexReplace);
Map<String, Object> inputs = new HashMap<String, Object>();
//type aggregation