use of org.jboss.pnc.dto.SCMRepository in project pnc by project-ncl.
the class SCMRepositoryProviderTest method testStoreNewRepositoryWithInvalidInternalUrlShouldFail.
@Test
public void testStoreNewRepositoryWithInvalidInternalUrlShouldFail() {
// when
SCMRepository toCreate = createNewSCMRepository("https://" + UUID.randomUUID().toString() + ".ca", "noway" + UUID.randomUUID().toString(), true, null);
// then
assertThatThrownBy(() -> provider.store(toCreate)).isInstanceOf(InvalidEntityException.class);
}
use of org.jboss.pnc.dto.SCMRepository in project pnc by project-ncl.
the class SCMRepositoryProviderImpl method notifySCMRepositoryCreated.
private void notifySCMRepositoryCreated(RepositoryCreated event) {
final SCMRepository repository = getSpecific(Integer.toString(event.getRepositoryId()));
final String taskId = event.getTaskId() == null ? null : event.getTaskId().toString();
if (taskId != null)
notifier.sendMessage(new SCMRepositoryCreationSuccess(repository, taskId));
}
use of org.jboss.pnc.dto.SCMRepository in project pnc by project-ncl.
the class SCMRepositoryProviderImpl method createSCMRepository.
@Override
public RepositoryCreationResponse createSCMRepository(String scmUrl, String revision, Boolean preBuildSyncEnabled, JobNotificationType jobType, Consumer<RepositoryCreated> consumer, Optional<BuildConfiguration> buildConfiguration) {
log.trace("Received request to start RC creation with url autodetect: " + scmUrl + " (sync enabled? " + preBuildSyncEnabled + ")");
if (StringUtils.isEmpty(scmUrl))
throw new InvalidEntityException("You must specify the SCM URL.");
if (scmUrl.contains(config.getInternalScmAuthority())) {
// validation phase
validateInternalRepository(scmUrl);
validateRepositoryWithInternalURLDoesNotExist(scmUrl, null);
SCMRepository scmRepository = createSCMRepositoryFromValues(null, scmUrl, false);
consumer.accept(new RepositoryCreated(null, Integer.valueOf(scmRepository.getId())));
return new RepositoryCreationResponse(scmRepository);
} else {
validateRepositoryWithExternalURLDoesNotExist(scmUrl, null);
boolean sync = preBuildSyncEnabled == null || preBuildSyncEnabled;
Integer taskId = startRCreationTask(scmUrl, revision, sync, jobType, consumer, buildConfiguration);
return new RepositoryCreationResponse(taskId);
}
}
Aggregations