Add ability to compose java command according to version
[integration/test.git] / csit / libraries / NexusKeywords.robot
index 90178aa3313b78db82a0f7e3973f960642c55636..850711e5d0c9066e2a05298459b1da230320fd58 100644 (file)
@@ -17,7 +17,7 @@ Library           String
 Resource          SSHKeywords.robot
 
 *** Variables ***
-${NEXUS_FALLBACK_URL}    http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot
+${NEXUS_FALLBACK_URL}    ${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot
 
 *** Keywords ***
 Initialize_Artifact_Deployment_And_Usage
@@ -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}