diff options
author | Andrei Belov <defan@nginx.com> | 2020-11-19 21:19:57 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2020-11-19 21:19:57 +0300 |
commit | 7f9079a3cd4cdb6ac3fea53f10bd34fe8b82fe9c (patch) | |
tree | c79dc48a3260156f3f824ecd299e5a4934d749c5 /test/unit/applications/lang/java.py | |
parent | 646d047e5d12515ceac02279b373601ce0752982 (diff) | |
parent | 806a9b2515c60b12a68cd97af04f7fa5cb4dffed (diff) | |
download | unit-7f9079a3cd4cdb6ac3fea53f10bd34fe8b82fe9c.tar.gz unit-7f9079a3cd4cdb6ac3fea53f10bd34fe8b82fe9c.tar.bz2 |
Merged with the default branch.1.21.0-1
Diffstat (limited to 'test/unit/applications/lang/java.py')
-rw-r--r-- | test/unit/applications/lang/java.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py index 01cbfa0b..0ff85187 100644 --- a/test/unit/applications/lang/java.py +++ b/test/unit/applications/lang/java.py @@ -9,8 +9,10 @@ from unit.applications.proto import TestApplicationProto class TestApplicationJava(TestApplicationProto): - def load(self, script, name='app', **kwargs): - app_path = self.temp_dir + '/java' + application_type = "java" + + def prepare_env(self, script): + app_path = option.temp_dir + '/java' web_inf_path = app_path + '/WEB-INF/' classes_path = web_inf_path + 'classes/' script_path = option.test_dir + '/java/' + script + '/' @@ -50,7 +52,7 @@ class TestApplicationJava(TestApplicationProto): os.makedirs(classes_path) classpath = ( - option.current_dir + '/build/tomcat-servlet-api-9.0.13.jar' + option.current_dir + '/build/tomcat-servlet-api-9.0.39.jar' ) ws_jars = glob.glob( @@ -62,18 +64,28 @@ class TestApplicationJava(TestApplicationProto): javac = [ 'javac', + '-target', '8', '-source', '8', '-nowarn', '-encoding', 'utf-8', '-d', classes_path, '-classpath', classpath + ':' + ws_jars[0], ] javac.extend(src) + if option.detailed: + print("\n$ " + " ".join(javac)) + try: process = subprocess.Popen(javac, stderr=subprocess.STDOUT) process.communicate() + except KeyboardInterrupt: + raise + except: - pytest.fail('Cann\'t run javac process.') + pytest.fail('Can\'t run javac process.') + + def load(self, script, **kwargs): + self.prepare_env(script) self._load_conf( { @@ -81,10 +93,13 @@ class TestApplicationJava(TestApplicationProto): "applications": { script: { "unit_jars": option.current_dir + '/build', - "type": 'java', + "type": self.get_application_type(), "processes": {"spare": 0}, - "working_directory": script_path, - "webapp": app_path, + "working_directory": option.test_dir + + '/java/' + + script + + '/', + "webapp": option.temp_dir + '/java', } }, }, |