本文整理汇总了Java中net.anthavio.phanbedder.Phanbedder.unpack方法的典型用法代码示例。如果您正苦于以下问题:Java Phanbedder.unpack方法的具体用法?Java Phanbedder.unpack怎么用?Java Phanbedder.unpack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.anthavio.phanbedder.Phanbedder
的用法示例。
在下文中一共展示了Phanbedder.unpack方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSeleniumGhostDriver
import net.anthavio.phanbedder.Phanbedder; //导入方法依赖的package包/类
@Test
public void testSeleniumGhostDriver() {
File phantomjs = Phanbedder.unpack();
DesiredCapabilities dcaps = new DesiredCapabilities();
dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath());
PhantomJSDriver driver = new PhantomJSDriver(dcaps);
try {
driver.get("https://www.google.com");
WebElement query = driver.findElement(By.name("q"));
query.sendKeys("Phanbedder");
query.submit();
Assertions.assertThat(driver.getTitle()).contains("Phanbedder");
} finally {
driver.quit();
}
}
示例2: testJavaIoTmpDirectory
import net.anthavio.phanbedder.Phanbedder; //导入方法依赖的package包/类
@Test
public void testJavaIoTmpDirectory() throws IOException, InterruptedException {
File binary = Phanbedder.unpack();
String javaIoTmpdir = System.getProperty("java.io.tmpdir");
File expectedDir = new File(javaIoTmpdir, "phantomjs-" + Phanbedder.PHANTOMJS_VERSION);
Assertions.assertThat(binary.getParentFile()).isEqualTo(expectedDir);
assertProcessExecution(binary);
long lastModified = binary.lastModified();
File binary2 = Phanbedder.unpack(); //existing file is returned
Assertions.assertThat(binary2.lastModified()).isEqualTo(lastModified); // SAME
assertProcessExecution(binary2);
binary.delete(); //purge cached
Assertions.assertThat(binary.exists()).isFalse();
Thread.sleep(1000); //1 second at least!
File binary3 = Phanbedder.unpack(); //new file must be unpacked
Assertions.assertThat(binary3.lastModified()).isNotEqualTo(lastModified); //DIFF
assertProcessExecution(binary3);
}
示例3: testLocalTargetDirectory
import net.anthavio.phanbedder.Phanbedder; //导入方法依赖的package包/类
@Test
public void testLocalTargetDirectory() throws IOException, InterruptedException {
String targetDir = "target/phanbedder-test/unpack";
String binaryPath = Phanbedder.unpack(targetDir);
File binary = new File(binaryPath);
String javaUserDir = System.getProperty("user.dir");
Assertions.assertThat(binary.getParentFile()).isEqualTo(new File(javaUserDir, targetDir));
assertProcessExecution(binary);
long lastModified = binary.lastModified();
String binaryPath2 = Phanbedder.unpack(targetDir); //existing file is returned
File binary2 = new File(binaryPath2);
Assertions.assertThat(binary2.lastModified()).isEqualTo(lastModified); // SAME
assertProcessExecution(binary2);
binary.delete(); //purge cached
Assertions.assertThat(binary.exists()).isFalse();
Thread.sleep(1000); //1 second at least!
String binaryPath3 = Phanbedder.unpack(targetDir); //new file must be unpacked
File binary3 = new File(binaryPath3);
Assertions.assertThat(binary3.lastModified()).isNotEqualTo(lastModified); //DIFF
assertProcessExecution(binary3);
}
示例4: before
import net.anthavio.phanbedder.Phanbedder; //导入方法依赖的package包/类
@Override
public void before() {
File phantomjs = Phanbedder.unpack();
DesiredCapabilities dcaps = new DesiredCapabilities();
dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath());
driver = new PhantomJSDriver(dcaps);
}