Search in sources :

Example 1 with RemoteResourceNotFoundException

use of org.jboss.pnc.client.RemoteResourceNotFoundException in project pnc by project-ncl.

the class BuildTest method buildToFinish.

private Boolean buildToFinish(String buildId, EnumSet<BuildStatus> isIn, EnumSet<BuildStatus> isNotIn) {
    Build build = null;
    logger.debug("Waiting for build {} to finish", buildId);
    try {
        build = buildClient.getSpecific(buildId);
        assertThat(build).isNotNull();
        logger.debug("Gotten build with status: {}", build.getStatus());
        if (!build.getStatus().isFinal())
            return false;
    } catch (RemoteResourceNotFoundException e) {
        fail(String.format("Build with id:%s not present", buildId), e);
    } catch (ClientException e) {
        fail("Client has failed in an unexpected way.", e);
    }
    assertThat(build).isNotNull();
    assertThat(build.getStatus()).isNotNull();
    if (isIn != null && !isIn.isEmpty())
        assertThat(build.getStatus()).isIn(isIn);
    if (isNotIn != null && !isNotIn.isEmpty())
        assertThat(build.getStatus()).isNotIn(isNotIn);
    return true;
}
Also used : RemoteResourceNotFoundException(org.jboss.pnc.client.RemoteResourceNotFoundException) GroupBuild(org.jboss.pnc.dto.GroupBuild) Build(org.jboss.pnc.dto.Build) ClientException(org.jboss.pnc.client.ClientException)

Example 2 with RemoteResourceNotFoundException

use of org.jboss.pnc.client.RemoteResourceNotFoundException in project pnc by project-ncl.

the class BuildTest method groupBuildToFinish.

private Boolean groupBuildToFinish(String groupBuildId, EnumSet<BuildStatus> isIn, EnumSet<BuildStatus> isNotIn) {
    if (isIn == null)
        isIn = EnumSet.noneOf(BuildStatus.class);
    if (isNotIn == null)
        isNotIn = EnumSet.noneOf(BuildStatus.class);
    GroupBuild build = null;
    logger.debug("Waiting for build {} to finish", groupBuildId);
    try {
        build = groupBuildClient.getSpecific(groupBuildId);
        assertThat(build).isNotNull();
        logger.debug("Gotten build with status: {}", build.getStatus());
        if (!build.getStatus().isFinal())
            return false;
    } catch (RemoteResourceNotFoundException e) {
        fail(String.format("Group Build with id:%s not present", groupBuildId), e);
    } catch (ClientException e) {
        fail("Client has failed in an unexpected way.", e);
    }
    assertThat(build.getStatus()).isNotIn(isNotIn).isIn(isIn);
    return true;
}
Also used : RemoteResourceNotFoundException(org.jboss.pnc.client.RemoteResourceNotFoundException) GroupBuild(org.jboss.pnc.dto.GroupBuild) ClientException(org.jboss.pnc.client.ClientException)

Example 3 with RemoteResourceNotFoundException

use of org.jboss.pnc.client.RemoteResourceNotFoundException in project pnc by project-ncl.

the class WebSocketClientTest method groupBuildToFinish.

private Boolean groupBuildToFinish(String groupBuildId) {
    GroupBuild build = null;
    try {
        build = new GroupBuildClient(RestClientConfiguration.asUser()).getSpecific(groupBuildId);
        assertThat(build).isNotNull();
        if (!build.getStatus().isFinal())
            return false;
    } catch (RemoteResourceNotFoundException e) {
        fail(String.format("Group Build with id:%s not present", groupBuildId), e);
    } catch (ClientException e) {
        fail("Client has failed in an unexpected way.", e);
    }
    return true;
}
Also used : RemoteResourceNotFoundException(org.jboss.pnc.client.RemoteResourceNotFoundException) GroupBuild(org.jboss.pnc.dto.GroupBuild) GroupBuildClient(org.jboss.pnc.client.GroupBuildClient) ClientException(org.jboss.pnc.client.ClientException)

Aggregations

ClientException (org.jboss.pnc.client.ClientException)3 RemoteResourceNotFoundException (org.jboss.pnc.client.RemoteResourceNotFoundException)3 GroupBuild (org.jboss.pnc.dto.GroupBuild)3 GroupBuildClient (org.jboss.pnc.client.GroupBuildClient)1 Build (org.jboss.pnc.dto.Build)1