public URI repositoryResource() { return super.resource(); }
public static Builder builder() { return new Builder(); }
public static Builder builder() { return new Builder(); }
private void createBranch( final EnrichmentContext context, final ExecutionEnrichment enrichment, final URI repositoryLocation, final String branchName) { final URI branchResource = enrichment.branchResource().get(); this.scmService.createBranch( CreateBranchCommand. builder(). withRepositoryLocation(repositoryLocation). withBranchName(branchName). withResource(branchResource). build()); context.setBranchResource(branchResource); LOGGER.debug("Created branch {} ({}) in repository {}",branchName,branchResource,repositoryLocation); }
private void createCommit( final EnrichmentContext context, final ExecutionEnrichment enrichment, final URI repositoryLocation, final String branchName, final String commitId) { final URI commitResource = enrichment.commitResource().get(); this.scmService.createCommit( CreateCommitCommand. builder(). withRepositoryLocation(repositoryLocation). withBranchName(branchName). withCommitId(commitId). withResource(commitResource). build()); context.setCommitResource(commitResource); LOGGER.debug("Created commit {} ({}) in branch {} of repository {}",commitId,commitResource,branchName,repositoryLocation); }
private void createRepository( final EnrichmentContext context, final ExecutionEnrichment enrichment, final URI repositoryLocation) { final URI repositoryResource = enrichment.repositoryResource().get(); this.scmService.createRepository( CreateRepositoryCommand. builder(). withRepositoryLocation(repositoryLocation). withResource(repositoryResource). build()); context.setRepositoryResource(repositoryResource); LOGGER.debug("Created repository {} ({})",repositoryLocation,repositoryResource); }
@Override public CreateRepositoryCommand build() { return new CreateRepositoryCommand( super.resource(), checkNotNull(this.repositoryLocation,"Repository location cannot be null")); }
@Override public CreateBranchCommand build() { return new CreateBranchCommand( super.resource(), checkNotNull(this.repositoryLocation,"Repository location cannot be null"), checkNotNull(this.branchName,"Branch name cannot be null")); }
@Override public CreateCommitCommand build() { return new CreateCommitCommand( super.resource(), checkNotNull(this.repositoryLocation,"Repository location cannot be null"), checkNotNull(this.branchName,"Branch name cannot be null"), checkNotNull(this.commitId,"Commit identifier cannot be null")); }
public void createCommit(final CreateCommitCommand aCommand) { checkNotNull(aCommand,COMMAND_CANNOT_BE_NULL); final Branch branch=findBranch(aCommand); final Commit commit = branch.createCommit(aCommand.commitId(), aCommand.commitResource()); commitRepository().add(commit); }
public void createBranch(final CreateBranchCommand aCommand) { checkNotNull(aCommand,COMMAND_CANNOT_BE_NULL); final Repository repository=findRepository(aCommand); final Branch branch = repository.createBranch(aCommand.branchName(), aCommand.branchResource()); branchRepository().add(branch); }
public void createRepository(final CreateRepositoryCommand aCommand) { checkNotNull(aCommand,COMMAND_CANNOT_BE_NULL); final URI location=aCommand.repositoryLocation(); Repository repository = repositoryRepository().repositoryOfLocation(location); checkState(repository==null,"A repository located at '%s' does already exist",location); final URI resource=aCommand.repositoryResource(); repository = Repository.newInstance(location, resource); repositoryRepository().add(repository); }
private Branch findBranch(final CreateCommitCommand aCommand) { final BranchId branchId=BranchId.create(aCommand.repositoryLocation(), aCommand.branchName()); final Branch branch = branchRepository().branchOfId(branchId); checkArgument(branch!=null,"No branch for repository located at '%s' with name '%s' is registered",branchId.repository(),branchId.name()); return branch; }
public static Builder builder() { return new Builder(); }
@Override public final String toString() { final ToStringHelper helper = MoreObjects. toStringHelper(getClass()). omitNullValues(). add("resource", this.resource); toString(helper); return helper.toString(); }
private Repository findRepository(final CreateBranchCommand aCommand) { final URI location=aCommand.repositoryLocation(); final Repository repository = repositoryRepository().repositoryOfLocation(location); checkArgument(repository!=null,"No repository located at '%s' is registered",location); return repository; }
private static void createBuild(final BuildRepository repository, final Build build, final Date createdOn, final String description, final SourceCodeManagementService scmService) { build.setCreatedOn(after(createdOn)); build.setDescription(description); build.setCodebase(new Codebase(build.buildId().resolve("repository.git"),"master")); scmService.createRepository( CreateRepositoryCommand. builder(). withRepositoryLocation(build.codebase().location()). withResource(build.buildId().resolve("scm/repo/")). build()); scmService.createBranch( CreateBranchCommand. builder(). withRepositoryLocation(build.codebase().location()). withBranchName(build.codebase().branchName()). withResource(build.buildId().resolve("scm/repo/master/")). build()); repository.add(build); }
private static Execution createExecution(final ExecutionRepository repository, final SourceCodeManagementService scmService, final Build build, final Execution execution, final int executionIdi, final Status status) { Date date=build.createdOn(); if(execution!=null) { if(execution.isFinished()) { date=execution.result().finishedOn(); } else { date=execution.createdOn(); } } final Execution newExecution=build.addExecution(executionId(build, executionIdi), after(date), build.codebase(), randomSHA1(build,executionIdi)); if(status!=null) { newExecution.finish(new Result(status,after(newExecution.createdOn()))); } repository.add(newExecution); final CreateCommitCommand command = CreateCommitCommand. builder(). withRepositoryLocation(newExecution.codebase().location()). withBranchName(newExecution.codebase().branchName()). withCommitId(newExecution.commitId()). withResource(build.buildId().resolve("scm/repo/master/"+newExecution.commitId()+"/")). build(); scmService.createCommit(command); return newExecution; }
public URI commitResource() { return super.resource(); }
public URI branchResource() { return super.resource(); }