Package org.glassfish.main.itest.tools
Class GlassFishTestEnvironment
java.lang.Object
org.glassfish.main.itest.tools.GlassFishTestEnvironment
This class represents GlassFish installation outside test environment.
Ensures that the domain in executed before first test started, and that the domain stops after tests are finished.
- Author:
- David Matejcek, Ondro Mihalyi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.glassfish.admin.rest.client.ClientWrapperCreates aClientinstance for the domain administrator.static voidcreateFileUser(String realmName, String user, String password, String... groupNames) Creates the unencrypted password file on the local file system and uses it to create the user record in the file realm.static voidThis will delete the jobs.xml filestatic Asadminstatic AsadmingetAsadmin(boolean terse) static Pathstatic KeyStorestatic KeyStorestatic Filestatic HttpResponse<String>getHttpResource(boolean secured, int port, String context) Creates aHttpURLConnectionfor the given port and context.static JarSignerstatic KeyToolstatic intgetPort(HttpListenerType listenerType) static StartServstatic StartServstatic Filestatic <T extends HttpURLConnection>
TopenConnection(boolean secured, int port, String context) Creates aHttpURLConnectionfor the given port and context.static HttpURLConnectionopenConnection(int port, String context) Creates an unencryptedHttpURLConnectionfor the given port and context.static HttpURLConnectionopenConnection(String context) Creates aHttpURLConnectionfor the admin administrator.static voidDefault is org.apache.derby.jdbc.ClientDataSourcestatic URIwebSocketUri(boolean secured, int port, String context) static URIwebSocketUri(int port, String context)
-
Constructor Details
-
GlassFishTestEnvironment
public GlassFishTestEnvironment()
-
-
Method Details
-
getGlassFishDirectory
- Returns:
- the installation directory, usually referred as AS_INSTALL and named
glassfish(without version number).
-
getAsadmin
- Returns:
Asadmincommand api for tests.
-
getAsadmin
- Parameters:
terse- true means suitable and minimized for easy parsing.- Returns:
Asadmincommand api for tests.
-
getStartServ
- Returns:
Asadmincommand api for tests.
-
getStartServInTopLevelBin
- Returns:
Asadmincommand api for tests.
-
getKeyTool
-
getJarSigner
-
getTargetDirectory
- Returns:
- project's target directory.
-
getDomain1Directory
- Returns:
- domain1 directory absolute path
-
getDomain1KeyStore
-
getDomain1TrustStore
-
getPort
-
createClient
public static org.glassfish.admin.rest.client.ClientWrapper createClient()Creates aClientinstance for the domain administrator. Caller is responsible for closing.- Returns:
- new
Clientinstance
-
openConnection
Creates aHttpURLConnectionfor the admin administrator.- Parameters:
context- - part of the url behind thehttp://localhost:4848- Returns:
- a new disconnected
HttpURLConnection. - Throws:
IOException
-
openConnection
Creates an unencryptedHttpURLConnectionfor the given port and context.- Parameters:
port-context- - part of the url behind thehttp://localhost:[port]- Returns:
- a new disconnected
HttpURLConnection. - Throws:
IOException
-
openConnection
public static <T extends HttpURLConnection> T openConnection(boolean secured, int port, String context) throws IOException Creates aHttpURLConnectionfor the given port and context.- Parameters:
secured- true for https, false for httpport-context- - part of the url behind thehttp://localhost:[port]- Returns:
- a new disconnected
HttpURLConnection. - Throws:
IOException
-
getHttpResource
public static HttpResponse<String> getHttpResource(boolean secured, int port, String context) throws Exception Creates aHttpURLConnectionfor the given port and context.- Parameters:
secured- true for https, false for httpport-context- - part of the url behind thehttp://localhost:[port]- Returns:
- a new disconnected
HttpURLConnection. - Throws:
IOExceptionException
-
webSocketUri
- Throws:
URISyntaxException
-
webSocketUri
- Throws:
URISyntaxException
-
createFileUser
public static void createFileUser(String realmName, String user, String password, String... groupNames) Creates the unencrypted password file on the local file system and uses it to create the user record in the file realm.- Parameters:
realmName-user-password-groupNames-
-
deleteJobsFile
public static void deleteJobsFile()This will delete the jobs.xml file -
switchDerbyPoolToEmbededded
public static void switchDerbyPoolToEmbededded()Default is org.apache.derby.jdbc.ClientDataSource
-