Package com.netflix.genie.common.exceptions

Examples of com.netflix.genie.common.exceptions.GenieException


            @ApiParam(value = "Http Servlet request object", required = true)
            @Context final HttpServletRequest hsr,
            @Context final UriInfo uriInfo) throws GenieException {
        LOG.info("Called to submit job: " + job);
        if (job == null) {
            throw new GenieException(
                    HttpURLConnection.HTTP_PRECON_FAILED,
                    "No job entered. Unable to submit.");
        }

        // get client's host from the context
View Full Code Here


    /**
     * Test 400.
     */
    @Test
    public void testGenieBadRequestException() {
        final GenieException ge = new GenieBadRequestException(ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

    /**
     * Test 409.
     */
    @Test
    public void testGenieConflictException() {
        final GenieException ge = new GenieConflictException(ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(HttpURLConnection.HTTP_CONFLICT, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

    /**
     * Test random exception.
     */
    @Test
    public void testGenieException() {
        final GenieException ge = new GenieException(300, ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(300, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

    /**
     * Test 404.
     */
    @Test
    public void testGenieNotFoundException() {
        final GenieException ge = new GenieNotFoundException(ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(HttpURLConnection.HTTP_NOT_FOUND, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

    /**
     * Test 412.
     */
    @Test
    public void testGeniePreconditionException() {
        final GenieException ge = new GeniePreconditionException(ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(HttpURLConnection.HTTP_PRECON_FAILED, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

    /**
     * Test 500.
     */
    @Test
    public void testGenieServerException() {
        final GenieException ge = new GenieServerException(ERROR_MESSAGE);
        final Response response = this.mapper.toResponse(ge);
        Assert.assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, response.getStatus());
        Assert.assertNotNull(response.getEntity());
        Assert.assertEquals(ERROR_MESSAGE, response.getEntity());
    }
View Full Code Here

        Mockito.when(job.getId()).thenReturn(JOB_1_ID);
        Mockito.when(jobRepo.findOne(JOB_1_ID)).thenReturn(job);

        final JobManager manager = Mockito.mock(JobManager.class);
        Mockito.when(jobManagerFactory.getJobManager(job))
                .thenThrow(new GenieException(
                                HttpURLConnection.HTTP_NOT_FOUND,
                                "Some message"
                        ));

        impl.runJob(job);
View Full Code Here

                    return mapper.readValue(response.getInputStream(), type);
                } else {
                    return mapper.readValue(response.getInputStream(), entityClass);
                }
            } else {
                throw new GenieException(
                        response.getStatus(),
                        response.getEntity(String.class));
            }
        } catch (final Exception e) {
            if (e instanceof GenieException) {
View Full Code Here

TOP

Related Classes of com.netflix.genie.common.exceptions.GenieException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.