@Test public void testShowConfig() { ConfigType configType = mock(ConfigType.class); Map<String, Map<String, String>> mockResult = mock(Map.class); when(configType.getName()).thenReturn(CORE_SITE); when(client.getServiceConfigMap(anyString())).thenReturn(mockResult); when(mockResult.get(CORE_SITE)).thenReturn(new HashMap<String, String>()); configCommands.showConfig(configType); verify(client).getServiceConfigMap(CORE_SITE); }
@CliCommand(value = "configuration show", help = "Prints the desired configuration") public String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType) { String configTypeName = configType.getName(); Map<String, Map<String, String>> configMap = client.getServiceConfigMap(configTypeName); return renderSingleMap(configMap.get(configTypeName), "KEY", "VALUE"); }
ConfigCommands implements CommandMarker { @CliCommand(value = "configuration show", help = "Prints the desired configuration") public String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType) { String configTypeName = configType.getName(); Map<String, Map<String, String>> configMap = client.getServiceConfigMap(configTypeName); return renderSingleMap(configMap.get(configTypeName), "KEY", "VALUE"); } }
ConfigCommands implements CommandMarker { @CliCommand(value = "configuration show", help = "Prints the desired configuration") public String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType) { String configTypeName = configType.getName(); Map<String, Map<String, String>> configMap = client.getServiceConfigMap(configTypeName); return renderSingleMap(configMap.get(configTypeName), "KEY", "VALUE"); } @Autowired  ConfigCommands(AmbariClient client, AmbariContext context); }
ConfigCommands implements CommandMarker { @CliCommand(value = "configuration show", help = "Prints the desired configuration") public String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType) { String configTypeName = configType.getName(); Map<String, Map<String, String>> configMap = client.getServiceConfigMap(configTypeName); return renderSingleMap(configMap.get(configTypeName), "KEY", "VALUE"); } @Autowired  ConfigCommands(AmbariClient client, AmbariContext context); @CliAvailabilityIndicator("configuration show") boolean isConfigShowCommandAvailable(); @CliCommand(value = "configuration show", help = "Prints the desired configuration") String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType); @CliAvailabilityIndicator("configuration set") boolean isConfigSetCommandAvailable(); @CliCommand(value = "configuration set", help = "Sets the desired configuration") String setConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType,
    @CliOption(key = "url", help = "URL of the config") String url,
    @CliOption(key = "file", help = "File of the config") File file); @CliAvailabilityIndicator("configuration modify") boolean isConfigModifyCommandAvailable(); @CliCommand(value = "configuration modify", help = "Modify the desired configuration") String modifyConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType,
    @CliOption(key = "key", mandatory = true, help = "Key of the config") String key,
    @CliOption(key = "value", mandatory = true, help = "Value of the config") String value); @CliAvailabilityIndicator("configuration download") boolean isConfigDownloadCommandAvailable(); @CliCommand(value = "configuration download", help = "Downloads the desired configuration") String downloadConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType); }
ConfigCommands implements CommandMarker { @CliCommand(value = "configuration show", help = "Prints the desired configuration") public String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType) { String configTypeName = configType.getName(); Map<String, Map<String, String>> configMap = client.getServiceConfigMap(configTypeName); return renderSingleMap(configMap.get(configTypeName), "KEY", "VALUE"); } @Autowired  ConfigCommands(AmbariClient client, AmbariContext context); @CliAvailabilityIndicator("configuration show") boolean isConfigShowCommandAvailable(); @CliCommand(value = "configuration show", help = "Prints the desired configuration") String showConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType); @CliAvailabilityIndicator("configuration set") boolean isConfigSetCommandAvailable(); @CliCommand(value = "configuration set", help = "Sets the desired configuration") String setConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType,
    @CliOption(key = "url", help = "URL of the config") String url,
    @CliOption(key = "file", help = "File of the config") File file); @CliAvailabilityIndicator("configuration modify") boolean isConfigModifyCommandAvailable(); @CliCommand(value = "configuration modify", help = "Modify the desired configuration") String modifyConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType,
    @CliOption(key = "key", mandatory = true, help = "Key of the config") String key,
    @CliOption(key = "value", mandatory = true, help = "Value of the config") String value); @CliAvailabilityIndicator("configuration download") boolean isConfigDownloadCommandAvailable(); @CliCommand(value = "configuration download", help = "Downloads the desired configuration") String downloadConfig(@CliOption(key = "type", mandatory = true, help = "Type of the configuration") ConfigType configType);  }