moved config dir creation to to masterscache

This commit is contained in:
David Ribeiro Alves 2012-03-08 04:15:41 +00:00
parent e915fd3e7b
commit 176a8b3b3c
3 changed files with 9 additions and 8 deletions

View File

@ -77,10 +77,6 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
properties.put(VIRTUALBOX_WORKINGDIR, workingDir); properties.put(VIRTUALBOX_WORKINGDIR, workingDir);
if (!new File(workingDir).exists()) {
new File(workingDir, "isos").mkdirs();
}
String yamlDescriptor = System.getProperty("test.virtualbox.image.descriptor.yaml", VIRTUALBOX_WORKINGDIR String yamlDescriptor = System.getProperty("test.virtualbox.image.descriptor.yaml", VIRTUALBOX_WORKINGDIR
+ File.separator + "images.yaml"); + File.separator + "images.yaml");

View File

@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
@ -108,6 +109,13 @@ public class MastersCache extends AbstractLoadingCache<Image, Master> {
this.version = Iterables.get(Splitter.on('r').split(version), 0); this.version = Iterables.get(Splitter.on('r').split(version), 0);
this.isoDownloader = isoDownloader; this.isoDownloader = isoDownloader;
} }
@PostConstruct
public void createCacheDirStructure() {
if (!new File(workingDir).exists()) {
new File(workingDir, "isos").mkdirs();
}
}
@Override @Override
public synchronized Master get(Image key) throws ExecutionException { public synchronized Master get(Image key) throws ExecutionException {

View File

@ -138,10 +138,7 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
imageId = "ubuntu-11.04-server-i386"; imageId = "ubuntu-11.04-server-i386";
isosDir = workingDir + File.separator + "isos"; isosDir = workingDir + File.separator + "isos";
File isosDirFile = new File(isosDir);
if (!isosDirFile.exists()) {
isosDirFile.mkdirs();
}
hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0); hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0);
operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId); operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId);
guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion); guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion);