Add ability to compose java command according to version
[integration/test.git] / csit / libraries / NexusKeywords.robot
index f93f707f406a42d62742d460abe2b0991ea1f6b6..850711e5d0c9066e2a05298459b1da230320fd58 100644 (file)
@@ -102,3 +102,20 @@ Deploy_Test_Tool
     ${name_suffix}=    BuiltIn.Set_Variable    -${suffix}.jar
     ${filename}=    Deploy_Artifact    ${component}    ${artifact}    ${name_prefix}    ${name_suffix}
     [Return]    ${filename}
+
+Compose_Base_Java_Command
+    [Arguments]    ${openjdk}=${JDKVERSION}
+    [Documentation]    Return string suitable for launching Java programs over SSHLibrary, depending on JRE version needed.
+    ...    Not directly related to nexus, but different versioned Java artifacts may need this.
+    BuiltIn.Return_From_Keyword_If    """${openjdk}""" == "openjdk8"    /usr/lib/jvm/java-1.8.0/bin/java
+    BuiltIn.Return_From_Keyword_If    """${openjdk}""" == "openjdk7"    /usr/lib/jvm/java-1.7.0/bin/java
+    BuiltIn.Return_From_Keyword    java
+
+Compose_Full_Java_Command
+    [Arguments]    ${options}    ${openjdk}=${JDKVERSION}
+    [Documentation]    Return full Bash command to run Java with given options.
+    ...    The options may include JVM options, application command line arguments, Bash redirects and other constructs.
+    ${base_command} =    Compose_Base_Java_Command    openjdk=${openjdk}
+    ${full_command} =    BuiltIn.Set_Variable    ${base_command} ${options}
+    BuiltIn.Log    ${full_command}
+    [Return]    ${full_command}