當前位置: 首頁>>代碼示例>>Java>>正文


Java TestSetup類代碼示例

本文整理匯總了Java中junit.extensions.TestSetup的典型用法代碼示例。如果您正苦於以下問題:Java TestSetup類的具體用法?Java TestSetup怎麽用?Java TestSetup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TestSetup類屬於junit.extensions包,在下文中一共展示了TestSetup類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestJoinProperties.class)) {
    protected void setUp() throws Exception {
      Configuration conf = new Configuration();
      cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
      base = cluster.getFileSystem().makeQualified(new Path("/nested"));
      src = generateSources(conf);
    }
    protected void tearDown() throws Exception {
      if (cluster != null) {
        cluster.shutdown();
      }
    }
  };
  return setup;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:TestJoinProperties.java

示例2: additionalDatabaseDecoratorNoShutdown

import junit.extensions.TestSetup; //導入依賴的package包/類
/**
 * Similar to additionalDatabaseDecorator except the database will
 * not be shutdown, only deleted. It is the responsibility of the
 * test to shut it down.
 *
 * @param test Test to be decorated
 * @param logicalDbName The logical database name. This name is
 *                      used to identify the database in
 *                      openConnection(String logicalDatabaseName)
 *                      method calls.
 * @return decorated test.
 */
public static TestSetup additionalDatabaseDecoratorNoShutdown(
    Test test,
    String logicalDbName)
{
    return new DatabaseChangeSetup(
        new DropDatabaseSetup(test, logicalDbName)
        {
            protected void tearDown() throws Exception {
                // the test is responsible for shutdown
                removeDatabase();
            }
        },
        logicalDbName,
        generateUniqueDatabaseName(),
        false);
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:29,代碼來源:TestConfiguration.java

示例3: baseSuite

import junit.extensions.TestSetup; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:25,代碼來源:SURTest.java

示例4: baseSuite

import junit.extensions.TestSetup; //導入依賴的package包/類
/**
 * 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 = createTestCases(model.toString());
        TestSetup decorator = new SURDataModelSetup(suite, model);
        mainSuite.addTest(decorator);
    }
    return mainSuite;
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:20,代碼來源:SURQueryMixTest.java

示例5: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestMiniMRDFSSort.class)) {
    protected void setUp() throws Exception {
      Configuration conf = new Configuration();
      dfsCluster = new MiniDFSCluster(conf, NUM_HADOOP_SLAVES, true, null);
      dfs = dfsCluster.getFileSystem();
      mrCluster = new MiniMRCluster(NUM_HADOOP_SLAVES, 
                                    dfs.getUri().toString(), 1);
    }
    protected void tearDown() throws Exception {
      if (dfsCluster != null) { dfsCluster.shutdown(); }
      if (mrCluster != null) { mrCluster.shutdown(); }
    }
  };
  return setup;
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:17,代碼來源:TestMiniMRDFSSort.java

示例6: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  TestSetup setup =
    new TestSetup(new TestSuite(TestSpeculativeExecution.class)) {
    @Override
    protected void setUp() throws Exception {
      JobConf conf = new JobConf();
      conf.set(JT_IPC_ADDRESS, "localhost:0");
      conf.set(JT_HTTP_ADDRESS, "0.0.0.0:0");
      jobTracker = new FakeJobTracker
        (conf, (clock = new SpecFakeClock(conf.getMapSpeculativeLag())),
         trackers);
      for (String tracker : trackers) {
        FakeObjectUtilities.establishFirstContact(jobTracker, tracker);
      }
    }
    @Override
    protected void tearDown() throws Exception {
      //delete the build/test/logs/ dir
    }
  };
  return setup;
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:23,代碼來源:TestSpeculativeExecution.java

示例7: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestClusterStatus.class)) {
    protected void setUp() throws Exception {
      JobConf conf = new JobConf();
      conf.setClass("mapred.jobtracker.taskScheduler", 
          TestClusterStatus.FakeTaskScheduler.class,
                TaskScheduler.class);
      mr = new MiniMRCluster(0, 0, 0, "file:///", 1, null, null, null, conf);
      jobTracker = mr.getJobTrackerRunner().getJobTracker();
      for (String tracker : trackers) {
        establishFirstContact(jobTracker, tracker);
      }
      client = new JobClient(mr.createJobConf());
    }

    protected void tearDown() throws Exception {
      client.close();
      mr.shutdown();
    }
  };
  return setup;
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:23,代碼來源:TestClusterStatus.java

示例8: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  return new TestSetup(new TestSuite(TestAvailableForUnderConstruction.class)) {
    protected void setUp() throws java.lang.Exception {
      AppendTestUtil.LOG.info("setUp()");
      conf = new Configuration();
      conf.setInt("io.bytes.per.checksum", 512);
      conf.setBoolean("dfs.support.append", true);
      conf.setLong("dfs.timeout.get.available.from.datanode", 1000L);
      buffersize = conf.getInt("io.file.buffer.size", 4096);
      cluster = new MiniDFSCluster(conf, DATANODE_NUM, true, null);
      fs = (DistributedFileSystem) cluster.getFileSystem();
    }

    protected void tearDown() throws Exception {
      AppendTestUtil.LOG.info("tearDown()");
      if (fs != null)
        fs.close();
      if (cluster != null)
        cluster.shutdown();
    }
  };
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:23,代碼來源:TestAvailableForUnderConstruction.java

示例9: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  return new TestSetup(new TestSuite(TestFileAppend3.class)) {
    protected void setUp() throws java.lang.Exception {
      AppendTestUtil.LOG.info("setUp()");
      conf = new Configuration();
      conf.setInt("io.bytes.per.checksum", 512);
      conf.setBoolean("dfs.support.append", true);
      buffersize = conf.getInt("io.file.buffer.size", 4096);
      cluster = new MiniDFSCluster(conf, DATANODE_NUM, true, null);
      fs = (DistributedFileSystem)cluster.getFileSystem();
    }
  
    protected void tearDown() throws Exception {
      AppendTestUtil.LOG.info("tearDown()");
      if(fs != null) fs.close();
      if(cluster != null) cluster.shutdown();
    }
  };  
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:20,代碼來源:TestFileAppend3.java

示例10: testRunningErrorsInTestSetup

import junit.extensions.TestSetup; //導入依賴的package包/類
public void testRunningErrorsInTestSetup() {
	TestCase failure= new TestCase("failure") {
		public void runTest() {
			fail();
		}
	};

	TestCase error= new TestCase("error") {
		public void runTest() {
			throw new Error();
		}
	};

	TestSuite suite= new TestSuite();
	suite.addTest(failure);
	suite.addTest(error);
	
	TestSetup wrapper= new TestSetup(suite);

	TestResult result= new TestResult();
	wrapper.run(result);

	assertEquals(1, result.failureCount());
	assertEquals(1, result.errorCount());
}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:26,代碼來源:ExtensionTest.java

示例11: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestJoinProperties.class)) {
    protected void setUp() throws Exception {
      Configuration conf = new Configuration();
      cluster = new MiniDFSCluster(conf, 2, true, null);
      base = cluster.getFileSystem().makeQualified(new Path("/nested"));
      src = generateSources(conf);
    }
    protected void tearDown() throws Exception {
      if (cluster != null) {
        cluster.shutdown();
      }
    }
  };
  return setup;
}
 
開發者ID:ict-carch,項目名稱:hadoop-plus,代碼行數:17,代碼來源:TestJoinProperties.java

示例12: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() {
    return new TestSetup(new TestSuite(GreenPepperRepositoryTest.class)) {
        @Override
        protected void setUp() throws Exception
        {
            ws = new WebServer( 9005 );
            ws.start();
        }

        @Override
        protected void tearDown() throws Exception
        {
            ws.shutdown();
        }
    };
}
 
開發者ID:strator-dev,項目名稱:greenpepper,代碼行數:17,代碼來源:GreenPepperRepositoryTest.java

示例13: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite()
{
	TestSetup setup = new TestSetup(new TestSuite(TestResourceEventVoter.class))
	{
		protected void setUp() throws Exception
		{
			oneTimeSetup();
		}

		protected void tearDown() throws Exception
		{
			oneTimeTearDown();
		}
	};
	return setup;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:17,代碼來源:TestResourceEventVoter.java

示例14: suite

import junit.extensions.TestSetup; //導入依賴的package包/類
public static Test suite() 
{
	TestSetup setup = new TestSetup(new TestSuite(PrivacyTest.class)) 
	{
		protected void setUp() throws Exception 
		{
			log.info("starting setup -- PrivacyTest");
			oneTimeSetup();
			log.info("finished setup -- PrivacyTest");
		}
		protected void tearDown() throws Exception 
		{
			oneTimeTearDown();
		}
	};
	return setup;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:18,代碼來源:PrivacyTest.java

示例15: testSetupErrorInTestSetup

import junit.extensions.TestSetup; //導入依賴的package包/類
public void testSetupErrorInTestSetup() {
    WasRun test = new WasRun();

    TestSetup wrapper = new TestSetup(test) {
        @Override
        public void setUp() {
            fail();
        }
    };

    TestResult result = new TestResult();
    wrapper.run(result);

    assertTrue(!test.fWasRun);
    assertTrue(!result.wasSuccessful());
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:17,代碼來源:ExtensionTest.java


注:本文中的junit.extensions.TestSetup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。