Java Code Examples for junit.framework.TestSuite#addTest()

The following examples show how to use junit.framework.TestSuite#addTest() . 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: InteceptorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static Test renameViaDataObjectSuite() {
TestSuite suite = new TestSuite();
       suite.addTest(new InteceptorTest("renameVersionedFile_DO"));
       suite.addTest(new InteceptorTest("renameUnversionedFile_DO"));
       suite.addTest(new InteceptorTest("renameUnversionedFolder_DO"));
       suite.addTest(new InteceptorTest("renameAddedFile_DO"));
       suite.addTest(new InteceptorTest("renameA2B2A_DO"));
       suite.addTest(new InteceptorTest("renameA2B2C_DO"));
       suite.addTest(new InteceptorTest("renameA2B2C2A_DO"));
       suite.addTest(new InteceptorTest("renameA2B_CreateA_DO"));
       suite.addTest(new InteceptorTest("deleteA_RenameB2A_DO_129805"));
       suite.addTest(new InteceptorTest("renameVersionedFolder_DO"));
       suite.addTest(new InteceptorTest("renameFileTree_DO"));
       suite.addTest(new InteceptorTest("renameA2CB2A_DO"));
       suite.addTest(new InteceptorTest("deleteA_renameB2A2B_DO"));
       suite.addTest(new InteceptorTest("deleteA_renameUnversioned2A_DO"));
       return(suite);
   }
 
Example 2
Source File: TestConfiguration.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Does the work of "defaultExistingServerSuite" as defined above.  Takes
 * a boolean argument to determine whether or not to "clean"
 * the test database before each suite.  If the resultant
 * suite is going to be wrapped inside a TestSetup that creates
 * database objects to be used throughout the tests, then the
 * cleanDB parameter should be "false" to prevent cleanup of the
 * database objects that TestSetup created.
 * <BR>
 * Does NOT decorate for running in embedded mode, only for running on
 * an already started server.
 */
public static Test defaultExistingServerSuite(Class testClass, boolean cleanDB)
{
     final TestSuite suite = new TestSuite(suiteName(testClass));
     
    if (cleanDB)
    {
        suite.addTest(new CleanDatabaseTestSetup(clientExistingServerSuite(testClass)));
    }
    else
    {
        suite.addTest(clientExistingServerSuite(testClass));
    }

    return (suite);
}
 
Example 3
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 4
Source File: SURQueryMixTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Run in client and embedded.
 */
public static Test suite() 
{   
    TestSuite mainSuite = new TestSuite("SURQueryMixTest suite");
    
    // DB2 client doesn't support this functionality
    if (usingDB2Client())
        return mainSuite;
    
    mainSuite.addTest(baseSuite("SURQueryMixTest:embedded"));
    mainSuite.addTest(
            TestConfiguration.clientServerDecorator(
                    baseSuite("SURQueryMixTest:client")));
    
    return mainSuite;
    
}
 
Example 5
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 wrapHardUpgradeUserTests(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("testHardUpgrade",
                                autLev,
                                users[autLev-1][0], // dbo
                                users[autLev-1][0].concat(pwSuffix)),
              users[autLev-1][userNo],
              users[autLev-1][userNo].concat(pwSuffix)));
    }

    return DatabasePropertyTestSetup.
        builtinAuthentication(usersSuite, users[autLev-1], pwSuffix);
}
 
Example 6
Source File: DataSourceTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Return a suite of tests that are run with client only
 * 
 * @return A suite of tests being run with client only
 */
private static Test getClientSuite() {
    TestSuite suite = new TestSuite("Client/Server");
    suite.addTest(new DataSourceTest("testClientDSConnectionAttributes"));
    suite.addTest(new DataSourceTest(
            "testClientTraceFileDSConnectionAttribute"));
    suite.addTest(new DataSourceTest(
            "testClientMessageTextConnectionAttribute"));
    return suite;
}
 
Example 7
Source File: TurtleParserTestCase.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void parseNegativeTurtleSyntaxTests(TestSuite suite, String fileBasePath, String testBaseUrl,
		String manifestBaseUrl, RepositoryConnection con) throws Exception {
	StringBuilder negativeQuery = new StringBuilder();
	negativeQuery.append(" PREFIX mf:   <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>\n");
	negativeQuery.append(" PREFIX qt:   <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>\n");
	negativeQuery.append(" PREFIX rdft: <http://www.w3.org/ns/rdftest#>\n");
	negativeQuery.append(" SELECT ?test ?testName ?inputURL ?outputURL \n");
	negativeQuery.append(" WHERE { \n");
	negativeQuery.append("     ?test a rdft:TestTurtleNegativeSyntax . ");
	negativeQuery.append("     ?test mf:name ?testName . ");
	negativeQuery.append("     ?test mf:action ?inputURL . ");
	negativeQuery.append(" }");

	TupleQueryResult queryResult = con.prepareTupleQuery(QueryLanguage.SPARQL, negativeQuery.toString()).evaluate();

	// Add all negative parser tests to the test suite
	while (queryResult.hasNext()) {
		BindingSet bindingSet = queryResult.next();
		IRI nextTestUri = (IRI) bindingSet.getValue("test");
		String nextTestName = ((Literal) bindingSet.getValue("testName")).getLabel();
		String nextTestFile = removeBase(((IRI) bindingSet.getValue("inputURL")).toString(), manifestBaseUrl);
		String nextInputURL = fileBasePath + nextTestFile;

		String nextBaseUrl = testBaseUrl + nextTestFile;

		suite.addTest(new NegativeParserTest(nextTestUri, nextTestName, nextInputURL, nextBaseUrl,
				createTurtleParser(), FailureMode.DO_NOT_IGNORE_FAILURE));
	}

	queryResult.close();

}
 
Example 8
Source File: Checks.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Consistency checks per Section 3.3.2 of TPC-C spec
 */
public static Test consistencyChecks()
{
    TestSuite suite = new TestSuite("Order Entry -Consistency checks");
    suite.addTest(new Checks("testCondition1"));
    suite.addTest(new Checks("testCondition2"));
    suite.addTest(new Checks("testCondition3"));
    suite.addTest(new Checks("testCondition4"));
    
    return suite;
}
 
Example 9
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 10
Source File: TextFeedbackTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testOneTest() {
	String expected= expected(new String[]{".", "Time: 0", "", "OK (1 test)", ""});
	TestSuite suite = new TestSuite();
	suite.addTest(new TestCase() { public void runTest() {}});
	runner.doRun(suite);
	assertEquals(expected, output.toString());
}
 
Example 11
Source File: BshScriptTestCase.java    From beanshell with Apache License 2.0 5 votes vote down vote up
/** Checks if is under scrutiny. Helper function to simplify singling out
 * a specific test for scrutiny when fault finding. Simply assign a value
 * to trouble_maker and the other tests will go on hold.
 * @param suite the suite
 * @return true, if is under scrutiny */
private static boolean isUnderScrutiny(final TestSuite suite) {
    // test file(s) under scrutiny
    final String trouble_maker = _SCRIPT;
    if (trouble_maker.isEmpty())
        return false;
    for (String f:trouble_maker.split(","))
        suite.addTest(new Script(f));
    return true;
}
 
Example 12
Source File: ClosedObjectTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Fills a suite with tests for all the methods of an interface.
 *
 * @param suite the suite to fill
 * @param decorator a decorator for the test (used for obtaining a
 * closed object to test the method on)
 * @param iface the interface which contains the methods to test
 */
private static void fillObjectSuite(TestSuite suite,
                                    ObjectDecorator decorator,
                                    Class iface)
{
    Method[] methods = iface.getMethods();
    for (int i = 0; i < methods.length; i++) {
        ClosedObjectTest cot = new ClosedObjectTest(methods[i], decorator);
        suite.addTest(cot);
    }
}
 
Example 13
Source File: DeclareGlobalTempTableJavaJDBC30Test.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Return a suite of tests that are run with client only
 * 
 * @return A suite of tests being run with client only
 */
private static Test getClientSuite() {
    TestSuite suite = new TestSuite("Client/Server");
    // skip the tests with more than 1 savepoint -  
    // see (lack of support described in) DERBY-3687
    // so, only do the following with network server/client: 
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testOnCommitPreserveRowsWithHoldability"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testSavepointRollbackbehaviour7"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testSavepointRollbackbehaviour8"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testSavepointRollbackbehaviour11"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testSavepointRollbackbehaviour12"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testTest4"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testPooledConnectionClosed"));
    
    // following 2 fail with network server; see DERBY-4373
    /*
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testOnCommitDeleteRowsWithHoldableOpenCursor"));
    suite.addTest(new DeclareGlobalTempTableJavaJDBC30Test(
        "testOnCommitDeleteRowsHoldabilityWithPreparedStatements"));
    */
    return suite;
}
 
Example 14
Source File: HoldCursorTest.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);

        // Add tests that every JVM jdk1.4 or above should be able to run.
        suite.addTestSuite(HoldCursorTest.class);
        if (!JDBC.vmSupportsJSR169()) {
             suite.addTest (new HoldCursorTest("StatementsInProcedureTest"));

           }
        return new CleanDatabaseTestSetup(suite);
    }
 
Example 15
Source File: Schema.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Add constraint tests to suite.
 * 
 * @param suite
 */
static void addConstraints(TestSuite suite) {
    suite.addTest(new Schema("primarykey.sql"));
    suite.addTest(new Schema("foreignkey.sql"));
    suite.addTest(new Schema("index.sql"));

}
 
Example 16
Source File: LangHarnessJavaTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
private static Test baseSuite(String which, String[] set) {
    TestSuite suite = new TestSuite("lang: " + which);
    for (int i = 0; i < set.length; i++)
    {
        suite.addTest(decorate(new LangHarnessJavaTest(set[i])));
    }
    return suite;
}
 
Example 17
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 18
Source File: JsfDocumentationTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static Test xsuite() {
    TestSuite suite = new TestSuite();
    suite.addTest(new JsfDocumentationTest("testSectioningPattern"));
    return suite;
}
 
Example 19
Source File: CallableTest.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
private static Test baseSuite(String name) {

        TestSuite suite = new TestSuite(name);

        // Add tests that every JVM should be able to run.
        suite.addTestSuite(CallableTest.class);

        // Add tests that require JDBC 3 
        if (JDBC.vmSupportsJDBC3()) {

            // Tests that require DriverManager.
            suite.addTest
                (new CallableTest("xtestUpdateLongBinaryProc"));

            // Tests that require DriverManager and batch update.
            suite.addTest
                (new CallableTest("xtestBatchUpdate"));
            suite.addTest
                (new CallableTest("xtestBatchUpdateError"));

            // Tests that get/set BigDecimal
            suite.addTest
                (new CallableTest("xtestBigDecimalInAndOutProc"));
            suite.addTest
                (new CallableTest("xtestNumericTypesInAndOutProc"));

            // Test that both requires DriverManager and BigDecimal
            suite.addTest
                (new CallableTest("xtestNumericBoundariesProc"));
            
            suite.addTest
                (new CallableTest("xtestRegUserDefOutParameterError"));
        }


        return new CleanDatabaseTestSetup(suite) 
        {
            /**
            * Creates the tables and the stored procedures used in the test
            * cases.
            * @throws SQLException 
            */
            protected void decorateSQL(Statement s) throws SQLException
            {
                for (int i = 0; i < ROUTINES.length; i++) {
                    s.execute(ROUTINES[i]);
                }
                for (int i = 0; i < TABLES.length; i++) {
                    s.execute(TABLES[i][1]);
                }
            }
        };
    }
 
Example 20
Source File: TableFunctionTest.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 * Return a suite that uses a single use database with
 * a primary fixture from this test plus potentially other
 * fixtures.
 * @param locale Locale to use for the database
 * @param baseFixture Base fixture from this test.
 * @return suite of tests to run for the given locale
 */
private static Test collatedSuite(String locale, String baseFixture)
{
    TestSuite suite = new TestSuite( "TableFunctionTest:territory=" + locale );
    suite.addTest( new TableFunctionTest( baseFixture ) );

    return Decorator.territoryCollatedDatabase( suite, locale );
}