当前位置: 首页>>代码示例>>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;未经允许,请勿转载。