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


Java BeforeTest類代碼示例

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


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

示例1: compileAll

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
/**
 * Compiles all modules used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(MODS_DIR);
    CompilerUtils.cleanDir(LIBS_DIR);

    for (String mn : modules) {
        // compile a module
        assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn));

        // create JAR files with no module-info.class
        Path root = MODS_DIR.resolve(mn);
        try (Stream<Path> stream = Files.walk(root, Integer.MAX_VALUE)) {
            Stream<Path> entries = stream.filter(f -> {
                String fn = f.getFileName().toString();
                return fn.endsWith(".class") && !fn.equals("module-info.class");
            });
            JdepsUtil.createJar(LIBS_DIR.resolve(mn + ".jar"), root, entries);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:TransitiveDeps.java

示例2: compileTestModule

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void compileTestModule() throws Exception {

    // javac -d mods/$TESTMODULE src/$TESTMODULE/**
    assertTrue(CompilerUtils.compile(SRC_DIR.resolve(M_MODULE),
                                     MODS_DIR,
                                     "--module-source-path", SRC_DIR.toString()));

    assertTrue(CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE),
                                     MODS_DIR,
                                     "--module-source-path", SRC_DIR.toString()));

    Files.createDirectories(LIBS_DIR);

    // create JAR files with no module-info.class
    assertTrue(jar(M_MODULE, "p/Lib.class") == 0);
    assertTrue(jar(TEST_MODULE, "jdk/test/Main.class") == 0);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:DryRunTest.java

示例3: setup

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
private void setup() throws Exception {
    // build jmod files
    JmodFileBuilder m1 = new JmodFileBuilder("m1");
    m1.headerFile("m1a.h");
    m1.headerFile("m1b.h");
    m1.build();

    JmodFileBuilder m2 = new JmodFileBuilder("m2");
    m2.headerFile("m2.h");
    m2.manPage("tool2.1");
    m2.build();

    JmodFileBuilder m3 = new JmodFileBuilder("m3");
    m3.manPage("tool3.1");
    m3.build();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:ExcludeJmodSectionPluginTest.java

示例4: compileAll

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void compileAll() throws Throwable {
    if (!hasJmods()) return;

    for (String mn : modules) {
        Path msrc = SRC_DIR.resolve(mn);
        assertTrue(CompilerUtils.compile(msrc, MODS_DIR,
            "--module-source-path", SRC_DIR.toString(),
            "--add-exports", "java.base/jdk.internal.module=" + mn,
            "--add-exports", "java.base/jdk.internal.org.objectweb.asm=" + mn));
    }

    if (Files.exists(IMAGE)) {
        FileUtils.deleteFileTreeUnchecked(IMAGE);
    }

    createImage(IMAGE, "m1", "m3");

    createJmods("m1", "m4");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:UserModuleTest.java

示例5: init

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void init() {
    payload = "<events>"
                + "<event>"
                    + "<symbol>WSO2</symbol>"
                    + "<price>55.645</price>"
                    + "<volume>100</volume>"
                + "</event>"
            + "</events>";
    expected = "<events>"
                + "<event>"
                    + "<symbol>WSO2</symbol>"
                    + "<price>55.645</price>"
                    + "<volume>100</volume>"
                + "</event>"
            + "</events>\n";
}
 
開發者ID:wso2-extensions,項目名稱:siddhi-io-http,代碼行數:18,代碼來源:HttpSinkMethodTypeTestCase.java

示例6: setup

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void setup() throws Exception {
    ModuleInfoMaker builder = new ModuleInfoMaker(SRC_DIR);
    builder.writeJavaFiles("m1",
        "module m1 { }",
        "package p1; public class C1 { " +
            "    public static void main(String... args) {}" +
            "}");

    builder.writeJavaFiles("m2",
        "module m2 { requires m1; exports p2; }",
        "package p2; public class C2 {  private p1.C1 c1; }");

    builder.writeJavaFiles("m3",
        "module m3 { requires m2; }",
        "package p3; class C3 { " +
            "    p1.C1 c; " +
            "    public static void main(String... args) { new p2.C2(); }" +
            "}");

    builder.compile("m1", MODS_DIR);
    builder.compile("m2", MODS_DIR, "--add-exports", "m1/p1=m2");
    builder.compile("m3", MODS_DIR, "--add-exports", "m1/p1=m3");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:AddExportsTestWarningError.java

示例7: init

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void init(){
	///set up the mock of OpsMapper and CmsCmProcessor
	when(opsMapper.getProcedureForCi( CI_WITH_ACTIVE_PROC ,null,null,null)).thenReturn(blockingList);
	when(opsMapper.getProcedureForCi( CI_WITH_NO_ACTIVE_PROC,null,null,null)).thenReturn(null);
	when(opsMapper.isActiveDeploymentExistForNsPath(NS_FOR_WHICH_ACTIVE_DEPLOYMENT)).thenReturn(true);
	
	when(opsMapper.getProcedureForCiByAction(CI_WITH_ACTIVE_ACTION, null, null, null)).thenReturn(blockingList);
	
	procProcessor.setOpsMapper(opsMapper);
	
	mockCi.setNsPath(NS_FOR_WHICH_ACTIVE_DEPLOYMENT);
	
	when(cmProcessor.getCiByIdNaked(anyLong())).thenReturn(mockCi);
	procProcessor.setCmProcessor(cmProcessor);

	CmsOpsProcedure opsProcThatBlocks=new CmsOpsProcedure();
	opsProcThatBlocks.setCiId(BLOCKING_PROC_ID);
	opsProcThatBlocks.setProcedureCiId(BLOCKING_PROC_ID+1);
	opsProcThatBlocks.setProcedureName("mockProcedureX");
	opsProcThatBlocks.setProcedureState(OpsProcedureState.active);
	blockingList.add(opsProcThatBlocks);
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:24,代碼來源:OpsProcedureProcessorTest.java

示例8: compile

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void compile() throws Exception {
    // javac -d mods1/test src/test/**
    boolean compiled = CompilerUtils.compile(
        SRC_DIR.resolve(TEST_MODULE),
        MODS1_DIR.resolve(TEST_MODULE)
    );
    assertTrue(compiled, "test did not compile");

    // javac -d mods1/logger src/logger/**
    compiled= CompilerUtils.compile(
        SRC_DIR.resolve(LOGGER_MODULE),
        MODS2_DIR.resolve(LOGGER_MODULE)
    );
    assertTrue(compiled, "test did not compile");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:AddModsTest.java

示例9: compileTestModules

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void compileTestModules() throws Exception {

    for (String mn : new String[] {MAIN_BUNDLES_MODULE, TEST_MODULE}) {
        boolean compiled =
            CompilerUtils.compile(SRC_DIR.resolve(mn),
                                  MODS_DIR.resolve(mn),
                        "--module-path", MODS_DIR.toString());
        assertTrue(compiled, "module " + mn + " did not compile");
    }

    Path res = Paths.get("jdk", "test", "resources", "MyResources.properties");
    Path dest = MODS_DIR.resolve(MAIN_BUNDLES_MODULE).resolve(res);
    Files.createDirectories(dest.getParent());
    Files.copy(SRC_DIR.resolve(MAIN_BUNDLES_MODULE).resolve(res), dest);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:CacheTest.java

示例10: setup

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void setup() throws Exception {

    // javac -d mods/java.enterprise src/java.enterprise/**
    boolean compiled = CompilerUtils.compile(
            SRC_DIR.resolve("java.enterprise"),
            MODS_DIR.resolve("java.enterprise"));
    assertTrue(compiled);

    // javac -d upgrademods/java.transaction --module-path mods src/java.transaction/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve("java.transaction"),
            UPGRADEDMODS_DIR.resolve("java.transaction"),
            "--module-path", MODS_DIR.toString());
    assertTrue(compiled);

    // javac -d mods --upgrade-module-path upgrademods --module-path mods src/test/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve("test"),
            MODS_DIR.resolve("test"),
            "--upgrade-module-path", UPGRADEDMODS_DIR.toString(),
            "--module-path", MODS_DIR.toString());
    assertTrue(compiled);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:UpgradeModulePathTest.java

示例11: compileAll

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
/**
 * Compiles classes used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(MODS_DIR);

    for (String mn : modules) {
        // compile a module
        assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn));

        // create JAR files with no module-info.class
        Path root = MODS_DIR.resolve(mn);

        try (Stream<Path> stream = Files.walk(root, Integer.MAX_VALUE)) {
            Stream<Path> entries = stream.filter(f -> {
                String fn = f.getFileName().toString();
                return fn.endsWith(".class") && !fn.equals("module-info.class");
            });
            JdepsUtil.createJar(LIBS_DIR.resolve(mn + ".jar"), root, entries);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:InverseDeps.java

示例12: compileAll

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
/**
 * Compiles classes used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(PATCHES_DIR);
    CompilerUtils.cleanDir(CLASSES_DIR);

    // compile sun.misc types
    Path sunMiscSrc = Paths.get(TEST_SRC, "patches", JDK_UNSUPPORTED);
    Path patchDir = PATCHES_DIR.resolve(JDK_UNSUPPORTED);
    assertTrue(CompilerUtils.compile(sunMiscSrc, patchDir,
                                     "--patch-module", JDK_UNSUPPORTED + "=" + sunMiscSrc.toString()));

    // compile com.sun.image.codec.jpeg types
    Path codecSrc = Paths.get(TEST_SRC, "patches", "java.desktop");
    Path codecDest = PATCHES_DIR;
    assertTrue(CompilerUtils.compile(codecSrc, codecDest));

    // patch jdk.unsupported and set -cp to codec types
    assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "p"),
                                     CLASSES_DIR,
                                     "--patch-module", "jdk.unsupported=" + patchDir,
                                     "-cp", codecDest.toString()));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:RemovedJDKInternals.java

示例13: setup

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void setup() throws Exception {
    boolean compiled;

    // javac -d mods/m1 --module-path mods src/m1/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve("m1"),
            MODS_DIR.resolve("m1"));
    assertTrue(compiled);

    // javac -d upgrademods/java.transaction --module-path mods src/java.transaction/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve("java.transaction"),
            UPGRADEMODS_DIR.resolve("java.transaction"));
    assertTrue(compiled);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:ListModsTest.java

示例14: deleteFiles

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void deleteFiles() {
    if (directory.exists() && directory.isDirectory()) {
        final File[] files = directory.listFiles();
        if (files != null) {
            for (File file : files) {
                if (file.isFile() && file.getName().endsWith(".ser")) {
                    if (file.delete()) {
                        System.out.println("Deleted file " + file.getAbsolutePath());
                    }
                }
            }
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:16,代碼來源:ArrayIOTests.java

示例15: setUp

import org.testng.annotations.BeforeTest; //導入依賴的package包/類
@BeforeTest
public void setUp() {
  try {
    he = new HadoopJobHistoryNodeExtractor(new LineageTest().properties);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
開發者ID:thomas-young-2013,項目名稱:wherehowsX,代碼行數:9,代碼來源:HadoopJobHistoryNodeExtractorTest.java


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