From b4ae92d12368da0862577bbe6f5b084786aadf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Wed, 29 Aug 2018 13:34:53 +0200 Subject: [PATCH] Add simple changeset integration test --- .../sonia/scm/it/RepositoryAccessITCase.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scm-it/src/test/java/sonia/scm/it/RepositoryAccessITCase.java b/scm-it/src/test/java/sonia/scm/it/RepositoryAccessITCase.java index a7ee8da41d..a9139f18c8 100644 --- a/scm-it/src/test/java/sonia/scm/it/RepositoryAccessITCase.java +++ b/scm-it/src/test/java/sonia/scm/it/RepositoryAccessITCase.java @@ -14,7 +14,9 @@ import sonia.scm.repository.client.api.RepositoryClient; import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; import static java.lang.Thread.sleep; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertNotNull; @@ -124,4 +126,31 @@ public class RepositoryAccessITCase { .statusCode(HttpStatus.SC_OK) .body(equalTo("sub-a")); } + + @Test + public void shouldFindChangesets() throws IOException { + RepositoryClient repositoryClient = RepositoryUtil.createRepositoryClient(repositoryType, folder); + + RepositoryUtil.createAndCommitFile(repositoryClient, "scmadmin", "a.txt", "a"); + RepositoryUtil.createAndCommitFile(repositoryClient, "scmadmin", "b.txt", "b"); + + String changesetsUrl = given() + .when() + .get(TestData.getDefaultRepositoryUrl(repositoryType)) + .then() + .statusCode(HttpStatus.SC_OK) + .extract() + .path("_links.changesets.href"); + + List changesets = given() + .when() + .get(changesetsUrl) + .then() + .statusCode(HttpStatus.SC_OK) + .extract() + .path("_embedded.changesets.id"); + + assertThat(changesets).size().isBetween(2, 3); // svn has an implicit root revision '0' that is extra to the two commits + } } +