Search in sources :

Example 51 with CommandStringBuilder

use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.

the class DurableClientCommandsController method listDurableClientContinuousQueries.

@RequestMapping(method = RequestMethod.GET, value = "/durable-clients/{durable-client-id}/cqs")
@ResponseBody
public String listDurableClientContinuousQueries(@PathVariable(ConfigurationProperties.DURABLE_CLIENT_ID) final String durableClientId, @RequestParam(value = CliStrings.LIST_DURABLE_CQS__MEMBER, required = false) final String memberNameId, @RequestParam(value = CliStrings.LIST_DURABLE_CQS__GROUP, required = false) final String[] groups) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.LIST_DURABLE_CQS);
    command.addOption(CliStrings.LIST_DURABLE_CQS__DURABLECLIENTID, decode(durableClientId));
    if (hasValue(memberNameId)) {
        command.addOption(CliStrings.LIST_DURABLE_CQS__MEMBER, memberNameId);
    }
    if (hasValue(groups)) {
        command.addOption(CliStrings.LIST_DURABLE_CQS__GROUP, StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
    }
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 52 with CommandStringBuilder

use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.

the class ExportLogController method exportLogs.

@RequestMapping(method = RequestMethod.GET, value = "/logs")
public ResponseEntity<InputStreamResource> exportLogs(@RequestParam(value = CliStrings.EXPORT_LOGS__DIR, required = false) final String directory, @RequestParam(value = CliStrings.EXPORT_LOGS__GROUP, required = false) final String[] groups, @RequestParam(value = CliStrings.EXPORT_LOGS__MEMBER, required = false) final String memberNameId, @RequestParam(value = CliStrings.EXPORT_LOGS__LOGLEVEL, required = false) final String logLevel, @RequestParam(value = CliStrings.EXPORT_LOGS__UPTO_LOGLEVEL, defaultValue = "false") final Boolean onlyLogLevel, @RequestParam(value = CliStrings.EXPORT_LOGS__MERGELOG, defaultValue = "false") final Boolean mergeLog, @RequestParam(value = CliStrings.EXPORT_LOGS__STARTTIME, required = false) final String startTime, @RequestParam(value = CliStrings.EXPORT_LOGS__ENDTIME, required = false) final String endTime, @RequestParam(value = CliStrings.EXPORT_LOGS__LOGSONLY, required = false) final boolean logsOnly, @RequestParam(value = CliStrings.EXPORT_LOGS__STATSONLY, required = false) final boolean statsOnly) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.EXPORT_LOGS);
    command.addOption(CliStrings.EXPORT_LOGS__DIR, decode(directory));
    if (hasValue(groups)) {
        command.addOption(CliStrings.EXPORT_LOGS__GROUP, StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
    }
    if (hasValue(memberNameId)) {
        command.addOption(CliStrings.EXPORT_LOGS__MEMBER, memberNameId);
    }
    if (hasValue(logLevel)) {
        command.addOption(CliStrings.EXPORT_LOGS__LOGLEVEL, logLevel);
    }
    command.addOption(CliStrings.EXPORT_LOGS__UPTO_LOGLEVEL, String.valueOf(onlyLogLevel));
    command.addOption(CliStrings.EXPORT_LOGS__MERGELOG, String.valueOf(mergeLog));
    command.addOption(CliStrings.EXPORT_LOGS__LOGSONLY, String.valueOf(logsOnly));
    command.addOption(CliStrings.EXPORT_LOGS__STATSONLY, String.valueOf(statsOnly));
    if (hasValue(startTime)) {
        command.addOption(CliStrings.EXPORT_LOGS__STARTTIME, startTime);
    }
    if (hasValue(endTime)) {
        command.addOption(CliStrings.EXPORT_LOGS__ENDTIME, endTime);
    }
    String result = processCommand(command.toString());
    return getResponse(result);
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 53 with CommandStringBuilder

use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.

the class ConfigCommandsController method exportClusterConfig.

@RequestMapping(method = RequestMethod.GET, value = "/config/cluster")
public Callable<ResponseEntity<String>> exportClusterConfig(@RequestParam(CliStrings.EXPORT_SHARED_CONFIG__FILE) final String zipFile) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.EXPORT_SHARED_CONFIG);
    command.addOption(CliStrings.EXPORT_SHARED_CONFIG__FILE, zipFile);
    return getProcessCommandCallable(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 54 with CommandStringBuilder

use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.

the class DataCommandsController method locateEntry.

@RequestMapping(method = RequestMethod.GET, value = "/regions/{region}/data/location")
@ResponseBody
public String locateEntry(@PathVariable("region") final String regionNamePath, @RequestParam(CliStrings.LOCATE_ENTRY__KEY) final String key, @RequestParam(value = CliStrings.LOCATE_ENTRY__KEYCLASS, required = false) final String keyClassName, @RequestParam(value = CliStrings.LOCATE_ENTRY__VALUEKLASS, required = false) final String valueClassName, @RequestParam(value = CliStrings.LOCATE_ENTRY__RECURSIVE, defaultValue = "false") final Boolean recursive) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.LOCATE_ENTRY);
    command.addOption(CliStrings.LOCATE_ENTRY__REGIONNAME, decode(regionNamePath));
    command.addOption(CliStrings.LOCATE_ENTRY__KEY, key);
    if (hasValue(keyClassName)) {
        command.addOption(CliStrings.LOCATE_ENTRY__KEYCLASS, keyClassName);
    }
    if (hasValue(valueClassName)) {
        command.addOption(CliStrings.LOCATE_ENTRY__VALUEKLASS, valueClassName);
    }
    command.addOption(CliStrings.LOCATE_ENTRY__RECURSIVE, String.valueOf(recursive));
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 55 with CommandStringBuilder

use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.

the class DataCommandsController method put.

@RequestMapping(method = RequestMethod.PUT, value = "/regions/{region}/data")
@ResponseBody
public String put(@PathVariable("region") final String regionNamePath, @RequestParam(CliStrings.PUT__KEY) final String key, @RequestParam(value = CliStrings.PUT__KEYCLASS, required = false) final String keyClassName, @RequestParam(CliStrings.PUT__VALUE) final String value, @RequestParam(value = CliStrings.PUT__VALUEKLASS, required = false) final String valueClassName, @RequestParam(value = CliStrings.PUT__PUTIFABSENT, defaultValue = "false") final Boolean putIfAbsent) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.PUT);
    command.addOption(CliStrings.PUT__REGIONNAME, decode(regionNamePath));
    command.addOption(CliStrings.PUT__KEY, key);
    command.addOption(CliStrings.PUT__VALUE, decode(value));
    if (hasValue(keyClassName)) {
        command.addOption(CliStrings.PUT__KEYCLASS, keyClassName);
    }
    if (hasValue(valueClassName)) {
        command.addOption(CliStrings.PUT__VALUEKLASS, valueClassName);
    }
    command.addOption(CliStrings.PUT__PUTIFABSENT, String.valueOf(putIfAbsent));
    return processCommand(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)186 Test (org.junit.Test)88 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)87 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)71 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)47 VM (org.apache.geode.test.dunit.VM)41 File (java.io.File)39 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)37 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)36 Properties (java.util.Properties)16 Region (org.apache.geode.cache.Region)14 Category (org.junit.experimental.categories.Category)14 Cache (org.apache.geode.cache.Cache)12 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)12 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)11 IOException (java.io.IOException)10 UnknownHostException (java.net.UnknownHostException)7 HashMap (java.util.HashMap)6 RegionAttributes (org.apache.geode.cache.RegionAttributes)6 ClusterConfigurationService (org.apache.geode.distributed.internal.ClusterConfigurationService)6