use of net.nemerosa.ontrack.extension.svn.db.SVNRepository in project ontrack by nemerosa.
the class SVNHealthIndicator method getHealth.
@Override
protected Health getHealth(SVNConfiguration config) {
// Just gets the latest revision
SVNRepository repository = svnService.getRepository(config.getName());
try (Transaction ignored = transactionService.start()) {
SVNURL url = SVNUtils.toURL(repository.getConfiguration().getUrl());
Health.Builder builder = Health.unknown();
try {
long repositoryRevision = svnClient.getRepositoryRevision(repository, url);
return builder.up().withDetail("revision", repositoryRevision).build();
} catch (Exception ex) {
return builder.down(ex).build();
}
}
}
use of net.nemerosa.ontrack.extension.svn.db.SVNRepository 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.svn.db.SVNRepository 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.svn.db.SVNRepository 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.svn.db.SVNRepository in project ontrack by nemerosa.
the class SVNChangeLogServiceImpl method changeLogExportFormats.
@Override
public Collection<ExportFormat> changeLogExportFormats(ID branchId) {
// Gets the branch
Branch branch = structureService.getBranch(branchId);
// Gets the SVN repository
SVNRepository svnRepository = getSVNRepository(branch);
ConfiguredIssueService configuredIssueService = svnRepository.getConfiguredIssueService();
if (configuredIssueService != null) {
return configuredIssueService.getIssueServiceExtension().exportFormats(configuredIssueService.getIssueServiceConfiguration());
} else {
return Collections.emptyList();
}
}
Aggregations