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


Java BeforeClass类代码示例

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


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

示例1: setUpDataSource

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass(alwaysRun = true)
static public void setUpDataSource() throws Exception {
    File propertiesFile = new File("config/application.properties");
    if (!propertiesFile.exists()) {
        throw new IllegalStateException(
                "Missing configuration file, please create config/application.properties based on sample.");
    }
    Properties props = new Properties();
    try (FileInputStream fis = new FileInputStream(propertiesFile)) {
        props.load(fis);
    }

    PGPoolingDataSource dataSource = new PGPoolingDataSource();
    dataSource.setServerName(props.getProperty("db.server"));
    dataSource.setDatabaseName(props.getProperty("db.database"));
    dataSource.setUser(props.getProperty("db.user"));
    dataSource.setPassword(props.getProperty("db.password"));
    dataSource.setPortNumber(Integer.parseInt(props.getProperty("db.port")));
    BaseITest.dataSource = dataSource;
}
 
开发者ID:OasisDigital,项目名称:nges,代码行数:21,代码来源:BaseITest.java

示例2: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodHandleAccessLong.class, "final_v", long.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodHandleAccessLong.class, "v", long.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodHandleAccessLong.class, "static_final_v", long.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodHandleAccessLong.class, "static_v", long.class);

    vhArray = MethodHandles.arrayElementVarHandle(long[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestMethodHandleAccessLong.java

示例3: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws IOException{
  out = new ByteArrayOutputStream();
  Configuration config = new Configuration();
  try(MDSRecordWriter writer = new MDSRecordWriter(out , config )) {

    JacksonMessageReader messageReader = new JacksonMessageReader();
    BufferedReader in = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResource("blackbox/TestMultiArray.json").openStream()));
    String line = in.readLine();
    while (line != null) {
      IParser parser = messageReader.create(line);
      writer.addParserRow(parser);
      line = in.readLine();
    }
  }
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:17,代码来源:TestMultiArray.java

示例4: initialize

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void initialize() throws Exception {
    CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
    creator.compileEntries();
    creator.buildMultiReleaseJar();
    int RUNTIME_VERSION = Runtime.version().major();
    rtVersion = Integer.getInteger("jdk.util.jar.version", RUNTIME_VERSION);
    String mrprop = System.getProperty("jdk.util.jar.enableMultiRelease", "");
    if (mrprop.equals("false")) {
        rtVersion = BASE_VERSION;
    } else if (rtVersion < BASE_VERSION) {
        rtVersion = BASE_VERSION;
    } else if (rtVersion > RUNTIME_VERSION) {
        rtVersion = RUNTIME_VERSION;
    }
    force = mrprop.equals("force");

    initializeClassLoader();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:MultiReleaseJarProperties.java

示例5: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestAccessDouble.class, "final_v", double.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestAccessDouble.class, "v", double.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestAccessDouble.class, "static_final_v", double.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestAccessDouble.class, "static_v", double.class);

    vhArray = MethodHandles.arrayElementVarHandle(double[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestAccessDouble.java

示例6: beforeClass

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT)
public void beforeClass() {
    // set up the client        
    client = new AsyncDocumentClient.Builder()
            .withServiceEndpoint(TestConfigurations.HOST)
            .withMasterKey(TestConfigurations.MASTER_KEY)
            .withConnectionPolicy(ConnectionPolicy.GetDefault())
            .withConsistencyLevel(ConsistencyLevel.Session)
            .build();
    registerSpyProxy();

    Database databaseDefinition = new Database();
    databaseDefinition.setId(DATABASE_ID);

    try {
        client.deleteDatabase(Utils.getDatabaseLink(databaseDefinition, true), null).toBlocking().single();
    } catch (Exception e) {
        // ignore failure if it doesn't exist
    }

    database = client.createDatabase(databaseDefinition, null).toBlocking().single().getResource();
    collection = client.createCollection(database.getSelfLink(), getCollectionDefinition(), null).toBlocking().single().getResource();
}
 
开发者ID:Azure,项目名称:azure-documentdb-rxjava,代码行数:24,代码来源:RetryCreateDocumentTest.java

示例7: setUp

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
protected void setUp() throws Exception {
    // A SessionFactory is set up once for an application!
    final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
            .configure() // configures settings from hibernate.cfg.xml
            .build();
    try {
        sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();
    }
    catch (Exception e) {
        e.printStackTrace();
        // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
        // so destroy it manually.
        StandardServiceRegistryBuilder.destroy( registry );
    }
}
 
开发者ID:SpaceHead1C,项目名称:module-template,代码行数:17,代码来源:HbConnectionTest.java

示例8: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeByte.class, "final_v", byte.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeByte.class, "v", byte.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeByte.class, "static_final_v", byte.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeByte.class, "static_v", byte.class);

    vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestMethodTypeByte.java

示例9: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeFloat.class, "final_v", float.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeFloat.class, "v", float.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeFloat.class, "static_final_v", float.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeFloat.class, "static_v", float.class);

    vhArray = MethodHandles.arrayElementVarHandle(float[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestMethodTypeFloat.java

示例10: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeDouble.class, "final_v", double.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodTypeDouble.class, "v", double.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeDouble.class, "static_final_v", double.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodTypeDouble.class, "static_v", double.class);

    vhArray = MethodHandles.arrayElementVarHandle(double[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestMethodTypeDouble.java

示例11: registerUser

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass(enabled = false)
public void registerUser() throws CipherException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
    ssp = createNewMember(2, 100)
            .thenApply(papyrusMember -> {
                allTransactionsMinedAsync(asList(papyrusMember.refillTransaction, papyrusMember.mintTransaction));
                return papyrusMember;
            }).join();
    sspRegistrar = createNewMember(2, 100)
            .thenApply(papyrusMember -> {
                allTransactionsMinedAsync(asList(papyrusMember.refillTransaction, papyrusMember.mintTransaction));
                return papyrusMember;
            }).join();
    dao = loadDaoContract(ssp.transactionManager);
    daoRegistrar = loadDaoContract(sspRegistrar.transactionManager);
    token = asCf(dao.token()).thenApply(tokenAddress -> loadTokenContract(tokenAddress.toString(), ssp.transactionManager)).join();
    tokenRegistrar = asCf(daoRegistrar.token())
            .thenApply(tokenAddress -> loadTokenContract(tokenAddress.toString(), sspRegistrar.transactionManager)
            ).join();
    sspRegistry = asCf(daoRegistrar.sspRegistry())
            .thenApply(sspRegistryAddress -> loadSspRegistry(sspRegistryAddress.toString(), ssp.transactionManager))
            .join();
    initDepositContract();
}
 
开发者ID:papyrusglobal,项目名称:smartcontracts,代码行数:24,代码来源:SSPTest.java

示例12: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    vhFinalField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodHandleAccessBoolean.class, "final_v", boolean.class);

    vhField = MethodHandles.lookup().findVarHandle(
            VarHandleTestMethodHandleAccessBoolean.class, "v", boolean.class);

    vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodHandleAccessBoolean.class, "static_final_v", boolean.class);

    vhStaticField = MethodHandles.lookup().findStaticVarHandle(
        VarHandleTestMethodHandleAccessBoolean.class, "static_v", boolean.class);

    vhArray = MethodHandles.arrayElementVarHandle(boolean[].class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:VarHandleTestMethodHandleAccessBoolean.java

示例13: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws SAXException, IOException, ParserConfigurationException {
    sf = newSchemaFactory();
    assertNotNull(sf);

    ifac = XMLInputFactory.newInstance();

    xsd1 = Files.readAllBytes(Paths.get(XML_DIR + "test.xsd"));
    xsd2 = Files.readAllBytes(Paths.get(XML_DIR + "test1.xsd"));

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    xsdDoc1 = db.parse(newInputStream(xsd1));
    xsdDoc2 = db.parse(newInputStream(xsd2));

    xml = Files.readAllBytes(Paths.get(XML_DIR + "test.xml"));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:SchemaFactoryTest.java

示例14: startftp

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
 protected void startftp() throws Exception
 {
    fakeFtpServer = new FakeFtpServer();
    fakeFtpServer.setServerControlPort(8089);  // use any free port

    FileSystem fileSystem = new UnixFakeFileSystem();
    fileSystem.add(new FileEntry("/data/s1-level-1-calibration.xsd", "<schema/>"));
    fileSystem.add(new FileEntry("/data/s1-object-types.xsd", "<schema/>"));
    fileSystem.add(new FileEntry("/data/GOM_EXT_2PNPDE20070312_232536_000000542056_00202_26308_1271.N1", "GOMOS DATA!"));
    fileSystem.add(new FileEntry ("/data/S1A_IW_SLC__1SDV_20141003T054235_20141003T054304_002661_002F66_D5C8.SAFE/manifest.safe", "<XFDU/>"));
    fileSystem.add(new FileEntry ("/data/S1A_EW_GRDH_1SSH_20120101T022934_20120101T022945_001770_000001_AF02.SAFE/manifest.safe", "<XFDU/>"));
    fileSystem.add(new FileEntry("/data/manifest.safe", "<XFDU/>"));
    
    fakeFtpServer.setFileSystem(fileSystem);

    UserAccount userAccount = new UserAccount("user", "password", "/");
    fakeFtpServer.addUserAccount(userAccount);
    
    fakeFtpServer.start();
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:22,代码来源:ScannerFactoryTest.java

示例15: setup

import org.testng.annotations.BeforeClass; //导入依赖的package包/类
@BeforeClass
public void setup() throws Throwable {
    if (Files.notExists(JMODS)) {
        return;
    }

    Files.createDirectories(MODS);

    for (String mn : MODULES) {
        Path mod = MODS.resolve(mn);
        if (!CompilerUtils.compile(SRC.resolve(mn), mod)) {
            throw new AssertionError("Compilation failure. See log.");
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:AllModulePath.java


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