use of org.jboss.pnc.rest.api.parameters.BuildsFilterParameters in project pnc by project-ncl.
the class BuildTest method shouldTriggerBuildWithADependencyAndFinishWithoutProblems.
@Test
public void shouldTriggerBuildWithADependencyAndFinishWithoutProblems() throws ClientException {
// given - A BC with a dependency on pnc-1.0.0.DR1
BuildConfiguration buildConfigurationParent = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==dependency-analysis-1.3")).iterator().next();
// Update dependency
BuildConfiguration buildConfigurationChild = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==pnc-1.0.0.DR1")).iterator().next();
BuildConfiguration updatedBuildConfigurationChild = buildConfigurationChild.toBuilder().description(buildConfigurationChild.getDescription() + ".").build();
buildConfigurationClient.update(buildConfigurationChild.getId(), updatedBuildConfigurationChild);
// The update of the description should not have changed the lastModificationDate
assertThat(buildConfigurationChild.getModificationTime()).isEqualTo(updatedBuildConfigurationChild.getModificationTime());
// when
Build build = buildConfigurationClient.trigger(buildConfigurationParent.getId(), getBuildParameters(false, true));
BuildsFilterParameters parameters = new BuildsFilterParameters();
parameters.setRunning(true);
RemoteCollection<Build> childBuildCol = buildConfigurationClient.getBuilds(buildConfigurationChild.getId(), parameters);
Build childBuild = childBuildCol.getAll().iterator().next();
// then
assertThat(childBuildCol.size()).isEqualTo(1);
assertThat(buildConfigurationParent.getDependencies().size()).isEqualTo(1);
assertThat(build).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, null), 15, TimeUnit.SECONDS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(childBuild.getId(), isIn, null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.rest.api.parameters.BuildsFilterParameters in project pnc by project-ncl.
the class BuildEndpointTest method shouldFilterByBuildConfigurationName.
@Test
public void shouldFilterByBuildConfigurationName() throws Exception {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
String buildConfigName = DatabaseDataInitializer.PNC_PROJECT_BUILD_CFG_ID;
BuildsFilterParameters filter = new BuildsFilterParameters();
filter.setBuildConfigName(buildConfigName);
List<String> buildConfigNames = client.getAll(filter, null).getAll().stream().map(Build::getBuildConfigRevision).map(BuildConfigurationRevisionRef::getName).collect(Collectors.toList());
// from DatabaseDataInitializer
assertThat(buildConfigNames).hasSize(2);
assertThat(buildConfigNames).containsOnly(buildConfigName);
}
use of org.jboss.pnc.rest.api.parameters.BuildsFilterParameters in project pnc by project-ncl.
the class BuildEndpointTest method shouldFilterByBuildConfigurationNameAndUserId.
@Test
public void shouldFilterByBuildConfigurationNameAndUserId() throws Exception {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
String buildConfigName = DatabaseDataInitializer.PNC_PROJECT_BUILD_CFG_ID;
String username = "pnc-admin";
String rsql = "user.username==" + username;
BuildsFilterParameters filter = new BuildsFilterParameters();
filter.setBuildConfigName(buildConfigName);
List<Build> builds = new ArrayList<>(client.getAll(filter, null, Optional.empty(), Optional.of(rsql)).getAll());
assertThat(builds).hasSize(2);
assertThat(builds.stream().map(Build::getBuildConfigRevision).map(BuildConfigurationRevisionRef::getName).allMatch(name -> name.equals(buildConfigName)));
assertThat(builds.stream().map(Build::getUser).map(User::getUsername).allMatch(name -> name.equals(username)));
}
use of org.jboss.pnc.rest.api.parameters.BuildsFilterParameters in project pnc by project-ncl.
the class BuildEndpointTest method shouldFilterByBuildConfigurationNameLike.
@Test
public void shouldFilterByBuildConfigurationNameLike() throws Exception {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
String buildConfigName = DatabaseDataInitializer.PNC_PROJECT_BUILD_CFG_ID;
BuildsFilterParameters filter = new BuildsFilterParameters();
filter.setBuildConfigName("*" + buildConfigName.substring(1, buildConfigName.length() - 2) + "*");
List<String> buildConfigNames = client.getAll(filter, null).getAll().stream().map(Build::getBuildConfigRevision).map(BuildConfigurationRevisionRef::getName).collect(Collectors.toList());
// from DatabaseDataInitializer
assertThat(buildConfigNames).hasSize(2);
assertThat(buildConfigNames).containsOnly(buildConfigName);
}
use of org.jboss.pnc.rest.api.parameters.BuildsFilterParameters in project bacon by project-ncl.
the class AbstractBuildListCommand method getAll.
public Collection<Build> getAll(String sort, String query) throws RemoteResourceException {
BuildsFilterParameters filter = new BuildsFilterParameters();
filter.setLatest(latest);
filter.setRunning(running);
return getAll(filter, sort, query);
}
Aggregations