mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 02:06:18 +01:00
Add checks to repository tests
This commit is contained in:
@@ -155,22 +155,25 @@ public class RepositoriesITCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldCloneRepository() throws IOException {
|
public void shouldCloneRepository() throws IOException {
|
||||||
RepositoryClient rc = createRepositoryClient();
|
RepositoryClient client = createRepositoryClient();
|
||||||
assertEquals(1, rc.getWorkingCopy().list().length);
|
assertEquals("expected metadata dir", 1, client.getWorkingCopy().list().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldCommitFiles() throws IOException {
|
public void shouldCommitFiles() throws IOException {
|
||||||
RepositoryClient rc = createRepositoryClient();
|
RepositoryClient client = createRepositoryClient();
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
createRandomFile(rc);
|
createRandomFile(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
commit(rc, "added some test files");
|
commit(client);
|
||||||
|
|
||||||
|
RepositoryClient checkClient = createRepositoryClient();
|
||||||
|
assertEquals("expected 5 files and metadata dir", 6, checkClient.getWorkingCopy().list().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createRandomFile(RepositoryClient client) throws IOException {
|
private static void createRandomFile(RepositoryClient client) throws IOException {
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
String name = "file-" + uuid + ".uuid";
|
String name = "file-" + uuid + ".uuid";
|
||||||
|
|
||||||
@@ -182,8 +185,8 @@ public class RepositoriesITCase {
|
|||||||
client.getAddCommand().add(name);
|
client.getAddCommand().add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void commit(RepositoryClient repositoryClient, String message) throws IOException {
|
private static void commit(RepositoryClient repositoryClient) throws IOException {
|
||||||
repositoryClient.getCommitCommand().commit(AUTHOR, message);
|
repositoryClient.getCommitCommand().commit(AUTHOR, "commit");
|
||||||
if ( repositoryClient.isCommandSupported(ClientCommand.PUSH) ) {
|
if ( repositoryClient.isCommandSupported(ClientCommand.PUSH) ) {
|
||||||
repositoryClient.getPushCommand().push();
|
repositoryClient.getPushCommand().push();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user