use of org.jboss.pnc.client.UserClient in project pnc by project-ncl.
the class UserEndpointTest method testGetUser.
@Test
public void testGetUser() throws ClientException {
// when
UserClient client = new UserClient(RestClientConfiguration.asUser());
User user = client.getCurrentUser();
// then
assertThat(user).isNotNull();
assertThat(user.getUsername()).isNotNull();
assertThat(user.getId()).isNotNull();
// when
client = new UserClient(RestClientConfiguration.asSystem());
user = client.getCurrentUser();
// then
assertThat(user).isNotNull();
assertThat(user.getUsername()).isNotNull();
assertThat(user.getId()).isNotNull();
}
use of org.jboss.pnc.client.UserClient 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