Search in sources :

Example 36 with BuildClient

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

Example 37 with BuildClient

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

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