Search in sources :

Example 1 with DirState

use of org.jboss.galleon.test.util.fs.state.DirState in project galleon by wildfly.

the class PmTestBase method main.

@Test
public void main() throws Throwable {
    final String[] errors = pmErrors();
    boolean failed = false;
    ProvisioningManager pm = null;
    try {
        pm = getPm();
        testPm(pm);
        pmSuccess();
        if (errors != null) {
            Assert.fail("Expected failures: " + Arrays.asList(errors));
        }
        if (isRecordState()) {
            assertProvisionedConfig(pm);
            assertProvisionedState(pm);
        } else if (initialProvisioningConfig != null) {
            pm.close();
            pm = getPm();
            assertProvisionedConfig(pm);
            assertProvisionedState(pm);
        } else {
            assertNoState();
        }
    } catch (AssertionError e) {
        throw e;
    } catch (Throwable t) {
        failed = true;
        if (errors == null) {
            pmFailure(t);
        } else {
            assertErrors(t, errors);
        }
        if (pm != null) {
            if (isRecordState()) {
                assertProvisioningConfig(pm, initialProvisioningConfig);
                assertProvisionedState(pm, initialProvisionedState);
            } else if (initialProvisioningConfig != null) {
                pm.close();
                pm = getPm();
                assertProvisioningConfig(pm, initialProvisioningConfig);
                assertProvisionedState(pm, initialProvisionedState);
            }
        }
    } finally {
        if (pm != null) {
            pm.close();
        }
    }
    DirState expectedHomeDir = provisionedHomeDir();
    if (expectedHomeDir == null) {
        if (!assertProvisionedHomeDir()) {
            return;
        }
        if (failed || initialProvisioningConfig != null) {
            expectedHomeDir = initialHomeDirState;
        } else {
            expectedHomeDir = newDirBuilder().build();
        }
    }
    expectedHomeDir.assertState(installHome);
}
Also used : ProvisioningManager(org.jboss.galleon.ProvisioningManager) DirState(org.jboss.galleon.test.util.fs.state.DirState) Test(org.junit.Test)

Aggregations

ProvisioningManager (org.jboss.galleon.ProvisioningManager)1 DirState (org.jboss.galleon.test.util.fs.state.DirState)1 Test (org.junit.Test)1