Search in sources :

Example 71 with JUnit4TestAdapter

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));
}
Also used : JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 72 with JUnit4TestAdapter

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();
        }
    }
}
Also used : MiniDFSCluster(org.apache.hadoop.hdfs.MiniDFSCluster) Configuration(org.apache.hadoop.conf.Configuration) ExecDriver(org.apache.hadoop.hive.ql.exec.mr.ExecDriver) HiveConf(org.apache.hadoop.hive.conf.HiveConf) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) IOException(java.io.IOException) URI(java.net.URI) IOException(java.io.IOException) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) Before(org.junit.Before)

Example 73 with JUnit4TestAdapter

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;
}
Also used : TestSuite(junit.framework.TestSuite) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 74 with JUnit4TestAdapter

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;
}
Also used : TestSuite(junit.framework.TestSuite) Suite(org.junit.runners.Suite) TestSuite(junit.framework.TestSuite) Method(java.lang.reflect.Method) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) Annotation(java.lang.annotation.Annotation)

Aggregations

JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)74 TestSuite (junit.framework.TestSuite)50 TestResult (junit.framework.TestResult)17 Test (org.junit.Test)6 Test (junit.framework.Test)2 Result (org.junit.runner.Result)2 I18nManagerTest (com.agiletec.aps.system.services.i18n.I18nManagerTest)1 I18nManagerCacheWrapperTest (com.agiletec.aps.system.services.i18n.cache.I18nManagerCacheWrapperTest)1 KeyGeneratorManagerTest (com.agiletec.aps.system.services.keygenerator.KeyGeneratorManagerTest)1 LangManagerTest (com.agiletec.aps.system.services.lang.LangManagerTest)1 ContentManagerTest (com.agiletec.plugins.jacms.aps.system.services.content.ContentManagerTest)1 ContentModelManagerTest (com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModelManagerTest)1 ContentPageMapperManagerTest (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.ContentPageMapperManagerTest)1 ContentMapperCacheWrapperTest (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.cache.ContentMapperCacheWrapperTest)1 ResourceManagerTest (com.agiletec.plugins.jacms.aps.system.services.resource.ResourceManagerTest)1 ListLastIndexOfTester (com.google.common.collect.testing.testers.ListLastIndexOfTester)1 ListListIteratorTester (com.google.common.collect.testing.testers.ListListIteratorTester)1 ListSubListTester (com.google.common.collect.testing.testers.ListSubListTester)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1