本文整理汇总了Java中org.apache.tomcat.util.http.fileupload.FileUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUtils类属于org.apache.tomcat.util.http.fileupload包,在下文中一共展示了FileUtils类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: run
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
public void run(String parentFolderPath, boolean override) throws IOException, InterruptedException, ExecutionException, XmlPullParserException, ProjectInitializationException, AddDependencyException {
Path parentFolder = Paths.get(parentFolderPath);
if(isSkip(override, parentFolder)) {
log.info("Skipping creation of projects because projects already exist");
System.exit(0);
}
Files.createDirectories(parentFolder);
FileUtils.cleanDirectory(parentFolder.toFile());
List<String> modules = createProjectsParallel(parentFolder);
for(JavaVersion javaVersion : springMatrixProperties.getJavaVersions()) {
log.info("Creating root project for {}", javaVersion);
createRootPom(parentFolder.resolve(javaVersion.name()), filter(modules, javaVersion));
addMavenWrapper(parentFolder.resolve(javaVersion.name()));
}
log.info("{} projects created", modules.size());
System.exit(0);
}
开发者ID:groupe-sii,项目名称:ogham,代码行数:18,代码来源:SpringBootProjectRunner.java
示例2: testAbsolutePath
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@Test
public void testAbsolutePath() throws IOException {
File test = new File(System.getProperty("java.io.tmpdir"), "testAbsolutePath");
if (test.exists()) {
FileUtils.forceDelete(test);
}
test.createNewFile();
doTest(test.getAbsolutePath());
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:TestConfigFileLoader.java
示例3: cleanup
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@PreDestroy
public void cleanup() {
REPOS.values().stream()
.forEach(path -> {
try {
log.info("Cleaning {}", path);
FileUtils.deleteDirectory(path.toFile());
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
});
}
开发者ID:dick-the-deployer,项目名称:dick,代码行数:13,代码来源:RepositoryService.java
示例4: deleteTestPack
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
/**
* delete a directory and all its contents
*
* @param dirToDelete directory to be deleted
* @throws java.io.IOException unable to delete the file
*/
private void deleteTestPack(String dirToDelete) throws IOException {
File workSpaceDir = new File(dirToDelete);
if (workSpaceDir.exists()) {
FileUtils.deleteDirectory(workSpaceDir);
}
}
开发者ID:wso2,项目名称:cloud-dev-studio,代码行数:13,代码来源:DeveloperStudioExtension.java
示例5: cleanup
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@AfterTest
public void cleanup() throws Exception {
FileUtils.deleteDirectory(tmpDir);
tmpDir.delete();
}
开发者ID:christophd,项目名称:citrus-admin,代码行数:6,代码来源:FileBrowserServiceTest.java
示例6: removeTestDataDirectory
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@After
public void removeTestDataDirectory() throws IOException {
File testDataDirectory = new File("testdata");
FileUtils.forceDelete(testDataDirectory);
}
开发者ID:zhaar,项目名称:Neuralnet-IoT-Car,代码行数:6,代码来源:RaceRecorderTest.java
示例7: testAdditionalWebInfClassesPaths
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@Test
public void testAdditionalWebInfClassesPaths() throws Exception {
Tomcat tomcat = getTomcatInstance();
File appDir = new File("test/webapp-3.0-virtual-webapp/src/main/webapp");
// app dir is relative to server home
StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
appDir.getAbsolutePath());
File tempFile = File.createTempFile("virtualWebInfClasses", null);
File additionWebInfClasses = new File(tempFile.getAbsolutePath() + ".dir");
Assert.assertTrue(additionWebInfClasses.mkdirs());
File targetPackageForAnnotatedClass =
new File(additionWebInfClasses,
MyAnnotatedServlet.class.getPackage().getName().replace('.', '/'));
Assert.assertTrue(targetPackageForAnnotatedClass.mkdirs());
InputStream annotatedServletClassInputStream =
this.getClass().getResourceAsStream(
MyAnnotatedServlet.class.getSimpleName() + ".class");
FileOutputStream annotatedServletClassOutputStream =
new FileOutputStream(new File(targetPackageForAnnotatedClass,
MyAnnotatedServlet.class.getSimpleName() + ".class"));
IOUtils.copy(annotatedServletClassInputStream, annotatedServletClassOutputStream);
annotatedServletClassInputStream.close();
annotatedServletClassOutputStream.close();
VirtualWebappLoader loader = new VirtualWebappLoader(ctx.getParentClassLoader());
loader.setVirtualClasspath("test/webapp-3.0-virtual-webapp/target/classes;" + //
"test/webapp-3.0-virtual-library/target/classes;" + //
additionWebInfClasses.getAbsolutePath());
ctx.setLoader(loader);
tomcat.start();
// first test that without the setting on StandardContext the annotated
// servlet is not detected
assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE, 404);
tomcat.stop();
// then test that if we configure StandardContext with the additional
// path, the servlet is detected
// ctx.setAdditionalVirtualWebInfClasses(additionWebInfClasses.getAbsolutePath());
VirtualDirContext resources = new VirtualDirContext();
resources.setExtraResourcePaths("/WEB-INF/classes=" + additionWebInfClasses);
ctx.setResources(resources);
tomcat.start();
assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE);
tomcat.stop();
FileUtils.deleteDirectory(additionWebInfClasses);
tempFile.delete();
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:53,代码来源:TestVirtualContext.java
示例8: pushAppBits
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
private void pushAppBits(AbstractBuild build, BuildListener listener, DeploymentInfo deploymentInfo,
CloudFoundryClient client)
throws IOException, InterruptedException, ZipException {
FilePath appPath = new FilePath(build.getWorkspace(), deploymentInfo.getAppPath());
if (appPath.getChannel() != Jenkins.MasterComputer.localChannel) {
if (appPath.isDirectory()) {
// The build is distributed, and a directory
// We need to make a copy of the target directory on the master
File tempAppFile = File.createTempFile("appFile", null); // This is on the master
OutputStream outputStream = new FileOutputStream(tempAppFile);
appPath.zip(outputStream);
// We now have a zip file on the master, extract it into a directory
ZipFile appZipFile = new ZipFile(tempAppFile);
File tempOutputDirectory = new File(tempAppFile.getAbsolutePath().split("\\.")[0]);
appZipFile.extractAll(tempOutputDirectory.getAbsolutePath());
// appPath.zip() creates a top level directory that we want to remove
File[] listFiles = tempOutputDirectory.listFiles();
if (listFiles != null && listFiles.length == 1) {
tempOutputDirectory = listFiles[0];
} else {
// This should never happen because appPath.zip() always makes a directory
throw new IllegalStateException("Unzipped output directory was empty.");
}
// We can now use tempOutputDirectory which is a copy of the target directory but on master
client.uploadApplication(deploymentInfo.getAppName(), tempOutputDirectory);
// Delete temporary files
boolean deleted = tempAppFile.delete();
try {
FileUtils.deleteDirectory(tempOutputDirectory);
} catch (IOException e) {
deleted = false;
}
if (!deleted) {
listener.getLogger().println("WARNING: Temporary files were not deleted successfully.");
}
} else {
// If the target path is a single file, we can just use an InputStream
// The CF client will make a temp file on the master from the InputStream
client.uploadApplication(deploymentInfo.getAppName(), appPath.getName(), appPath.read());
}
} else {
// If the build is not distributed, we can convert the FilePath to a File without problems
File targetFile = new File(appPath.toURI());
client.uploadApplication(deploymentInfo.getAppName(), targetFile);
}
}
开发者ID:hpcloud,项目名称:cloudfoundry-jenkins,代码行数:51,代码来源:CloudFoundryPushPublisher.java
示例9: startServer
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@Before
public void startServer() throws InterruptedException, IOException {
logFile = new File(System.getProperty("user.home") + "/access-log-app-access.log");
FileUtils.forceDelete(logFile);
assertThat(logFile.exists(), is(false));
server = new MicroserverApp(() -> "access-log-app");
Thread.sleep(1000);
server.start();
}
开发者ID:aol,项目名称:micro-server,代码行数:14,代码来源:AccessLogConfigTest.java
示例10: startServer
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@Before
public void startServer() throws IOException {
logFile = new File(System.getProperty("user.home") + "/access-log-app-access.log");
FileUtils.forceDelete(logFile);
System.out.println(logFile.exists());
assertThat(logFile.exists(), is(false));
server = new MicroserverApp(() -> "access-log-app");
server.start();
}
开发者ID:aol,项目名称:micro-server,代码行数:14,代码来源:AccessLogConfigTest.java
示例11: tearDownClass
import org.apache.tomcat.util.http.fileupload.FileUtils; //导入依赖的package包/类
@AfterClass
public static void tearDownClass() throws Exception {
FileUtils.deleteDirectory(new File(WEBAPP_DOC_BASE));
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:TestWebappClassLoaderWeaving.java
注:本文中的org.apache.tomcat.util.http.fileupload.FileUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论