Package com.netflix.genie.common.exceptions

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


    /**
     * 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


    public Set<String> addTagsForJob(
            final String id,
            final Set<String> tags) throws GenieException {
        this.testId(id);
        if (tags == null) {
            throw new GeniePreconditionException("No tags entered.");
        }
        final Job job = this.jobRepo.findOne(id);
        if (job != null) {
            job.getTags().addAll(tags);
            return job.getTags();
View Full Code Here

    @Transactional(rollbackFor = GenieException.class)
    public Set<String> removeTagForJob(final String id, final String tag)
            throws GenieException {
        this.testId(id);
        if (id.equals(tag)) {
            throw new GeniePreconditionException(
                    "Cannot delete job id from the tags list.");
        }

        final Job job = this.jobRepo.findOne(id);
        if (job != null) {
View Full Code Here

            final JobStatus status,
            final String msg) throws GenieException {
        LOG.debug("Setting job with id " + id + " to status " + status + " for reason " + msg);
        this.testId(id);
        if (status == null) {
            throw new GeniePreconditionException("No status entered.");
        }
        final Job job = this.jobRepo.findOne(id);
        if (job != null) {
            job.setJobStatus(status, msg);
        } else {
View Full Code Here

        return "http://" + hostName + ":" + SERVER_PORT;
    }

    private void testId(final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No id entered.");
        }
    }
View Full Code Here

    @Transactional(readOnly = true)
    public Application getApplication(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            //Messages will be logged by exception mapper at resource level
            throw new GeniePreconditionException("No id entered. Unable to get");
        }
        LOG.debug("Called with id " + id);
        final Application app = this.applicationRepo.findOne(id);
        if (app == null) {
            throw new GenieNotFoundException("No application with id " + id);
View Full Code Here

     */
    @Override
    public Application createApplication(
            final Application app) throws GenieException {
        if (app == null) {
            throw new GeniePreconditionException("No application entered to create.");
        }
        app.validate();

        LOG.debug("Called with application: " + app.toString());
        if (app.getId() != null && this.applicationRepo.exists(app.getId())) {
View Full Code Here

    @Override
    public Application updateApplication(
            final String id,
            final Application updateApp) throws GenieException {
        if (StringUtils.isEmpty(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to update.");
        }
        if (updateApp == null) {
            throw new GeniePreconditionException("No application information entered. Unable to update.");
        }
        if (!this.applicationRepo.exists(id)) {
            throw new GenieNotFoundException("No application information entered. Unable to update.");
        }
        if (StringUtils.isNotBlank(updateApp.getId())
View Full Code Here

     */
    @Override
    public Application deleteApplication(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to delete.");
        }
        LOG.debug("Called with id " + id);
        final Application app = this.applicationRepo.findOne(id);
        if (app == null) {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
View Full Code Here

    @Override
    public Set<String> addConfigsToApplication(
            final String id,
            final Set<String> configs) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to add configurations.");
        }
        if (configs == null) {
            throw new GeniePreconditionException("No configuration files entered.");
        }
        final Application app = this.applicationRepo.findOne(id);
        if (app != null) {
            app.getConfigs().addAll(configs);
            return app.getConfigs();
View Full Code Here

TOP

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

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.