Java Code Examples for junit.framework.Test

The following examples show how to use junit.framework.Test. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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 2
Source Project: gemfirexd-oss   Source File: Decorator.java    License: 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
/**
 * 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 Project: database   Source File: JSR166TestCase.java    License: 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 5
Source Project: birt   Source File: AllParserTests.java    License: 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 6
Source Project: spliceengine   Source File: SURTest.java    License: 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 7
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 8
Source Project: gemfirexd-oss   Source File: NullIfTest.java    License: 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 9
/**
* 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 10
Source Project: gemfirexd-oss   Source File: Checks.java    License: 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 11
Source Project: gemfirexd-oss   Source File: Derby3625Test.java    License: 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 12
Source Project: gemfirexd-oss   Source File: LangProcedureTest.java    License: 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 13
Source Project: Camera2   Source File: StressTests.java    License: 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 Project: hadoop   Source File: TestDatamerge.java    License: 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 15
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 16
/**
 * 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 17
Source Project: netbeans   Source File: NbModuleSuiteTest.java    License: 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 Project: gemfirexd-oss   Source File: EncryptionSuite.java    License: 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 19
Source Project: netbeans   Source File: svnPropertiesTestSuite.java    License: 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 20
Source Project: jTDS   Source File: Tds9Test.java    License: 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 Project: Pydev   Source File: ConstructorFieldTestSuite.java    License: 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 22
Source Project: netbeans   Source File: AnnotationsTest.java    License: 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 23
/**
  * 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 24
/**
 * 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 25
Source Project: netbeans   Source File: EngineComponentsProviderTest.java    License: Apache License 2.0 4 votes vote down vote up
public static Test createTestSuite(Class<? extends TestCase> clazz) {
    NbModuleSuite.Configuration suiteConfiguration = NbModuleSuite.createConfiguration(clazz);
    suiteConfiguration = suiteConfiguration.gui(false);
    //suiteConfiguration = suiteConfiguration.reuseUserDir(false);
    return NbModuleSuite.create(suiteConfiguration);
}
 
Example 26
Source Project: astor   Source File: MutableBooleanTest.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static Test suite() {
    return new TestSuite(MutableBooleanTest.class);
}
 
Example 27
Source Project: openjdk-jdk9   Source File: ExchangerTest.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static Test suite() {
    return new TestSuite(ExchangerTest.class);
}
 
Example 28
public static Test suite() {
	return new FunctionalTestClassTestSuite( BackrefCompositeMapKeyTest.class );
}
 
Example 29
Source Project: gemfirexd-oss   Source File: UnarySimpleTest.java    License: Apache License 2.0 4 votes vote down vote up
/**
   * Create a suite of tests.
   */
public static Test suite() {
  return   TestConfiguration.defaultSuite(UnarySimpleTest.class);
}
 
Example 30
Source Project: netbeans   Source File: RefactorFindUsagesTest.java    License: Apache License 2.0 4 votes vote down vote up
public static Test suite() {
    return emptyConfiguration()
            .addTest(J2SESetup.class, "testCloseMemoryToolbar", "testOpenDataProject")
            .addTest(RefactorFindUsagesTest.class)
            .suite();
}