use of org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter in project metalnx-web by irods-contrib.
the class RuleServiceImpl method executeRule.
@Override
public Map<String, IRODSRuleExecResultOutputParameter> executeRule(String rule) throws DataGridRuleException, DataGridConnectionRefusedException {
if (rule == null || rule.isEmpty())
return null;
Map<String, IRODSRuleExecResultOutputParameter> ruleResultMap;
try {
IRODSRuleExecResult result = is.getRuleProcessingAO().executeRule(rule);
ruleResultMap = result.getOutputParameterResults();
} catch (JargonException e) {
String error = String.format("Could not execute rule %s: %s", rule, e.getMessage());
logger.error(error);
throw new DataGridRuleException(error);
}
return ruleResultMap;
}
use of org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter in project metalnx-web by irods-contrib.
the class TestRuleService method testGetMSIsRule.
@Test
public void testGetMSIsRule() throws DataGridRuleException, DataGridConnectionRefusedException {
Map<String, IRODSRuleExecResultOutputParameter> result = new HashMap<>();
IRODSRuleExecResultOutputParameter output = new IRODSRuleExecResultOutputParameter();
output.setOutputParamType(IRODSRuleExecResultOutputParameter.OutputParamType.STRING);
output.setParameterName("*msis");
output.setResultObject("libmsi1.so, libmsi2.so, libmsi3.so, libmsi4.so");
result.put("*msis", output);
when(ruleService.executeRule(anyString())).thenReturn(result);
List<String> msis = ruleService.execGetMSIsRule("icat.test.com");
assertNotNull(msis);
assertFalse(msis.isEmpty());
assertTrue(msis.contains("libmsi1.so"));
assertTrue(msis.contains("libmsi2.so"));
assertTrue(msis.contains("libmsi3.so"));
assertTrue(msis.contains("libmsi4.so"));
}
use of org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter in project metalnx-web by irods-contrib.
the class TestRuleService method testGetVersionRule.
@Test
public void testGetVersionRule() throws DataGridRuleException, DataGridConnectionRefusedException {
Map<String, IRODSRuleExecResultOutputParameter> result = new HashMap<>();
IRODSRuleExecResultOutputParameter output = new IRODSRuleExecResultOutputParameter();
output.setOutputParamType(IRODSRuleExecResultOutputParameter.OutputParamType.STRING);
output.setParameterName("*version");
output.setResultObject(msiVersion);
result.put("*version", output);
when(ruleService.executeRule(anyString())).thenReturn(result);
String version = ruleService.execGetVersionRule("icat.test.com");
assertEquals(msiVersion, version);
}
use of org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter in project metalnx-web by irods-contrib.
the class TestRuleService method testGetMSIsRuleNoReturn.
@Test
public void testGetMSIsRuleNoReturn() throws DataGridRuleException, DataGridConnectionRefusedException {
Map<String, IRODSRuleExecResultOutputParameter> result = new HashMap<>();
IRODSRuleExecResultOutputParameter output = new IRODSRuleExecResultOutputParameter();
output.setOutputParamType(IRODSRuleExecResultOutputParameter.OutputParamType.STRING);
output.setParameterName("*msis");
output.setResultObject(null);
result.put("*msis", output);
when(ruleService.executeRule(anyString())).thenReturn(result);
List<String> msis = ruleService.execGetMSIsRule(HOST);
assertNotNull(msis);
assertTrue(msis.isEmpty());
}
Aggregations