Search in sources :

Example 56 with CommandStringBuilder

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

the class DataCommandsController method query.

@RequestMapping(method = RequestMethod.GET, value = "/regions/data/query")
public Callable<ResponseEntity<String>> query(final WebRequest request, @RequestParam(CliStrings.QUERY__QUERY) final String oql, @RequestParam(value = CliStrings.QUERY__STEPNAME, defaultValue = CliStrings.QUERY__STEPNAME__DEFAULTVALUE) final String stepName, @RequestParam(value = CliStrings.QUERY__INTERACTIVE, defaultValue = "true") final Boolean interactive) {
    // logRequest(request);
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.QUERY);
    command.addOption(CliStrings.QUERY__QUERY, decode(oql));
    command.addOption(CliStrings.QUERY__STEPNAME, stepName);
    command.addOption(CliStrings.QUERY__INTERACTIVE, String.valueOf(Boolean.TRUE.equals(interactive)));
    return getProcessCommandCallable(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 57 with CommandStringBuilder

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

the class DataCommandsController method rebalance.

@RequestMapping(method = RequestMethod.POST, value = "/regions/data", params = "op=rebalance")
public Callable<ResponseEntity<String>> rebalance(@RequestParam(value = CliStrings.REBALANCE__INCLUDEREGION, required = false) final String[] includedRegions, @RequestParam(value = CliStrings.REBALANCE__EXCLUDEREGION, required = false) final String[] excludedRegions, @RequestParam(value = CliStrings.REBALANCE__SIMULATE, defaultValue = "false") final Boolean simulate, @RequestParam(value = CliStrings.REBALANCE__TIMEOUT, defaultValue = "-1") final Long timeout) {
    final CommandStringBuilder command = new CommandStringBuilder(CliStrings.REBALANCE);
    if (hasValue(includedRegions)) {
        command.addOption(CliStrings.REBALANCE__INCLUDEREGION, StringUtils.join(includedRegions, StringUtils.COMMA_DELIMITER));
    }
    if (hasValue(excludedRegions)) {
        command.addOption(CliStrings.REBALANCE__EXCLUDEREGION, StringUtils.join(excludedRegions, StringUtils.COMMA_DELIMITER));
    }
    command.addOption(CliStrings.REBALANCE__SIMULATE, String.valueOf(simulate));
    command.addOption(CliStrings.REBALANCE__TIMEOUT, String.valueOf(timeout));
    return getProcessCommandCallable(command.toString());
}
Also used : CommandStringBuilder(org.apache.geode.management.internal.cli.util.CommandStringBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 58 with CommandStringBuilder

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

the class DiskStoreCommandsController method createDiskStore.

@RequestMapping(method = RequestMethod.POST, value = "/diskstores")
@ResponseBody
public String createDiskStore(@RequestParam(CliStrings.CREATE_DISK_STORE__NAME) final String diskStoreNameId, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE) final String[] directoryAndSizes, @RequestParam(value = CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, defaultValue = "false") final Boolean allowForceCompaction, @RequestParam(value = CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, defaultValue = "true") final Boolean autoCompact, @RequestParam(value = CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, defaultValue = "50") final Integer compactionThreshold, @RequestParam(value = CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, defaultValue = "1024") final Integer maxOplogSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, defaultValue = "0") final Integer queueSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, defaultValue = "1000") final Long timeInterval, @RequestParam(value = CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, defaultValue = "32768") final Integer writeBufferSize, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, defaultValue = "90") final Float diskUsageWarningPercentage, @RequestParam(value = CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, defaultValue = "99") final Integer diskUsageCriticalPercentage, @RequestParam(value = CliStrings.CREATE_DISK_STORE__GROUP, required = false) final String[] groups) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
    command.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreNameId);
    if (hasValue(directoryAndSizes)) {
        command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, StringUtils.join(directoryAndSizes, StringUtils.COMMA_DELIMITER));
    }
    command.addOption(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, String.valueOf(Boolean.TRUE.equals(allowForceCompaction)));
    command.addOption(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, String.valueOf(Boolean.TRUE.equals(autoCompact)));
    command.addOption(CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, String.valueOf(compactionThreshold));
    command.addOption(CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, String.valueOf(maxOplogSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, String.valueOf(queueSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, String.valueOf(timeInterval));
    command.addOption(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, String.valueOf(writeBufferSize));
    command.addOption(CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, String.valueOf(diskUsageWarningPercentage));
    command.addOption(CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, String.valueOf(diskUsageCriticalPercentage));
    if (hasValue(groups)) {
        command.addOption(CliStrings.CREATE_DISK_STORE__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 59 with CommandStringBuilder

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

the class DiskStoreCommandsController method destroyDiskStore.

// TODO determine whether Async functionality is required
@RequestMapping(method = RequestMethod.DELETE, value = "/diskstores/{name}")
@ResponseBody
public String destroyDiskStore(@PathVariable("name") final String diskStoreNameId, @RequestParam(value = CliStrings.DESTROY_DISK_STORE__GROUP, required = false) final String[] groups) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
    command.addOption(CliStrings.DESTROY_DISK_STORE__NAME, decode(diskStoreNameId));
    if (hasValue(groups)) {
        command.addOption(CliStrings.DESTROY_DISK_STORE__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 60 with CommandStringBuilder

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

the class ConfigCommandsController method describeConfig.

@RequestMapping(method = RequestMethod.GET, value = "/members/{member}/config")
@ResponseBody
public String describeConfig(@PathVariable("member") final String memberNameId, @RequestParam(value = CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS, defaultValue = "true") final Boolean hideDefaults) {
    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESCRIBE_CONFIG);
    command.addOption(CliStrings.DESCRIBE_CONFIG__MEMBER, decode(memberNameId));
    command.addOption(CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS, String.valueOf(hideDefaults));
    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