com.ibm.websphere.simplicity.log.Log.info()

Here are the examples of the java api com.ibm.websphere.simplicity.log.Log.info() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3537 Examples 7

19 Source : PackageRunnableTest.java
with Eclipse Public License 1.0
from OpenLiberty

@Before
public void setup() throws Exception {
    String method = "setup";
    int timeout = 0;
    // Sanity check to make sure the manifest.mf that is used by package exists before starting the
    // test case(s).
    while (timeout <= 10) {
        File manifest = new File(server.getInstallRoot(), "lib/extract/META-INF/MANIFEST.MF");
        if (!manifest.exists()) {
            Log.info(c, method, "Manifest did not exist. Sleeping - " + timeout + " seconds elapsed.");
            Thread.sleep(1000);
        } else {
            Log.info(c, method, "Manifest was found in " + server.getInstallRoot() + "/lib/extract/META-INF/MANIFEST.MF with size = " + manifest.length());
            break;
        }
        timeout++;
    }
    outputAutoFVTDirectory = new File("output/servers/", serverName);
    Log.info(c, method, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath());
}

19 Source : ExternalDependencyDownloadTest.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Generate a sample with the given dependency and server name and ensure that installing it fails.
 *
 * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app
 * @param serverName the server name that should be included in the sample
 * @throws Exception
 */
private void replacedertGoodInstall(String dependencyPath, String serverName) throws Exception {
    String dependencyTargetFile = serverName + ".testfile";
    prepareSampleJar(dependencyPath, serverName);
    LibertyServer installServer = createEmptyServer(serverName);
    boolean serveravailable = hostingServer.isStarted();
    boolean fileavailable = hostingServer.fileExistsInLibertyInstallRoot("/usr/servers/" + serverName);
    Log.info(ExternalDependencyDownloadTest.clreplaced, "serveravailable", Boolean.toString(serveravailable));
    Log.info(ExternalDependencyDownloadTest.clreplaced, "fileavailable", Boolean.toString(fileavailable));
    Log.info(ExternalDependencyDownloadTest.clreplaced, "getServerFolderFiles", listFiles(hostingServer.getUserDir() + "/servers"));
    Log.info(ExternalDependencyDownloadTest.clreplaced, "getServerFiles", listFiles(hostingServer.getUserDir() + "/servers/" + serverName));
    // This method uses the sample jar created above
    installServer.installSampleWithExternalDependencies(serverName);
    replacedertTrue(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile));
}

19 Source : WebServerControl.java
with Eclipse Public License 1.0
from OpenLiberty

public static void startWebServer() throws Exception {
    String command;
    if (!getStatus().equals(ProcessStatus.RUNNING)) {
        if (getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) {
            command = workdir + "\\apache -k start -n ihs";
        } else {
            command = workdir + "/apachectl start";
        }
        ProgramOutput po = machine.execute(command, workdir);
        Log.info(c, "startWebServer:", "rc==>" + po.getReturnCode());
        Log.info(c, "startWebServer:stdout:", po.getStdout());
        Log.info(c, "startWebServer:stderr:", po.getStderr());
        // TODO: check status
        status = ProcessStatus.RUNNING;
    }
}

19 Source : WebServerControl.java
with Eclipse Public License 1.0
from OpenLiberty

public static void stopWebServer(String serverName) throws Exception {
    String command;
    if (!getStatus().equals(ProcessStatus.STOPPED)) {
        if (getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) {
            command = workdir + "\\apache -k stop -n ihs";
        } else {
            command = workdir + "/apachectl stop";
        }
        ProgramOutput po = machine.execute(command, workdir);
        Log.info(c, "stopWebServer:", "rc==>" + po.getReturnCode());
        Log.info(c, "stopWebServer:stdout:", po.getStdout());
        Log.info(c, "stopWebServer:stderr:", po.getStderr());
        status = ProcessStatus.STOPPED;
        // TODO: check status
        postStopServerArchive(serverName);
    }
}

19 Source : FATLogging.java
with Eclipse Public License 1.0
from OpenLiberty

public static void info(Clreplaced<?> sourceClreplaced, String sourceMethodName, String prefix, String text1, Object value1, String text2, Object value2) {
    Log.info(sourceClreplaced, sourceMethodName, prefix + ": " + text1 + " [ " + value1 + " ] " + text2 + " [ " + value2 + " ]");
}

19 Source : FATLogging.java
with Eclipse Public License 1.0
from OpenLiberty

public static void info(Clreplaced<?> sourceClreplaced, String sourceMethodName, String text1, Object value1, String text2, Object value2) {
    Log.info(sourceClreplaced, sourceMethodName, text1 + " [ " + value1 + " ] " + text2 + " [ " + value2 + " ]");
}

19 Source : FATLogging.java
with Eclipse Public License 1.0
from OpenLiberty

public static void info(Clreplaced<?> sourceClreplaced, String sourceMethodName, String text) {
    Log.info(sourceClreplaced, sourceMethodName, text);
}

19 Source : FATLogging.java
with Eclipse Public License 1.0
from OpenLiberty

public static void info(Clreplaced<?> sourceClreplaced, String sourceMethodName, String text, Object value) {
    Log.info(sourceClreplaced, sourceMethodName, text + " [ " + value + " ]");
}

19 Source : FATLogging.java
with Eclipse Public License 1.0
from OpenLiberty

public static void info(Clreplaced<?> sourceClreplaced, String sourceMethodName, String prefix, String text, Object value) {
    Log.info(sourceClreplaced, sourceMethodName, prefix + ": " + text + " [ " + value + " ]");
}

19 Source : TestEnableDisableFeaturesTest.java
with Eclipse Public License 1.0
from OpenLiberty

private void checkStrings(String metricsText, String[] expectedString, String[] unexpectedString) {
    for (String m : expectedString) {
        if (!metricsText.contains(m)) {
            Log.info(c, "checkStrings", "Failed:\n" + metricsText);
            replacedert.fail("Did not contain string: " + m);
        }
    }
    for (String m : unexpectedString) {
        if (metricsText.contains(m)) {
            Log.info(c, "checkStrings", "Failed:\n" + metricsText);
            replacedert.fail("Contained string: " + m);
        }
    }
}

19 Source : DefaultOverallReadinessStatusUpAppStartupTest.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Helper for simple logging.
 */
private static void log(String method, String msg) {
    Log.info(DefaultOverallReadinessStatusUpAppStartupTest.clreplaced, method, msg);
}

19 Source : LibertyServerUtils.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Makes the String compatible with Java, this problem only exists where
 * Windows uses \ for a path seperator and Java uses /
 *
 * @param s
 *            the string to change
 */
public static String makeJavaCompatible(String s) {
    try {
        File f = new File(s);
        return f.getCanonicalPath().replace('\\', '/');
    } catch (IOException e) {
        Log.info(c, "makeJavaCompatible", "Unable to normalize the path: " + s + ". Error: " + e.getMessage());
        e.printStackTrace();
    }
    return s.replace('\\', '/');
}

19 Source : LDAPUtils.java
with Eclipse Public License 1.0
from OpenLiberty

/*
     * Set the public LDAP server variables.
     *
     * I would really like to set this to the local servers when running remote, but they
     * don't start up before the LDAP test suites start checking the servers defined by
     * these variables to see if they are available. Additionally, the FAT suite can force
     * running with the remote servers even if USE_LOCAL_LDAP_SERVER==true.
     */
private static void setLdapServerVariables() {
    Log.info(c, "<clinit>", "USE_LOCAL_LDAP_SERVER=" + USE_LOCAL_LDAP_SERVER);
    LDAP_SERVER_2_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[2] : remoteServers[2]).serverName;
    LDAP_SERVER_2_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[2] : remoteServers[2]).ldapPort;
    LDAP_SERVER_2_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[2] : remoteServers[2]).ldapsPort;
    LDAP_SERVER_2_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[2] : remoteServers[2]).bindDn;
    LDAP_SERVER_2_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[2] : remoteServers[2]).bindPwd;
    LDAP_SERVER_6_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[6] : remoteServers[6]).serverName;
    LDAP_SERVER_6_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[6] : remoteServers[6]).ldapPort;
    LDAP_SERVER_6_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[6] : remoteServers[6]).ldapsPort;
    LDAP_SERVER_6_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[6] : remoteServers[6]).bindDn;
    LDAP_SERVER_6_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[6] : remoteServers[6]).bindPwd;
    LDAP_SERVER_1_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[1] : remoteServers[1]).serverName;
    LDAP_SERVER_1_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[1] : remoteServers[1]).ldapPort;
    LDAP_SERVER_5_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[5] : remoteServers[5]).serverName;
    LDAP_SERVER_5_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[5] : remoteServers[5]).ldapPort;
    LDAP_SERVER_4_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[4] : remoteServers[4]).serverName;
    LDAP_SERVER_4_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[4] : remoteServers[4]).ldapPort;
    LDAP_SERVER_4_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[4] : remoteServers[4]).ldapsPort;
    LDAP_SERVER_4_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[4] : remoteServers[4]).bindDn;
    LDAP_SERVER_4_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[4] : remoteServers[4]).bindPwd;
    LDAP_SERVER_7_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[7] : remoteServers[7]).serverName;
    LDAP_SERVER_7_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[7] : remoteServers[7]).ldapPort;
    LDAP_SERVER_7_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[7] : remoteServers[7]).ldapsPort;
    LDAP_SERVER_7_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[7] : remoteServers[7]).bindDn;
    LDAP_SERVER_7_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[7] : remoteServers[7]).bindPwd;
    LDAP_SERVER_8_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[8] : remoteServers[8]).serverName;
    LDAP_SERVER_8_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[8] : remoteServers[8]).ldapPort;
    LDAP_SERVER_8_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[8] : remoteServers[8]).ldapsPort;
    LDAP_SERVER_8_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[8] : remoteServers[8]).bindDn;
    LDAP_SERVER_8_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[8] : remoteServers[8]).bindPwd;
    LDAP_SERVER_10_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[10] : remoteServers[10]).serverName;
    LDAP_SERVER_10_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[10] : remoteServers[10]).ldapPort;
    LDAP_SERVER_10_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[10] : remoteServers[10]).bindDn;
    LDAP_SERVER_10_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[10] : remoteServers[10]).bindPwd;
    LDAP_SERVER_12_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[12] : remoteServers[12]).serverName;
    LDAP_SERVER_12_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[12] : remoteServers[12]).ldapPort;
    LDAP_SERVER_12_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[12] : remoteServers[12]).bindDn;
    LDAP_SERVER_12_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[12] : remoteServers[12]).bindPwd;
    LDAP_SERVER_3_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[3] : remoteServers[3]).serverName;
    LDAP_SERVER_3_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[3] : remoteServers[3]).ldapPort;
    LDAP_SERVER_3_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[3] : remoteServers[3]).ldapsPort;
    LDAP_SERVER_3_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[3] : remoteServers[3]).bindDn;
    LDAP_SERVER_3_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[3] : remoteServers[3]).bindPwd;
    LDAP_SERVER_13_NAME = (USE_LOCAL_LDAP_SERVER ? localServers[13] : remoteServers[13]).serverName;
    LDAP_SERVER_13_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[13] : remoteServers[13]).ldapPort;
    LDAP_SERVER_13_SSL_PORT = (USE_LOCAL_LDAP_SERVER ? localServers[13] : remoteServers[13]).ldapsPort;
    LDAP_SERVER_13_BINDDN = (USE_LOCAL_LDAP_SERVER ? localServers[13] : remoteServers[13]).bindDn;
    LDAP_SERVER_13_BINDPWD = (USE_LOCAL_LDAP_SERVER ? localServers[13] : remoteServers[13]).bindPwd;
}

19 Source : LDAPUtils.java
with Eclipse Public License 1.0
from OpenLiberty

/*
     * Either the test was requested to run with local LDAP servers or we failed back from
     * the remote servers.
     */
private static void logLdapServerInfo() {
    final String METHOD_NAME = "logLDAPServerInfo";
    Log.info(c, METHOD_NAME, "USE_LOCAL_LDAP_SERVER=" + USE_LOCAL_LDAP_SERVER);
    Log.info(c, METHOD_NAME, "Active Directory WAS SVT LDAP Servers");
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_2_NAME=" + LDAP_SERVER_2_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_2_PORT=" + LDAP_SERVER_2_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_2_SSL_PORT=" + LDAP_SERVER_2_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_6_NAME=" + LDAP_SERVER_6_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_6_PORT=" + LDAP_SERVER_6_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_6_SSL_PORT=" + LDAP_SERVER_6_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "IBM Continuous Delivery LDAP Servers");
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_1_NAME=" + LDAP_SERVER_1_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_1_PORT=" + LDAP_SERVER_1_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_5_NAME=" + LDAP_SERVER_5_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_5_PORT=" + LDAP_SERVER_5_PORT + '\n');
    Log.info(c, METHOD_NAME, "IBM WAS Security FVT LDAP Servers");
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_4_NAME=" + LDAP_SERVER_4_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_4_PORT=" + LDAP_SERVER_4_PORT);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_4_SSL_PORT=" + LDAP_SERVER_4_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_7_NAME=" + LDAP_SERVER_7_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_7_PORT=" + LDAP_SERVER_7_PORT);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_7_SSL_PORT=" + LDAP_SERVER_7_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_8_NAME=" + LDAP_SERVER_8_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_8_PORT=" + LDAP_SERVER_8_PORT);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_8_SSL_PORT=" + LDAP_SERVER_8_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "IBM WAS Security LDAP Servers");
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_10_NAME=" + LDAP_SERVER_10_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_10_PORT=" + LDAP_SERVER_10_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_12_NAME=" + LDAP_SERVER_12_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_12_PORT=" + LDAP_SERVER_12_PORT + '\n');
    Log.info(c, METHOD_NAME, "Oracle WAS SVT LDAP Servers");
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_3_NAME=" + LDAP_SERVER_3_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_3_PORT=" + LDAP_SERVER_3_PORT);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_3_SSL_PORT=" + LDAP_SERVER_3_SSL_PORT + '\n');
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_13_NAME=" + LDAP_SERVER_13_NAME);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_13_PORT=" + LDAP_SERVER_13_PORT);
    Log.info(c, METHOD_NAME, "           LDAP_SERVER_13_SSL_PORT=" + LDAP_SERVER_13_SSL_PORT + '\n');
}

19 Source : LogMonitor.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Set the marks that we'll go back to when {@link #resetLogMarks()} is called.
 */
public void setOriginLogMarks() {
    client.lmcSetOriginLogOffsets();
    originMarks = new HashMap<String, Long>(logMarks);
    Log.info(c, "setOriginLogMarks", "Set origin log marks " + originMarks);
}

19 Source : LibertyServerFactory.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * @param ls
 * @param appNames
 * @param bootstrap
 */
private static void removeHeldApplicationsFromDropins(LibertyServer ls, String appNames) {
    for (String appName : appNames.split(",")) {
        try {
            ls.removeDropinsApplications(appName);
            Log.info(c, "removeHeldApplicationsFromDropins", "moved app {0} out of dropins folder", appName);
        } catch (Exception e) {
            Log.error(c, "removeHeldApplicationsFromDropins", e);
        }
    }
}

19 Source : LibertyFileManager.java
with Eclipse Public License 1.0
from OpenLiberty

public static boolean renameLibertyFileNoRetry(Machine machine, String oldFilePath, String newFilePath) throws Exception {
    RemoteFile source = createRemoteFile(machine, oldFilePath);
    RemoteFile target = createRemoteFile(machine, newFilePath);
    if (source.exists()) {
        return source.renameNoRetry(target);
    } else {
        Log.info(CLreplaced, "renameLibertyFileNoRetry", "Copying: " + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " failed because " + source.getAbsolutePath() + "does not exist");
    }
    return false;
}

19 Source : LibertyFileManager.java
with Eclipse Public License 1.0
from OpenLiberty

// 
public static boolean renameLibertyFile(Machine machine, String oldFilePath, String newFilePath) throws Exception {
    RemoteFile source = createRemoteFile(machine, oldFilePath);
    RemoteFile target = createRemoteFile(machine, newFilePath);
    if (source.exists()) {
        return source.rename(target);
    } else {
        Log.info(CLreplaced, "renameLibertyFile", "Copying: " + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " failed because " + source.getAbsolutePath() + "does not exist");
    }
    return false;
}

19 Source : LibertyClientFactory.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This method should not be ran by the user, it is ran by the JUnit runner at the end of each test
 * to recover the clients.
 *
 * @param testClreplacedName the name of the FAT test clreplaced to recover known clients for
 * @throws Exception
 */
public static void recoverAllclients(String testClreplacedName) throws Exception {
    Log.info(c, "recoverAllclients", "Now recovering all clients known to test clreplaced: " + testClreplacedName);
    // If backups were required, so is recovery
    if (BACKUP_REQUIRED) {
        // Iteration through this data structure must be synchronized as
        // so it can not be modified during iteration
        synchronized (knownLibertyClients) {
            for (LibertyClient lc : getKnownLibertyClients(testClreplacedName)) {
                postTestRecover(lc);
            }
        }
    } else {
        // we weren't backing up, if we're running with delete run fats in RTC
        // we should delete the client to save space
        if (DELETE_RUN_FATS) {
            synchronized (knownLibertyClients) {
                for (LibertyClient lc : getKnownLibertyClients(testClreplacedName)) {
                    LibertyFileManager.deleteLibertyDirectoryAndContents(lc.getMachine(), lc.getClientRoot());
                }
            }
        }
    }
}

19 Source : DatabaseTester.java
with Eclipse Public License 1.0
from OpenLiberty

private static void blowUpUnlessDerby(String msg) throws Exception {
    // To run with a different DB, fat.test.databases=true must be set
    String fat_test_databases = System.getProperty("fat.test.databases");
    if (!"true".equals(fat_test_databases)) {
        Log.info(c, "blowUpUnlessDerby", msg + " This is OK because we are running with Derby.");
        return;
    }
    String fat_bucket_db_type = System.getProperty("fat.bucket.db.type", "Derby");
    if ("Derby".equals(fat_bucket_db_type)) {
        Log.info(c, "blowUpUnlessDerby", msg + " This is OK because we are running with Derby.");
        return;
    }
    throw new Exception(msg);
}

19 Source : Database.java
with Eclipse Public License 1.0
from OpenLiberty

public void testConnection() throws Exception {
    final String m = "testConnection";
    try {
        Log.info(c, m, "Attempting to connect to database server " + dbhostname + " to make sure it's available.");
        databaseMachine.connect();
        Log.info(c, m, "Successfully connected to database server " + dbhostname);
    } catch (Exception ex) {
        // TODO we should have a more prominent way of letting people know that we had to failover?
        // perhaps sending an email out?
        UnavailableDatabaseException unavailableMachine = new UnavailableDatabaseException("The database server " + dbhostname + " is unreachable.", ex);
        Log.error(c, m, unavailableMachine);
        throw unavailableMachine;
    }
}

19 Source : Database.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Drop the test database or user IDs
 *
 * @throws Exception If the drop fails.
 */
final public void dropDatabase() throws Exception {
    final String method = "dropDatabase";
    if (bootstrap.getValue("database.dropdatabase") != null) {
        for (int i = 1; i <= NUMBER_OF_DROP_RETRIES; i++) {
            Log.finer(c, method, "drop database attempt " + i);
            try {
                dropVendorDatabase();
                return;
            } catch (Exception e) {
                if (i == NUMBER_OF_DROP_RETRIES)
                    throw e;
                Log.finer(c, method, "Waiting for 30s before retrying drop");
                TimeUnit.SECONDS.sleep(30);
            }
        }
    } else {
        Log.info(c, method, "Drop database ignored since database.dropandcreate has been added to the bootstrapping.properties to save the database after tests have been run.");
    }
}

19 Source : DatabaseContainerFactory.java
with Eclipse Public License 1.0
from OpenLiberty

public static JdbcDatabaseContainer<?> createType(DatabaseContainerType type) throws IllegalArgumentException {
    Log.info(c, "createType", "Database Container Type is " + type);
    return initContainer(type);
}

19 Source : DatabaseContainerFactory.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Check to see if the JDBC driver necessary for this test-container is in the location
 * where the server expects to find it. <br>
 *
 * JDBC drivers are not publicly available for some databases. In those cases the
 * driver will need to be provided by the user to run this test-container.
 *
 * @return boolean - true if and only if driver exists. Otherwise, false.
 */
private static boolean isJdbcDriverAvailable(DatabaseContainerType type) {
    File temp = new File("publish/shared/resources/jdbc/" + type.getDriverName());
    boolean result = temp.exists();
    if (result) {
        Log.info(c, "isJdbcDriverAvailable", "FOUND: " + type + " JDBC driver in location: " + temp.getAbsolutePath());
    } else {
        Log.warning(c, "MISSING: " + type + " JDBC driver not in location: " + temp.getAbsolutePath());
    }
    return result;
}

19 Source : DatabaseContainerFactory.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * @see #create()
 *
 *      This method let's you specify the default database type if one is not provided.
 *      This should mainly be used if you want to use derby client instead of derby embedded as your default.
 */
public static JdbcDatabaseContainer<?> create(DatabaseContainerType defaultType) throws IllegalArgumentException {
    String dbRotation = System.getProperty("fat.test.databases");
    String dbProperty = System.getProperty("fat.bucket.db.type", defaultType.name());
    Log.info(c, "create", "System property: fat.test.databases is " + dbRotation);
    Log.info(c, "create", "System property: fat.bucket.db.type is " + dbProperty);
    if (!"true".equals(dbRotation)) {
        throw new IllegalArgumentException("To use a generic database, the FAT must be opted into database rotation by setting 'fat.test.databases: true' in the FAT project's bnd.bnd file");
    }
    DatabaseContainerType type = null;
    try {
        type = DatabaseContainerType.valueOf(dbProperty);
        Log.info(c, "create", "FOUND: database test-container type: " + type);
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("No database test-container supported for " + dbProperty, e);
    }
    return initContainer(type);
}

19 Source : FeatureList.java
with Eclipse Public License 1.0
from OpenLiberty

public static synchronized void reset() throws IOException {
    Log.info(c, "reset", "Removing existing " + FAT_FEATURE_LIST);
    if (featureList != null)
        if (!featureList.delete())
            throw new IOException("Unable to delete old " + FAT_FEATURE_LIST + " at: " + featureList.getAbsolutePath());
    featureList = null;
}

19 Source : LogPolice.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Sets the maximum allowed trace for a given FAT bucket. If the limit is exceeded, a test failure will be generated.
 *
 * @param maxTraceInMB The maximum allowed trace (in MB) to be produced by the current FAT
 */
public static void setMaxAllowedTraceMB(int maxTraceInMB) {
    if (maxTraceInMB > 10000)
        throw new RuntimeException("You know this is max trace in MB (not KB or bytes), right?");
    effectiveMaxTrace = effectiveMaxTrace(maxTraceInMB * MB);
    Log.info(LogPolice.clreplaced, "setMaxAllowedTraceMB", "The max allowed trace has been set to " + effectiveMaxTrace / MB + "MB.  In LITE mode it will be " + maxTraceInMB + "MB, in FULL mode it will be " + maxTraceInMB * 3 + ", and 85% of those when running locally.");
}

19 Source : LogPolice.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Blows up if the currently running FAT has produced too much trace. See LogPolice.MAX_ALLOWED_TRACE for the current limit.
 */
static void checkUsedTrace() throws Exception {
    Log.info(LogPolice.clreplaced, "checkUsedTrace", "So far this FAT has used " + (usedTrace / MB) + "MB of trace.");
    if (usedTrace > effectiveMaxTrace)
        throw new IllegalStateException("This FAT has used up too much trace!  The maximum allowed trace is " + (effectiveMaxTrace / MB) + "MB but so far this FAT has logged " + (usedTrace / MB) + "MB of trace.");
}

19 Source : FATRunner.java
with Eclipse Public License 1.0
from OpenLiberty

// FFDC summary file format:
// """
// 
// Index  Count  Time of first Occurrence    Time of last Occurrence     Exception SourceId ProbeId
// ------+------+---------------------------+---------------------------+---------------------------
// 0      2     4/11/13 2:25:30:312 BST     4/11/13 2:25:30:312 BST java.lang.ClreplacedNotFoundException com.ibm.ws.config.internal.xml.validator.XMLConfigValidatorFactory 112
// - /test/jazz_build/jbe_rheinfelden/jazz/buildsystem/buildengine/eclipse/build/build.image/wlp/usr/servers/com.ibm.ws.config.validator/logs/ffdc/ffdc_13.04.11_02.25.30.0.log
// - /test/jazz_build/jbe_rheinfelden/jazz/buildsystem/buildengine/eclipse/build/build.image/wlp/usr/servers/com.ibm.ws.config.validator/logs/ffdc/ffdc_13.04.11_02.25.30.0.log
// 1      1     4/11/13 2:25:31:959 BST     4/11/13 2:25:31:959 BST java.lang.NullPointerException com.ibm.ws.threading.internal.Worker 446
// ------+------+---------------------------+---------------------------+---------------------------
// """
private HashMap<String, FFDCInfo> parseSummary(RemoteFile summaryFile) throws Exception {
    HashMap<String, FFDCInfo> ffdcInfo = new LinkedHashMap<String, FFDCInfo>();
    if (summaryFile.exists()) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(summaryFile.openForReading()));
        String line = null;
        try {
            // parse exception_summary
            // empty line
            reader.readLine();
            // header line
            reader.readLine();
            // --- line
            reader.readLine();
            Machine machine = summaryFile.getMachine();
            int count = 0;
            String exception = "";
            line = reader.readLine();
            // truncated file
            if (line == null) {
                return null;
            }
            while (!(line.startsWith("---"))) {
                String[] parts = line.trim().split("\\s+");
                if (parts.length > 9) {
                    // 0      1     4/11/13 2:25:30:312 BST     4/11/13 2:25:30:312 BST java.lang.ClreplacedNotFoundException com.ibm.ws.config.internal.xml.validator.XMLConfigValidatorFactory 112
                    count = Integer.parseInt(parts[1]);
                    exception = parts[8];
                } else if (parts.length > 1 && parts[0].equals("-")) {
                    String ffdcFile = parts[1];
                    FFDCInfo oldInfo = ffdcInfo.get(exception);
                    if (oldInfo != null) {
                        oldInfo.count += count;
                    } else {
                        ffdcInfo.put(exception, new FFDCInfo(machine, ffdcFile, count));
                    }
                } else {
                    Log.warning(this.getClreplaced(), "Failed to match FFDC line: " + line);
                }
                line = reader.readLine();
                // truncated file
                if (line == null) {
                    return null;
                }
            }
        } catch (Exception e) {
            // Something went wrong parsing, return null so caller tries again
            Log.info(this.getClreplaced(), "retrieveFFDCCounts", "Exception parsing FFDC summary");
            Log.error(this.getClreplaced(), "retrieveFFDCCounts", e);
            return null;
        } finally {
            reader.close();
        }
    }
    return ffdcInfo;
}

19 Source : FATRunner.java
with Eclipse Public License 1.0
from OpenLiberty

private static void compareDirectorySnapshots(String path, Map<String, Long> before, Map<String, Long> after) {
    if (!ENABLE_TMP_DIR_CHECKING)
        return;
    final String method = "compareDirectorySnapshots";
    if (before.isEmpty() || after.isEmpty()) {
        Log.info(c, method, "Unable to calculate directories for " + path);
        return;
    }
    long sizeDiff = 0;
    // remove all files that were previously there - adding/subtracting any changes to file sizes in between.
    for (Map.Entry<String, Long> entry : before.entrySet()) {
        String fileName = entry.getKey();
        Long afterFileSize = after.remove(fileName);
        if (afterFileSize != null) {
            Long beforeFileSize = entry.getValue();
            if (beforeFileSize != null) {
                long difference = afterFileSize - beforeFileSize;
                sizeDiff += difference;
                if (difference > 0) {
                    Log.info(c, method, fileName + " grew by " + difference + " bytes.");
                } else if (difference < 0) {
                    // using debug here, because we'll rarely care when a file takes up _less_ space
                    Log.debug(c, method + " " + fileName + " shrank by " + difference + " bytes.");
                }
            }
        }
    }
    // Now the after map should only contain files that were created during this test clreplaced's execution.
    for (Map.Entry<String, Long> entry : after.entrySet()) {
        Long size = entry.getValue();
        if (size != null) {
            sizeDiff += size;
        }
        Log.info(c, method, "New file found during test clreplaced execution: + " + entry.getKey() + " size: " + size + " bytes.");
    }
    // While it is possible that a file was deleted during the test clreplaced execution, this is probably pretty rare,
    // so we will not consider that possibility when determining whether the test exceeded the file size threshold.
    if (ENABLE_TMP_DIR_CHECKING && sizeDiff > TMP_DIR_SIZE_THRESHOLD) {
        throw new replacedertionFailedError("This test clreplaced left too much garbage in the " + path + " directory.  Total difference in size between start and finish is " + sizeDiff + " bytes");
    }
}

19 Source : ExternalTestServiceDockerClientStrategy.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Determines if we are going to attempt to run against a remote
 * docker host, or a local docker host.
 *
 * Priority:
 * 1. System Property: fat.test.use.remote.docker
 * 2. System Property: fat.test.docker.host -> REMOTE
 * 3. System: GITHUB_ACTIONS -> LOCAL
 * 4. System: WINDOWS -> REMOTE
 *
 * default (!!! fat.test.localrun)
 *
 * @return true, we are running against a remote docker host, false otherwise.
 */
private static boolean useRemoteDocker() {
    boolean result;
    String reason;
    do {
        // State 1: fat.test.use.remote.docker should always be honored first
        if (System.getProperty("fat.test.use.remote.docker") != null) {
            result = Boolean.getBoolean("fat.test.use.remote.docker");
            reason = "fat.test.use.remote.docker set to " + result;
            break;
        }
        // State 2: User provided a remote docker host, replacedume they want to use the remote host
        if (USE_DOCKER_HOST != null) {
            result = true;
            reason = "fat.test.docker.host set to " + USE_DOCKER_HOST;
            break;
        }
        // State 3: Github actions build should always use local
        if (Boolean.parseBoolean(System.getenv("GITHUB_ACTIONS"))) {
            result = false;
            reason = "GitHub Actions Build";
            break;
        }
        // State 4: Earlier version of TestContainers didn't support docker for windows
        // replacedume a user on windows with no other preferences will want to use a remote host.
        if (System.getProperty("os.name", "unknown").toLowerCase().contains("windows")) {
            result = true;
            reason = "Local operating system is Windows. Default container support not guaranteed.";
            break;
        }
        // Default, use local docker for local runs, and remote docker for remote (RTC) runs
        result = !FATRunner.FAT_TEST_LOCALRUN;
        reason = "fat.test.localrun set to " + FATRunner.FAT_TEST_LOCALRUN;
    } while (false);
    reason = // 
    result ? // 
    "Running against remote docker host.  Reason: " + reason : "Running against local docker host. Reason: " + reason;
    Log.info(c, "useRemoteDocker", reason);
    return result;
}

19 Source : ShrinkHelper.java
with Eclipse Public License 1.0
from OpenLiberty

public static void clereplacedlExportedArchives() {
    for (File exportedArchive : exportedArchives) {
        Log.info(ShrinkHelper.clreplaced, "clereplacedlExportedArchives", "Deleting archive at: " + exportedArchive.getAbsolutePath());
        exportedArchive.delete();
    }
    exportedArchives.clear();
}

19 Source : CxfX509SigTests.java
with Eclipse Public License 1.0
from OpenLiberty

public String updateClientWsdl(String origClientWsdl, String updatedClientWsdl) {
    try {
        if (portNumber.equals(defaultHttpPort)) {
            Log.info(thisClreplaced, "updateClientWsdl", "Test should use " + origClientWsdl + " as the client WSDL");
            return origClientWsdl;
        } else {
            // port number needs to be updated
            newWsdl = new UpdateWSDLPortNum(origClientWsdl, updatedClientWsdl);
            newWsdl.updatePortNum(defaultHttpPort, portNumber);
            Log.info(thisClreplaced, "updateClientWsdl", "Test should use " + updatedClientWsdl + " as the client WSDL");
            return updatedClientWsdl;
        }
    } catch (Exception ex) {
        Log.info(thisClreplaced, "updateClientWsdl", "Failed updating the client wsdl try using the original");
        newWsdl = null;
        return origClientWsdl;
    }
}

19 Source : CxfX509EncTests.java
with Eclipse Public License 1.0
from OpenLiberty

public String updateClientWsdl(String origClientWsdl, String updatedClientWsdl) {
    try {
        if (portNumber.equals(defaultHttpPort)) {
            Log.info(thisClreplaced, "updateClientWsdl", "Test should use the original client wsdl " + origClientWsdl + " as the client WSDL");
            return origClientWsdl;
        } else {
            // port number needs to be updated
            newWsdl = new UpdateWSDLPortNum(origClientWsdl, updatedClientWsdl);
            newWsdl.updatePortNum(defaultHttpPort, portNumber);
            Log.info(thisClreplaced, "updateClientWsdl", "Test should use the updated client wsdl " + updatedClientWsdl + " as the client WSDL");
            return updatedClientWsdl;
        }
    } catch (Exception ex) {
        Log.info(thisClreplaced, "updateClientWsdl", "Failed updating the client wsdl try using the original");
        newWsdl = null;
        return origClientWsdl;
    }
}

19 Source : CxfX509EncTests.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * TestDescription:
 *
 * A CXF service client invokes a simple jax-ws CXF web service.
 * In the request message, username token is encrypted.
 * In the response message, SOAP body is encrypted.
 * In the provider's WSDL file, this scenario uses defferent WS-Security policy
 * for the request and response messages.
 * This is a positive scenario.
 */
// @Test
public void testCXFClientEncryptUntBody() throws Exception {
    String thisMethod = "testCXFClientEncryptUntBody";
    printMethodName(thisMethod, "Start Prep for " + thisMethod);
    newClientWsdl = updateClientWsdl(defaultClientWsdlLoc + "X509XmlEnc.wsdl", defaultClientWsdlLoc + "X509XmlEncUpdated.wsdl");
    Log.info(thisClreplaced, thisMethod, "Using " + newClientWsdl);
    printMethodName(thisMethod, "End Prep for " + thisMethod);
    genericTest(// test name for logging
    thisMethod, // Svc Client Url that generic test code should use
    clientHttpUrl, // Port that svc client code should use
    "", // user that svc client code should use
    "user1", // pw that svc client code should use
    "security", // wsdl sevice that svc client code should use
    "X509XmlEncService6", // wsdl that the svc client code should use
    // newClientWsdl,
    "", // wsdl port that svc client code should use
    "UrnX509Enc6", // msg to send from svc client to server
    "", // expected response from server
    "Response: This is X509EncWebSvc6 Web Service", // msg to issue if do NOT get the expected result
    "The test expected a succesful message from the server.");
}

19 Source : CommonTests.java
with Eclipse Public License 1.0
from OpenLiberty

@AfterClreplaced
public static void tearDown() throws Exception {
    try {
        printMethodName("tearDown");
        try {
            Log.info(thisClreplaced, "tearDown", "Time to stop the server");
            if (server != null && server.isStarted()) {
                if (getIgnoredServerExceptions() == null) {
                    Log.info(thisClreplaced, "tearDown", "calling stop with no expected exceptions");
                    server.stopServer();
                } else {
                    Log.info(thisClreplaced, "tearDown", "calling stop WITH expected exceptions");
                    server.stopServer(getIgnoredServerExceptions());
                }
            }
        } catch (Exception e) {
            Log.info(thisClreplaced, "tearDown", "Server stop threw an exception - start");
            e.printStackTrace(System.out);
            Log.info(thisClreplaced, "tearDown", "Server stop threw an exception - end");
        }
        Log.info(thisClreplaced, "tearDown", "Trying to unintall the callback handler");
        SharedTools.unInstallCallbackHandler(server);
    /*
             * if (TCPMON_LISTENER_PORT != 0) {
             * System.out.println("Terminating TCPMON...");
             * TCPMonitor.terminate(tcpMon); }
             */
    // if (uniqOrigServerXml != null) {
    // // Restore the original server.xml
    // String oldServerXml = server.getServerRoot() + File.separator
    // + "server.xml";
    // String newServerXml = System.getProperty("user.dir")
    // + File.separator + server.getPathToAutoFVTNamedServer()
    // + uniqOrigServerXml;
    // System.out.println("DEBUG: Copy File " + newServerXml + " to "
    // + oldServerXml);
    // UpdateServerXml.copyFile(newServerXml, oldServerXml);
    // }
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}

19 Source : CommonTests.java
with Eclipse Public License 1.0
from OpenLiberty

protected static void printMethodName(String strMethod) {
    System.out.flush();
    Log.info(thisClreplaced, strMethod, "*****************************" + strMethod);
    System.err.println("*****************************" + strMethod);
}

19 Source : CommonTests.java
with Eclipse Public License 1.0
from OpenLiberty

public static void restoreServer() throws Exception {
    Log.info(thisClreplaced, "restoreServer", "lastServer: " + lastServer);
    Log.info(thisClreplaced, "restoreServer", "origServer: " + origServer);
    reconfigServer(origServer, "restoreServer");
}

19 Source : CommonTests.java
with Eclipse Public License 1.0
from OpenLiberty

public static String[] getIgnoredServerExceptions() {
    Log.info(thisClreplaced, "getIgnoredServerExceptions", Arrays.toString(ignoredServerExceptions));
    return ignoredServerExceptions;
}

19 Source : CommonTests.java
with Eclipse Public License 1.0
from OpenLiberty

protected static void printMethodName(String strMethod, String task) {
    System.err.flush();
    Log.info(thisClreplaced, strMethod, "*****************************" + task);
    System.err.println("*****************************" + task);
}

19 Source : MultiRecoveryTest.java
with Eclipse Public License 1.0
from OpenLiberty

private void stopServers(LibertyServer... servers) {
    final String method = "stopServers";
    for (LibertyServer server : servers) {
        if (server == null) {
            Log.info(getClreplaced(), method, "Attempted to stop a null server");
            continue;
        }
        try {
            final ProgramOutput po = server.stopServer(true, true, "WTRN0046E", "WTRN0048W", "WTRN0049W", "WTRN0094W");
            if (po == null) {
                Log.info(getClreplaced(), method, "Attempt to stop " + server.getServerName() + " returned null");
                continue;
            }
            if (po.getReturnCode() != 0) {
                Log.info(getClreplaced(), method, po.getCommand() + " returned " + po.getReturnCode());
                Log.info(getClreplaced(), method, "Stdout: " + po.getStdout());
                Log.info(getClreplaced(), method, "Stderr: " + po.getStderr());
                Exception ex = new Exception("Server stop failed for " + server.getServerName());
                throw ex;
            }
        } catch (Exception e) {
            Log.error(getClreplaced(), method, e);
        }
    }
}

19 Source : MultiRecoveryTest.java
with Eclipse Public License 1.0
from OpenLiberty

private void startServers(LibertyServer... servers) {
    final String method = "startServers";
    for (LibertyServer server : servers) {
        replacedertNotNull("Attempted to start a null server", server);
        try {
            final ProgramOutput po = server.startServerAndValidate(false, false, true);
            if (po.getReturnCode() != 0) {
                Log.info(getClreplaced(), method, po.getCommand() + " returned " + po.getReturnCode());
                Log.info(getClreplaced(), method, "Stdout: " + po.getStdout());
                Log.info(getClreplaced(), method, "Stderr: " + po.getStderr());
                Exception ex = new Exception("Server start failed for " + server.getServerName());
                throw ex;
            }
        } catch (Exception e) {
            Log.error(getClreplaced(), method, e);
            fail(e.getMessage());
        }
    }
}

19 Source : SSLRedirectTest.java
with Eclipse Public License 1.0
from OpenLiberty

private void httpException(String methodName, Throwable t, int httpPort, int httpsPort, String proxyHttpHost, int proxyHttpPort, int proxyHttpsPort) {
    String msg = t.getMessage();
    Log.info(thisClreplaced, methodName, "httpException: " + msg + " httpPort:" + httpPort + " httpsPort:" + httpsPort + " proxyHost:" + proxyHttpHost + " proxyHttp:" + proxyHttpPort + " proxyHttps:" + proxyHttpsPort, t);
    t.printStackTrace();
    if (proxyHttpPort != httpPort) {
        // if using proxy, and no proxy exists,then we expect an exception
        replacedertTrue("Expected exception does not indicate a failure to reach a (missing) proxy server", msg.contains(proxyHttpHost) && msg.contains(":" + proxyHttpsPort));
    } else {
        if (t instanceof replacedertionFailedError) {
            throw (replacedertionFailedError) t;
        } else {
            fail("Unexpected exception: " + t);
        }
    }
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Access protected servlet for POST with invalid credentials
 */
public void accessPostProtectedServletWithInvalidCredentials(String url, String user, String preplacedword, String secureUrl, LibertyServer server) throws Exception {
    String methodName = "accessPostProtectedServletWithInvalidCredentials";
    Log.info(thisClreplaced, methodName, "url = " + url + ", user = " + user + ", preplacedword = " + preplacedword);
    accessAndAuthenticate(POST_METHOD, url, user, preplacedword, secureUrl, 403, server);
    Log.info(thisClreplaced, methodName, "Exiting test " + methodName);
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Access unprotected servlet for POST
 */
public void accessPostUnprotectedServlet(String url) throws Exception {
    String methodName = "accessPostUnprotectedServlet";
    Log.info(thisClreplaced, methodName, "url = " + url);
    String response = access(POST_METHOD, url, 200);
    // validate the request went to the correct servlet
    replacedertTrue("Failed to connect to servlet.", response.contains(url));
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Helper method to process custom methods
 */
public String processDoCustom(String url, boolean secure, int port, String user, String preplacedword, LibertyServer server) {
    String methodName = "processDoCustom";
    Log.info(thisClreplaced, methodName, "Entering method " + methodName);
    String httpMethod = "CUSTOM";
    String response = null;
    String trustStoreFile = null;
    String trustStorePwd = null;
    if (url.contains("https")) {
        trustStoreFile = server.getServerRoot() + "/resources/security/key.jks";
        trustStorePwd = "Liberty";
    }
    try {
        response = httpCustomMethodResponse(url, httpMethod, secure, port, user, preplacedword, trustStoreFile, trustStorePwd);
        Log.info(thisClreplaced, methodName, "response: " + response);
    } catch (Exception e) {
        e.printStackTrace();
        fail("--debug Test failed to access the URL " + url);
    }
    Log.info(thisClreplaced, methodName, "Exiting method " + methodName);
    return response;
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Access unprotected servlet for GET
 */
public String accessGetUnprotectedServlet(String url) throws Exception {
    String methodName = "accessGetUnprotectedServlet";
    Log.info(thisClreplaced, methodName, "url = " + url);
    String response = access(GET_METHOD, url, 200);
    replacedertTrue("Failed to connect to servlet.", response.contains(url));
    return response;
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Wrapper used to setup SSL before running the Custom method.
 *
 * @param String
 * @param String
 * @param boolean
 * @param int
 * @param String
 * @param String
 * @param LibertyServer
 * @throws IOException
 */
public String httpCustomMethodResponse(String urlLink, String httpMethod, boolean secure, int port, String user, String preplacedword, LibertyServer server) {
    String trustStoreFile = null;
    String trustStorePwd = null;
    Log.info(thisClreplaced, "httpCustomMethodResponse", urlLink);
    if (urlLink.indexOf("https") > -1) {
        // * String trustStoreFile = server.getServerSharedPath() + "resources/security/DummyServerKeyFile.jks";
        trustStoreFile = server.getServerRoot() + "/resources/security/key.jks";
        trustStorePwd = "Liberty";
    }
    return httpCustomMethodResponse(urlLink, httpMethod, secure, port, user, preplacedword, trustStoreFile, trustStorePwd);
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This is used for Basic Auth to handle exceptions with httpclient
 */
public void handleException(Exception e, String methodName, String debugData) {
    Log.info(thisClreplaced, methodName, "caught unexpected exception for: " + debugData + e.getMessage());
    fail("Caught unexpected exception: " + e);
}

19 Source : CommonTestHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Access protected servlet for GET with authorized credentials
 */
public String accessGetProtectedServletWithAuthorizedCredentials(String url, String user, String preplacedword, String secureUrl, LibertyServer server) throws Exception {
    String methodName = "accessGetProtectedServletWithAuthorizedCredentials";
    Log.info(thisClreplaced, methodName, "url = " + url + ", user = " + user + ", preplacedword = " + preplacedword);
    String response = accessAndAuthenticate(GET_METHOD, url, user, preplacedword, secureUrl, 200, server);
    // validate the request went to the correct servlet
    replacedertTrue("Failed to connect to expected servlet.", response.contains(url));
    Log.info(thisClreplaced, methodName, "Exiting test " + methodName);
    return response;
}

See More Examples