Search in sources :

Example 6 with BuildClient

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
}
Also used : BuildClient(org.jboss.pnc.client.BuildClient) BuildConfigurationRevision(org.jboss.pnc.dto.BuildConfigurationRevision) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 7 with BuildClient

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);
}
Also used : BuildClient(org.jboss.pnc.client.BuildClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 8 with BuildClient

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);
}
Also used : Build(org.jboss.pnc.dto.Build) BuildClient(org.jboss.pnc.client.BuildClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 9 with BuildClient

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());
}
Also used : Build(org.jboss.pnc.dto.Build) BuildClient(org.jboss.pnc.client.BuildClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 10 with BuildClient

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
}
Also used : BuildClient(org.jboss.pnc.client.BuildClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

BuildClient (org.jboss.pnc.client.BuildClient)37 ContainerTest (org.jboss.pnc.test.category.ContainerTest)33 Test (org.junit.Test)33 Build (org.jboss.pnc.dto.Build)20 BuildsFilterParameters (org.jboss.pnc.rest.api.parameters.BuildsFilterParameters)7 InputStream (java.io.InputStream)5 Artifact (org.jboss.pnc.dto.Artifact)5 InSequence (org.jboss.arquillian.junit.InSequence)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Response (javax.ws.rs.core.Response)3 ArtifactClient (org.jboss.pnc.client.ArtifactClient)3 BuildPushParameters (org.jboss.pnc.dto.requests.BuildPushParameters)3 Field (java.lang.reflect.Field)2 ApacheHttpClient43EngineWithRetry (org.jboss.pnc.client.ApacheHttpClient43EngineWithRetry)2 ClientException (org.jboss.pnc.client.ClientException)2 Configuration (org.jboss.pnc.client.Configuration)2 BuildConfigurationRevision (org.jboss.pnc.dto.BuildConfigurationRevision)2 BuildRef (org.jboss.pnc.dto.BuildRef)2 BeforeClass (org.junit.BeforeClass)2