Search in sources :

Example 76 with After

use of org.junit.After in project jackrabbit-oak by apache.

the class LdapLoginTestBase method after.

@After
public void after() throws Exception {
    if (!USE_COMMON_LDAP_FIXTURE) {
        LDAP_SERVER.tearDown();
    }
    try {
        Authorizable a = userManager.getAuthorizable(USER_ID);
        if (a != null) {
            a.remove();
        }
        if (GROUP_DN != null) {
            a = userManager.getAuthorizable(GROUP_DN);
            if (a != null) {
                a.remove();
            }
        }
        root.commit();
    } finally {
        root.refresh();
        super.after();
    }
}
Also used : Authorizable(org.apache.jackrabbit.api.security.user.Authorizable) After(org.junit.After)

Example 77 with After

use of org.junit.After in project geode by apache.

the class OffHeapRegionBase method cleanUp.

@After
public void cleanUp() {
    File dir = new File(".");
    File[] files = dir.listFiles(new FilenameFilter() {

        @Override
        public boolean accept(File dir, String name) {
            return name.startsWith("BACKUP");
        }
    });
    for (File file : files) {
        file.delete();
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) File(java.io.File) After(org.junit.After)

Example 78 with After

use of org.junit.After in project geode by apache.

the class DiskRegionTestingBase method tearDown.

@After
public final void tearDown() throws Exception {
    preTearDown();
    try {
        if (cache != null && !cache.isClosed()) {
            for (Iterator itr = cache.rootRegions().iterator(); itr.hasNext(); ) {
                Region root = (Region) itr.next();
                if (root.isDestroyed() || root instanceof HARegion) {
                    continue;
                }
                try {
                    logWriter.info("<ExpectedException action=add>RegionDestroyedException</ExpectedException>");
                    root.localDestroyRegion("teardown");
                    logWriter.info("<ExpectedException action=remove>RegionDestroyedException</ExpectedException>");
                } catch (RegionDestroyedException ignore) {
                // ignore
                }
            }
        }
        for (DiskStore dstore : ((InternalCache) cache).listDiskStoresIncludingRegionOwned()) {
            ((DiskStoreImpl) dstore).waitForClose();
        }
    } finally {
        closeCache();
    }
    ds.disconnect();
    // Asif : below is not needed but leave it
    deleteFiles();
    DiskStoreImpl.SET_IGNORE_PREALLOCATE = false;
    postTearDown();
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) Iterator(java.util.Iterator) Region(org.apache.geode.cache.Region) After(org.junit.After)

Example 79 with After

use of org.junit.After in project geode by apache.

the class GfshHistoryJUnitTest method teardown.

@After
public void teardown() throws Exception {
    // Null out static instance so Gfsh can be reinitialised
    Field gfshInstance = Gfsh.class.getDeclaredField("instance");
    gfshInstance.setAccessible(true);
    gfshInstance.set(null, null);
}
Also used : Field(java.lang.reflect.Field) After(org.junit.After)

Example 80 with After

use of org.junit.After in project geode by apache.

the class PdxAttributesJUnitTest method tearDown.

@After
public void tearDown() throws Exception {
    GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
    if (instance != null) {
        instance.close();
    }
    FileUtils.deleteDirectory(diskDir);
    File[] defaultStoreFiles = new File(".").listFiles(new FilenameFilter() {

        public boolean accept(File dir, String name) {
            return name.startsWith("BACKUPPDXAttributes");
        }
    });
    for (File file : defaultStoreFiles) {
        FileUtils.forceDelete(file);
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) File(java.io.File) After(org.junit.After)

Aggregations

After (org.junit.After)1427 File (java.io.File)284 Before (org.junit.Before)137 Test (org.junit.Test)127 List (java.util.List)87 IOException (java.io.IOException)83 Assert (org.junit.Assert)70 Collectors (java.util.stream.Collectors)67 ArrayList (java.util.ArrayList)64 Map (java.util.Map)62 Assert.assertEquals (org.junit.Assert.assertEquals)60 Arrays (java.util.Arrays)56 Collections (java.util.Collections)56 Assert.assertTrue (org.junit.Assert.assertTrue)54 HashMap (java.util.HashMap)53 Rule (org.junit.Rule)50 HashSet (java.util.HashSet)44 Set (java.util.Set)42 UUID (java.util.UUID)42 TimeUnit (java.util.concurrent.TimeUnit)41