use of junit.framework.JUnit4TestAdapter in project junit4 by junit-team.
the class ForwardCompatibilityTest method testUseGlobalCache.
public void testUseGlobalCache() {
JUnit4TestAdapter adapter1 = new JUnit4TestAdapter(NewTest.class);
JUnit4TestAdapter adapter2 = new JUnit4TestAdapter(NewTest.class);
assertSame(adapter1.getTests().get(0), adapter2.getTests().get(0));
}
use of junit.framework.JUnit4TestAdapter in project hive by apache.
the class TestDDLWithRemoteMetastoreSecondNamenode method setUp.
@Before
public void setUp() throws Exception {
if (tests > 0) {
return;
}
tests = new JUnit4TestAdapter(this.getClass()).countTestCases();
try {
conf = new HiveConf(ExecDriver.class);
SessionState.start(conf);
// Test with remote metastore service
int port = MetaStoreTestUtils.startMetaStoreWithRetry();
conf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
conf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
conf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
conf.setVar(HiveConf.ConfVars.METASTOREWAREHOUSE, new URI(tmppath + "/warehouse").getPath());
// Initialize second mocked filesystem (implement only necessary stuff)
// Physical files are resides in local file system in the similar location
jobConf = new HiveConf(conf);
miniDfs = new MiniDFSCluster(new Configuration(), 1, true, null);
fs2 = miniDfs.getFileSystem();
try {
fs2.delete(tmppathFs2, true);
} catch (IOException e) {
}
fs2.mkdirs(tmppathFs2);
fs2Uri = fs2.getUri().toString();
jobConf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fs2Uri);
driver = DriverFactory.newDriver(jobConf);
fs = FileSystem.get(conf);
if (fs.exists(tmppath) && !fs.getFileStatus(tmppath).isDir()) {
throw new RuntimeException(tmpdir + " exists but is not a directory");
}
if (!fs.exists(tmppath)) {
if (!fs.mkdirs(tmppath)) {
throw new RuntimeException("Could not make scratch directory " + tmpdir);
}
}
db = Hive.get(conf);
cleanup();
isInitialized = true;
} catch (Exception e) {
throw new RuntimeException("Encountered exception " + e.getMessage() + (e.getCause() == null ? "" : ", caused by: " + e.getCause().getMessage()), e);
} finally {
if (!isInitialized) {
shutdownMiniDfs();
}
}
}
use of junit.framework.JUnit4TestAdapter in project jena by apache.
the class TS_IRIx method suite.
public static TestSuite suite() {
TestSuite ts = new TestSuite();
ts.setName("IRIx");
ts.addTest(new JUnit4TestAdapter(TS_IRIx.class));
return ts;
}
use of junit.framework.JUnit4TestAdapter in project j2objc by google.
the class TestUtil method getPackageTests.
public static TestSuite getPackageTests(String pkgName) {
if (pkgName == null || pkgName.isEmpty()) {
throw new IllegalArgumentException("package name not specified");
}
Class<?>[] allJreTests = null;
try {
Class<?> allJreTestsClass = Class.forName("AllJreTests");
Annotation a = allJreTestsClass.getAnnotation(Suite.SuiteClasses.class);
if (a == null) {
throw new AssertionError(ALLJRETESTS_NOT_ACCESSIBLE);
}
Method valueAccessor = Suite.SuiteClasses.class.getDeclaredMethod("value");
allJreTests = (Class<?>[]) valueAccessor.invoke(a);
} catch (Exception e) {
throw new AssertionError(ALLJRETESTS_NOT_ACCESSIBLE);
}
TestSuite packageTests = new TestSuite();
for (Class<?> jreTest : allJreTests) {
Package testPackage = jreTest.getPackage();
if (testPackage != null && testPackage.getName().equals(pkgName) && !isSuiteClass(jreTest)) {
packageTests.addTest(new JUnit4TestAdapter(jreTest));
}
}
return packageTests;
}
Aggregations