use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildEndpointTest method shouldGetBuildConfigurationRevision.
@Test
public void shouldGetBuildConfigurationRevision() throws ClientException {
// when
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
BuildConfigurationRevision bcRevision = client.getBuildConfigRevision(buildId);
// then
// from
assertThat(bcRevision.getScmRevision()).isEqualTo("*/v0.2");
// DatabaseDataInitializer
}
use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildEndpointTest method shouldNotStandardUserModifyUnallowedQualityLevel.
@Test
public void shouldNotStandardUserModifyUnallowedQualityLevel() throws RemoteResourceException {
BuildClient client = new BuildClient(RestClientConfiguration.asUser());
String REASON = "This artifact has become old enough";
assertThatThrownBy(() -> client.createBuiltArtifactsQualityLevelRevisions(buildId, "BLACKListed", REASON)).hasCauseInstanceOf(BadRequestException.class);
}
use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildEndpointTest method shouldFilterByUserId.
@Test
public void shouldFilterByUserId() throws Exception {
BuildClient bc = new BuildClient(RestClientConfiguration.asAnonymous());
Build build = bc.getAll(null, null).getAll().iterator().next();
String userId = build.getUser().getId();
String rsql = "user.id==" + userId;
List<String> userIds = bc.getAll(null, null, Optional.empty(), Optional.of(rsql)).getAll().stream().map(Build::getUser).map(User::getId).collect(Collectors.toList());
// from DatabaseDataInitializer
assertThat(userIds).hasSize(2);
assertThat(userIds).containsOnly(userId);
}
use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildEndpointTest method shouldGetByStatusAndLog.
@Test
public void shouldGetByStatusAndLog() throws RemoteResourceException {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
RemoteCollection<Build> builds = client.getAllByStatusAndLogContaining(BuildStatus.SUCCESS, "fox");
assertThat(builds.size()).isGreaterThan(0);
Build build = builds.iterator().next();
logger.info("Found build:" + build.toString());
}
use of org.jboss.pnc.client.BuildClient in project pnc by project-ncl.
the class BuildEndpointTest method shouldFailToGetSshCredentialsForAnonymous.
@Test
public void shouldFailToGetSshCredentialsForAnonymous() {
BuildClient client = new BuildClient(RestClientConfiguration.asAnonymous());
// 401
assertThatThrownBy(() -> client.getSshCredentials(buildId)).hasCauseInstanceOf(NotAuthorizedException.class);
// means
// not
// authenticated
}
Aggregations