Skip to content

Commit a5aed6a

Browse files
rjrudinMarkLogic Builder
authored andcommitted
DHFPROD-4500: Fixing dynamic params for client JAR
1 parent fcc8459 commit a5aed6a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/cli/client/RunFlowCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.apache.commons.lang3.StringUtils;
1313
import org.apache.commons.lang3.tuple.Pair;
1414

15+
import java.util.HashMap;
1516
import java.util.Map;
1617
import java.util.stream.Stream;
1718

@@ -40,7 +41,7 @@ public class RunFlowCommand extends CommandLineFlowInputs implements Runnable {
4041
names = "-P",
4142
description = "Override any Data Hub property; e.g. -PmlStagingPort=8410 -PmlFinalPort=8411. See https://docs.marklogic.com/datahub/tools/gradle/gradle-properties.html for a full list."
4243
)
43-
private Map<String, String> params;
44+
private Map<String, String> params = new HashMap<>();
4445

4546
@Override
4647
public void run() {

marklogic-data-hub/src/test/java/com/marklogic/hub/cli/client/RunFlowViaMainTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.marklogic.bootstrap.Installer;
44
import com.marklogic.hub.ApplicationConfig;
5+
import com.marklogic.hub.DatabaseKind;
56
import com.marklogic.hub.HubTestBase;
67
import org.custommonkey.xmlunit.XMLUnit;
78
import org.junit.jupiter.api.AfterAll;
@@ -11,6 +12,10 @@
1112
import org.springframework.test.context.ContextConfiguration;
1213
import org.springframework.test.context.junit.jupiter.SpringExtension;
1314

15+
import java.util.Map;
16+
17+
import static org.junit.jupiter.api.Assertions.assertNotNull;
18+
1419
@ExtendWith(SpringExtension.class)
1520
@ContextConfiguration(classes = ApplicationConfig.class)
1621
public class RunFlowViaMainTest extends HubTestBase {
@@ -39,9 +44,18 @@ public void testRunFlow() {
3944
"-host", host,
4045
"-username", flowRunnerUser,
4146
"-password", flowRunnerPassword,
42-
"-flowName", flowName
47+
"-flowName", flowName,
48+
// Including this to verify that -P flags don't break things
49+
"-PmlStagingPort=" + adminHubConfig.getPort(DatabaseKind.STAGING)
4350
});
4451

4552
verifyCollectionCountsFromRunningTestFlow();
4653
}
54+
55+
@Test
56+
void paramsMapHasToBeNonNull() {
57+
Map<String, String> params = new RunFlowCommand().getParams();
58+
assertNotNull(params, "jcommander requires that the map backing a DynamicParameter annotation not be null; " +
59+
"if it is null, then jcommander will throw a null-pointer exception");
60+
}
4761
}

0 commit comments

Comments
 (0)