本文整理汇总了Java中org.testng.reporters.Files类的典型用法代码示例。如果您正苦于以下问题:Java Files类的具体用法?Java Files怎么用?Java Files使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Files类属于org.testng.reporters包,在下文中一共展示了Files类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCollection
import org.testng.reporters.Files; //导入依赖的package包/类
@Test
public void createCollection() throws IOException
{
ObjectNode schema = Schemas.json(context.getFullName("schema"), "/item/name", "/item/description");
ObjectNode item = schema.with("definition").with("xml").with("item");
item.with("name").put("_indexed", true);
item.with("description").put("_indexed", true);
item.with("boolean").put("_indexed", true);
schemaId = schemas.getId(schemas.create(schema));
ObjectNode collection = CollectionJson.json(context.getFullName("collection"), schemaId, null);
ObjectNode metadataRules = collection.with("security").with("metadata");
metadataRules.put(
UUID.randomUUID().toString(),
metadataRule(Files.readFile(getClass().getResourceAsStream("script.js")), "DISCOVER_ITEM", "U:" + USER,
false));
collectionUuid = collections.getId(collections.create(collection));
}
开发者ID:equella,项目名称:Equella,代码行数:21,代码来源:MetadataAclTest.java
示例2: skipiosProjectCompiles
import org.testng.reporters.Files; //导入依赖的package包/类
@Test public void skipiosProjectCompiles() throws Exception {
final File dir = new File("target/tests/noicompile/").getAbsoluteFile();
File generated = generateFromArchetype("m-n-test", dir, "-Diospath=target/skip");
File created = new File(generated, "client");
assertTrue(created.isDirectory(), "Project created");
File pom = new File(created, "pom.xml");
assertTrue(pom.isFile(), "Pom file is in there");
assertFalse(Files.readFile(pom).contains("ios"), "There should be no mention of ios in " + pom);
Verifier v = createVerifier(created.getParent());
v.getCliOptions().add("-Denforcer.fail=true");
v.executeGoal("package");
v.verifyErrorFreeLog();
File nbactions = new File(created, "nbactions.xml");
assertTrue(nbactions.isFile(), "Actions file is in there");
assertFalse(Files.readFile(nbactions).contains("robovm"), "There should be no mention of robovm in " + nbactions);
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:21,代码来源:VerifyArchetypeIT.java
示例3: findDialogs
import org.testng.reporters.Files; //导入依赖的package包/类
private File findDialogs(File root, StringBuilder sb) throws IOException {
if (root.isDirectory()) {
File found = null;
for (File f : root.listFiles()) {
File r = findDialogs(f, sb);
if (r != null && found == null) {
found = r;
}
}
return found;
} else {
if (root.getName().equals("PlatformServices.java")) {
return root;
}
if (root.getName().endsWith(".java")) {
String text = Files.readFile(root);
if (text.contains("PlatformServices")) {
sb.append("No PlatformServices shall be used ").append(root).append("\n");
}
}
return null;
}
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:24,代码来源:VerifyNoExampleIT.java
示例4: skipiosProjectCompiles
import org.testng.reporters.Files; //导入依赖的package包/类
@Test public void skipiosProjectCompiles() throws Exception {
final File dir = new File("target/tests/noicompile/").getAbsoluteFile();
generateFromArchetype("m-n-test", dir, "-Diospath=target/skip");
File created = new File(new File(dir, "m-n-test"), "client");
assertTrue(created.isDirectory(), "Project created");
File pom = new File(created, "pom.xml");
assertTrue(pom.isFile(), "Pom file is in there");
assertFalse(Files.readFile(pom).contains("ios"), "There should be no mention of ios in " + pom);
Verifier v = createVerifier(created.getParent());
v.getCliOptions().add("-Denforcer.fail=true");
v.executeGoal("package");
v.verifyErrorFreeLog();
File nbactions = new File(created, "nbactions.xml");
assertTrue(nbactions.isFile(), "Actions file is in there");
assertFalse(Files.readFile(nbactions).contains("robovm"), "There should be no mention of robovm in " + nbactions);
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:21,代码来源:VerifyArchetypeIT.java
示例5: testCheckDisk
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test check_disk output")
public void testCheckDisk() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("check_disk.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
Collection<NagiosPerformanceData> perfDataCollection = checkResult
.getPerfData();
assertEquals(perfDataCollection.size(), 1);
Iterator<NagiosPerformanceData> it = perfDataCollection.iterator();
// test perfdata for /=2016MB;9832;9822;0;9842
NagiosPerformanceData perfData = it.next();
assertEquals(perfData.getName(), "/");
assertEquals(perfData.getCurrent(), 2016.0);
assertEquals(perfData.getWarning(), 9832.0);
assertEquals(perfData.getCritical(), 9822.0);
assertEquals(perfData.getMinimum(), 0.0);
assertEquals(perfData.getMaximum(), 9842.0);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:23,代码来源:NagiosCheckResultTest.java
示例6: testReplacing
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test replacing")
public void testReplacing() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("output_case3.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = new NagiosCheckResult();
checkResult.addPerfDataReplacement("_", ".");
checkResult.parseMessage(message);
assertEquals(checkResult.getPerfData().get(0).getName(),
"perfdata.line1");
assertEquals(checkResult.getPerfData().get(1).getName(),
"perfdata.line2");
assertEquals(checkResult.getPerfData().get(2).getName(),
"perfdata.line3");
assertEquals(checkResult.getPerfData().get(3).getName(),
"perfdata.line4");
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:19,代码来源:NagiosCheckResultTest.java
示例7: assertNoTextInSubdir
import org.testng.reporters.Files; //导入依赖的package包/类
private static void assertNoTextInSubdir(String fx, File genRoot) throws IOException {
if (genRoot.isFile()) {
if (Files.readFile(genRoot).contains(fx)) {
fail("String " + fx + " is in file " + genRoot);
}
} else {
for (File ch : genRoot.listFiles()) {
assertNoTextInSubdir(fx, ch);
}
}
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:12,代码来源:VerifyArchetypeIT.java
示例8: assertPlatformServicesEmpty
import org.testng.reporters.Files; //导入依赖的package包/类
@Override
protected boolean assertPlatformServicesEmpty(File dir) throws IOException {
StringBuilder sb = new StringBuilder();
File dialogs = findDialogs(dir, sb);
assertNotNull(dialogs, "PlatformServices file found");
String text = Files.readFile(dialogs);
assertEquals(text.indexOf("confirmByUser"), -1, "Do method confirmByUser in the file: " + dialogs);
assertEquals(text.indexOf("screenSize"), -1, "Do method screenSize in the file: " + dialogs);
assertEquals(sb.length(), 0, sb.toString());
return true;
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:12,代码来源:VerifyNoExampleIT.java
示例9: test_withTempFile_creates_and_deletes_a_file
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(groups = { "tempfile" })
public void test_withTempFile_creates_and_deletes_a_file() throws Exception {
final File file = TempFile.withTempFile("content\n1", f -> {
assertTrue(f.exists());
assertTrue(f.isFile());
assertEquals(Files.readFile(f), "content\n1\n");
return f;
});
assertNotNull(file);
assertFalse(file.exists());
}
开发者ID:lefou,项目名称:LambdaTest,代码行数:12,代码来源:TempFileTest.java
示例10: test_withTempFileP_creates_and_deletes_a_file
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(groups = { "tempfile" })
public void test_withTempFileP_creates_and_deletes_a_file() throws Exception {
final File[] file = new File[] { null };
TempFile.withTempFileP("content\n2", f -> {
assertTrue(f.exists());
assertTrue(f.isFile());
assertEquals(Files.readFile(f), "content\n2\n");
file[0] = f;
});
assertNotNull(file[0]);
assertFalse(file[0].exists());
}
开发者ID:lefou,项目名称:LambdaTest,代码行数:13,代码来源:TempFileTest.java
示例11: testCheckLinuxProcstat
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test check_linux_procstat.pl output")
public void testCheckLinuxProcstat() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("check_linux_procstat.pl.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
assertEquals(checkResult.getPerfData().size(), 11);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:10,代码来源:NagiosCheckResultTest.java
示例12: testCheckLoad
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test check_load output")
public void testCheckLoad() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("check_load.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
Collection<NagiosPerformanceData> perfDataCollection = checkResult
.getPerfData();
assertEquals(perfDataCollection.size(), 3);
Iterator<NagiosPerformanceData> it = perfDataCollection.iterator();
// test perfdata for load1=0.200;4.000;8.000;0;
NagiosPerformanceData perfData = it.next();
assertEquals(perfData.getName(), "load1");
assertEquals(perfData.getCurrent(), 0.2);
assertEquals(perfData.getWarning(), 4.0);
assertEquals(perfData.getCritical(), 8.0);
assertEquals(perfData.getMinimum(), 0.0);
// test perfdata for load5=0.170;4.000;8.000;0;
perfData = it.next();
assertEquals(perfData.getName(), "load5");
assertEquals(perfData.getCurrent(), 0.17);
assertEquals(perfData.getWarning(), 4.0);
assertEquals(perfData.getCritical(), 8.0);
assertEquals(perfData.getMinimum(), 0.0);
// test perfdata for load15=0.270;4.000;8.000;0;
perfData = it.next();
assertEquals(perfData.getName(), "load15");
assertEquals(perfData.getCurrent(), 0.27);
assertEquals(perfData.getWarning(), 4.0);
assertEquals(perfData.getCritical(), 8.0);
assertEquals(perfData.getMinimum(), 0.0);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:37,代码来源:NagiosCheckResultTest.java
示例13: testCheckCpuStats
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test check_cpu_stats.sh output")
public void testCheckCpuStats() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("check_cpu_stats.sh.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
Collection<NagiosPerformanceData> perfDataCollection = checkResult
.getPerfData();
assertEquals(perfDataCollection.size(), 2);
Iterator<NagiosPerformanceData> it = perfDataCollection.iterator();
// test perfdata for CpuSTEAL=0.17;30;100
NagiosPerformanceData perfData = it.next();
assertEquals(perfData.getName(), "CpuSTEAL");
assertEquals(perfData.getCurrent(), 0.17);
assertEquals(perfData.getWarning(), 30.0);
assertEquals(perfData.getCritical(), 100.0);
// test perfdata for CpuIOWAIT=0.00;30;100
perfData = it.next();
assertEquals(perfData.getName(), "CpuIOWAIT");
assertEquals(perfData.getCurrent(), 0.0);
assertEquals(perfData.getWarning(), 30.0);
assertEquals(perfData.getCritical(), 100.0);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:28,代码来源:NagiosCheckResultTest.java
示例14: testCheckCassandraCluster
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test check_cassandra_cluster.sh output")
public void testCheckCassandraCluster() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("check_cassandra_cluster.sh.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
Collection<NagiosPerformanceData> perfDataCollection = checkResult
.getPerfData();
assertEquals(perfDataCollection.size(), 18);
Iterator<NagiosPerformanceData> it = perfDataCollection.iterator();
// Load_172.17.45.155=20.78GB
NagiosPerformanceData perfData = it.next();
assertEquals(perfData.getName(), "Load_172.17.45.155");
assertEquals(perfData.getCurrent(), 20.78);
// Tokens_172.17.45.155=256
perfData = it.next();
assertEquals(perfData.getName(), "Tokens_172.17.45.155");
assertEquals(perfData.getCurrent(), 256.0);
// Owns_172.17.45.155=15.1%
perfData = it.next();
assertEquals(perfData.getName(), "Owns_172.17.45.155");
assertEquals(perfData.getCurrent(), 15.1);
// Load_172.17.45.154=18.06GB
perfData = it.next();
assertEquals(perfData.getName(), "Load_172.17.45.154");
assertEquals(perfData.getCurrent(), 18.06);
// Tokens_172.17.45.154=256
perfData = it.next();
assertEquals(perfData.getName(), "Tokens_172.17.45.154");
assertEquals(perfData.getCurrent(), 256.0);
// Owns_172.17.45.154=16.6%
perfData = it.next();
assertEquals(perfData.getName(), "Owns_172.17.45.154");
assertEquals(perfData.getCurrent(), 16.6);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:40,代码来源:NagiosCheckResultTest.java
示例15: testParsingSingleLine
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test Case1 output")
public void testParsingSingleLine() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("output_case1.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
assertEquals(checkResult.getMessage(), "message_line1");
assertEquals(checkResult.getPerfData().size(), 0);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:11,代码来源:NagiosCheckResultTest.java
示例16: testParsingSingleLineWithPerfdata
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test Case2 output")
public void testParsingSingleLineWithPerfdata() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("output_case2.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
assertEquals(checkResult.getMessage(), "message_line1");
assertEquals(checkResult.getPerfData().size(), 1);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:11,代码来源:NagiosCheckResultTest.java
示例17: testParsingMultipleLinesWithPerfdata
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(description = "Test Case3 output")
public void testParsingMultipleLinesWithPerfdata() throws IOException {
InputStream is = ClassLoader
.getSystemResourceAsStream("output_case3.txt");
String message = Files.readFile(is);
NagiosCheckResult checkResult = NagiosCheckResult.fromMessage(message);
assertEquals(checkResult.getMessage(),
"message_line1\nmessage_line2\nmessage_line3\nmessage_line4");
assertEquals(checkResult.getPerfData().size(), 4);
}
开发者ID:frederikhappel,项目名称:activecheck,代码行数:12,代码来源:NagiosCheckResultTest.java
示例18: createTokenFile
import org.testng.reporters.Files; //导入依赖的package包/类
private void createTokenFile(String fileName, String content) throws IOException {
Files.writeFile(content, new File(fileName));
}
开发者ID:otto-de,项目名称:edison-vault,代码行数:4,代码来源:VaultTokenReaderTest.java
示例19: testCreateTlvElementFromTooLargeInput_ThrowsMultipleTLVElementException
import org.testng.reporters.Files; //导入依赖的package包/类
@Test(expectedExceptions = MultipleTLVElementException.class)
public void testCreateTlvElementFromTooLargeInput_ThrowsMultipleTLVElementException() throws Exception {
byte[] tmp = Files.readFile(CommonTestUtil.loadFile("root_content_larger_than_max.tlv")).getBytes();
TLVElement.create(tmp);
}
开发者ID:guardtime,项目名称:ksi-java-sdk,代码行数:6,代码来源:TLVElementTest.java
示例20: defaultProjectCompiles
import org.testng.reporters.Files; //导入依赖的package包/类
@Test public void defaultProjectCompiles() throws Exception {
final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
File created = generateFromArchetype("o-a-test", dir);
assertTrue(created.isDirectory(), "Project created");
assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
Verifier v = createVerifier(created.getAbsolutePath());
v.getCliOptions().add("-Denforcer.fail=true");
v.executeGoal("verify");
v.verifyErrorFreeLog();
for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
if (l.contains("j2js")) {
fail("No pre-compilaton:\n" + l);
}
if (l.contains("-javafx.zip")) {
fail("Don't generate the ZIP by default: " + l);
}
}
v = createVerifier(created.getAbsolutePath());
v.addCliOption("-Pdesktop");
v.getCliOptions().add("-Denforcer.fail=true");
v.executeGoals(Arrays.asList("clean", "install"));
v.verifyErrorFreeLog();
final String t = "o-a-test-1.0-SNAPSHOT-javafx.zip";
verifyFileInLog(v, t);
final File webpages = new File(new File(new File(created, "client"), "target"), getClass().getSimpleName() + "-o-a-test-1.0-SNAPSHOT-webpages.zip");
assertTrue(webpages.exists(), "Web pages file created: " + webpages);
JarFile jf = new JarFile(webpages);
ZipEntry indexHTML = jf.getEntry("index.html");
assertNotNull(indexHTML, "index.html in ZIP found");
InputStream is = jf.getInputStream(indexHTML);
assertHTMLContent(is);
assertDialogsEmpty(dir);
is.close();
jf.close();
File dataModel = new File(new File(new File(new File(new File(new File(new File(new File(new File(
created, "client"), "src"), "main"), "java"), "org"), "someuser"), "test"), "" + oat + ""), "DataModel.java"
);
assertTrue(dataModel.isFile(), "Java file exists: " + dataModel);
String mainSrc = Files.readFile(dataModel);
int bootMethod = mainSrc.indexOf("onPageLoad(");
assertNotEquals(bootMethod, -1, "onPageLoad method present: " + mainSrc);
int bootMethodEnd = mainSrc.indexOf("}", bootMethod);
assertNotEquals(bootMethodEnd, -1, "onPageLoad method present: " + mainSrc);
StringBuilder mainSb = new StringBuilder(mainSrc);
mainSb.insert(bootMethodEnd, "\n"
+ "ClassLoader loader = Main.class.getClassLoader();\n"
+ "if (loader == ClassLoader.getSystemClassLoader()) {\n"
+ " System.out.println(\"Presenter: \" + org.netbeans.html.boot.spi.Fn.activePresenter().getClass().getName());\n"
+ " System.exit(0);\n"
+ "} else {\n"
+ " throw new IllegalStateException(\"wrong classloader:\" + loader);\n"
+ "}\n"
);
FileWriter w = new FileWriter(dataModel);
w.write(mainSb.toString());
w.close();
assertPresenter(created, v, null, "org.netbeans.html.boot.fx.FXPresenter");
assertPresenter(created, v, "-Pwebkit-presenter", "com.dukescript.presenters.webkit.WebKitPresenter");
assertPresenter(created, v, "-Pbrowser-presenter", "com.dukescript.presenters.Browser");
}
开发者ID:dukescript,项目名称:maven-archetypes,代码行数:73,代码来源:VerifyArchetypeIT.java
注:本文中的org.testng.reporters.Files类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论