junit.framework.TestSuite Java Examples

The following examples show how to use junit.framework.TestSuite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SURQueryMixTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private static TestSuite createTestCases(final String modelName) {
    TestSuite suite = new TestSuite();
    for (int doPos = 0; doPos<2; doPos++) {
        boolean positioned = doPos>0; // true if to use positioned updates

        for (int i = 0; i < selectConditions.length; i++) {
            for (int j = 0; j < projectConditions.length; j++) {
                final String cursorName = "cursor_" + i + "_" + j;
                
                final String stmtString = "SELECT " + projectConditions[j] +
                        " FROM T1 " + selectConditions[i];
                suite.addTest(new SURQueryMixTest(modelName, stmtString, cursorName, 
                                          positioned));
            }
        }
    }
    return suite;
}
 
Example #2
Source File: SingleConsumerQueueTests.java    From caffeine with Apache License 2.0 6 votes vote down vote up
private static TestSuite queueTest(boolean optimistic) {
  return QueueTestSuiteBuilder
      .using(new TestStringQueueGenerator() {
          @Override public Queue<String> create(String[] elements) {
            Queue<String> queue = optimistic
                ? SingleConsumerQueue.optimistic()
                : SingleConsumerQueue.linearizable();
            queue.addAll(MinimalCollection.of(elements));
            return queue;
          }
        })
      .named(SingleConsumerQueue.class.getSimpleName())
      .withFeatures(
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example #3
Source File: DboPowersTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Wraps the shutdown fixture in decorators to run with data
 * base owner and one other valid user.
 *
 * @param autLev security context to use
 */

private static Test wrapShutdownUserTests(int autLev)
{
    // add decorator for different users authenticated
    TestSuite usersSuite =
        new TestSuite("usersSuite: security level=" +
                      secLevelNames[autLev]);

    // First decorate with users, then with
    for (int userNo = 0; userNo < users.length; userNo++) {
        usersSuite.addTest
            (TestConfiguration.changeUserDecorator
             (new DboPowersTest("testShutDown", autLev),
              users[autLev-1][userNo],
              users[autLev-1][userNo].concat(pwSuffix)));
    }

    return DatabasePropertyTestSetup.
        builtinAuthentication(usersSuite, users[autLev-1], pwSuffix);
}
 
Example #4
Source File: TestSuiteBuilder.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Scans *Test.class files under org.kuali for matches against the given strategies.
 * 
 * @param classCriteria strategy for whether to include a given TestCase in the suite. If included, a test class acts like a
 *        sub-suite to include all its test methods. Classes not included may still include methods individually.
 * @param methodCriteria strategy for whether to include a given test method in the suite, if the whole class was not included.
 * @return a TestSuite containing the specified tests
 * @throws java.io.IOException if the directory containing this class file cannot be scanned for other test class files
 * @throws Exception if either of the given criteria throw it
 */
public static TestSuite build(ClassCriteria classCriteria, MethodCriteria methodCriteria) throws Exception {
    TestSuite suite = new TestSuite();
    for (Class<? extends TestCase> t : constructTestClasses(scanTestClassNames(getTestRootPackageDir()))) {
        if (t.isAnnotationPresent(Exclude.class)) {
            continue; // don't consider any methods of this test either
        }
        if (classCriteria.includes(t)) {
            suite.addTestSuite(t);
        }
        else {
            for (Method m : t.getMethods()) {
                if (isTestMethod(m) && methodCriteria.includes(m)) {
                    suite.addTest(TestSuite.createTest(t, m.getName()));
                }
            }
        }
    }
    suite.setName(getDefaultName());
    return suite;
}
 
Example #5
Source File: DBInJarTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
protected static Test baseSuite(String name) {
    TestSuite suite = new TestSuite(name);
    suite.addTestSuite(DBInJarTest.class);
    // Don't run with security manager, we need access to user.dir to archive
    // the database.
    return new CleanDatabaseTestSetup(SecurityManagerSetup.noSecurityManager(suite)) 
    {
        /**
         * Creates the procedure used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException
        {
            stmt.execute("create procedure CREATEARCHIVE(jarName VARCHAR(20)" +
                    " , path VARCHAR(20), dbName VARCHAR(20))" +
                    " LANGUAGE JAVA PARAMETER STYLE JAVA" +
                    " NO SQL" +
                    " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.lang.dbjarUtil.createArchive'");
            
            
        }
    };
}
 
Example #6
Source File: TestUtil.java    From j2objc with Apache License 2.0 6 votes vote down vote up
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 TestSuite(jreTest));
    }
  }
  return packageTests;
}
 
Example #7
Source File: LangProcedureTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Default suite for running this test (embedded and client).
 */
public static Test suite() {
    if (JDBC.vmSupportsJSR169())
        return new TestSuite("Empty LangProcedureTest. JSR169 does not support jdbc:default:connection");
    else
        return TestConfiguration.defaultSuite(LangProcedureTest.class);
}
 
Example #8
Source File: TestSuiteVisitor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void visit(TestSuite testSuite) {
	handler.startingTestSuite( testSuite );
	Enumeration tests = testSuite.tests();
	while ( tests.hasMoreElements() ) {
		Test test = ( Test ) tests.nextElement();
		if ( test instanceof TestSuite ) {
			visit( ( TestSuite ) test );
		}
		else {
			handler.handleTestCase( test );
		}
	}
	handler.completedTestSuite( testSuite );
}
 
Example #9
Source File: ResultSetTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/************************************************************************
 **                        T E S T  S E T U P                           *
 ************************************************************************/

public static Test suite() {
    TestSuite rsSuite = new TestSuite("ResultSetTest suite");
    rsSuite.addTest(decorateTestSuite(TestConfiguration.defaultSuite
        (ResultSetTest.class,false)));
    return rsSuite;
}
 
Example #10
Source File: FxmlParserTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static TestSuite suite() {
    TestSuite s = new TestSuite();
    s.addTest(new FxmlParserTest("testUnresolvedThings"));
    s.addTest(new FxmlParserTest("testDefinitionsResolved"));
    s.addTest(new FxmlParserTest("testInlineScript"));
    return s;
}
 
Example #11
Source File: TestConfiguration.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Create a test suite with all the test cases in the specified class. The
 * test cases should be ordered lexicographically by their names.
 *
 * @param testClass the class with the test cases
 * @return a lexicographically ordered test suite
 */
public static Test orderedSuite(Class testClass) {
    // Extract all tests from the test class and order them.
    ArrayList tests = Collections.list(new TestSuite(testClass).tests());
    Collections.sort(tests, TEST_ORDERER);

    // Build a new test suite with the tests in lexicographic order.
    TestSuite suite = new TestSuite(suiteName(testClass));
    for (Iterator it = tests.iterator(); it.hasNext(); ) {
        suite.addTest((Test) it.next());
    }

    return suite;
}
 
Example #12
Source File: JSR166TestCase.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public static TestSuite newTestSuite(Object... suiteOrClasses) {
    TestSuite suite = new TestSuite();
    for (Object suiteOrClass : suiteOrClasses) {
        if (suiteOrClass instanceof TestSuite)
            suite.addTest((TestSuite) suiteOrClass);
        else if (suiteOrClass instanceof Class)
            suite.addTest(new TestSuite((Class<?>) suiteOrClass));
        else
            throw new ClassCastException("not a test suite or class");
    }
    return suite;
}
 
Example #13
Source File: MapExtensionsTest.java    From xtext-lib with Eclipse Public License 2.0 5 votes vote down vote up
public static TestSuite suite() {
	return MapTestSuiteBuilder
			// The create method is called with an array of elements
			// that should populate the collection.
			.using(new TestStringMapGenerator() {
				@Override
				protected Map<String, String> create(Entry<String, String>[] source) {
					Map<String, String> left = Maps.newHashMap();
					Map<String, String> right = Maps.newHashMap();
					for(int i = 0; i < source.length; i++) {
						Entry<String, String> entry = source[i];
						if (right.containsKey(entry.getKey())) {
							left.put(entry.getKey(), right.get(entry.getKey()));
							right.put(entry.getKey(), entry.getValue());
						} else if (i % 2 != 0) {
							left.put(entry.getKey(), entry.getValue());	
						} else {
							right.put(entry.getKey(), entry.getValue());
							if (i % 4 != 0) {
								left.put(entry.getKey(), "will be ignored");
							}
						}
					}
					return new UnmodifiableMergingMapView(left, right);
				}
			}).named("Guava-based UnmodifiableMergingMapView tests")
			.withFeatures(
					MapFeature.ALLOWS_NULL_KEYS,
					MapFeature.ALLOWS_NULL_VALUES,
					MapFeature.ALLOWS_ANY_NULL_QUERIES,
					MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionFeature.ALLOWS_NULL_QUERIES,
					CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionSize.ANY)
			.createTestSuite();
}
 
Example #14
Source File: AndroidDeviceTestSuite.java    From android-test with Apache License 2.0 5 votes vote down vote up
public static TestSuite suite() {
  String argvFromEnv = System.getProperty("argv");
  String[] cleanedFlags =
      Arrays.stream(argvFromEnv.split(" |="))
          .map(s -> s.replaceAll("^\"|\"$", ""))
          .toArray(String[]::new);
  return new Builder().withCommandLineArgs(cleanedFlags).build();
  // */
}
 
Example #15
Source File: CameraTestRunner.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
@Override
public TestSuite getAllTests()
{
    TestSuite suite = new InstrumentationTestSuite(this);
    suite.addTestSuite(CameraTest.class);
    suite.addTestSuite(ImageCaptureIntentTest.class);
    suite.addTestSuite(VideoCaptureIntentTest.class);
    suite.addTestSuite(CameraUnitTest.class);
    return suite;
}
 
Example #16
Source File: AllTests.java    From oopsla15-artifact with Eclipse Public License 1.0 5 votes vote down vote up
private static void addReferenceTests(TestSuite suite) {
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestAnnotations.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestBasicValues.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestEquality.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestList.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestListRelation.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestMap.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestRandomValues.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestRelation.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestSet.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestValueFactory.class);
}
 
Example #17
Source File: TestTCK.java    From database with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the stress tests a couple of times.
 * 
 * @throws Exception
 */
public void test_stressTests() throws Exception {

    for (int i = 0; i < 100; i++) {
        final TestSuite suite = new TestSuite(
            TCKStressTests.class.getSimpleName());

        suite.addTestSuite(TCKStressTests.class);
        suite.run(new TestResult());
    }
}
 
Example #18
Source File: OSReadOnlyTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
protected static Test baseSuite(String name) 
{
    TestSuite readonly = new TestSuite("OSReadOnly");
    TestSuite suite = new TestSuite(name);
    readonly.addTestSuite(OSReadOnlyTest.class);
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(newCleanDatabase(readonly)));
    
    return suite;
}
 
Example #19
Source File: Derby3625Test.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
protected static Test baseSuite(String name) 
{
    TestSuite suite = new TestSuite(name);
    suite.addTestSuite(Derby3625Test.class);
    return new CleanDatabaseTestSetup(
            DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4)) 
    {
        /**
         * Creates the tables used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException
        {
            Connection conn = stmt.getConnection();

            CallableStatement set_dbprop =  conn.prepareCall(
                "CALL SYSCS_UTIL.SET_DATABASE_PROPERTY(?, ?)");
            set_dbprop.setString(1,"gemfirexd.storage.pageReservedSpace");
            set_dbprop.setString(2,"0");
            set_dbprop.executeUpdate();
            
            // create a table, with blob it will be 32k page size
            stmt.executeUpdate(
                "CREATE TABLE testCompress " +
                    "(id int, padcol blob(1M), c varchar(200))");

            set_dbprop.setString(2, null);
            set_dbprop.executeUpdate();

            set_dbprop.close();

            conn.setAutoCommit(false);
        }
    };
}
 
Example #20
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void openTest(Test suite) {
    Test test = null;
    if (suite instanceof TestSuite) {
        test = ((TestSuite) suite).testAt(0);
    } else {
        test = suite;
    }
    if (test != null && test instanceof MarathonTestCase) {
        openFile(((MarathonTestCase) test).getFile());
    }
}
 
Example #21
Source File: DboPowersTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Wraps the encryption fixtures in decorators to run with data
 * base owner and one other valid user.
 *
 * @param autLev security context to use
 */

private static Test wrapEncryptionUserTests(int autLev)
{
    // add decorator for different users authenticated
    TestSuite usersSuite =
        new TestSuite("usersSuite: security level=" +
                      secLevelNames[autLev]);

    // First decorate with users, then with authentication.  Note
    // use of no teardown / no shutdown decorator variants:
    // Necessary since framework doesnt know bootPassword
    for (int userNo = 0; userNo < users.length; userNo++) {
        for (int tNo = 0; tNo < encryptionTests.length; tNo++) {
            Test test = TestConfiguration.changeUserDecorator
                (new DboPowersTest(encryptionTests[tNo],
                                   autLev,
                                   users[autLev-1][0], // dbo
                                   users[autLev-1][0].concat(pwSuffix)),
                 users[autLev-1][userNo],
                 users[autLev-1][userNo].concat(pwSuffix));
            test = DatabasePropertyTestSetup.builtinAuthenticationNoTeardown
                (test, users[autLev-1], pwSuffix);
            if (autLev == AUTHENTICATION) {
                test = TestConfiguration.
                    singleUseDatabaseDecoratorNoShutdown(test);
            } else {
                test = TestConfiguration.
                    sqlAuthorizationDecoratorSingleUse(test);
            }
            usersSuite.addTest(test);
        }
    }
    return usersSuite;
}
 
Example #22
Source File: SuiteTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testCreateSuiteFromArray() {
	Class[] testClassArray = { OneTestCase.class, DoublePrecisionAssertTest.class };
	TestSuite suite = new TestSuite(testClassArray);
	assertEquals(2, suite.testCount());
	assertEquals("junit.tests.framework.DoublePrecisionAssertTest" , ((TestSuite)suite.testAt(1)).getName());
	assertEquals("junit.tests.framework.OneTestCase" , ((TestSuite)suite.testAt(0)).getName());
}
 
Example #23
Source File: NullSQLTextTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
private static Test baseSuite(String name) {
    TestSuite suite = new TestSuite(name);

    suite.addTestSuite(NullSQLTextTest.class);

    return new CleanDatabaseTestSetup(suite) {
        /**
         * Creates the tables and the stored procedures used in the test
         * cases.
         *
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException {

            Connection conn = getConnection();

            /**
             * Creates the table used in the test cases.
             *
             */
            stmt.execute("create table t1 (i int)");
            stmt.execute("insert into t1 values 1, 2, 3, 4, 5, 6, 7");
            stmt.execute("create procedure za() language java external name " +
                         "'org.apache.derbyTesting.functionTests.tests.jdbcapi.NullSQLTextTest.zeroArg'" +
                         " parameter style java");
        }
    };
}
 
Example #24
Source File: 测试博客增删改用例集合.java    From androidtestdebug with MIT License 5 votes vote down vote up
public static Test suite() {
	return new TestSetup(new TestSuite(博客测试2.class)) {
		protected void setUp() {
			System.out.println("用户登录");
		}
		
		protected void tearDown() {
			System.out.println("用户注销");
		}
	};
}
 
Example #25
Source File: CoreTestSuite.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Constructs test suite.
 * @return test suite
 */
public static Test suite() {
    TestSuite s = new TestSuite();
    s.addTestSuite(LoggingEventTest.class);
    s.addTestSuite(org.apache.log4j.LevelTest.class);
    s.addTestSuite(org.apache.log4j.PriorityTest.class);
    s.addTestSuite(org.apache.log4j.CategoryTest.class);
    s.addTestSuite(org.apache.log4j.FileAppenderTest.class);
    s.addTestSuite(org.apache.log4j.LogManagerTest.class);
    s.addTestSuite(org.apache.log4j.helpers.LogLogTest.class);
    s.addTestSuite(org.apache.log4j.LayoutTest.class);
    s.addTestSuite(org.apache.log4j.helpers.DateLayoutTest.class);
    s.addTestSuite(org.apache.log4j.TTCCLayoutTest.class);
    s.addTestSuite(org.apache.log4j.xml.XMLLayoutTest.class);
    s.addTestSuite(org.apache.log4j.HTMLLayoutTest.class);
    s.addTestSuite(org.apache.log4j.PatternLayoutTest.class);
    s.addTestSuite(org.apache.log4j.spi.LoggingEventTest.class);
    s.addTestSuite(org.apache.log4j.spi.ThrowableInformationTest.class);
    s.addTestSuite(org.apache.log4j.spi.LocationInfoTest.class);
    s.addTestSuite(org.apache.log4j.PropertyConfiguratorTest.class);
    s.addTestSuite(org.apache.log4j.net.SMTPAppenderTest.class);
    s.addTestSuite(org.apache.log4j.net.TelnetAppenderTest.class);
    return s;
}
 
Example #26
Source File: JUnitCustomRunnerTestUnitFinderTest.java    From pitest with Apache License 2.0 4 votes vote down vote up
public static TestSuite suite() {
  return new TestSuite(JUnit3Test.class);
}
 
Example #27
Source File: AppTest.java    From game-server with MIT License 4 votes vote down vote up
/**
 * @return the suite of tests being tested
 */
public static Test suite()
{
    return new TestSuite( AppTest.class );
}
 
Example #28
Source File: DOMConvertorTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(DOMConvertorTest.class);
}
 
Example #29
Source File: KeyFilterTest.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public static Test suite()
{
	return new TestSuite(KeyFilterTest.class);
}
 
Example #30
Source File: MessageTest.java    From openid4java with Apache License 2.0 4 votes vote down vote up
public static Test suite()
{
    return new TestSuite(MessageTest.class);
}