use of org.jreleaser.model.Release in project jreleaser by jreleaser.
the class ChangelogGeneratorUnitTest method doNecessaryMock.
private LogCommand doNecessaryMock(String effectiveTagName, String configuredTagName, ObjectId headId, boolean isSnapshot, List<Ref> tagRefs) throws GitAPIException, IOException {
ListTagCommand listTagCommand = mock(ListTagCommand.class);
JReleaserModel model = mock(JReleaserModel.class);
when(context.getModel()).thenReturn(model);
Project project = mock(Project.class);
when(model.getProject()).thenReturn(project);
Release release = mock(Release.class);
when(model.getRelease()).thenReturn(release);
VersionPattern versionPattern = mock(VersionPattern.class);
when(versionPattern.getType()).thenReturn(VersionPattern.Type.SEMVER);
when(project.versionPattern()).thenReturn(versionPattern);
LogCommand logCommand = mock(LogCommand.class, RETURNS_DEEP_STUBS);
when(git.log()).thenReturn(logCommand);
when(listTagCommand.call()).thenReturn(tagRefs);
when(git.tagList()).thenReturn(listTagCommand);
GitService gitService = mock(GitService.class, RETURNS_DEEP_STUBS);
when(release.getGitService()).thenReturn(gitService);
when(gitService.getEffectiveTagName(any())).thenReturn(effectiveTagName);
when(gitService.getConfiguredTagName()).thenReturn(configuredTagName);
when(git.getRepository().resolve(Constants.HEAD)).thenReturn(headId);
doReturn(SemVer.of(effectiveTagName)).when(project).version();
when(context.getModel().getProject().isSnapshot()).thenReturn(isSnapshot);
return logCommand;
}
use of org.jreleaser.model.Release in project jreleaser by jreleaser.
the class ReleaseValidator method validateRelease.
public static void validateRelease(JReleaserContext context, JReleaserContext.Mode mode, Errors errors) {
context.getLogger().debug("release");
Release release = context.getModel().getRelease();
int count = 0;
if (validateGithub(context, mode, release.getGithub(), errors))
count++;
if (validateGitlab(context, mode, release.getGitlab(), errors))
count++;
if (validateGitea(context, mode, release.getGitea(), errors))
count++;
if (validateCodeberg(context, mode, release.getCodeberg(), errors))
count++;
if (validateGeneric(context, mode, release.getGeneric(), errors))
count++;
if (mode != JReleaserContext.Mode.ASSEMBLE) {
if (0 == count) {
errors.configuration(RB.$("validation_release_no_providers"));
return;
}
if (count > 1) {
errors.configuration(RB.$("validation_release_requirement", "release.[github|gitlab|gitea|codeberg|generic]"));
}
}
}
Aggregations