use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignaturesEmptyEmails.
@Test
public void findSignaturesEmptyEmails() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignatures(new PageRequest(0, 1), Arrays.asList("notorganization"), Collections.emptyList())).isEmpty();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignatureEmailDomain.
@Test
public void findSignatureEmailDomain() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignature(springCla.getName(), Arrays.asList("notorganization"), user.getEmails())).isNotNull();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignatureByEmptyGitHubOrganizations.
@Test
public void findSignatureByEmptyGitHubOrganizations() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignature(springCla.getName(), Arrays.asList(), null)).isNull();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignaturesEmailDomain.
@Test
public void findSignaturesEmailDomain() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignatures(new PageRequest(0, 1), Arrays.asList("notorganization"), user.getEmails())).hasSize(1);
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CclaController method signCla.
@RequestMapping(value = "/sign/{claName}/ccla", method = RequestMethod.POST)
public String signCla(@AuthenticationPrincipal User user, @Valid SignCorporateClaForm signCorporateClaForm, BindingResult result, Map<String, Object> model, RedirectAttributes redirect) throws Exception {
ContributorLicenseAgreement cla = clas.findOne(signCorporateClaForm.getClaId());
List<String> currentUserGitHubOrganizations = gitHub.getOrganizations(user.getGitHubLogin());
if (result.hasErrors()) {
model.put("cla", cla);
signCorporateClaForm.setGitHubOrganizations(currentUserGitHubOrganizations);
return "cla/ccla/sign";
}
CorporateSignature signature = new CorporateSignature();
signature.setCla(cla);
signature.setEmail(signCorporateClaForm.getEmail());
signature.setDateOfSignature(new Date());
signature.setGitHubLogin(user.getGitHubLogin());
signature.setGitHubOrganization(signCorporateClaForm.getGitHubOrganization());
signature.setTitle(signCorporateClaForm.getTitle());
signature.setCountry(signCorporateClaForm.getCountry());
signature.setName(signCorporateClaForm.getName());
signature.setMailingAddress(signCorporateClaForm.getMailingAddress());
signature.setTelephone(signCorporateClaForm.getTelephone());
signature.setCompanyName(signCorporateClaForm.getCompanyName());
corporate.save(signature);
// update github
String repositoryId = signCorporateClaForm.getRepositoryId();
Integer pullRequestId = signCorporateClaForm.getPullRequestId();
redirect.addAttribute("claName", cla.getName());
if (repositoryId == null || pullRequestId == null) {
return "redirect:/sign/{claName}/ccla";
}
ClaPullRequestStatusRequest updatePullRequest = signCorporateClaForm.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}/ccla";
}
Aggregations