@@ -13,23 +13,66 @@ class DemoApplication {
13
13
@JvmStatic
14
14
fun main (args : Array <String >) {
15
15
runApplication<DemoApplication >(* args)
16
- runScript(" Hello world" ) { SimpleScriptExecutor ().executeScript(" helloWorld.kts" ) }
17
- runScript(" Simple script with variables" ) { SimpleScriptExecutor ().executeScript(" useContext.kts" ) }
18
- runScript(" Simple script using business package" ) { SimpleScriptExecutor ().executeScript(" useContextAndBusiness.kts" ) }
19
- runScript(" Simple script using business and common package" , " This test will fail on fat jar, because the commons module isn't unpacked." ) { SimpleScriptExecutor ().executeScript(" useContextAndBusinessAndCommons.kts" ) }
20
- runScript(" ScriptExecutorWithCustomizedScriptingHost" ) {
21
- ScriptExecutorWithCustomizedScriptingHost ().executeScript()
16
+ runScript( " SIMPLE_1" , " Hello world" ) { SimpleScriptExecutor ().executeScript(" helloWorld.kts" ) }
17
+ runScript(" SIMPLE_2" , " Simple script with variables" ) { SimpleScriptExecutor ().executeScript(" useContext.kts" ) }
18
+ runScript(" SIMPLE_3" , " Simple script using business package" ) { SimpleScriptExecutor ().executeScript(" useContextAndBusiness.kts" ) }
19
+ runScript(
20
+ " SIMPLE_4" ,
21
+ " Simple script using business and common package (OK)" ,
22
+ " This test will fail on fat jar, because the commons module isn't unpacked (OK)."
23
+ ) { SimpleScriptExecutor ().executeScript(" useContextAndBusinessAndIndirectCommons.kts" ) }
24
+ runScript(
25
+ " CUST_OK" ,
26
+ " ScriptExecutorWithCustomizedScriptingHost" ,
27
+ " Using ThreadLocal, context and execution with timeout." ,
28
+ ) {
29
+ ScriptExecutorWithCustomizedScriptingHost ().executeScript(" useContextAndThreadLocal.kts" )
30
+ }
31
+ runScript(
32
+ " CUST_TIMEOUT" ,
33
+ " ScriptExecutorWithCustomizedScriptingHost: endless loop (OK)" ,
34
+ " Timeout expected after 5 seconds! (OK)" ,
35
+ ) {
36
+ ScriptExecutorWithCustomizedScriptingHost ().executeScript(" endlessLoop.kts" )
37
+ }
38
+ runScript(
39
+ " CLASSLOADER_FAIL" ,
40
+ " *** ScriptExecutorWithOwnClassloader (fails for fat jar)***" ,
41
+ " CustomCustomLoader is not used for loading commons (no log)! *** Any ideas on how to fix this?***" ,
42
+ ) {
43
+ ScriptExecutorWithOwnClassloader ().executeScript()
44
+ }
45
+ runScript(
46
+ " COPY_1" ,
47
+ " ScriptExecutorWithCopiedJars, direct commons-usage" ,
48
+ " common package is not extracted in fat jar, but copied to temp dir for url classloader." ,
49
+ ) {
50
+ ScriptExecutorWithCopiedJars ().executeScript(" useContextAndCommons.kts" )
51
+ }
52
+ runScript(
53
+ " COPY_MIX_FAIL" ,
54
+ " ScriptExecutorWithCopiedJars, indirect commons-usage (fails for fat jar****)" ,
55
+ " common package available thru url classloader, but the mix of extracted and copied jars fails. *** Any ideas on how to fix this?***" ,
56
+ ) {
57
+ ScriptExecutorWithCopiedJars ().executeScript(" useContextAndBusinessAndIndirectCommons.kts" )
58
+ }
59
+ runScript(
60
+ " COPY_2" ,
61
+ " ScriptExecutorWithCopiedJars, direct commons and indirect misc-usage" ,
62
+ " common and misc packages are not extracted in fat jar, but copied to temp dir for url classloader." ,
63
+ ) {
64
+ ScriptExecutorWithCopiedJars ().executeScript(" useContextAndCommonsAndIndirectMisc.kts" )
22
65
}
23
66
System .exit(0 ) // Not an elegant way, but here it is enough.
24
67
}
25
68
26
- private fun runScript (name : String , msg : String? = null, block : () -> Unit ) {
27
- log.info { " ******************************************************************************" }
28
- log.info { " *** Running test $name " }
69
+ private fun runScript (id : String , name : String , msg : String? = null, block : () -> Unit ) {
70
+ log.info { " ***************************************************************************************************** " }
71
+ log.info { " *** $id : Running test $name " }
29
72
if (msg != null ) {
30
73
log.info { " *** $msg " }
31
74
}
32
- log.info { " ******************************************************************************" }
75
+ log.info { " ***************************************************************************************************** " }
33
76
block()
34
77
}
35
78
}
0 commit comments