Search in sources :

Example 51 with AfterClass

use of org.junit.AfterClass in project GNS by MobilityFirst.

the class GNSClientCapacityTest method cleanup.

/**
	 * Removes all account and sub-guids created during the test.
	 * 
	 * @throws Exception
	 */
@AfterClass
public static void cleanup() throws Exception {
    Thread.sleep(2000);
    assert (clients != null && clients[0] != null);
    if (!accountGuidsOnly) {
        System.out.println("About to delete " + guidEntries.length + " sub-guids: " + Arrays.asList(guidEntries));
        for (GuidEntry guidEntry : guidEntries) {
            try {
                log.log(Level.FINE, "About to delete sub-guid {0}", new Object[] { guidEntry });
                if (guidEntry != null)
                    clients[0].execute(GNSCommand.guidRemove(guidEntry));
                log.log(Level.FINE, "Deleted sub-guid {0}", new Object[] { guidEntry });
            } catch (Exception e) {
                log.log(Level.WARNING, "Failed to delete sub-guid {0}", new Object[] { guidEntry });
                e.printStackTrace();
            // continue with rest
            }
        }
    }
    System.out.println("About to delete " + accountGuidEntries.length + " account guids: " + Arrays.asList(accountGuidEntries));
    for (GuidEntry accGuidEntry : accountGuidEntries) {
        try {
            log.log(Level.FINE, "About to delete account guid {0}", new Object[] { accGuidEntry });
            if (accGuidEntry != null)
                clients[0].execute(GNSCommand.accountGuidRemove(accGuidEntry));
            log.log(Level.FINE, "Deleted account guid {0}", new Object[] { accGuidEntry });
        } catch (Exception e) {
            log.log(Level.WARNING, "Failed to delete account guid {0}", new Object[] { accGuidEntry });
            e.printStackTrace();
        // continue with rest
        }
    }
    for (GNSClient client : clients) client.close();
    executor.shutdown();
    System.out.println(DelayProfiler.getStats());
}
Also used : GNSClient(edu.umass.cs.gnsclient.client.GNSClient) GuidEntry(edu.umass.cs.gnsclient.client.util.GuidEntry) JSONException(org.json.JSONException) ClientException(edu.umass.cs.gnscommon.exceptions.client.ClientException) IOException(java.io.IOException) DuplicateNameException(edu.umass.cs.gnscommon.exceptions.client.DuplicateNameException) AfterClass(org.junit.AfterClass)

Example 52 with AfterClass

use of org.junit.AfterClass in project GNS by MobilityFirst.

the class HighConcurrencyReadsTest method cleanup.

/**
   * Removes all account and sub-guids created during the test.
   *
   * @throws Exception
   */
@AfterClass
public static void cleanup() throws Exception {
    Thread.sleep(2000);
    assert (clients != null && clients[0] != null);
    if (!accountGuidsOnly) {
        System.out.println("About to delete " + guidEntries.length + " sub-guids: " + Arrays.asList(guidEntries));
        for (GuidEntry guidEntry : guidEntries) {
            try {
                LOGGER.log(Level.FINE, "About to delete sub-guid {0}", new Object[] { guidEntry });
                clients[0].guidRemove(guidEntry);
                LOGGER.log(Level.FINE, "Deleted sub-guid {0}", new Object[] { guidEntry });
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "Failed to delete sub-guid {0}", new Object[] { guidEntry });
                e.printStackTrace();
            // continue with rest
            }
        }
    }
    System.out.println("About to delete " + accountGuidEntries.length + " account guids: " + Arrays.asList(accountGuidEntries));
    for (GuidEntry accGuidEntry : accountGuidEntries) {
        try {
            LOGGER.log(Level.FINE, "About to delete account guid {0}", new Object[] { accGuidEntry });
            clients[0].accountGuidRemove(accGuidEntry);
            LOGGER.log(Level.FINE, "Deleted account guid {0}", new Object[] { accGuidEntry });
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "Failed to delete account guid {0}", new Object[] { accGuidEntry });
            e.printStackTrace();
        // continue with rest
        }
    }
    for (GNSClientCommands client : clients) {
        client.close();
    }
    executor.shutdown();
    System.out.println(DelayProfiler.getStats());
}
Also used : GNSClientCommands(edu.umass.cs.gnsclient.client.GNSClientCommands) GuidEntry(edu.umass.cs.gnsclient.client.util.GuidEntry) ClientException(edu.umass.cs.gnscommon.exceptions.client.ClientException) IOException(java.io.IOException) DuplicateNameException(edu.umass.cs.gnscommon.exceptions.client.DuplicateNameException) AfterClass(org.junit.AfterClass)

Example 53 with AfterClass

use of org.junit.AfterClass in project mobile-center-sdk-android by Microsoft.

the class StorageHelperAndroidTest method tearDownClass.

@AfterClass
public static void tearDownClass() {
    /* Clean up shared preferences. */
    try {
        for (SharedPreferencesTestData data : generateSharedPreferenceData()) {
            String key = data.value.getClass().getCanonicalName();
            PreferencesStorage.remove(key);
        }
    } catch (NoSuchMethodException ignored) {
    /* Ignore exception. */
    }
    /* Clean up internal storage. */
    FilenameFilter filter = new FilenameFilter() {

        @Override
        public boolean accept(File dir, String filename) {
            return filename.endsWith(INTERNAL_STORAGE_TEST_FILE_EXTENSION);
        }
    };
    String[] filenames = InternalStorage.getFilenames(sAndroidFilesPath, filter);
    /* Delete the files to clean up. */
    for (String filename : filenames) {
        InternalStorage.delete(sAndroidFilesPath + filename);
    }
    InternalStorage.delete(sAndroidFilesPath);
    /* Delete database. */
    sContext.deleteDatabase("test-databaseStorage");
    sContext.deleteDatabase("test-databaseStorageUpgrade");
    sContext.deleteDatabase("test-putTooManyLogs");
    sContext.deleteDatabase("test-databaseStorageScannerRemove");
    sContext.deleteDatabase("test-databaseStorageScannerNext");
    sContext.deleteDatabase("test-databaseStorageInMemoryDB");
}
Also used : FilenameFilter(java.io.FilenameFilter) File(java.io.File) AfterClass(org.junit.AfterClass)

Example 54 with AfterClass

use of org.junit.AfterClass in project GNS by MobilityFirst.

the class GNSClientCapacityTest method cleanup.

/**
	 * Removes all account and sub-guids created during the test.
	 * 
	 * @throws Exception
	 */
@AfterClass
public static void cleanup() throws Exception {
    Thread.sleep(2000);
    assert (clients != null && clients[0] != null);
    if (!accountGuidsOnly) {
        System.out.println("About to delete " + guidEntries.length + " sub-guids: " + Arrays.asList(guidEntries));
        for (GuidEntry guidEntry : guidEntries) {
            try {
                log.log(Level.FINE, "About to delete sub-guid {0}", new Object[] { guidEntry });
                clients[0].guidRemove(guidEntry);
                log.log(Level.FINE, "Deleted sub-guid {0}", new Object[] { guidEntry });
            } catch (Exception e) {
                log.log(Level.WARNING, "Failed to delete sub-guid {0}", new Object[] { guidEntry });
                e.printStackTrace();
            // continue with rest
            }
        }
    }
    System.out.println("About to delete " + accountGuidEntries.length + " account guids: " + Arrays.asList(accountGuidEntries));
    for (GuidEntry accGuidEntry : accountGuidEntries) {
        try {
            log.log(Level.FINE, "About to delete account guid {0}", new Object[] { accGuidEntry });
            clients[0].accountGuidRemove(accGuidEntry);
            log.log(Level.FINE, "Deleted account guid {0}", new Object[] { accGuidEntry });
        } catch (Exception e) {
            log.log(Level.WARNING, "Failed to delete account guid {0}", new Object[] { accGuidEntry });
            e.printStackTrace();
        // continue with rest
        }
    }
    for (GNSClientCommands client : clients) client.close();
    executor.shutdown();
    System.out.println(DelayProfiler.getStats());
}
Also used : GNSClientCommands(edu.umass.cs.gnsclient.client.GNSClientCommands) GuidEntry(edu.umass.cs.gnsclient.client.util.GuidEntry) JSONException(org.json.JSONException) ClientException(edu.umass.cs.gnscommon.exceptions.client.ClientException) IOException(java.io.IOException) DuplicateNameException(edu.umass.cs.gnscommon.exceptions.client.DuplicateNameException) AfterClass(org.junit.AfterClass)

Example 55 with AfterClass

use of org.junit.AfterClass in project distributedlog by twitter.

the class TestDistributedLogBase method teardownCluster.

@AfterClass
public static void teardownCluster() throws Exception {
    bkutil.teardown();
    zks.stop();
    for (File dir : tmpDirs) {
        FileUtils.deleteDirectory(dir);
    }
}
Also used : File(java.io.File) AfterClass(org.junit.AfterClass)

Aggregations

AfterClass (org.junit.AfterClass)231 File (java.io.File)83 DalHints (com.ctrip.platform.dal.dao.DalHints)25 FileSystem (org.apache.hadoop.fs.FileSystem)14 Path (org.apache.hadoop.fs.Path)14 HashMap (java.util.HashMap)12 IOException (java.io.IOException)11 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)9 ModelNode (org.jboss.dmr.ModelNode)8 Statement (java.sql.Statement)7 ScenarioConfiguration (org.apache.hadoop.mapred.nativetask.testutil.ScenarioConfiguration)7 FileOutputStream (java.io.FileOutputStream)6 RelationManager (edu.uci.ics.textdb.storage.RelationManager)5 ClientException (edu.umass.cs.gnscommon.exceptions.client.ClientException)5 Configuration (org.apache.hadoop.conf.Configuration)5 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)5 RelationManager (edu.uci.ics.texera.storage.RelationManager)4 Method (java.lang.reflect.Method)4 SQLException (java.sql.SQLException)4 LoggerContext (org.apache.logging.log4j.core.LoggerContext)4