use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class ArtifactEndpointTest method shouldGetBuildsThatDependsOnArtifact.
@Test
public void shouldGetBuildsThatDependsOnArtifact() throws RemoteResourceException {
ArtifactClient client = new ArtifactClient(RestClientConfiguration.asUser());
RemoteCollection<Build> builds = client.getDependantBuilds(artifactRest3.getId());
assertThat(builds).hasSize(2);
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method testGetAllWithLatest.
@Test
@InSequence(10)
public void testGetAllWithLatest() throws RemoteResourceException {
BuildConfigurationClient client = new BuildConfigurationClient(RestClientConfiguration.asAnonymous());
RemoteCollection<BuildConfigurationWithLatestBuild> bcsWithLatest = client.getAllWithLatestBuild();
BuildsFilterParameters filter = new BuildsFilterParameters();
filter.setLatest(true);
// from DatabaseDataInitializer
assertThat(bcsWithLatest).hasSize(5);
for (BuildConfigurationWithLatestBuild bc : bcsWithLatest.getAll()) {
List<Build> associatedBuilds = new ArrayList<>(client.getBuilds(bc.getId(), filter).getAll());
if (bc.getLatestBuild() != null) {
assertThat(associatedBuilds).isNotEmpty();
assertThat(bc.getLatestBuild().getId()).isEqualTo(associatedBuilds.get(0).getId());
}
}
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildEndpointTest method shouldFilterByNotExistingBuildConfigurationName.
@Test
public void shouldFilterByNotExistingBuildConfigurationName() throws Exception {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
String buildConfigName = "SomeRandomName";
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());
assertThat(buildConfigNames).isEmpty();
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildEndpointTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
BuildClient bc = new BuildClient(RestClientConfiguration.asAnonymous());
Iterator<Build> it = bc.getAll(null, null).iterator();
buildId = it.next().getId();
build2Id = it.next().getId();
build3Id = it.next().getId();
}
use of org.jboss.pnc.dto.Build in project pnc by project-ncl.
the class BuildEndpointTest method shouldUpdateBuild.
@Test
@InSequence(20)
public void shouldUpdateBuild() throws ClientException {
// given
BuildClient client = new BuildClient(RestClientConfiguration.asSystem());
Build original = client.getSpecific(buildId);
Build toUpdate = original.toBuilder().status(BuildStatus.SYSTEM_ERROR).build();
assertThat(toUpdate.getStatus()).isNotEqualTo(original.getStatus());
// when
client.update(buildId, toUpdate);
Build updated = client.getSpecific(buildId);
assertThat(updated.getId()).isEqualTo(buildId);
assertThat(updated).isEqualToIgnoringGivenFields(original, "status", "lastUpdateTime");
assertThat(updated.getStatus()).isNotEqualTo(original.getStatus());
assertThat(updated.getStatus()).isEqualTo(toUpdate.getStatus());
}
Aggregations