junit.framework.Test Java Examples

The following examples show how to use junit.framework.Test. 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: SURTest.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * The suite contains all testcases in this class running on different 
 * data models
 */
private static Test baseSuite(String name) { 
    
    TestSuite mainSuite = new TestSuite(name);
    
    // Iterate over all data models and decorate the tests:
    for (Iterator i = SURDataModelSetup.SURDataModel.values().iterator();
         i.hasNext();) {
        
        SURDataModelSetup.SURDataModel model = 
            (SURDataModelSetup.SURDataModel) i.next();
        
        TestSuite suite = new TestSuite(SURTest.class);
        TestSetup decorator = new SURDataModelSetup
            (suite, model);
        
        mainSuite.addTest(decorator);    
    }
    
    return mainSuite;
}
 
Example #2
Source File: Decorator.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Decorate a test (or suite of tests) to use a single use database
 * as the default database. The database is created by the setUp
 * method of the decorator. The database will be created using
 * a JDBC data source with createDatabase set to create and
 * connectionAttributes set to the passed in attributes.
 * 
 * 
 * @param attributes Value to set connectionAttributes to when creating
 * the database.
 * @param test Test to decorate
 * @return Decorated test
 */
private static Test attributesDatabase(final String attributes, Test test)
{
    test = new BaseTestSetup(test) {
        
        /**
         * Create a  database
         * using a JDBC data source with connectionAttributes set.
         */
        protected void setUp() throws SQLException
        {
            DataSource ds = JDBCDataSource.getDataSource();
                           
            JDBCDataSource.setBeanProperty(ds,
                    "createDatabase", "create");
            JDBCDataSource.setBeanProperty(ds,
                    "connectionAttributes", attributes);
                            
            ds.getConnection().close();
        }
    };
    
    return TestConfiguration.singleUseDatabaseDecorator(test);
}
 
Example #3
Source File: DboPowersTest.java    From spliceengine with GNU Affero General Public License v3.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: TestConfiguration.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
* A variant of defaultServerDecorator allowing 
* non-default hostname, portnumber and database name.
*/
public static Test existingServerDecorator(Test test, 
        String hostName, int PortNumber, String dbPath)
{
	// Need to have network server and client and not
    // running in J2ME (JSR169).
    if (!(Derby.hasClient() && Derby.hasServer())
            || JDBC.vmSupportsJSR169())
        return new TestSuite("empty: no network server support");

    Test r =
            new ServerSetup(test, hostName, PortNumber);
    ((ServerSetup)r).setJDBCClient(JDBCClient.DERBYNETCLIENT);
    ((ServerSetup)r).setDbPath(dbPath);
    return r;
}
 
Example #5
Source File: NullIfTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public static Test baseSuite(String name) {
  TestSuite suite = new TestSuite(name);
  suite.addTestSuite(NullIfTest.class);

  return new CleanDatabaseTestSetup(suite) {
    /**
     * Creates the table used in the test cases.
     *
     */
    protected void decorateSQL(Statement s) throws SQLException {
      SQLUtilities.createAndPopulateAllDataTypesTable(s);
    }


  };
}
 
Example #6
Source File: JSR166TestCase.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Runs all JSR166 unit tests using junit.textui.TestRunner
 */
public static void main(String[] args) {
    if (useSecurityManager) {
        System.err.println("Setting a permissive security manager");
        Policy.setPolicy(permissivePolicy());
        System.setSecurityManager(new SecurityManager());
    }
    int iters = (args.length == 0) ? 1 : Integer.parseInt(args[0]);

    Test s = suite();
    for (int i = 0; i < iters; ++i) {
        junit.textui.TestRunner.run(s);
        System.gc();
        System.runFinalization();
    }
    System.exit(0);
}
 
Example #7
Source File: AllParserTests.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @return the test
 */

public static Test suite( )
{
	TestSuite test = new TestSuite( );

	test.addTestSuite( AggregationCellParseTest.class );
	test.addTestSuite( CrosstabCellParseTest.class );
	test.addTestSuite( CrosstabParseTest.class );
	test.addTestSuite( CrosstabViewParseTest.class );
	test.addTestSuite( DimensionViewParseTest.class );
	test.addTestSuite( LevelViewParseTest.class );
	test.addTestSuite( MeasureViewParseTest.class );

	// add all test classes here

	return test;
}
 
Example #8
Source File: DateTimeTest.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
protected static Test baseSuite(String name) {
    TestSuite suite = new TestSuite(name);
    suite.addTestSuite(DateTimeTest.class);
    return new CleanDatabaseTestSetup(suite) {
        /**
         * Creates the tables used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException {
            createTableForArithmeticTest(stmt);
            createTableForSyntaxTest(stmt);
            createTableForConversionTest(stmt);
            createTableForISOFormatTest(stmt);
        }
    };
}
 
Example #9
Source File: TestDatamerge.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestDatamerge.class)) {
    protected void setUp() throws Exception {
      Configuration conf = new Configuration();
      cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
    }
    protected void tearDown() throws Exception {
      if (cluster != null) {
        cluster.shutdown();
      }
    }
  };
  return setup;
}
 
Example #10
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 #11
Source File: AnnotationsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static Test suite() {
    return NbModuleSuite.create(
            NbModuleSuite.createConfiguration(AnnotationsTest.class).addTest(
               "testShowAnnotations"
            )
            .enableModules(".*")
            .clusters(".*")
   );
}
 
Example #12
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 #13
Source File: StressTests.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
public static Test suite()
{
    TestSuite result = new TestSuite();
    result.addTestSuite(CameraLatency.class);
    result.addTestSuite(CameraStartUp.class);
    result.addTestSuite(ImageCapture.class);
    //      result.addTestSuite(SwitchPreview.class);
    return result;
}
 
Example #14
Source File: TestPostStartedMasterAndSlave_StopSlave.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
  * Adds this class to the *existing server* suite.
  */
 public static Test suite(String serverHost, int serverPort)
 {
     System.out.println("*** TestPostStartedMasterAndSlave_StopSlave.suite(serverHost,serverPort)");
  
     Test t = TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopSlave.class,false,serverHost,serverPort);
     System.out.println("*** Done TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopSlave.class,false,serverHost,serverPort)");
     return t;
}
 
Example #15
Source File: KeycloakConfigureAdminGroupTest.java    From camunda-bpm-identity-keycloak with Apache License 2.0 5 votes vote down vote up
public static Test suite() {
    return new TestSetup(new TestSuite(KeycloakConfigureAdminGroupTest.class)) {

    	// @BeforeClass
        protected void setUp() throws Exception {
    		ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
    				.createProcessEngineConfigurationFromResource("camunda.configureAdminGroup.cfg.xml");
    		configureKeycloakIdentityProviderPlugin(config);
    		PluggableProcessEngineTestCase.cachedProcessEngine = config.buildProcessEngine();
        }
        
        // @AfterClass
        protected void tearDown() throws Exception {
    		PluggableProcessEngineTestCase.cachedProcessEngine.close();
    		PluggableProcessEngineTestCase.cachedProcessEngine = null;
        }
    };
}
 
Example #16
Source File: SystemPropertyTestSetup.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Create a test decorator that sets and restores the passed
 * in properties. Assumption is that the contents of
 * properties and values will not change during execution.
 * @param test test to be decorated
 * @param newValues properties to be set
 */
public SystemPropertyTestSetup(Test test,
		Properties newValues,
		boolean staticProperties)
{
	super(test);
	this.newValues = newValues;
	this.staticProperties = staticProperties;
}
 
Example #17
Source File: NbModuleSuiteTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAccessToInsaneAndFSWithAllModules() {
    System.setProperty("ins.one", "no");
    System.setProperty("ins.fs", "no");

    Test instance = NbModuleSuite.createConfiguration(NbModuleSuiteIns.class).
            gui(false).clusters(".*").enableModules(".*").suite();
    junit.textui.TestRunner.run(instance);

    assertProperty("ins.one", "OK");
    assertProperty("ins.fs", "OK");
}
 
Example #18
Source File: ConstructorFieldTestSuite.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static Test suite() {
    String testdir = "tests" + File.separator + "python" + File.separator + "codegenerator" + File.separator
            + "constructorfield";
    ConstructorFieldTestSuite testSuite = new ConstructorFieldTestSuite("Constructor Field");

    testSuite.createTests(testdir);

    return testSuite;
}
 
Example #19
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 #20
Source File: Tds9Test.java    From jTDS with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Test suite()
{
   String tds = props.getProperty( Messages.get( Driver.TDS ) );

   if( tds == null || Double.valueOf( tds ) >= Double.valueOf( DefaultProperties.TDS_VERSION_90 ) )
   {
      return new TestSuite( Tds9Test.class );
   }

   return new TestSuite();
}
 
Example #21
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 #22
Source File: svnPropertiesTestSuite.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Simple method uniting together all the different tests under subversion
 * tests-qa-functional
 */
public static Test suite() {
    if (svnExistsChecker.check(false)) {
        return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
                .addTest(SvnPropertiesTest.class, "propTest")
                .enableModules(".*").clusters(".*"));
    } else {
        return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
    }
}
 
Example #23
Source File: EncryptionSuite.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Set of tests which are run for each encryption algorithm.
 */
private static Test baseSuite(String algorithm)
{
    TestSuite suite = new TestSuite("Encryption Algorithm: " + algorithm);
    
    // Very simple test to get the setup working while we have
    // no tests that were previously run under encryption converted.
    suite.addTestSuite(EncryptionSuite.class);
    
    return suite;
}
 
Example #24
Source File: LobStreamsTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Run with DerbyNetClient only.
 * Embedded Clob/Blob.setXXXStream() methods are not implemented.
 */
public static Test suite() {
            
    TestSuite ts  = new TestSuite ("LobStreamsTest");
    ts.addTest(TestConfiguration.defaultSuite (LobStreamsTest.class));
    // JSR169 does not have support for encryption
    if (JDBC.vmSupportsJDBC3()) {
        TestSuite encSuite = new TestSuite ("LobStreamsTest:encrypted");
        encSuite.addTestSuite (LobStreamsTest.class);
        ts.addTest(Decorator.encryptedDatabase (encSuite));
    }
    return ts;
}
 
Example #25
Source File: AppTest.java    From pom-manipulation-ext with Apache License 2.0 4 votes vote down vote up
/**
 * @return the suite of tests being tested
 */
public static Test suite()
{
    return new TestSuite( AppTest.class );
}
 
Example #26
Source File: AtomicIntegerArray9Test.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static Test suite() {
    return new TestSuite(AtomicIntegerArray9Test.class);
}
 
Example #27
Source File: CoreModulesTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static Test suite() {       
    return createModuleTest(CoreModulesTest.class, tests);
}
 
Example #28
Source File: ImageNodeTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** method used for explicit testsuite definition
 */
public static Test suite() {
    return createModuleTest(ImageNodeTest.class, tests);
}
 
Example #29
Source File: WizardDescriptorWhenClosedWindowTest.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(WizardDescriptorWhenClosedWindowTest.class);
}
 
Example #30
Source File: DboPowersTest.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 *
 * Construct suite of tests for hard upgrade database action
 *
 * NOTE: there is no real upgrade going on here since the
 * database is created with the same version, but the checking
 * is performed nonetheless, which is what we are testing
 * here.  This saves us from having to create a database with
 * an old version of Derby to test this power.
 *
 * @param framework Derby framework name
 * @return A suite containing the test case for hard upgrade
 * incarnated for the three security levels no authentication,
 * authentication, and authentication plus sqlAuthorization, The
 * latter two has an instance for dbo, and one for an ordinary user,
 * so there are in all five incarnations of tests.
 */
private static Test dboHardUpgradeSuite(String framework)
{
    Test tests[] = new Test[SQLAUTHORIZATION+1]; // one per authLevel

    /* Tests without any authorization active (level ==
     * NOAUTHENTICATION).
     */
    TestSuite noauthSuite =
        new TestSuite("suite: security level=" +
                      secLevelNames[NOAUTHENTICATION]);
    noauthSuite.addTest(new DboPowersTest("testHardUpgrade",
                                          NOAUTHENTICATION,
                                          "foo", "bar"));
    tests[NOAUTHENTICATION] = noauthSuite;

    /* First decorate with users, then with authentication. Do this
     * twice, once for authentication only, and once for
     * authentication + sqlAuthorization (see extra decorator
     * added below).
     */
    for (int autLev = AUTHENTICATION;
         autLev <= SQLAUTHORIZATION ; autLev++) {

        tests[autLev] = wrapHardUpgradeUserTests(autLev);
    }

    TestSuite suite = new TestSuite("dboPowers:"+framework);

    // A priori, doing a hard upgrade is a no-op here; we are only
    // interested in checking if we have the powers to do it. However,
    // sometimes the regression suite is run against a default database
    // (system/wombat) created by an earlier release to check soft upgrade
    // modes. To avoid interfering with such usage, we use a
    // singleUseDatabaseDecorator below, so we avoid accidentally hard
    // upgrading system/wombat in such runs. The SQLAUTHORIZATION run takes
    // care of itself since it uses another database anyway.

    /* run tests with no authentication enabled */
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(
                      tests[NOAUTHENTICATION]));

    /* run test for all users with only authentication enabled */
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(
                      tests[AUTHENTICATION]));

    /* run test for all users with authentication and
     * sqlAuthorization enabled
     */
    suite.addTest(
        TestConfiguration.
        sqlAuthorizationDecorator(tests[SQLAUTHORIZATION]));

    return suite;
}