Fix initial Java migration

This commit fixes several issues with the initial java migration.

On MacOS, the name of the temp directory can be `T` and the new tgz API
requires a parent folder whose name has at least 3 characters.

The Selenium tests require a more precise element to show the advanced
section.

The integration tests were generation the docs snippet on the wrong
accept header.
This commit is contained in:
Stephane Nicoll
2017-02-08 11:32:28 +01:00
parent ec5a7da507
commit 2c0269c96b
4 changed files with 19 additions and 11 deletions

View File

@@ -67,9 +67,10 @@ class ProjectGenerator {
@Autowired
ProjectResourceLocator projectResourceLocator = new ProjectResourceLocator()
@Value('${TMPDIR:.}')
@Value('${TMPDIR:.}/initializr')
String tmpdir
private File temporaryDirectory
private transient Map<String, List<File>> temporaryFiles = [:]
/**
@@ -126,7 +127,7 @@ class ProjectGenerator {
protected File doGenerateProjectStructure(ProjectRequest request) {
def model = resolveModel(request)
def rootDir = File.createTempFile('tmp', '', new File(tmpdir))
def rootDir = File.createTempFile('tmp', '', getTemporaryDirectory())
addTempFile(rootDir.name, rootDir)
rootDir.delete()
rootDir.mkdirs()
@@ -182,11 +183,19 @@ class ProjectGenerator {
* directory and extension
*/
File createDistributionFile(File dir, String extension) {
def download = new File(tmpdir, dir.name + extension)
def download = new File(getTemporaryDirectory(), dir.name + extension)
addTempFile(dir.name, download)
download
}
private File getTemporaryDirectory() {
if (!temporaryDirectory) {
temporaryDirectory = new File(tmpdir, 'initializr')
temporaryDirectory.mkdirs()
}
temporaryDirectory
}
/**
* Clean all the temporary files that are related to this root
* directory.