當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。