Class GlassFishTestEnvironment

java.lang.Object
org.glassfish.main.itest.tools.GlassFishTestEnvironment

public class GlassFishTestEnvironment extends Object
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 Details

    • GlassFishTestEnvironment

      public GlassFishTestEnvironment()
  • Method Details

    • getAsadmin

      public static Asadmin getAsadmin()
      Returns:
      Asadmin command api for tests.
    • getAsadmin

      public static Asadmin getAsadmin(boolean terse)
      Parameters:
      terse - true means suitable and minimized for easy parsing.
      Returns:
      Asadmin command api for tests.
    • getStartServ

      public static StartServ getStartServ()
      Returns:
      Asadmin command api for tests.
    • getStartServInTopLevelBin

      public static StartServ getStartServInTopLevelBin()
      Returns:
      Asadmin command api for tests.
    • getKeyTool

      public static KeyTool getKeyTool()
    • getTargetDirectory

      public static File getTargetDirectory()
      Returns:
      project's target directory.
    • getDomain1Directory

      public static Path getDomain1Directory()
      Returns:
      domain1 directory absolute path
    • getDomain1KeyStore

      public static KeyStore getDomain1KeyStore()
    • getDomain1TrustStore

      public static KeyStore getDomain1TrustStore()
    • getPort

      public static int getPort(HttpListenerType listenerType)
    • createClient

      public static org.glassfish.admin.rest.client.ClientWrapper createClient()
      Creates a Client instance for the domain administrator. Caller is responsible for closing.
      Returns:
      new Client instance
    • openConnection

      public static HttpURLConnection openConnection(String context) throws IOException
      Creates a HttpURLConnection for the admin administrator.
      Parameters:
      context - - part of the url behind the http://localhost:4848
      Returns:
      a new disconnected HttpURLConnection.
      Throws:
      IOException
    • openConnection

      public static HttpURLConnection openConnection(int port, String context) throws IOException
      Creates an unencrypted HttpURLConnection for the given port and context.
      Parameters:
      port -
      context - - part of the url behind the http://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 a HttpURLConnection for the given port and context.
      Parameters:
      secured - true for https, false for http
      port -
      context - - part of the url behind the http://localhost:[port]
      Returns:
      a new disconnected HttpURLConnection.
      Throws:
      IOException
    • webSocketUri

      public static URI webSocketUri(int port, String context) throws URISyntaxException
      Throws:
      URISyntaxException
    • webSocketUri

      public static URI webSocketUri(boolean secured, int port, String context) throws URISyntaxException
      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