mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 02:06:18 +01:00
improve RepositoryExtendedITCase
This commit is contained in:
@@ -37,7 +37,10 @@ package sonia.scm.it;
|
||||
|
||||
import sonia.scm.ScmState;
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.repository.client.RepositoryClient;
|
||||
import sonia.scm.repository.client.RepositoryClientException;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -51,7 +54,12 @@ import com.sun.jersey.client.apache.config.ApacheHttpClientConfig;
|
||||
import com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig;
|
||||
import com.sun.jersey.core.util.MultivaluedMapImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
|
||||
@@ -161,6 +169,36 @@ public class IntegrationTestUtil
|
||||
return ApacheHttpClient.create(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param client
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryClientException
|
||||
*/
|
||||
public static void createRandomFile(RepositoryClient client)
|
||||
throws IOException, RepositoryClientException
|
||||
{
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String name = "file-" + uuid + ".uuid";
|
||||
FileOutputStream out = null;
|
||||
|
||||
try
|
||||
{
|
||||
out = new FileOutputStream(new File(client.getLocalRepository(), name));
|
||||
out.write(uuid.getBytes());
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(out);
|
||||
}
|
||||
|
||||
client.add(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -188,6 +226,22 @@ public class IntegrationTestUtil
|
||||
return BASE_URL.concat(url).concat(EXTENSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static File createTempDirectory()
|
||||
{
|
||||
File directory = new File(System.getProperty("java.io.tmpdir"),
|
||||
UUID.randomUUID().toString());
|
||||
|
||||
IOUtil.mkdirs(directory);
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user