/**
 * Initializes a property set with the contents of a property file.
 *
 * @param props The property set to initialize
 * @param name The name of the property file to load. It is relative
 *             to the <tt>configRoot</tt> path.
 * @param configRoot The fully qualified pathname to the root
 *                   configuration directory.
 *
 * @return <tt>0</tt> for success, otherwise <tt>-1</tt>
 */
static int
initProps(Property** props, const pcsl_string * name,
    const pcsl_string * configRoot) {

    pcsl_string pathname;
    int fd = -1 ;
    char * errStr;

    /* Property file can be relative or at midp_home variable */
    pcsl_string_cat(configRoot, name, &pathname);

    fd = storage_open(&errStr, &pathname, OPEN_READ);
    pcsl_string_free(&pathname);
    if (errStr != NULL) {
        REPORT_WARN2(LC_CORE,
             "Warning: could not open config file(%s): %s\n",
             pathname, errStr);
             
        storageFreeError(errStr);

        return 0;
    }

    /* Read through the file one line at a time */
    if (parseConfig(fd, props) != 0) {
        return -1;
    }

    /* Close the storage handle */
    storageClose(&errStr, fd);
    return 0;
}
Пример #2
0
int testInstalFileUsingJar(void) {
    int    res    =  ALL_OK;
    int    myArgc = 2;

    REPORT_INFO(LC_AMS, "#############  This test should pass.\n");
    res = fileInstaller(myArgc, mrgv);

    if (res != ALL_OK) {
        REPORT_WARN2(LC_AMS, "\n%s failed. Result code is %d\n",
		     fileInstallerTestJar, res);
    } else {
        REPORT_INFO1(LC_AMS, "%s passed\n", fileInstallerTestJar);
    }
    return res;
} /* testInstalFileUsingJad */
Пример #3
0
int testInstalFileUsingBadJad(void) {
    int    res    =  -1;
    int    myArgc = 2;

    REPORT_INFO(LC_AMS, "#############  This test should fail. Using Jad without JAR-Size\n");
    res = fileInstaller(myArgc, mrgvbad);

    if (res >= 0) {
        REPORT_WARN2(LC_AMS, "\n%s failed. Result code is %d\n",
		     fileInstallerTestBadJad, res);
        res = -1;
    } else {
        REPORT_INFO1(LC_AMS, "%s passed\n", fileInstallerTestBadJad);
        res = ALL_OK;
    }
    return res;
}