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());
}
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());
}
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");
}
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());
}
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);
}
}
Aggregations