- Set Variable [ $r; Value:MBS( "Trace") ]
- #Test static methods
- Set Variable [ $r; Value:MBS( "Java.CallStaticMethod"; "tests"; "GetString"; "()Ljava/lang/String;" ) ]
- If [ MBS("IsError") or (Left ( $r ; 5 ) ≠ "Hello") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "String function failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.CallStaticMethod"; "tests"; "method_int"; "(IDCJS)I"; 10000; 2000; 300; 40; 5 ) ]
- If [ MBS("IsError") or ($r ≠ 12345) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static int method failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.CallStaticMethod"; "tests"; "method_double"; "(IDCJS)D"; 10000; 2000; 300; 40; 5 ) ]
- If [ MBS("IsError") or ($r ≠ 12345) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static double method failed" ]
- End If
- #Test static properties
- #int
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_int"; "I"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_int"; "I") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #long
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_long"; "J"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_long"; "J") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #char
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_char"; "C"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_char"; "C") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #short
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_short"; "S"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_short"; "S") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #boolean
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_boolean"; "Z"; 1) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_boolean"; "Z") ]
- If [ MBS("IsError") or ($r ≠ 1) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #double
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_double"; "D"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_double"; "D") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #float
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_float"; "F"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_float"; "F") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #byte
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_byte"; "B"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_byte"; "B") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #string
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_string"; "Ljava/lang/String;"; "123") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_string"; "Ljava/lang/String;") ]
- If [ MBS("IsError") or ($r ≠ "123") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #char array
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_charArray"; "[C"; "123") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_charArray"; "[C") ]
- If [ MBS("IsError") or ($r ≠ "123") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- End If
- #byte array
- Set Variable [ $r; Value:MBS( "Java.SetStaticField"; "tests"; "static_property_byteArray"; "[B"; Java Test::TestContainer) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.SetContainerFileName"; "Logo.png" ) ]
- Set Variable [ $r; Value:MBS( "Java.GetStaticField"; "tests"; "static_property_byteArray"; "[B") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Static get property failed" ]
- Else
- Set Field [ Java Test::ContainerResult1; $r ]
- End If
- #Create object
- Set Variable [ $j; Value:MBS( "Java.NewClassObject"; "tests"; "<init>"; "()V") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $j; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Constructor failed" ]
- End If
- #Call method
- Set Variable [ $r; Value:MBS( "Java.CallObjectMethod"; $j; "method_void"; "()V" ) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "Method Void Call failed" ]
- End If
- #Test properties
- #int
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_int"; "I"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_int"; "I") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #long
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_long"; "J"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_long"; "J") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #char
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_char"; "C"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_char"; "C") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #short
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_short"; "S"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_short"; "S") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #boolean
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_boolean"; "Z"; 1) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_boolean"; "Z") ]
- If [ MBS("IsError") or ($r ≠ 1) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #double
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_double"; "D"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_double"; "D") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #float
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_float"; "F"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_float"; "F") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #byte
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_byte"; "B"; 123) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_byte"; "B") ]
- If [ MBS("IsError") or ($r ≠ 123) ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #string
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_string"; "Ljava/lang/String;"; "123") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_string"; "Ljava/lang/String;") ]
- If [ MBS("IsError") or ($r ≠ "123") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #char array
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_charArray"; "[C"; "123") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_charArray"; "[C") ]
- If [ MBS("IsError") or ($r ≠ "123") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- End If
- #byte array
- Set Variable [ $r; Value:MBS( "Java.SetObjectField"; $j; "property_byteArray"; "[B"; Java Test::TestContainer) ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "set property failed" ]
- End If
- Set Variable [ $r; Value:MBS( "Java.SetContainerFileName"; "Logo.png" ) ]
- Set Variable [ $r; Value:MBS( "Java.GetObjectField"; $j; "property_byteArray"; "[B") ]
- If [ MBS("IsError") ]
- Show Custom Dialog [ Title: "Java Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
- Exit Script [ Result: "get property failed" ]
- Else
- Set Field [ Java Test::ContainerResult2; $r ]
- End If
- #Cleanup and Finish
- Set Variable [ $r; Value:MBS( "Java.Release"; $j) ]
- Show Custom Dialog [ Title: "Java Success"; Message: "All tests okay"; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
|