use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildPushTest method shouldRefuseToPushNoRebuildRequiredStatusBuild.
@Test
public void shouldRefuseToPushNoRebuildRequiredStatusBuild() throws ClientException {
BuildClient client = new BuildClient(RestClientConfiguration.asSystem());
Build build = client.getSpecific(build2Id);
Build noRebuildStatus = build.toBuilder().status(BuildStatus.NO_REBUILD_REQUIRED).build();
client.update(build2Id, noRebuildStatus);
BuildPushParameters parameters = BuildPushParameters.builder().reimport(false).tagPrefix("test-tag").build();
assertThatThrownBy(() -> client.push(build2Id, parameters)).hasCauseInstanceOf(ForbiddenException.class);
}
use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class UserEndpointTest method testGetAllBuilds.
@Test
public void testGetAllBuilds() throws ClientException {
UserClient client = new UserClient(RestClientConfiguration.asUser());
BuildClient buildClient = new BuildClient(RestClientConfiguration.asAnonymous());
BuildsFilterParameters params = new BuildsFilterParameters();
params.setLatest(false);
params.setRunning(false);
RemoteCollection<Build> remoteBuilds = buildClient.getAllByStatusAndLogContaining(BuildStatus.SUCCESS, "fox");
User user = remoteBuilds.iterator().next().getUser();
RemoteCollection<Build> builds = client.getBuilds(user.getId(), params);
assertThat(builds).isNotNull();
assertThat(builds.size()).isGreaterThanOrEqualTo(1);
}
Aggregations