summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications/lang/java.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/applications/lang/java.py')
-rw-r--r--test/unit/applications/lang/java.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index ec1c95d9..40bf3662 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -1,4 +1,5 @@
import os
+import glob
import shutil
from subprocess import Popen
from unit.applications.proto import TestApplicationProto
@@ -6,11 +7,9 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationJava(TestApplicationProto):
def load(self, script, name='app'):
-
app_path = self.testdir + '/java'
web_inf_path = app_path + '/WEB-INF/'
classes_path = web_inf_path + 'classes/'
-
script_path = self.current_dir + '/java/' + script + '/'
if not os.path.isdir(app_path):
@@ -19,39 +18,48 @@ class TestApplicationJava(TestApplicationProto):
src = []
for f in os.listdir(script_path):
+ file_path = script_path + f
+
if f.endswith('.java'):
- src.append(script_path + f)
+ src.append(file_path)
continue
if f.startswith('.') or f == 'Makefile':
continue
- if os.path.isdir(script_path + f):
+ if os.path.isdir(file_path):
if f == 'WEB-INF':
continue
- shutil.copytree(script_path + f, app_path + '/' + f)
+ shutil.copytree(file_path, app_path + '/' + f)
continue
if f == 'web.xml':
if not os.path.isdir(web_inf_path):
os.makedirs(web_inf_path)
- shutil.copy2(script_path + f, web_inf_path)
+ shutil.copy2(file_path, web_inf_path)
else:
- shutil.copy2(script_path + f, app_path)
+ shutil.copy2(file_path, app_path)
if src:
if not os.path.isdir(classes_path):
os.makedirs(classes_path)
- tomcat_jar = self.pardir + '/build/tomcat-servlet-api-9.0.13.jar'
+ classpath = self.pardir + '/build/tomcat-servlet-api-9.0.13.jar'
+
+ ws_jars = glob.glob(
+ self.pardir + '/build/websocket-api-java-*.jar'
+ )
+
+ if not ws_jars:
+ self.fail('websocket api jar not found.')
javac = [
'javac',
'-encoding', 'utf-8',
'-d', classes_path,
- '-classpath', tomcat_jar,
+ '-classpath', classpath + ':' + ws_jars[0],
]
javac.extend(src)