2020-04-27 14:52:31 +02:00
|
|
|
|
2019-10-03 12:22:44 +02:00
|
|
|
package eu.dnetlib.dhp.application;
|
|
|
|
|
2020-03-25 16:45:03 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
2019-10-03 12:22:44 +02:00
|
|
|
|
2020-04-18 12:42:58 +02:00
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2019-10-03 12:22:44 +02:00
|
|
|
public class ArgumentApplicationParserTest {
|
|
|
|
|
2020-04-27 14:52:31 +02:00
|
|
|
@Test
|
|
|
|
public void testParseParameter() throws Exception {
|
|
|
|
final String jsonConfiguration = IOUtils
|
|
|
|
.toString(
|
|
|
|
this.getClass().getResourceAsStream("/eu/dnetlib/application/parameters.json"));
|
|
|
|
assertNotNull(jsonConfiguration);
|
|
|
|
ArgumentApplicationParser parser = new ArgumentApplicationParser(jsonConfiguration);
|
|
|
|
parser
|
|
|
|
.parseArgument(
|
|
|
|
new String[] {
|
|
|
|
"-p",
|
|
|
|
"value0",
|
|
|
|
"-a",
|
|
|
|
"value1",
|
|
|
|
"-n",
|
|
|
|
"value2",
|
|
|
|
"-u",
|
|
|
|
"value3",
|
|
|
|
"-ru",
|
|
|
|
"value4",
|
|
|
|
"-rp",
|
|
|
|
"value5",
|
|
|
|
"-rh",
|
|
|
|
"value6",
|
|
|
|
"-ro",
|
|
|
|
"value7",
|
|
|
|
"-rr",
|
|
|
|
"value8",
|
|
|
|
"-w",
|
|
|
|
"value9",
|
|
|
|
"-cc",
|
|
|
|
ArgumentApplicationParser.compressArgument(jsonConfiguration)
|
|
|
|
});
|
|
|
|
assertNotNull(parser.get("hdfsPath"));
|
|
|
|
assertNotNull(parser.get("apidescriptor"));
|
|
|
|
assertNotNull(parser.get("namenode"));
|
|
|
|
assertNotNull(parser.get("userHDFS"));
|
|
|
|
assertNotNull(parser.get("rabbitUser"));
|
|
|
|
assertNotNull(parser.get("rabbitPassWord"));
|
|
|
|
assertNotNull(parser.get("rabbitHost"));
|
|
|
|
assertNotNull(parser.get("rabbitOngoingQueue"));
|
|
|
|
assertNotNull(parser.get("rabbitReportQueue"));
|
|
|
|
assertNotNull(parser.get("workflowId"));
|
|
|
|
assertEquals("value0", parser.get("hdfsPath"));
|
|
|
|
assertEquals("value1", parser.get("apidescriptor"));
|
|
|
|
assertEquals("value2", parser.get("namenode"));
|
|
|
|
assertEquals("value3", parser.get("userHDFS"));
|
|
|
|
assertEquals("value4", parser.get("rabbitUser"));
|
|
|
|
assertEquals("value5", parser.get("rabbitPassWord"));
|
|
|
|
assertEquals("value6", parser.get("rabbitHost"));
|
|
|
|
assertEquals("value7", parser.get("rabbitOngoingQueue"));
|
|
|
|
assertEquals("value8", parser.get("rabbitReportQueue"));
|
|
|
|
assertEquals("value9", parser.get("workflowId"));
|
|
|
|
assertEquals(jsonConfiguration, parser.get("ccCoco"));
|
|
|
|
}
|
2019-10-03 12:22:44 +02:00
|
|
|
}
|