Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Prev Previous commit
Next Next commit
Remove unnecessary code
  • Loading branch information
donggyu04 committed Nov 5, 2020
commit 454dbaa81c9393ce8b380acffcaee321c45cc17e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.agent.controller;

Expand Down Expand Up @@ -57,7 +57,7 @@ public class AgentDownloadController {
* @param fileName file path of agent
* @param response response.
*/
@GetMapping("/{fileName:[a-zA-Z0-9\\.\\-_]+}")
@GetMapping("/{fileName:[a-zA-Z0-9.\\-_]+}")
public void download(@PathVariable String fileName, HttpServletResponse response) {
File home = config.getHome().getDownloadDirectory();
File ngrinderFile = new File(home, fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class MonitorDownloadController {
* @param fileName monitor file name.
* @param response response.
*/

@GetMapping("/{fileName:[a-zA-Z0-9\\.\\-_]+}")
@GetMapping("/{fileName:[a-zA-Z0-9.\\-_]+}")
public void download(@PathVariable String fileName, HttpServletResponse response) {
File home = config.getHome().getDownloadDirectory();
File monitorFile = new File(home, fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Future<SystemInfo> getAsyncSystemInfo(String ip, int port) {
* Close the monitor JXM connection to the given target.
*
* @param ip target host IP
* @return success if succeeded.
*
*/
@GetMapping("/close")
public void closeMonitorConnection(@RequestParam String ip) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,15 +9,13 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.agent.repository;

import org.ngrinder.model.AgentInfo;
import org.springframework.data.jpa.domain.Specification;

import javax.persistence.criteria.*;

/**
* Agent Manager JPA Specification.
*
Expand All @@ -34,5 +32,5 @@ public abstract class AgentManagerSpecification {
public static Specification<AgentInfo> idEqual(final Long id) {
return (Specification<AgentInfo>) (root, query, cb) -> cb.equal(root.get("id"), id);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.ngrinder.infra.config.Config;
import org.ngrinder.packages.AgentPackageHandler;
import org.ngrinder.packages.PackageHandler;
Expand All @@ -14,13 +13,10 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import lombok.RequiredArgsConstructor;

import static org.apache.commons.lang.StringUtils.isNotEmpty;
import static org.ngrinder.common.util.CompressionUtils.*;
import static org.ngrinder.common.util.EncodingUtils.decodePathWithUTF8;
import static org.ngrinder.common.util.StringUtils.replaceLast;

Expand Down Expand Up @@ -137,30 +133,4 @@ protected boolean isDependentLib(File libFile, Set<String> libs) {
name = name.substring(0, (libVersionStartIndex == -1) ? name.lastIndexOf(".") : libVersionStartIndex);
return libs.contains(name);
}

static class TarArchivingZipEntryProcessor implements ZipEntryProcessor {
private TarArchiveOutputStream tao;
private FilePredicate filePredicate;
private String basePath;
private int mode;

TarArchivingZipEntryProcessor(TarArchiveOutputStream tao, FilePredicate filePredicate, String basePath, int mode) {
this.tao = tao;
this.filePredicate = filePredicate;
this.basePath = basePath;
this.mode = mode;
}

@Override
public void process(ZipFile file, ZipEntry entry) throws IOException {
try (InputStream inputStream = file.getInputStream(entry)) {
if (filePredicate.evaluate(entry)) {
addInputStreamToTar(this.tao, inputStream, basePath + FilenameUtils.getName(entry.getName()),
entry.getSize(),
this.mode);
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
import static org.ngrinder.common.constant.CacheConstants.*;
import static org.ngrinder.common.constant.ControllerConstants.PROP_CONTROLLER_ENABLE_AGENT_AUTO_APPROVAL;
import static org.ngrinder.common.util.CollectionUtils.newHashMap;
import static org.ngrinder.common.util.ExceptionUtils.processException;
import static org.ngrinder.common.util.LoggingUtils.format;
import static org.ngrinder.common.util.TypeConvertUtils.cast;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* @since 3.3
*/
public interface ClusterConstants {
public static final String PROP_CLUSTER_ENABLED = "cluster.enabled";
public static final String PROP_CLUSTER_HIDDEN_REGION = "cluster.hidden_region";
public static final String PROP_CLUSTER_MEMBERS = "cluster.members";
public static final String PROP_CLUSTER_PORT = "cluster.port";
public static final String PROP_CLUSTER_REGION = "cluster.region";
public static final String PROP_CLUSTER_HOST = "cluster.host";
public static final String PROP_CLUSTER_MODE = "cluster.mode";
public static final String PROP_CLUSTER_SAFE_DIST = "cluster.safe_dist";
String PROP_CLUSTER_ENABLED = "cluster.enabled";
String PROP_CLUSTER_HIDDEN_REGION = "cluster.hidden_region";
String PROP_CLUSTER_MEMBERS = "cluster.members";
String PROP_CLUSTER_PORT = "cluster.port";
String PROP_CLUSTER_REGION = "cluster.region";
String PROP_CLUSTER_HOST = "cluster.host";
String PROP_CLUSTER_MODE = "cluster.mode";
String PROP_CLUSTER_SAFE_DIST = "cluster.safe_dist";
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.common.constant;

Expand All @@ -20,69 +20,65 @@
*/
public interface ControllerConstants {

public static final String DEFAULT_PACKAGE_NAME = "org.ngrinder";
public static final int PLUGIN_UPDATE_FREQUENCY = 10;

// Google Analytics application name and Tracking ID
public static final String GOOGLE_ANALYTICS_APP_NAME = "ngrinder-controller";
public static final String GOOGLE_ANALYTICS_TRACKING_ID = "UA-36328271-5";
String DEFAULT_PACKAGE_NAME = "org.ngrinder";
int PLUGIN_UPDATE_FREQUENCY = 10;

/**
* Performance test execution frequency in milliseconds.
*/
public static final int PERFTEST_RUN_FREQUENCY_MILLISECONDS = 1000;
int PERFTEST_RUN_FREQUENCY_MILLISECONDS = 1000;

/**
* Performance test termination frequency in milliseconds.
*/
public static final int PERFTEST_TERMINATION_FREQUENCY_MILLISECONDS = 3000;
int PERFTEST_TERMINATION_FREQUENCY_MILLISECONDS = 3000;

//NGRINDER INITIAL ADMIN USER ID
public static final String NGRINDER_INITIAL_ADMIN_USERID = "admin";
String NGRINDER_INITIAL_ADMIN_USERID = "admin";

public static final int MAX_STACKTRACE_STRING_SIZE = 2048;
int MAX_STACKTRACE_STRING_SIZE = 2048;

public static final String PROP_CONTROLLER_ALLOW_SIGN_UP = "controller.allow_sign_up";
public static final String PROP_CONTROLLER_CONSOLE_PORT_BASE = "controller.console_port_base";
public static final String PROP_CONTROLLER_CONTROLLER_PORT = "controller.controller_port";
public static final String PROP_CONTROLLER_DEFAULT_LANG = "controller.default_lang";
public static final String PROP_CONTROLLER_DEMO_MODE = "controller.demo_mode";
public static final String PROP_CONTROLLER_DEV_MODE = "controller.dev_mode";
public static final String PROP_CONTROLLER_DIST_LOGBACK = "controller.dist_logback";
public static final String PROP_CONTROLLER_FRONT_PAGE_ENABLED = "controller.front_page_enabled";
public static final String PROP_CONTROLLER_FRONT_PAGE_ASK_QUESTION_URL = "controller.front_page_ask_question_url";
public static final String PROP_CONTROLLER_FRONT_PAGE_RESOURCES_RSS = "controller.front_page_resources_rss";
public static final String PROP_CONTROLLER_FRONT_PAGE_QNA_MORE_URL = "controller.front_page_qna_more_url";
public static final String PROP_CONTROLLER_FRONT_PAGE_QNA_RSS = "controller.front_page_qna_rss";
public static final String PROP_CONTROLLER_FRONT_PAGE_RESOURCES_MORE_URL = "controller.front_page_resources_more_url";
public static final String PROP_CONTROLLER_HELP_URL = "controller.help_url";
public static final String PROP_CONTROLLER_IP = "controller.ip";
public static final String PROP_CONTROLLER_MAX_AGENT_PER_TEST = "controller.max_agent_per_test";
public static final String PROP_CONTROLLER_MAX_CONCURRENT_TEST = "controller.max_concurrent_test";
public static final String PROP_CONTROLLER_MAX_RUN_COUNT = "controller.max_run_count";
public static final String PROP_CONTROLLER_MAX_RUN_HOUR = "controller.max_run_hour";
public static final String PROP_CONTROLLER_MAX_VUSER_PER_AGENT = "controller.max_vuser_per_agent";
public static final String PROP_CONTROLLER_MONITOR_PORT = "controller.monitor_port";
public static final String PROP_CONTROLLER_PLUGIN_SUPPORT = "controller.plugin_support";
public static final String PROP_CONTROLLER_SAFE_DIST = "controller.safe_dist";
public static final String PROP_CONTROLLER_SAFE_DIST_THRESHOLD = "controller.safe_dist_threshold";
public static final String PROP_CONTROLLER_SECURITY = "controller.security";
public static final String PROP_CONTROLLER_SECURITY_LEVEL = "controller.security.level";
public static final String PROP_CONTROLLER_URL = "controller.url";
public static final String PROP_CONTROLLER_VALIDATION_SYNTAX_CHECK = "controller.validation_syntax_check";
public static final String PROP_CONTROLLER_USAGE_REPORT = "controller.usage_report";
public static final String PROP_CONTROLLER_USER_PASSWORD_SHA256 = "controller.user_password_sha256";
public static final String PROP_CONTROLLER_USER_SECURITY = "controller.user_security";
public static final String PROP_CONTROLLER_VALIDATION_TIMEOUT = "controller.validation_timeout";
public static final String PROP_CONTROLLER_VERBOSE = "controller.verbose";
public static final String PROP_CONTROLLER_MAX_CONNECTION_WAITING_MILLISECOND = "controller.max_connection_waiting_millisecond";
public static final String PROP_CONTROLLER_ADMIN_PASSWORD_RESET = "controller.admin_password_reset";
public static final String PROP_CONTROLLER_ENABLE_SCRIPT_CONSOLE = "controller.enable_script_console";
public static final String PROP_CONTROLLER_ENABLE_AGENT_AUTO_APPROVAL = "controller.enable_agent_auto_approval";
public static final String PROP_CONTROLLER_AGENT_FORCE_UPDATE = "controller.agent_force_update";
public static final String PROP_CONTROLLER_UPDATE_CHUNK_SIZE = "controller.update_chunk_size";
public static final String PROP_CONTROLLER_INACTIVE_CLIENT_TIME_OUT = "controller.inactive_client_time_out";
public static final String PROP_CONTROLLER_ENABLE_STATISTICS = "controller.enable_statistics";
public static final String PROP_CONTROLLER_CSV_SEPARATOR = "controller.csv_separator";
public static final String PROP_CONTROLLER_GITHUB_BASE_URL = "controller.github_base_url";
String PROP_CONTROLLER_ALLOW_SIGN_UP = "controller.allow_sign_up";
String PROP_CONTROLLER_CONSOLE_PORT_BASE = "controller.console_port_base";
String PROP_CONTROLLER_CONTROLLER_PORT = "controller.controller_port";
String PROP_CONTROLLER_DEFAULT_LANG = "controller.default_lang";
String PROP_CONTROLLER_DEMO_MODE = "controller.demo_mode";
String PROP_CONTROLLER_DEV_MODE = "controller.dev_mode";
String PROP_CONTROLLER_DIST_LOGBACK = "controller.dist_logback";
String PROP_CONTROLLER_FRONT_PAGE_ENABLED = "controller.front_page_enabled";
String PROP_CONTROLLER_FRONT_PAGE_ASK_QUESTION_URL = "controller.front_page_ask_question_url";
String PROP_CONTROLLER_FRONT_PAGE_RESOURCES_RSS = "controller.front_page_resources_rss";
String PROP_CONTROLLER_FRONT_PAGE_QNA_MORE_URL = "controller.front_page_qna_more_url";
String PROP_CONTROLLER_FRONT_PAGE_QNA_RSS = "controller.front_page_qna_rss";
String PROP_CONTROLLER_FRONT_PAGE_RESOURCES_MORE_URL = "controller.front_page_resources_more_url";
String PROP_CONTROLLER_HELP_URL = "controller.help_url";
String PROP_CONTROLLER_IP = "controller.ip";
String PROP_CONTROLLER_MAX_AGENT_PER_TEST = "controller.max_agent_per_test";
String PROP_CONTROLLER_MAX_CONCURRENT_TEST = "controller.max_concurrent_test";
String PROP_CONTROLLER_MAX_RUN_COUNT = "controller.max_run_count";
String PROP_CONTROLLER_MAX_RUN_HOUR = "controller.max_run_hour";
String PROP_CONTROLLER_MAX_VUSER_PER_AGENT = "controller.max_vuser_per_agent";
String PROP_CONTROLLER_MONITOR_PORT = "controller.monitor_port";
String PROP_CONTROLLER_PLUGIN_SUPPORT = "controller.plugin_support";
String PROP_CONTROLLER_SAFE_DIST = "controller.safe_dist";
String PROP_CONTROLLER_SAFE_DIST_THRESHOLD = "controller.safe_dist_threshold";
String PROP_CONTROLLER_SECURITY = "controller.security";
String PROP_CONTROLLER_SECURITY_LEVEL = "controller.security.level";
String PROP_CONTROLLER_URL = "controller.url";
String PROP_CONTROLLER_VALIDATION_SYNTAX_CHECK = "controller.validation_syntax_check";
String PROP_CONTROLLER_USAGE_REPORT = "controller.usage_report";
String PROP_CONTROLLER_USER_PASSWORD_SHA256 = "controller.user_password_sha256";
String PROP_CONTROLLER_USER_SECURITY = "controller.user_security";
String PROP_CONTROLLER_VALIDATION_TIMEOUT = "controller.validation_timeout";
String PROP_CONTROLLER_VERBOSE = "controller.verbose";
String PROP_CONTROLLER_MAX_CONNECTION_WAITING_MILLISECOND = "controller.max_connection_waiting_millisecond";
String PROP_CONTROLLER_ADMIN_PASSWORD_RESET = "controller.admin_password_reset";
String PROP_CONTROLLER_ENABLE_SCRIPT_CONSOLE = "controller.enable_script_console";
String PROP_CONTROLLER_ENABLE_AGENT_AUTO_APPROVAL = "controller.enable_agent_auto_approval";
String PROP_CONTROLLER_AGENT_FORCE_UPDATE = "controller.agent_force_update";
String PROP_CONTROLLER_UPDATE_CHUNK_SIZE = "controller.update_chunk_size";
String PROP_CONTROLLER_INACTIVE_CLIENT_TIME_OUT = "controller.inactive_client_time_out";
String PROP_CONTROLLER_ENABLE_STATISTICS = "controller.enable_statistics";
String PROP_CONTROLLER_CSV_SEPARATOR = "controller.csv_separator";
String PROP_CONTROLLER_GITHUB_BASE_URL = "controller.github_base_url";
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* @since 3.3
*/
public interface DatabaseConstants {
public static final String PROP_DATABASE_TYPE = "database.type";
public static final String PROP_DATABASE_URL = "database.url";
public static final String PROP_DATABASE_UNIT_TEST = "database.unit-test";
public static final String PROP_DATABASE_URL_OPTION = "database.url_option";
public static final String PROP_DATABASE_USERNAME = "database.username";
public static final String PROP_DATABASE_PASSWORD = "database.password";
String PROP_DATABASE_TYPE = "database.type";
String PROP_DATABASE_URL = "database.url";
String PROP_DATABASE_UNIT_TEST = "database.unit-test";
String PROP_DATABASE_URL_OPTION = "database.url_option";
String PROP_DATABASE_USERNAME = "database.username";
String PROP_DATABASE_PASSWORD = "database.password";
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -9,7 +9,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
package org.ngrinder.common.constant;

Expand All @@ -20,32 +20,31 @@
*/
public interface WebConstants {

public static final String JSON_SUCCESS = "success";
public static final String JSON_MESSAGE = "message";
String JSON_SUCCESS = "success";
String JSON_MESSAGE = "message";

// parameter constant, for parameter from page, and for key in map

public static final String PARAM_TPS = "tps";
public static final String PARAM_STATUS_AGENT_PORT = "port";
String PARAM_TPS = "tps";
String PARAM_STATUS_AGENT_PORT = "port";

public static final String PARAM_TEST = "test";
public static final String PARAM_LOG_LIST = "logs";
String PARAM_TEST = "test";
String PARAM_LOG_LIST = "logs";

public static final String PARAM_TEST_CHART_INTERVAL = "chartInterval";
String PARAM_TEST_CHART_INTERVAL = "chartInterval";

public static final String PARAM_TIMEZONE_OFFSET = "timezoneOffset";
public static final String PARAM_REGION_LIST = "regions";
public static final String PARAM_REGION_AGENT_COUNT_MAP = "regionAgentCountMap";
public static final String PARAM_QUICK_SCRIPT = "quickScript";
public static final String PARAM_QUICK_SCRIPT_REVISION = "quickScriptRevision";
public static final String PARAM_PROCESS_THREAD_POLICY_SCRIPT = "vuserCalcScript";
String PARAM_TIMEZONE_OFFSET = "timezoneOffset";
String PARAM_REGION_LIST = "regions";
String PARAM_REGION_AGENT_COUNT_MAP = "regionAgentCountMap";
String PARAM_QUICK_SCRIPT = "quickScript";
String PARAM_QUICK_SCRIPT_REVISION = "quickScriptRevision";
String PARAM_PROCESS_THREAD_POLICY_SCRIPT = "vuserCalcScript";

public static final String PARAM_AVAILABLE_RAMP_UP_TYPE = "rampUpTypes";
public static final String PARAM_MAX_VUSER_PER_AGENT = "maxVuserPerAgent";
public static final String PARAM_MAX_RUN_COUNT = "maxRunCount";
public static final String PARAM_MAX_RUN_HOUR = "maxRunHour";
public static final String PARAM_SAFE_FILE_DISTRIBUTION = "safeFileDistribution";

public static final String PARAM_SECURITY_LEVEL = "securityLevel";
String PARAM_AVAILABLE_RAMP_UP_TYPE = "rampUpTypes";
String PARAM_MAX_VUSER_PER_AGENT = "maxVuserPerAgent";
String PARAM_MAX_RUN_COUNT = "maxRunCount";
String PARAM_MAX_RUN_HOUR = "maxRunHour";
String PARAM_SAFE_FILE_DISTRIBUTION = "safeFileDistribution";

String PARAM_SECURITY_LEVEL = "securityLevel";
}
Loading