Search in sources :

Example 1 with VerifierCheck

use of com.sun.enterprise.tools.verifier.tests.VerifierCheck in project Payara by payara.

the class CheckMgr method check.

/**
 * <p/>
 * Entry point for executing all tests pertinent to this architecture
 * </p>
 *
 * @param descriptor <code>ConnectorDescritor</code> the deployment descriptor
 */
protected void check(Descriptor descriptor) throws Exception {
    logger.log(Level.FINE, "com.sun.enterprise.tools.verifier.CheckMgr.check", new Object[] { getClass().getName(), descriptor.getName() });
    setRuntimeDDPresent(getAbstractArchiveUri(descriptor));
    // Load the list of tests from the property file for this manager
    loadTestInformationFromPropsFile();
    // These temporary placeholder will keep the results of the tests
    logger.log(Level.FINE, "com.sun.enterprise.tools.verifier.CheckMgr.RunAllTests", new Object[] { descriptor.getName() });
    String schemaVersion = getSchemaVersion(descriptor);
    context.setSchemaVersion(schemaVersion);
    context.setJavaEEVersion(verifierFrameworkContext.getJavaEEVersion());
    context.setComponentNameConstructor(getComponentNameConstructor(descriptor));
    FileArchive moduleArchive = new FileArchive();
    moduleArchive.open(getAbstractArchiveUri(descriptor));
    context.setModuleArchive(moduleArchive);
    ResultManager resultManager = verifierFrameworkContext.getResultManager();
    for (int i = 0; i < test.size(); i++) {
        TestInformation ti = (TestInformation) test.elementAt(i);
        String minVersion = ti.getMinimumVersion();
        String maxVersion = ti.getMaximumVersion();
        // this component's descriptor
        if (schemaVersion != null && minVersion != null && schemaVersion.compareTo(minVersion) < 0) {
            logger.log(Level.FINE, "com.sun.enterprise.tools.verifier.CheckMgr.version.NOT_APPLICABLE", new Object[] { ti.getClassName() });
            continue;
        }
        if (schemaVersion != null && maxVersion != null && schemaVersion.compareTo(maxVersion) > 0) {
            logger.log(Level.FINE, "com.sun.enterprise.tools.verifier.CheckMgr.version.NOT_APPLICABLE", new Object[] { ti.getClassName() });
            continue;
        }
        if (!isApplicable(ti, descriptor)) {
            logger.log(Level.FINE, "com.sun.enterprise.tools.verifier.CheckMgr.version.NOT_APPLICABLE", new Object[] { ti.getClassName() });
            continue;
        }
        try {
            Class c = Class.forName(ti.getClassName());
            VerifierCheck t = (VerifierCheck) c.newInstance();
            t.setVerifierContext(context);
            Result r = t.check(descriptor);
            // no need to setComponentName as it is already set in
            // VerifierTest.getInitialisedResult(). By Sahoo
            // r.setComponentName(getArchiveUri(descriptor));
            setModuleName(r);
            resultManager.add(r);
            // notify listeners of test completion
            fireTestFinishedEvent(r);
        } catch (Throwable e) {
            LogRecord logRecord = new LogRecord(Level.SEVERE, ti.getClassName());
            logRecord.setThrown(e);
            resultManager.log(logRecord);
        }
    }
    fireAllTestsFinishedEvent();
// done adding it to hastable vector.
}
Also used : LogRecord(java.util.logging.LogRecord) FileArchive(com.sun.enterprise.deploy.shared.FileArchive) VerifierCheck(com.sun.enterprise.tools.verifier.tests.VerifierCheck)

Aggregations

FileArchive (com.sun.enterprise.deploy.shared.FileArchive)1 VerifierCheck (com.sun.enterprise.tools.verifier.tests.VerifierCheck)1 LogRecord (java.util.logging.LogRecord)1