/**
* 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);
}
}
}
java类org.testng.annotations.BeforeTest的实例源码
TransitiveDeps.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
DryRunTest.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
@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);
}
ExcludeJmodSectionPluginTest.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
@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();
}
UserModuleTest.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
@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");
}
HttpSinkMethodTypeTestCase.java 文件源码
项目:siddhi-io-http
阅读 26
收藏 0
点赞 0
评论 0
@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";
}
AddExportsTestWarningError.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
@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");
}
HttpsSinkTestCase.java 文件源码
项目:siddhi-io-http
阅读 25
收藏 0
点赞 0
评论 0
@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";
}
OpsProcedureProcessorTest.java 文件源码
项目:oneops
阅读 31
收藏 0
点赞 0
评论 0
@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);
}
AddModsTest.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
@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");
}
CacheTest.java 文件源码
项目:openjdk-jdk10
阅读 36
收藏 0
点赞 0
评论 0
@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);
}
UpgradeModulePathTest.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
InverseDeps.java 文件源码
项目:openjdk-jdk10
阅读 29
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
}
RemovedJDKInternals.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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()));
}
ListModsTest.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
ArrayIOTests.java 文件源码
项目:morpheus-core
阅读 25
收藏 0
点赞 0
评论 0
@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());
}
}
}
}
}
}
HadoopJobHistoryNodeExtractorTest.java 文件源码
项目:wherehowsX
阅读 27
收藏 0
点赞 0
评论 0
@BeforeTest
public void setUp() {
try {
he = new HadoopJobHistoryNodeExtractor(new LineageTest().properties);
} catch (Exception e) {
e.printStackTrace();
}
}
AddReadsTestWarningError.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
@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");
}
AbstractTest.java 文件源码
项目:java-maven-testng-starter
阅读 31
收藏 0
点赞 0
评论 0
@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);
}
JaxbMarshallTest.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
CLICompatibility.java 文件源码
项目:openjdk-jdk10
阅读 34
收藏 0
点赞 0
评论 0
@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));
}
SearchSenderTest.java 文件源码
项目:oneops
阅读 23
收藏 0
点赞 0
评论 0
@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
}
}
OpsEventListenerTest.java 文件源码
项目:oneops
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
ExecutorTemplateTest.java 文件源码
项目:otter-G
阅读 28
收藏 0
点赞 0
评论 0
@BeforeTest
public void setUp() {
try {
template.afterPropertiesSet();
} catch (Exception e) {
want.fail(e.getMessage());
}
}
FiltersTests.java 文件源码
项目:jfrog-idea-plugin
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
AddExportsTest.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
@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");
}
SingleMode.java 文件源码
项目:heat
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}
MongoIndraDriverIT.java 文件源码
项目:Indra
阅读 28
收藏 0
点赞 0
评论 0
@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);
}
RequestBodyTest.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
@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();
}
PatchSystemModules.java 文件源码
项目:openjdk-jdk10
阅读 30
收藏 0
点赞 0
评论 0
@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(), ".");
}
ImageModules.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
@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"));
}