use of net.nemerosa.ontrack.extension.scm.model.SCMBuildView in project ontrack by nemerosa.
the class SVNChangeLogServiceImpl method getSCMBuildView.
protected SCMBuildView<SVNHistory> getSCMBuildView(SVNRepository svnRepository, ID buildId) {
// Gets the build view
BuildView buildView = getBuildView(buildId);
// Gets the history for the build
SVNHistory history = getBuildSVNHistory(svnRepository, buildView.getBuild());
// OK
return new SCMBuildView<>(buildView, history);
}
use of net.nemerosa.ontrack.extension.scm.model.SCMBuildView in project ontrack by nemerosa.
the class SVNChangeLogTest method branch_low.
@Test
public void branch_low() {
Branch branch = branch();
SVNRepository repository = repository();
SCMBuildView<SVNHistory> scmBuildFrom = new SCMBuildView<>(BuildView.of(Build.of(branch, new NameDescription("10", "Build 10"), Signature.of("user"))), new SVNHistory(new SVNReference("/project/branches/10", "http://server/project/branches/10", 110000, Time.now()), new SVNReference("/project/trunk", "http://server/project/trunk", 100000, Time.now())));
SCMBuildView<SVNHistory> scmBuildTo = new SCMBuildView<>(BuildView.of(Build.of(branch, new NameDescription("5", "Build 5"), Signature.of("user"))), new SVNHistory(new SVNReference("/project/trunk", "http://server/project/trunk", 90000, Time.now())));
SVNChangeLog changeLog = new SVNChangeLog(UUID.randomUUID().toString(), branch.getProject(), repository, scmBuildFrom, scmBuildTo);
// Gets the references
Collection<SVNChangeLogReference> references = changeLog.getChangeLogReferences();
// Check
assertNotNull(references);
assertEquals(2, references.size());
Iterator<SVNChangeLogReference> iterator = references.iterator();
SVNChangeLogReference referenceBranch = iterator.next();
{
assertEquals("/project/branches/10", referenceBranch.getPath());
assertEquals(0, referenceBranch.getStart());
assertEquals(110000, referenceBranch.getEnd());
}
SVNChangeLogReference referenceTrunk = iterator.next();
{
assertEquals("/project/trunk", referenceTrunk.getPath());
assertEquals(90000, referenceTrunk.getStart());
assertEquals(100000, referenceTrunk.getEnd());
}
}
use of net.nemerosa.ontrack.extension.scm.model.SCMBuildView in project ontrack by nemerosa.
the class SVNChangeLogTest method simple.
@Test
public void simple() {
Branch branch = branch();
SVNRepository repository = repository();
SCMBuildView<SVNHistory> scmBuildFrom = new SCMBuildView<>(BuildView.of(Build.of(branch, new NameDescription("10", "Build 10"), Signature.of("user"))), new SVNHistory(new SVNReference("/project/trunk", "http://server/project/trunk", 110000, Time.now())));
SCMBuildView<SVNHistory> scmBuildTo = new SCMBuildView<>(BuildView.of(Build.of(branch, new NameDescription("20", "Build 20"), Signature.of("user"))), new SVNHistory(new SVNReference("/project/trunk", "http://server/project/trunk", 120000, Time.now())));
SVNChangeLog changeLog = new SVNChangeLog(UUID.randomUUID().toString(), branch.getProject(), repository, scmBuildFrom, scmBuildTo);
// Gets the references
Collection<SVNChangeLogReference> references = changeLog.getChangeLogReferences();
// Check
assertNotNull(references);
assertEquals(1, references.size());
SVNChangeLogReference reference = references.iterator().next();
assertEquals("/project/trunk", reference.getPath());
assertEquals(110000, reference.getStart());
assertEquals(120000, reference.getEnd());
}
use of net.nemerosa.ontrack.extension.scm.model.SCMBuildView in project ontrack by nemerosa.
the class SVNChangeLogTest method none.
@Test
public void none() {
Branch branch = branch();
SVNRepository repository = repository();
SCMBuildView<SVNHistory> scmBuildFrom = new SCMBuildView<>(BuildView.of(Build.of(branch, new NameDescription("10", "Build 10"), Signature.of("user"))), new SVNHistory(new SVNReference("/project/trunk", "http://server/project/trunk", 100000, Time.now())));
SVNChangeLog changeLog = new SVNChangeLog(UUID.randomUUID().toString(), branch.getProject(), repository, scmBuildFrom, scmBuildFrom);
// Gets the references
Collection<SVNChangeLogReference> references = changeLog.getChangeLogReferences();
// Check
assertNotNull(references);
assertEquals(1, references.size());
assertTrue(references.iterator().next().isNone());
}
use of net.nemerosa.ontrack.extension.scm.model.SCMBuildView in project ontrack by nemerosa.
the class GitChangeLogResourceDecoratorTest method gitChangeLogWithoutIssues.
@Test
public void gitChangeLogWithoutIssues() throws JsonProcessingException {
Signature signature = Signature.of(LocalDateTime.of(2014, 12, 5, 21, 53), "user");
Project project = Project.of(nd("P", "Project")).withId(ID.of(1)).withSignature(signature);
Branch branch = Branch.of(project, nd("B", "Branch")).withId(ID.of(10)).withSignature(signature);
List<BuildView> buildView = Stream.of(1, 2).map(it -> BuildView.of(Build.of(branch, nd(String.valueOf(it), "Build " + it), signature).withId(ID.of(it)))).collect(Collectors.toList());
GitChangeLog changeLog = new GitChangeLog("uuid", project, new SCMBuildView<>(buildView.get(0), GitBuildInfo.INSTANCE), new SCMBuildView<>(buildView.get(1), GitBuildInfo.INSTANCE), false);
when(gitService.getProjectConfiguration(project)).thenReturn(Optional.of(new BasicGitActualConfiguration(BasicGitConfiguration.empty().withName("MyConfig").withIssueServiceConfigurationIdentifier("mock:MyTest"), null)));
ObjectNode signatureObject = object().with("time", "2014-12-05T21:53:00Z").with("user", object().with("name", "user").end()).end();
assertResourceJson(mapper, object().with("project", object().with("id", 1).with("name", "P").with("description", "Project").with("disabled", false).with("signature", signatureObject).end()).with("scmBuildFrom", object().with("buildView", object().with("build", object().with("id", 1).with("name", "1").with("description", "Build 1").with("signature", signatureObject).with("branch", object().with("id", 10).with("name", "B").with("description", "Branch").with("disabled", false).with("type", "CLASSIC").with("signature", signatureObject).end()).end()).with("decorations", array().end()).with("promotionRuns", array().end()).with("validationStampRunViews", array().end()).end()).with("scm", object().with("placeholder", "").end()).end()).with("scmBuildTo", object().with("buildView", object().with("build", object().with("id", 2).with("name", "2").with("description", "Build 2").with("signature", signatureObject).with("branch", object().with("id", 10).with("name", "B").with("description", "Branch").with("disabled", false).with("type", "CLASSIC").with("signature", signatureObject).end()).end()).with("decorations", array().end()).with("promotionRuns", array().end()).with("validationStampRunViews", array().end()).end()).with("scm", object().with("placeholder", "").end()).end()).with("syncError", false).with("uuid", "uuid").with("_commits", "urn:test:net.nemerosa.ontrack.extension.git.GitController#changeLogCommits:uuid").with("_files", "urn:test:net.nemerosa.ontrack.extension.git.GitController#changeLogFiles:uuid").with("_changeLogFileFilters", "urn:test:net.nemerosa.ontrack.extension.scm.SCMController#getChangeLogFileFilters:1").with("_diff", "urn:test:net.nemerosa.ontrack.extension.git.GitController#diff:").with("_exportFormats", "urn:test:net.nemerosa.ontrack.extension.git.GitController#changeLogExportFormats:1").with("_exportIssues", "urn:test:net.nemerosa.ontrack.extension.git.GitController#changeLog:IssueChangeLogExportRequest%28format%3Dtext%2C+grouping%3D%2C+exclude%3D%2C+altGroup%3DOther%29").with("_page", "urn:test:#:extension/git/changelog?from=1&to=2").end(), changeLog);
}
Aggregations