Search in sources :

Example 1 with FsEntryFactory

use of org.jboss.galleon.diff.FsEntryFactory in project galleon by wildfly.

the class FsDiffTestBase method test.

@Test
public void test() throws Exception {
    initOriginal();
    initOther();
    final FsEntryFactory factory = FsEntryFactory.getInstance();
    initFactory(factory);
    assertDiff(FsDiff.diff(factory.forPath(original), factory.forPath(other)));
}
Also used : FsEntryFactory(org.jboss.galleon.diff.FsEntryFactory) Test(org.junit.Test)

Example 2 with FsEntryFactory

use of org.jboss.galleon.diff.FsEntryFactory in project galleon by wildfly.

the class FsEntriesTestBase method test.

@Test
public void test() throws Exception {
    initFs();
    final FsEntryFactory factory = FsEntryFactory.getInstance();
    initFactory(factory);
    assertRootEntry(factory.forPath(root));
}
Also used : FsEntryFactory(org.jboss.galleon.diff.FsEntryFactory) Test(org.junit.Test)

Example 3 with FsEntryFactory

use of org.jboss.galleon.diff.FsEntryFactory in project galleon by wildfly.

the class ProvisioningManager method getFsDiff.

/**
 * Returns the status of the filesystem describing which files have been
 * added, removed and modified since the last provisioning state transition.
 *
 * @return current status of the filesystem
 * @throws ProvisioningException  in case of an error during the status check
 */
public FsDiff getFsDiff() throws ProvisioningException {
    final ProvisioningConfig config = getProvisioningConfig();
    if (config == null || !config.hasFeaturePackDeps()) {
        return null;
    }
    log.verbose("Detecting user changes");
    final Path hashesDir = LayoutUtils.getHashesDir(getInstallationHome());
    if (Files.exists(hashesDir)) {
        final FsEntry originalState = new FsEntry(null, hashesDir);
        readHashes(originalState, new ArrayList<>());
        final FsEntry currentState = getDefaultFsEntryFactory().forPath(getInstallationHome());
        return FsDiff.diff(originalState, currentState);
    }
    try (ProvisioningRuntime rt = getRuntime(config)) {
        rt.provision();
        final FsEntryFactory fsFactory = getDefaultFsEntryFactory();
        final FsEntry originalState = fsFactory.forPath(rt.getStagedDir());
        final FsEntry currentState = fsFactory.forPath(getInstallationHome());
        final long startTime = log.isVerboseEnabled() ? System.nanoTime() : -1;
        final FsDiff fsDiff = FsDiff.diff(originalState, currentState);
        if (startTime != -1) {
            log.verbose(Errors.tookTime("  filesystem diff", startTime));
        }
        return fsDiff;
    }
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) Path(java.nio.file.Path) FsEntry(org.jboss.galleon.diff.FsEntry) ProvisioningRuntime(org.jboss.galleon.runtime.ProvisioningRuntime) FsDiff(org.jboss.galleon.diff.FsDiff) FsEntryFactory(org.jboss.galleon.diff.FsEntryFactory)

Aggregations

FsEntryFactory (org.jboss.galleon.diff.FsEntryFactory)3 Test (org.junit.Test)2 Path (java.nio.file.Path)1 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)1 FsDiff (org.jboss.galleon.diff.FsDiff)1 FsEntry (org.jboss.galleon.diff.FsEntry)1 ProvisioningRuntime (org.jboss.galleon.runtime.ProvisioningRuntime)1