use of io.pivotal.cla.data.IndividualSignature in project pivotal-cla by pivotalsoftware.
the class BaseWebDriverTests method setup.
@Before
public void setup() {
driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(mockMvc).useMockMvcForHosts("github.com").build();
MarkdownContent corporate = new MarkdownContent();
corporate.setMarkdown("# Corporate");
corporate.setHtml("[h1]Corporate[/h1]");
MarkdownContent individual = new MarkdownContent();
individual.setMarkdown("# Individual");
individual.setHtml("[h1]Individual[/h1]");
cla = new ContributorLicenseAgreement();
cla.setName("pivotal");
cla.setCorporateContent(corporate);
cla.setIndividualContent(individual);
cla.setId(1L);
individualSignature = new IndividualSignature();
individualSignature.setCla(cla);
individualSignature.setGitHubLogin("rwinch");
individualSignature.setEmail("rob@gmail.com");
individualSignature.setName("Rob Winch");
individualSignature.setMailingAddress("123 Seasame Street");
individualSignature.setTelephone("123.456.7890");
corporateSignature = new CorporateSignature();
corporateSignature.setCla(cla);
corporateSignature.setGitHubLogin("rwinch");
corporateSignature.setEmail("rob@gmail.com");
corporateSignature.setName("Rob Winch");
corporateSignature.setMailingAddress("123 Seasame Street");
corporateSignature.setTelephone("123.456.7890");
corporateSignature.setGitHubOrganization("organization");
}
use of io.pivotal.cla.data.IndividualSignature in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method assertThatClaIsSigned.
private void assertThatClaIsSigned(SignClaForm form) {
ArgumentCaptor<IndividualSignature> signatureCaptor = ArgumentCaptor.forClass(IndividualSignature.class);
verify(mockIndividualSignatureRepository).save(signatureCaptor.capture());
IndividualSignature signature = signatureCaptor.getValue();
assertThat(signature.getCla()).isEqualTo(cla);
String country = form.getCountry();
assertThat(signature.getCountry()).isEqualTo(country);
assertThat(signature.getName()).isEqualTo(form.getName());
assertThat(signature.getEmail()).isEqualTo(form.getEmail());
assertThat(signature.getMailingAddress()).isEqualTo(form.getMailingAddress());
assertThat(signature.getTelephone()).isEqualTo(form.getTelephone());
assertThat(signature.getDateOfSignature()).isCloseTo(new Date(), TimeUnit.SECONDS.toMillis(5));
verifyZeroInteractions(mockGitHub);
}
use of io.pivotal.cla.data.IndividualSignature in project pivotal-cla by pivotalsoftware.
the class IndividualSignatureRepositoryTests method createSignature.
private static IndividualSignature createSignature(ContributorLicenseAgreement cla, User user) {
IndividualSignature signature = DataUtils.iclaSignature(cla);
signature.setGitHubLogin(user.getGitHubLogin());
signature.setEmail(user.getEmails().iterator().next());
return signature;
}
use of io.pivotal.cla.data.IndividualSignature in project pivotal-cla by pivotalsoftware.
the class IclaController method signCla.
@RequestMapping(value = "/sign/{claName}/icla", method = RequestMethod.POST)
public String signCla(@AuthenticationPrincipal User user, @Valid SignClaForm signClaForm, BindingResult result, Map<String, Object> model, RedirectAttributes redirect) throws Exception {
String claName = signClaForm.getClaName();
Integer pullRequestId = signClaForm.getPullRequestId();
String repositoryId = signClaForm.getRepositoryId();
ContributorLicenseAgreement cla = clas.findOne(signClaForm.getClaId());
if (result.hasErrors()) {
model.put("cla", cla);
return "cla/icla/sign";
}
IndividualSignature signature = new IndividualSignature();
signature.setCla(cla);
signature.setName(signClaForm.getName());
signature.setCountry(signClaForm.getCountry());
signature.setEmail(signClaForm.getEmail());
signature.setMailingAddress(signClaForm.getMailingAddress());
signature.setDateOfSignature(new Date());
signature.setTelephone(signClaForm.getTelephone());
signature.setGitHubLogin(user.getGitHubLogin());
individual.save(signature);
// update github
redirect.addAttribute("claName", claName);
if (repositoryId == null || pullRequestId == null) {
return "redirect:/sign/{claName}/icla";
}
ClaPullRequestStatusRequest updatePullRequest = signClaForm.createUpdatePullRequestStatus(user.getGitHubLogin());
if (updatePullRequest != null) {
updatePullRequest.getCommitStatus().setSuccess(true);
claService.savePullRequestStatus(updatePullRequest);
}
redirect.addAttribute("repositoryId", repositoryId);
redirect.addAttribute("pullRequestId", pullRequestId);
return "redirect:/sign/{claName}/icla";
}
use of io.pivotal.cla.data.IndividualSignature in project pivotal-cla by pivotalsoftware.
the class ClaService method hasSigned.
public boolean hasSigned(User user, String claName) {
if (claName == null) {
return false;
}
IndividualSignature signedIndividual = findIndividualSignaturesFor(user, claName);
if (signedIndividual != null) {
return true;
}
CorporateSignatureInfo corporateSignatureInfo = findCorporateSignatureInfoFor(claName, user);
CorporateSignature corporateSignature = corporateSignatureInfo.getCorporateSignature();
return corporateSignature != null;
}
Aggregations