Java 类org.testng.annotations.BeforeTest 实例源码

项目:openjdk-jdk10    文件:TransitiveDeps.java   
/**
 * 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);
        }
    }
}
项目:openjdk-jdk10    文件:DryRunTest.java   
@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);
}
项目:openjdk-jdk10    文件:ExcludeJmodSectionPluginTest.java   
@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();
}
项目:openjdk-jdk10    文件:UserModuleTest.java   
@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");
}
项目:siddhi-io-http    文件:HttpSinkMethodTypeTestCase.java   
@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";
}
项目:openjdk-jdk10    文件:AddExportsTestWarningError.java   
@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");
}
项目:siddhi-io-http    文件:HttpsSinkTestCase.java   
@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";
}
项目:oneops    文件:OpsProcedureProcessorTest.java   
@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);
}
项目:openjdk-jdk10    文件:AddModsTest.java   
@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");
}
项目:openjdk-jdk10    文件:CacheTest.java   
@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);
}
项目:openjdk-jdk10    文件:UpgradeModulePathTest.java   
@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);

}
项目:openjdk-jdk10    文件:InverseDeps.java   
/**
 * 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);
        }
    }
}
项目:openjdk-jdk10    文件:RemovedJDKInternals.java   
/**
 * 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()));
}
项目:openjdk-jdk10    文件:ListModsTest.java   
@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);
}
项目:morpheus-core    文件:ArrayIOTests.java   
@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());
                    }
                }
            }
        }
    }
}
项目:wherehowsX    文件:HadoopJobHistoryNodeExtractorTest.java   
@BeforeTest
public void setUp() {
  try {
    he = new HadoopJobHistoryNodeExtractor(new LineageTest().properties);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:openjdk-jdk10    文件:AddReadsTestWarningError.java   
@BeforeTest
public void setup() throws Exception {
    ModuleInfoMaker builder = new ModuleInfoMaker(SRC_DIR);
    builder.writeJavaFiles("m1",
        "module m1 { requires m4; }",
        "package p1; public class C1 { " +
        "    public static void main(String... args) {" +
        "        p2.C2 c2 = new p2.C2();" +
        "        p3.C3 c3 = new p3.C3();" +
        "    }" +
        "}"
    );

    builder.writeJavaFiles("m2",
        "module m2 { exports p2; }",
        "package p2; public class C2 { }"
    );

    builder.writeJavaFiles("m3",
        "module m3 { exports p3; }",
        "package p3; public class C3 { }"
    );

    builder.writeJavaFiles("m4",
        "module m4 { requires m2; requires m3; }",
        "package p4; public class C4 { " +
        "    public static void main(String... args) {}" +
        "}"
    );

    builder.compile("m2", MODS_DIR);
    builder.compile("m3", MODS_DIR);
    builder.compile("m4", MODS_DIR);
    builder.compile("m1", MODS_DIR, "--add-reads", "m1=m2,m3");
}
项目:java-maven-testng-starter    文件:AbstractTest.java   
@BeforeTest
@Parameters({"url"})
public void setup(String url) {
  // Set the path to the geckodriver
  System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver");

  // Instantiate a new Page and navigate 
  // to the url specified in the testng.xml
  page = new Page(new FirefoxDriver());
  page.navigate(url);
}
项目:openjdk-jdk10    文件:JaxbMarshallTest.java   
@BeforeTest
public void setUp() throws IOException {
    // Create test directory inside scratch
    testWorkDir = Paths.get(System.getProperty("user.dir", "."));
    // Save its URL
    testWorkDirUrl = testWorkDir.toUri().toURL();
    // Get test source directory path
    testSrcDir = Paths.get(System.getProperty("test.src", "."));
    // Get path of xjc result folder
    xjcResultDir = testWorkDir.resolve(TEST_PACKAGE);
    // Copy schema document file to scratch directory
    Files.copy(testSrcDir.resolve(XSD_FILENAME), testWorkDir.resolve(XSD_FILENAME), REPLACE_EXISTING);
}
项目:openjdk-jdk10    文件:CLICompatibility.java   
@BeforeTest
public void setupResourcesForJar() throws Exception {
    // Copy the files that we are going to use for creating/updating test
    // jar files, so that they can be referred to without '-C dir'
    Files.copy(TEST_CLASSES.resolve(RES1), USER_DIR.resolve(RES1));
    Files.copy(TEST_CLASSES.resolve(RES2), USER_DIR.resolve(RES2));
}
项目:oneops    文件:SearchSenderTest.java   
@BeforeTest
public void initContext() {
    context = new ClassPathXmlApplicationContext("classpath:test-commons-context.xml");
    consumer = context.getBean(JMSConsumer.class);
    searchPublisher = context.getBean(SearchPublisher.class);
    retryDir = context.getBean("retryDir", String.class);
    while (!consumer.isStarted()) {
        //wait until the consumers are started
    }
}
项目:oneops    文件:OpsEventListenerTest.java   
@BeforeTest
public void init(){
    //listener.setOpsCiStateDao(mock(OpsCiStateDao.class));
    listener.setOpsEventDao(mock(OpsEventDao.class));
    listener.setOpsEventPub(mock(OpsEventPublisher.class));

    SensorHeartBeat sensorHeartBeat = mock(SensorHeartBeat.class);
    when(sensorHeartBeat.getLatestHearBeatTime(anyString())).thenReturn(1L);
    listener.setSensorHeartBeat(sensorHeartBeat);

}
项目:otter-G    文件:ExecutorTemplateTest.java   
@BeforeTest
public void setUp() {
    try {
        template.afterPropertiesSet();
    } catch (Exception e) {
        want.fail(e.getMessage());
    }
}
项目:jfrog-idea-plugin    文件:FiltersTests.java   
/**
 * Init the FilterManager to accept all severities and MIT license.
 */
@BeforeTest
public void init() {
    super.init();
    filterManager = new FilterManager();
    severitiesFilters = filterManager.selectedSeverities;
    for (Severity severity : Severity.values()) {
        severitiesFilters.put(severity, true);
    }
    licensesFilters = filterManager.selectedLicenses;
    licensesFilters.put(createLicense("MIT"), true);
}
项目:openjdk-jdk10    文件:AddExportsTest.java   
@BeforeTest
public void compileTestModules() throws Exception {

    // javac -d mods/m1 src/m1/**
    boolean compiled = CompilerUtils.compile(
            SRC_DIR.resolve(TEST1_MODULE),
            MODS_DIR.resolve(TEST1_MODULE),
            "--add-exports", "java.base/jdk.internal.misc=m1");
    assertTrue(compiled, "module " + TEST1_MODULE + " did not compile");

    // javac -d upgrademods/java.transaction src/java.transaction/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve("java.transaction"),
            UPGRADE_MODS_DIRS.resolve("java.transaction"));
    assertTrue(compiled, "module java.transaction did not compile");

    // javac --upgrade-module-path upgrademods -d mods/m2 src/m2/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve(TEST2_MODULE),
            MODS_DIR.resolve(TEST2_MODULE),
            "--upgrade-module-path", UPGRADE_MODS_DIRS.toString(),
            "--add-exports", "java.transaction/javax.transaction.internal=m2");
    assertTrue(compiled, "module " + TEST2_MODULE + " did not compile");

    // javac -d mods/m3 src/m3/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve(TEST3_MODULE),
            MODS_DIR.resolve(TEST3_MODULE));
    assertTrue(compiled, "module " + TEST3_MODULE + " did not compile");

    // javac -d mods/m4 src/m4/**
    compiled = CompilerUtils.compile(
            SRC_DIR.resolve(TEST4_MODULE),
            MODS_DIR.resolve(TEST4_MODULE));
    assertTrue(compiled, "module " + TEST4_MODULE + " did not compile");
}
项目:heat    文件:SingleMode.java   
/**
 * Method that takes tests parameters and sets some environment properties.
 * @param inputJsonParamPath path of the json input file with input data for tests
 * @param enabledEnvironments environments enabled for the specific suite
 * @param context testNG context
 */
@BeforeTest
@Override
@Parameters(value = {INPUT_JSON_PATH, ENABLED_ENVIRONMENTS})
public void beforeTestCase(String inputJsonParamPath,
                           String enabledEnvironments,
                           ITestContext context) {
    super.beforeTestCase(inputJsonParamPath, enabledEnvironments, context);
    this.webappName = TestSuiteHandler.getInstance().getWebappName();
    this.webappPath = TestSuiteHandler.getInstance().getEnvironmentHandler().getEnvironmentUrl(webappName);
}
项目:Indra    文件:MongoIndraDriverIT.java   
@BeforeTest
private void configure() {
    final String mongoURI = System.getProperty("indra.mongoURI");
    if (mongoURI == null) {
        Assert.fail("System.getProperty(\"indra.mongoURI\") is null. Provide a mongoURI to execute the integration test.");
    }

    MongoClientOptions builder = MongoClientOptions.builder().serverSelectionTimeout(5000).build();
    MongoClient mongoClient = new MongoClient(mongoURI, builder);
    vectorSpaceFactory = new MongoVectorSpaceFactory(mongoClient);
    translatorFactory = new MongoTranslatorFactory(mongoClient);
}
项目:openjdk-jdk10    文件:RequestBodyTest.java   
@BeforeTest
public void setup() throws Exception {
    LightWeightHttpServer.initServer();
    httpURI = LightWeightHttpServer.httproot + "echo/foo";
    httpsURI = LightWeightHttpServer.httpsroot + "echo/foo";

    SSLContext ctx = LightWeightHttpServer.ctx;
    client = HttpClient.newBuilder()
                       .sslContext(ctx)
                       .version(HttpClient.Version.HTTP_1_1)
                       .followRedirects(HttpClient.Redirect.ALWAYS)
                       .executor(exec)
                       .build();
}
项目:openjdk-jdk10    文件:PatchSystemModules.java   
@BeforeTest
private void setup() throws Throwable {
    Path src = TEST_SRC.resolve("src");
    Path src1 = TEST_SRC.resolve("src1");

    for (String name : modules) {
        assertTrue(CompilerUtils.compile(src.resolve(name),
                                         MODS_DIR,
                                         "--module-source-path", src.toString()));
    }

    // compile patched source
    String patchDir = src1.resolve(JAVA_BASE).toString();
    assertTrue(CompilerUtils.compile(src1.resolve(JAVA_BASE),
                                     PATCH_DIR.resolve(JAVA_BASE),
                                     "--patch-module", "java.base=" + patchDir));
    assertTrue(CompilerUtils.compile(src1.resolve("m2"),
                                     PATCH_DIR.resolve("m2")));

    createJars();

    // create an image with only m1 and m2
    if (Files.exists(JMODS)) {
        // create an image with m1,m2
        createImage();
    }

    // compile a different version of m1
    Path tmp = Paths.get("tmp");
    assertTrue(CompilerUtils.compile(src1.resolve("m1"), tmp,
                                     "--module-path", MODS_DIR.toString(),
                                     "--module-source-path", src1.toString()));

    // package new_m1.jar
    jar("--create",
        "--file=" + NEW_M1_JAR.toString(),
        "-C", tmp.resolve("m1").toString(), ".");
}
项目:openjdk-jdk10    文件:ImageModules.java   
@BeforeTest
private void setup() throws Throwable {
    Path src = TEST_SRC.resolve("src");
    for (String name : modules) {
        assertTrue(CompilerUtils.compile(src.resolve(name),
                                         MODS_DIR,
                                         "--module-source-path", src.toString()));
    }

    assertTrue(CompilerUtils.compile(src.resolve("cp"),
                                     CP_DIR,
                                     "--module-path", MODS_DIR.toString(),
                                     "--add-modules", "message.writer"));
}
项目:jdk8u-jdk    文件:JaxbMarshallTest.java   
@BeforeTest
public void setUp() throws IOException {
    // Create test directory inside scratch
    testWorkDir = Paths.get(System.getProperty("user.dir", "."));
    // Save its URL
    testWorkDirUrl = testWorkDir.toUri().toURL();
    // Get test source directory path
    testSrcDir = Paths.get(System.getProperty("test.src", "."));
    // Get path of xjc result folder
    xjcResultDir = testWorkDir.resolve(TEST_PACKAGE);
    // Copy schema document file to scratch directory
    Files.copy(testSrcDir.resolve(XSD_FILENAME), testWorkDir.resolve(XSD_FILENAME), REPLACE_EXISTING);
}
项目:strongbox    文件:AWSConfigTest.java   
@BeforeTest
public void setup() {
    AWSCLIConfigFile.Section section = new AWSCLIConfigFile.Section(profile.name);
    section.addProperty(mfa_serial);
    section.addProperty(source_profile);
    section.addProperty(role_arn);
    section.addProperty(aws_access_key_id);
    section.addProperty(aws_secret_access_key);

    Map<String, AWSCLIConfigFile.Section> sectionMap = new HashMap<>();
    sectionMap.put(profile.name, section);

    config = new AWSConfig(new AWSCLIConfigFile.Config(sectionMap));
}
项目:openjdk-jdk10    文件:DirPermissionDenied.java   
@BeforeTest
public void setup() throws Throwable {
    // mkdir and chmod "333"
    Files.createDirectories(TEST_DIR);
    ProcessTools.executeCommand("chmod", "333", TEST_DIR.toString())
                .outputTo(System.out)
                .errorTo(System.out)
                .shouldHaveExitValue(0);
}
项目:openjdk-jdk10    文件:JavaClassPathTest.java   
@BeforeTest
public void setup() throws Exception {
    boolean compiled = CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE),
                                             MODS_DIR.resolve(TEST_MODULE));
    assertTrue(compiled, "module " + TEST_MODULE + " did not compile");

    // add the class and a resource to the current working directory
    Path file = Paths.get("jdk/test/Main.class");
    Files.createDirectories(file.getParent());
    Files.copy(MODS_DIR.resolve(TEST_MODULE).resolve(file), file);

    Path res = Paths.get("jdk/test/res.properties");
    Files.createFile(res);

    ToolProvider jartool = ToolProvider.findFirst("jar").orElseThrow(
        () -> new RuntimeException("jar tool not found")
    );

    Path jarfile = LIB_DIR.resolve("m.jar");
    Files.createDirectories(LIB_DIR);
    assertTrue(jartool.run(System.out, System.err, "cfe",
                           jarfile.toString(), TEST_MAIN,
                           file.toString()) == 0);

    Path manifest = LIB_DIR.resolve("manifest");
    try (BufferedWriter writer = Files.newBufferedWriter(manifest)) {
        writer.write("CLASS-PATH: lib/m.jar");
    }
    jarfile = LIB_DIR.resolve("m1.jar");
    assertTrue(jartool.run(System.out, System.err, "cfme",
                           jarfile.toString(), manifest.toString(), TEST_MAIN,
                           file.toString()) == 0);
}
项目:openjdk-jdk10    文件:LimitModsTest.java   
@BeforeTest
public void compileTestModule() throws Exception {

    // javac -d mods/$TESTMODULE src/$TESTMODULE/**
    boolean compiled
        = CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE),
            MODS_DIR.resolve(TEST_MODULE));

    assertTrue(compiled, "test module did not compile");
}
项目:openjdk-jdk10    文件:GenModuleInfo.java   
/**
 * Compiles all modules used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(MODS_DIR);
    CompilerUtils.cleanDir(LIBS_DIR);
    CompilerUtils.cleanDir(DEST_DIR);
    CompilerUtils.cleanDir(NEW_MODS_DIR);

    compileModules(MODS_DIR);

    createJARFiles(MODS_DIR, LIBS_DIR);
}
项目:openjdk-jdk10    文件:CheckModuleTest.java   
/**
 * Compiles classes used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(MODS_DIR);
    modules.forEach(mn ->
        assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn)));
}
项目:openjdk-jdk10    文件:SplitPackage.java   
@BeforeTest
private void setup() throws Exception {
    Files.createDirectory(BAR_DIR);

    Path pkgDir = Paths.get("p");
    // compile classes in package p
    assertTrue(CompilerUtils.compile(SRC_DIR.resolve(pkgDir), BAR_DIR));

    // move p.Foo to a different directory
    Path foo = pkgDir.resolve("Foo.class");
    Files.createDirectories(FOO_DIR.resolve(pkgDir));
    Files.move(BAR_DIR.resolve(foo), FOO_DIR.resolve(foo),
               StandardCopyOption.REPLACE_EXISTING);
}
项目:openjdk-jdk10    文件:ShowReplacement.java   
/**
 * Compiles classes used by the test
 */
@BeforeTest
public void compileAll() throws Exception {
    CompilerUtils.cleanDir(CLASSES_DIR);

    Path tmp = Paths.get("tmp");
    assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "apple"), tmp));
    assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "q"),
                                     CLASSES_DIR,
                                     "-cp", tmp.toString(),
                                     "--add-exports=java.base/sun.security.util=ALL-UNNAMED"));
}
项目:openjdk-jdk10    文件:ModuleTest.java   
/**
 * Compiles all sample classes
 */
@BeforeTest
public void compileAll() throws Exception {
    assertTrue(CompilerUtils.compile(
            Paths.get(TEST_SRC, "src", "mserver"),
            Paths.get(SERVER_EXP)));

    JarUtils.createJarFile(
            Paths.get(SERVER_JAR),
            Paths.get(SERVER_EXP));

    assertTrue(CompilerUtils.compile(
            Paths.get(TEST_SRC, "src", "mclient"),
            Paths.get(CLIENT_EXP),
            "-cp", SERVER_JAR));

    JarUtils.createJarFile(
            Paths.get(CLIENT_JAR),
            Paths.get(CLIENT_EXP));

    assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "mtest"),
            Paths.get(MTEST_EXP),
            "-cp", pathJoin(CLIENT_JAR, SERVER_JAR)));

    JarUtils.createJarFile(
            Paths.get(MTEST_JAR),
            Paths.get(MTEST_EXP));
}