Package dev.galasa.zosliberty
Interface IZosLibertyServer
public interface IZosLibertyServer
Represents a zOS Liberty server
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeature
(String feature) Convenience method to add a feature to the Liberty serverserver.xml
void
build()
Builds the the Liberty server on the zOS UNIX file system from any objects that have been created such as the server.xmlvoid
Convenience method to checkpoint the known Liberty server logs, i.e.void
Clear the contents of the Liberty servers logs directoryint
create()
Create a Liberty server using theserver create
commandvoid
delete()
Delete the Liberty server files and directoriesvoid
deployApplication
(Class<?> testClass, String path, String targetLocation, IZosLibertyServer.ApplicationType type, String name, String contextRoot) Deploy an application to the Liberty server.void
deployApplicationToDropins
(Class<?> testClass, String path) Deploy an application to the Liberty server dropins directory.Get the Liberty server dropins directoryGet the JAVA_HOME value for this Liberty serverReturns the keystore file for this Liberty servergetLogs()
Get the contents of the Liberty servers logs directoryGet the Liberty server logs directoryReturns the Liberty Server Configuration Directory${server.config.app.dir}
as aIZosUNIXFile
objectReturns the Liberty Server NameReturns the Liberty Server Output Directory${server.output.dir}
as aIZosUNIXFile
objectGet the server.xml object for this Liberty serverReturns the Liberty Shared Application Directory${shared.app.dir}
as aIZosUNIXFile
objectReturns the Liberty Shared Configuration Directory${shared.config.dir}
as aIZosUNIXFile
objectReturns the Liberty Shared Resources Directory${shared.resources.dir}
as aIZosUNIXFile
objectReturns the Liberty versionReturns the Liberty Install Directory${WLP_INSTALL_DIR}
as aIZosUNIXFile
objectReturns the Liberty Output Directory${WLP_OUTPUT_DIR}
as aIZosUNIXFile
objectReturns the Liberty User Directory${WLP_USER_DIR}
as aIZosUNIXFile
objectGet the zOS Image for this Liberty serverConvenience method to list the current features listed in thefeatureManager
element in the Liberty serverserver.xml
Load the content of the Liberty server.xml from the file system into the internalIZosLibertyServerXml
objectvoid
removeApplication
(String name) Remove an application from the Liberty server.void
removeApplicationFromDropins
(String fileName) Remove an application from the Liberty server dropins directory.void
removeFeature
(String feature) Convenience method remove a feature from the Liberty serverserver.xml
Get the current contents of the Liberty servermessages.log
as aString
Get the current contents of the Liberty servermessages.log
as aString
since the last checkpointGet the current contents of the Liberty servertrace.log
as aString
Get the current contents of the Liberty servertrace.log
as aString
since the last checkpointint
run()
Run the Liberty server as a zOS batch jobvoid
Store the content of the Liberty server logs and configuration to the default location in the Results Archive Storevoid
saveToResultsArchive
(String rasPath) Store the content of the Liberty server logs and configuration to the Results Archive StoresecurityUtilityEncode
(String password) Use the Liberty securityUtility command to encode a passwordsecurityUtilityGenerateKeystore
(String password) Use the Liberty securityUtility to create a new keyStorevoid
setDefaultHttpEndpoint
(String host, int httpPort, int httpsPort) Convenience method to create or replace thedefaultHttpEndpoint
element in the Liberty serverserver.xml
void
setJavaHome
(String javaHome) Set the value of JAVA_HOME for this Liberty servervoid
setServerName
(String serverName) Provides the Liberty Server Namevoid
setServerXml
(IZosLibertyServerXml serverXml) Set the server.xml object for this Liberty servervoid
setWlpInstallDir
(String wlpInstallDir) Provides the location of the Liberty Install Directory${WLP_INSTALL_DIR}
void
setWlpOutputDir
(String wlpOutputDir) Provides the location of the Liberty Output Directory${WLP_OUTPUT_DIR}
void
setWlpUserDir
(String wlpUserDir) Provides the location of the Liberty User Directory${WLP_USER_DIR}
int
start()
Start the Liberty server using theserver start
commandint
status()
Get the Liberty sever status using theserver status
commandint
stop()
Stop the Liberty serverboolean
Wait for an application to start using the default timeout by looking forCWWKZ0001I
message in messages.log.boolean
waitForApplicationStart
(String name, int timeout) Wait for an application to start using the supplied timeout by looking forCWWKZ0001I
message in messages.log.boolean
waitForApplicationStop
(String name) Wait for an application to stop using the default timeout by looking forCWWKZ0009I
message in messages.log.boolean
waitForApplicationStop
(String name, int timeout) If themessages.log
has not been check-pointed, the whole file will be searched.int
Wait for the Liberty server to start using the default timeoutint
waitForStart
(int timeout) Wait for the Liberty server to start using the supplied timeoutboolean
Wait for the Liberty server to issue theCWWKF0011I
message to themessages.log
using the default timeoutboolean
waitForStartMessage
(int timeout) Wait for the Liberty server to issue theCWWKF0011I
message to themessages.log
using the supplied timeoutint
Wait for the Liberty server to stop using the default timeoutint
waitForStop
(int timeout) Wait for the Liberty server to stop using the supplied timeoutboolean
Wait for the Liberty server to issue theCWWKE0036I
message to themessages.log
using the default timeoutboolean
waitForStopMessage
(int timeout) Wait for the Liberty server to issue theCWWKE0036I
message to themessages.log
using the supplied timeout
-
Method Details
-
setServerName
Provides the Liberty Server Name- Parameters:
serverName
-- Throws:
ZosLibertyServerException
-
setWlpInstallDir
Provides the location of the Liberty Install Directory${WLP_INSTALL_DIR}
- Parameters:
wlpInstallDir
-- Throws:
ZosLibertyServerException
-
setWlpUserDir
Provides the location of the Liberty User Directory${WLP_USER_DIR}
- Parameters:
wlpUserDir
-- Throws:
ZosLibertyServerException
-
setWlpOutputDir
Provides the location of the Liberty Output Directory${WLP_OUTPUT_DIR}
- Parameters:
wlpOutputDir
-- Throws:
ZosLibertyServerException
-
setJavaHome
Set the value of JAVA_HOME for this Liberty server- Parameters:
javaHome
-- Throws:
ZosLibertyServerException
-
getVersion
Returns the Liberty version- Returns:
- Liberty version
- Throws:
ZosLibertyServerException
-
getServerName
String getServerName()Returns the Liberty Server Name- Returns:
- the Liberty Server Name
-
getWlpInstallDir
Returns the Liberty Install Directory${WLP_INSTALL_DIR}
as aIZosUNIXFile
object- Returns:
- the Liberty Install Directory
- Throws:
ZosLibertyServerException
-
getWlpUserDir
Returns the Liberty User Directory${WLP_USER_DIR}
as aIZosUNIXFile
object- Returns:
- the Liberty User Directory
- Throws:
ZosLibertyServerException
-
getWlpOutputDir
Returns the Liberty Output Directory${WLP_OUTPUT_DIR}
as aIZosUNIXFile
object- Returns:
- the Liberty Output Directory
- Throws:
ZosLibertyServerException
-
getServerConfigDir
Returns the Liberty Server Configuration Directory${server.config.app.dir}
as aIZosUNIXFile
object- Returns:
- the Liberty Server Configuration Directory
- Throws:
ZosLibertyServerException
-
getServerOutputDir
Returns the Liberty Server Output Directory${server.output.dir}
as aIZosUNIXFile
object- Returns:
- the Liberty Server Output Directory
- Throws:
ZosLibertyServerException
-
getLogsDirectory
Get the Liberty server logs directory- Returns:
- the Liberty server logs directory
- Throws:
ZosLibertyServerException
-
getDropinsDir
Get the Liberty server dropins directory- Returns:
- the dropins directory
- Throws:
ZosLibertyServerException
-
getJavaHome
Get the JAVA_HOME value for this Liberty server- Returns:
- Throws:
ZosLibertyServerException
-
getZosImage
IZosImage getZosImage()Get the zOS Image for this Liberty server- Returns:
-
setServerXml
Set the server.xml object for this Liberty server- Parameters:
serverXml
- theIZosLibertyServerXml
server.xml object- Throws:
ZosLibertyServerException
-
getServerXml
Get the server.xml object for this Liberty server- Returns:
- the server.xml
- Throws:
ZosLibertyServerException
-
loadServerXmlFromFileSystem
Load the content of the Liberty server.xml from the file system into the internalIZosLibertyServerXml
object- Returns:
- the server.xml
- Throws:
ZosLibertyServerException
-
getLogs
Get the contents of the Liberty servers logs directory- Returns:
- the Liberty server logs
- Throws:
ZosLibertyServerException
-
clearLogs
Clear the contents of the Liberty servers logs directory- Throws:
ZosLibertyServerException
-
checkpointLogs
Convenience method to checkpoint the known Liberty server logs, i.e.messages.log
andtrace.log
- Throws:
ZosLibertyServerException
-
retrieveMessagesLog
Get the current contents of the Liberty servermessages.log
as aString
- Returns:
- the content of the
messages.log
ornull
if the file does not exist - Throws:
ZosLibertyServerException
-
retrieveTraceLog
Get the current contents of the Liberty servertrace.log
as aString
- Returns:
- the content of the
messages.log
ornull
if the file does not exist - Throws:
ZosLibertyServerException
-
retrieveMessagesLogSinceCheckpoint
Get the current contents of the Liberty servermessages.log
as aString
since the last checkpoint- Returns:
- the content of the
messages.log
- Throws:
ZosLibertyServerException
-
retrieveTraceLogSinceCheckpoint
Get the current contents of the Liberty servertrace.log
as aString
since the last checkpoint- Returns:
- the content of the
messages.log
- Throws:
ZosLibertyServerException
-
build
Builds the the Liberty server on the zOS UNIX file system from any objects that have been created such as the server.xml- Throws:
ZosLibertyServerException
-
create
Create a Liberty server using theserver create
command- Returns:
server
command return code- Throws:
ZosLibertyServerException
-
start
Start the Liberty server using theserver start
command- Returns:
server
command return code- Throws:
ZosLibertyServerException
-
run
Run the Liberty server as a zOS batch job- Returns:
server
command return code- Throws:
ZosLibertyServerException
-
waitForStart
Wait for the Liberty server to start using the default timeout- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
waitForStart
Wait for the Liberty server to start using the supplied timeout- Parameters:
timeout
- the timeout in seconds- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
waitForStartMessage
Wait for the Liberty server to issue theCWWKF0011I
message to themessages.log
using the default timeout- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
waitForStartMessage
Wait for the Liberty server to issue theCWWKF0011I
message to themessages.log
using the supplied timeout- Parameters:
timeout
- the timeout in seconds- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
stop
Stop the Liberty server- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
waitForStop
Wait for the Liberty server to stop using the default timeout- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
waitForStop
Wait for the Liberty server to stop using the supplied timeout- Parameters:
timeout
- the timeout in seconds- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
waitForStopMessage
Wait for the Liberty server to issue theCWWKE0036I
message to themessages.log
using the default timeout- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
waitForStopMessage
Wait for the Liberty server to issue theCWWKE0036I
message to themessages.log
using the supplied timeout- Parameters:
timeout
- the timeout in seconds- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
status
Get the Liberty sever status using theserver status
command- Returns:
- the return code from the
server status
command - Throws:
ZosLibertyServerException
-
delete
Delete the Liberty server files and directories- Throws:
ZosLibertyServerException
-
setDefaultHttpEndpoint
void setDefaultHttpEndpoint(String host, int httpPort, int httpsPort) throws ZosLibertyServerException Convenience method to create or replace thedefaultHttpEndpoint
element in the Liberty serverserver.xml
NOTE: This method loads the
server.xml
from the file system, updates the XML and stores it back on the file system- Parameters:
host
- the value for thehost
property. The property will not be set when the value is nullhttpPort
- the value of thehttpPort
property. The property will not be set when the value less than 0httpsPort
- the value of thehttpPorts
property. The property will not be set when the value less than 0- Throws:
ZosLibertyServerException
-
listFeatures
Convenience method to list the current features listed in thefeatureManager
element in the Liberty serverserver.xml
NOTE: This method loads the
server.xml
from the file system- Returns:
- a list of features
- Throws:
ZosLibertyServerException
-
addFeature
Convenience method to add a feature to the Liberty serverserver.xml
NOTE: This method loads the
server.xml
from the file system, updates the XML and stores it back on the file system- Parameters:
feature
- the feature to add- Throws:
ZosLibertyServerException
-
removeFeature
Convenience method remove a feature from the Liberty serverserver.xml
NOTE: This method loads the
server.xml
from the file system, updates the XML and stores it back on the file system- Parameters:
feature
- the feature to remove- Throws:
ZosLibertyServerException
-
deployApplication
void deployApplication(Class<?> testClass, String path, String targetLocation, IZosLibertyServer.ApplicationType type, String name, String contextRoot) throws ZosLibertyServerException Deploy an application to the Liberty server. This method copies the application archive file to the zOS UNIX file system and creates anapplication
element in the server.xml.- Parameters:
testClass
- a class in the same bundle containing the application archive file, usethis.getClass()
path
- the path in the bundle to the application archive filetargetLocation
- the location on the zOS UNIX file system to store the application archive file. If the value is null,${shared.app.dir}/fileName
will be usedtype
- the application typeIZosLibertyServer.ApplicationType
name
- the name of the applicationcontextRoot
- the application context-root. Can be null- Throws:
ZosLibertyServerException
-
deployApplicationToDropins
Deploy an application to the Liberty server dropins directory. This method copies the application archive file to the Liberty server dropins directory- Parameters:
testClass
- a class in the same bundle containing the application archive file, usethis.getClass()
path
- the path in the bundle to the application archive file- Throws:
ZosLibertyServerException
-
removeApplication
Remove an application from the Liberty server. This method removes theapplication
from the server.xml and deletes the application archive file from the zOS UNIX file system. Set name tonull
to remove all applications from dropins- Parameters:
name
- the application name- Throws:
ZosLibertyServerException
-
removeApplicationFromDropins
Remove an application from the Liberty server dropins directory. Set fileName tonull
to remove all applications from dropins- Parameters:
fileName
- the name of the file in the dropins directory- Throws:
ZosLibertyServerException
-
waitForApplicationStart
Wait for an application to start using the default timeout by looking forCWWKZ0001I
message in messages.log. If themessages.log
has not been check-pointed, the whole file will be searched.- Parameters:
name
- the application name- Returns:
- true if application has started within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStart
Wait for an application to start using the supplied timeout by looking forCWWKZ0001I
message in messages.log. If themessages.log
has not been check-pointed, the whole file will be searched.- Parameters:
name
- the application nametimeout
- the timeout in seconds- Returns:
- true if application has stopped within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStop
Wait for an application to stop using the default timeout by looking forCWWKZ0009I
message in messages.log. If themessages.log
has not been check-pointed, the whole file will be searched.- Parameters:
name
- the application name- Returns:
- true if application has started within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStop
If themessages.log
has not been check-pointed, the whole file will be searched.- Parameters:
name
- the application nametimeout
- the timeout in seconds- Returns:
- true if application has stopped within the timeout
- Throws:
ZosLibertyServerException
-
getKeystoreFile
Returns the keystore file for this Liberty server- Returns:
- the Liberty
key.p12
orkey.jks
keystore file. Will returnnull
if the file does not exist. - Throws:
ZosLibertyServerException
-
securityUtilityEncode
Use the Liberty securityUtility command to encode a password- Parameters:
password
- the password to encode- Returns:
- the encoded password
- Throws:
ZosLibertyServerException
-
securityUtilityGenerateKeystore
Use the Liberty securityUtility to create a new keyStore- Parameters:
password
- the password used to create the certificate/keystore- Returns:
- the new keystore file
- Throws:
ZosLibertyServerException
-
saveToResultsArchive
Store the content of the Liberty server logs and configuration to the default location in the Results Archive Store- Throws:
ZosLibertyServerException
-
saveToResultsArchive
Store the content of the Liberty server logs and configuration to the Results Archive Store- Parameters:
rasPath
- path in Results Archive Store- Throws:
ZosLibertyServerException
-