mirror of https://github.com/apache/jclouds.git
Avoid creating temporary files via relative paths
This avoids creating junk in the source directory.
This commit is contained in:
parent
970f521bcd
commit
f2413cd191
|
@ -679,7 +679,7 @@ public class RegionScopedSwiftBlobStore implements BlobStore {
|
||||||
|
|
||||||
ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor);
|
ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor);
|
||||||
RandomAccessFile raf = null;
|
RandomAccessFile raf = null;
|
||||||
File tempFile = new File(destination.getName() + "." + UUID.randomUUID());
|
File tempFile = new File(destination + "." + UUID.randomUUID());
|
||||||
try {
|
try {
|
||||||
long contentLength = api
|
long contentLength = api
|
||||||
.getObjectApi(regionId, container)
|
.getObjectApi(regionId, container)
|
||||||
|
|
|
@ -56,7 +56,7 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||||
@Test(groups = "live", singleThreaded = true)
|
@Test(groups = "live", singleThreaded = true)
|
||||||
public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreIntegrationTest {
|
public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
private final File BIG_FILE = new File("random.dat");
|
private final File BIG_FILE;
|
||||||
private final long SIZE = 10 * 1000 * 1000;
|
private final long SIZE = 10 * 1000 * 1000;
|
||||||
private BlobStore blobStore;
|
private BlobStore blobStore;
|
||||||
private String ETAG;
|
private String ETAG;
|
||||||
|
@ -71,6 +71,11 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
|
|
||||||
public RegionScopedSwiftBlobStoreParallelLiveTest() {
|
public RegionScopedSwiftBlobStoreParallelLiveTest() {
|
||||||
provider = "openstack-swift";
|
provider = "openstack-swift";
|
||||||
|
try {
|
||||||
|
BIG_FILE = File.createTempFile("random", "dat");
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new RuntimeException(ioe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override as needed for the right region
|
// Override as needed for the right region
|
||||||
|
@ -121,7 +126,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
|
|
||||||
@Test(dependsOnMethods = "uploadMultipartBlob", singleThreaded = true)
|
@Test(dependsOnMethods = "uploadMultipartBlob", singleThreaded = true)
|
||||||
public void downloadParallelBlob() throws IOException {
|
public void downloadParallelBlob() throws IOException {
|
||||||
final File downloadedFile = new File(BIG_FILE.getName() + ".downloaded");
|
final File downloadedFile = new File(BIG_FILE + ".downloaded");
|
||||||
blobStore.downloadBlob(CONTAINER, BIG_FILE.getName(), downloadedFile, executor);
|
blobStore.downloadBlob(CONTAINER, BIG_FILE.getName(), downloadedFile, executor);
|
||||||
String eTag = Files.hash(downloadedFile, Hashing.md5()).toString();
|
String eTag = Files.hash(downloadedFile, Hashing.md5()).toString();
|
||||||
assertEquals(eTag, ETAG);
|
assertEquals(eTag, ETAG);
|
||||||
|
|
Loading…
Reference in New Issue