当前位置: 首页>>代码示例>>Java>>正文


Java BeforeClass类代码示例

本文整理汇总了Java中org.junit.BeforeClass的典型用法代码示例。如果您正苦于以下问题:Java BeforeClass类的具体用法?Java BeforeClass怎么用?Java BeforeClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BeforeClass类属于org.junit包,在下文中一共展示了BeforeClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateTestDataAndQueries

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void generateTestDataAndQueries() throws Exception {
  // Table consists of two columns "emp_id", "emp_name" and "dept_id"
  empTableLocation = testTempFolder.newFolder().getAbsolutePath();

  // Write 100 records for each new file
  final int empNumRecsPerFile = 100;
  for(int fileIndex=0; fileIndex<NUM_EMPLOYEES/empNumRecsPerFile; fileIndex++) {
    File file = new File(empTableLocation + File.separator + fileIndex + ".json");
    PrintWriter printWriter = new PrintWriter(file);
    for (int recordIndex = fileIndex*empNumRecsPerFile; recordIndex < (fileIndex+1)*empNumRecsPerFile; recordIndex++) {
      String record = String.format("{ \"emp_id\" : %d, \"emp_name\" : \"Employee %d\", \"dept_id\" : %d }",
          recordIndex, recordIndex, recordIndex % NUM_DEPTS);
      printWriter.println(record);
    }
    printWriter.close();
  }

  // Initialize test queries
  groupByQuery = String.format("SELECT dept_id, count(*) as numEmployees FROM dfs.`%s` GROUP BY dept_id", empTableLocation);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:22,代码来源:TestPartitionSender.java

示例2: setup

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerAddTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerAddTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerAddTest.java

示例3: beforeClassSetup

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void beforeClassSetup() throws InterruptedException {
	network = 
			(NeatNetwork) NetworkBuilder
			.create(NetworkType.EVOLUTION)
			.setInputLayer(
					LayerBuilder
					.create()
					.addNodes(1, Activations.sigmoid))
			.addHiddenLayer(
					LayerBuilder
					.create()
					.addNodes(4, Activations.sigmoid))
			.setOutputLayer(
					LayerBuilder
					.create()
					.addNodes(1, Activations.sigmoid)
					)
			.withBiasNode()
			.withSettings(
					NeatSettings
					.create()
					.setRandomSeed(3000))
			.build();		
}
 
开发者ID:hkamran,项目名称:HooIsNeural,代码行数:26,代码来源:CopulateConnectionTest.java

示例4: createTempFile

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void createTempFile() throws Exception {

  File tempFile;
  while (true) {
    tempFile = File.createTempFile("drillFSTest", ".txt");
    if (tempFile.exists()) {
      boolean success = tempFile.delete();
      if (success) {
        break;
      }
    }
  }

  // Write some data
  PrintWriter printWriter = new PrintWriter(tempFile);
  for (int i=1; i<=200000; i++) {
    printWriter.println (String.format("%d, key_%d", i, i));
  }
  printWriter.close();

  tempFilePath = tempFile.getPath();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:TestDrillFileSystem.java

示例5: setup

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
    SharesDataRetrievalServiceLocal billingRetrievalService = mock(SharesDataRetrievalServiceLocal.class);
    when(
            billingRetrievalService.loadOrganizationHistoryRoles(anyLong(),
                    anyLong())).thenReturn(
            Arrays.asList(new OrganizationRole(
                    OrganizationRoleType.SUPPLIER)));
    supplierShareAssembler = spy(new SupplierShareResultAssembler(
            billingRetrievalService));

    createBillingResults();

    mockOrganizationData();
    mockOrganizationHistoryRoles();
    mockGetMarketplaceRevenueSharePercentage();
    mockGetOperatorRevenueSharePercentage();
    mockGetSellerRevenueSharePercentage();
    mockGetProductHistoryData();
    mockGetSubscriptionHistoryData();
    mockGetBillingResults();
    mockFindMarketplaceHistory();
    mockGetOrgData(CUSTOMER);
    mockXmlSearch();
    datatypeFactory = DatatypeFactory.newInstance();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:27,代码来源:SupplierShareResultAssemblerTest.java

示例6: setUp

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
    server.start();
    server.addReference(REF_BIO_ID, REF_ID, REFERENCE_NAME, PATH_TO_REFERENCE);

    //register vcf, no name, no index
    server.addFeatureIndexedFileRegistration(REF_ID, PATH_TO_VCF, null, VCF_ID,
            VCF_BIO_ID, BiologicalDataItemFormat.VCF, true);

    // add another without feature index
    server.addFeatureIndexedFileRegistration(REF_ID, PATH_TO_VCF, null, VCF_ID,
                                             VCF_BIO_ID, BiologicalDataItemFormat.VCF, false);

    //register BAM with name
    server.addFileRegistration(REF_ID, PATH_TO_BAM, PATH_TO_BAI, BAM_NAME, BAM_ID, BAM_BIO_ID,
            BiologicalDataItemFormat.BAM);

    //register BAM without name
    server.addFileRegistration(REF_ID, PATH_TO_BAM, PATH_TO_BAI, null, BAM_ID, BAM_BIO_ID,
            BiologicalDataItemFormat.BAM);

    serverParameters = getDefaultServerOptions(server.getPort());
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:24,代码来源:FileRegistrationHandlerTest.java

示例7: setUp

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    WebserviceTestBase.getMailReader().deleteMails();
    WebserviceTestBase.getOperator().addCurrency("EUR");

    setup = new WebserviceTestSetup();
    supplier1 = setup.createSupplier("Supplier1");
    is = ServiceFactory.getDefault().getIdentityService(
            WebserviceTestBase.getPlatformOperatorKey(),
            WebserviceTestBase.getPlatformOperatorPassword());
    VOUserDetails userDetails = is.getCurrentUserDetails();
    userDetails.setEMail(WebserviceTestBase.getMailReader()
            .getMailAddress());
    is.updateUser(userDetails);

    WebserviceTestBase.getMailReader().deleteMails();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:18,代码来源:IdentityServiceWSPlatformOperatorTest.java

示例8: setUpFixture

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setUpFixture() {

    StringBuilder sb = new StringBuilder();
    sb.append("Lorem ipsum dolor sit amet, eam no tale solet patrioque, est ")
            .append("ne dico veri. Copiosae petentium no eum, has at wisi dicunt causae. Duo ea ")
            .append("animal eligendi honestatis, dico fastidii officiis sit ne. At oblique ")
            .append("docendi verterem ius, te vide cibo gloriatur nam. Ad has possit delicata. ")
            .append("Sit vocibus accusamus an.");
    loremIpsum = sb.toString();

    sb = new StringBuilder();
    for (int i = 0; i < 10000; i++) {
        sb.append(loremIpsum);
    }

    repeatedLoremIpsum = sb.toString();
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:19,代码来源:MessageSerializerTests.java

示例9: initializeJiraDataBase

import org.junit.BeforeClass; //导入依赖的package包/类
/**
 * Initialize data base with 'MDA' JIRA project.
 */
@BeforeClass
public static void initializeJiraDataBase() throws SQLException {
	datasource = new SimpleDriverDataSource(new JDBCDriver(), "jdbc:hsqldb:mem:dataSource", null, null);
	final Connection connection = datasource.getConnection();
	final JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource);
	try {
		ScriptUtils.executeSqlScript(connection,
				new EncodedResource(new ClassPathResource("sql/base-1/jira-create.sql"), StandardCharsets.UTF_8));
		ScriptUtils.executeSqlScript(connection,
				new EncodedResource(new ClassPathResource("sql/base-1/jira.sql"), StandardCharsets.UTF_8));
		jdbcTemplate.queryForList("SELECT * FROM pluginversion WHERE ID = 10075");
	} finally {
		connection.close();
	}
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:19,代码来源:AbstractJiraTest.java

示例10: setupConfigsAndUtils

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setupConfigsAndUtils() throws Exception {
    PRODUCER_CONFIG.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
    PRODUCER_CONFIG.put(ProducerConfig.ACKS_CONFIG, "all");
    PRODUCER_CONFIG.put(ProducerConfig.RETRIES_CONFIG, 0);
    PRODUCER_CONFIG.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
    PRODUCER_CONFIG.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);

    RESULT_CONSUMER_CONFIG.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
    RESULT_CONSUMER_CONFIG.put(ConsumerConfig.GROUP_ID_CONFIG, APP_ID + "-result-consumer");
    RESULT_CONSUMER_CONFIG.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
    RESULT_CONSUMER_CONFIG.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class);
    RESULT_CONSUMER_CONFIG.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);

    STREAMS_CONFIG.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
    STREAMS_CONFIG.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
    STREAMS_CONFIG.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath());
    STREAMS_CONFIG.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.Long().getClass());
    STREAMS_CONFIG.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
    STREAMS_CONFIG.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 0);
    STREAMS_CONFIG.put(IntegrationTestUtils.INTERNAL_LEAVE_GROUP_ON_CLOSE, true);
    STREAMS_CONFIG.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 100);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:24,代码来源:JoinIntegrationTest.java

示例11: init

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException {
    mQClientAPIImpl = mock(MQClientAPIImpl.class);
    defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);

    Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance");
    field.setAccessible(true);
    field.set(defaultMQAdminExtImpl, mqClientInstance);
    field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl");
    field.setAccessible(true);
    field.set(mqClientInstance, mQClientAPIImpl);
    field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl");
    field.setAccessible(true);
    field.set(defaultMQAdminExt, defaultMQAdminExtImpl);

    Properties properties = new Properties();
    properties.setProperty("maxMessageSize", "5000000");
    properties.setProperty("flushDelayOffsetInterval", "15000");
    properties.setProperty("serverSocketRcvBufSize", "655350");
    when(mQClientAPIImpl.getBrokerConfig(anyString(), anyLong())).thenReturn(properties);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:23,代码来源:GetBrokerConfigCommandTest.java

示例12: beforeClass

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
    String queueName = "DEMO.CONTRACT.MOCK";
    System.setProperty("karate.env", "contract");        
    File file = FileUtils.getFileRelativeTo(PaymentServiceContractUsingMockTest.class, "payment-service-mock.feature");
    server = FeatureServer.start(file, 0, false, Collections.singletonMap("queueName", queueName));
    String paymentServiceUrl = "http://localhost:" + server.getPort();
    System.setProperty("payment.service.url", paymentServiceUrl);
    System.setProperty("shipping.queue.name", queueName);
}
 
开发者ID:intuit,项目名称:karate,代码行数:11,代码来源:PaymentServiceContractUsingMockTest.java

示例13: checkAvailability

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void checkAvailability() {
	try {
		new Hmac();
	} catch (WolfCryptException e) {
		if (e.getError() == WolfCryptError.NOT_COMPILED_IN)
			System.out.println("Hmac test skipped: " + e.getError());
		Assume.assumeNoException(e);
	}
}
 
开发者ID:wolfSSL,项目名称:wolfcrypt-jni,代码行数:11,代码来源:HmacTest.java

示例14: setupDefaultTestCluster

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void setupDefaultTestCluster() throws Exception {
  // Create a test implementation of UserService
  // and inject it in SabotNode.
  BINDER_RULE.bind(UserService.class, new UserServiceTestImpl());

  BaseTestQuery.setupDefaultTestCluster();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:TestCustomUserAuthenticator.java

示例15: init

import org.junit.BeforeClass; //导入依赖的package包/类
@BeforeClass
public static void init() {
	Calendar c = Calendar.getInstance();
	c.set(1979, 2, 9, 11, 30);
	c.set(Calendar.SECOND, 0);
	c.set(Calendar.MILLISECOND, 0);
	DATE_VALUE = c.getTime();

	builder = GsonConfiguration.builder();
}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:11,代码来源:TestPropertyBoxSerialization.java


注:本文中的org.junit.BeforeClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。