Skip to content

Commit

Permalink
Feat/us47299 vulnerabilities (#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelmarik authored May 5, 2023
1 parent 4131dfb commit 102318e
Show file tree
Hide file tree
Showing 9 changed files with 652 additions and 813 deletions.
3 changes: 1 addition & 2 deletions bzt/modules/java/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from bzt.modules.functional import FuncSamplesReader
from bzt.modules.jmeter import JTLReader
from bzt.utils import get_full_path, shell_exec, TclLibrary, JavaVM, BetterDict, get_assembled_value
from .tools import SeleniumServer, Hamcrest, Json, TaurusJavaHelper, JavaC, JUnitJupiterApi, JUnitJupiterEngine
from .tools import Hamcrest, Json, TaurusJavaHelper, JavaC, JUnitJupiterApi, JUnitJupiterEngine
from .tools import JUnitPlatformCommons, JUnitPlatformLauncher, JUnitPlatformEngine, JUnitPlatformRunner
from .tools import JUnitPlatformSuiteApi, JUnitVintageEngine, ApiGuardian, JUnit, OpenTest4j, TestNG

Expand All @@ -46,7 +46,6 @@ def __init__(self):
self.report_file_suffix = ".ldjson"

def install_required_tools(self):
self._add_jar_tool(SeleniumServer, config=self.settings.get("selenium-server"))
self._add_jar_tool(Hamcrest, config=self.settings.get("hamcrest-core"))
self._add_jar_tool(Json, config=self.settings.get("json-jar"))
self._add_jar_tool(TaurusJavaHelper)
Expand Down
49 changes: 0 additions & 49 deletions bzt/modules/java/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,55 +76,6 @@ def check_if_installed(self):
return True


class SeleniumServer(RequiredTool):
VERSION = "3.141"
REMOTE_ADDR = "http://selenium-release.storage.googleapis.com/"
REMOTE_PATH = "{short_version}/selenium-server-standalone-{full_version}.jar"
TOOL_FILE = "selenium-server-{version}.jar"

def __init__(self, config, **kwargs):
if not isinstance(config, dict):
config = BetterDict.from_dict({"path": config})

version = config.get("version", self.VERSION)
version = str(version).split('.')
# 3.141.59 version
version.extend(['59'] * (3 - len(version)))
short_version = '.'.join(version[:2]) # 2 elements
full_version = '.'.join(version) # 3+ elements

remote_path = config.get("remote-path", self.REMOTE_PATH)
remote_path = remote_path.format(short_version=short_version, full_version=full_version)

tool_file = config.get("tool-file", self.TOOL_FILE)
tool_file = tool_file.format(version=full_version)

local_path = config.get("path", JarTool.LOCAL_PATH)
local_path = local_path.format(tool_file=tool_file)

download_link = config.get("download-link", JarTool.URL)
download_link = download_link.format(remote_addr=self.REMOTE_ADDR, remote_path=remote_path)

super(SeleniumServer, self).__init__(
tool_path=local_path,
download_link=download_link,
version=full_version,
**kwargs)

def check_if_installed(self):
self.log.debug("Trying %s: %s", self.tool_name, self.tool_path)
try:
out, err = self.call(["java", "-jar", self.tool_path, "-help"])
except CALL_PROBLEMS as exc:
self.log.warning("%s check failed: %s", self.tool_name, exc)
return False

if err:
out += err
self.log.debug("%s output: %s", self.tool_name, out)
return True


class Json(JarTool):
REMOTE_PATH = "org/json/json/20160810/json-20160810.jar"
TOOL_FILE = "json.jar"
Expand Down
23 changes: 0 additions & 23 deletions examples/all-executors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ execution:
- url: http://localhost:8000/
label: Selenium Chrome

- executor: selenium # Selenium_JUnit
concurrency: 1
hold-for: 10s
iterations: 10
runner: junit
scenario:
script: BOOTH1/Blazedemo.java

- executor: selenium # Selenium_TestNG
concurrency: 1
hold-for: 10s
iterations: 10
runner: testng
scenario:
script: selenium/TestNGExample.java

---
execution:
- executor: selenium # Selenium Ruby
Expand All @@ -78,13 +62,6 @@ execution:
scenario:
script: functional/JUnitTest.java

- executor: testng # testTestNG
concurrency: 1
hold-for: 10s
iterations: 10
scenario:
script: functional/TestNGTest.java

- executor: rspec # Ruby test
concurrency: 1
hold-for: 10s
Expand Down
5 changes: 0 additions & 5 deletions tests/resources/selenium/invalid/NotJUnittest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NotJUnittest {
public static void main(String[] args) {
}
Expand Down
30 changes: 0 additions & 30 deletions tests/resources/selenium/invalid/SeleniumTest.java

This file was deleted.

29 changes: 0 additions & 29 deletions tests/resources/selenium/invalid/SimpleTest.java

This file was deleted.

23 changes: 0 additions & 23 deletions tests/resources/selenium/invalid/selenium1.java

This file was deleted.

Loading

0 comments on commit 102318e

Please sign in to comment.