CheckCommand extends BergamotObject<CheckCommandMO> implements Parameterised { public LinkedHashMap<String, Parameter> resolveCheckParameters() { return this.resolveCheckParameters(this.getCommand()); } CheckCommand(); UUID getCheckId(); void setCheckId(UUID checkId); UUID getCommandId(); void setCommandId(UUID commandId); Command getCommand(); void configure(CheckCommandCfg cfg); @Override LinkedHashMap<String, Parameter> getParameters(); @Override void setParameters(LinkedHashMap<String, Parameter> parameters); String getScript(); void setScript(String script); LinkedHashMap<String, Parameter> resolveCheckParameters(); LinkedHashMap<String, Parameter> resolveCheckParameters(Command command); String resolveCheckParameter(String name); String resolveCheckParameter(Command command, String name); String resolveCheckScript(); @Override int hashCode(); @Override boolean equals(Object obj); @Override CheckCommandMO toMO(Contact contact, EnumSet<MOFlag> options); String toString();  }
@Test public void testCheckCommandParameterResolution() { Command command = new Command(); command.addParameter("command_line", "check_dummy #{arg1} #{arg2}"); command.addParameter("arg1", "#{host.address}"); CheckCommand checkCommand = new CheckCommand(); checkCommand.addParameter("arg1", "127.0.0.1"); checkCommand.addParameter("arg2", "TestValue!"); LinkedHashMap<String, Parameter> resolved = checkCommand.resolveCheckParameters(command); assertThat(resolved, is(notNullValue())); assertThat(resolved, hasKey("arg1")); assertThat(resolved, hasKey("arg2")); assertThat(resolved, hasKey("command_line")); assertThat(resolved.entrySet().stream().map((e) -> e.getKey()).collect(Collectors.toList()).toArray(new String[0]), is(equalTo(new String[] {"command_line", "arg1", "arg2"}))); assertThat(resolved.get("arg1").getValue(), is(equalTo("127.0.0.1"))); assertThat(resolved.get("arg2").getValue(), is(equalTo("TestValue!"))); assertThat(resolved.get("command_line").getValue(), is(equalTo("check_dummy #{arg1} #{arg2}"))); }