Package com.netflix.genie.common.model

Examples of com.netflix.genie.common.model.Application


        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id sent. Cannot retrieve tags.");
        }

        final Application application = this.applicationRepo.findOne(id);
        if (application != null) {
            return application.getTags();
        } else {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
        }
    }
View Full Code Here


            final String id,
            final Set<String> tags) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to update tags.");
        }
        final Application application = this.applicationRepo.findOne(id);
        if (application != null) {
            application.setTags(tags);
            return application.getTags();
        } else {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
        }
    }
View Full Code Here

    public Set<String> removeAllTagsForApplication(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to remove tags.");
        }
        final Application application = this.applicationRepo.findOne(id);
        if (application != null) {
            application.getTags().clear();
            return application.getTags();
        } else {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
        }
    }
View Full Code Here

            throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to remove tag.");
        }

        final Application application = this.applicationRepo.findOne(id);
        if (application != null) {
            if (StringUtils.isNotBlank(tag)) {
                application.getTags().remove(tag);
            }
            return application.getTags();
        } else {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
        }
    }
View Full Code Here

    public Set<Command> getCommandsForApplication(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No application id entered. Unable to get commands.");
        }
        final Application app = this.applicationRepo.findOne(id);
        if (app != null) {
            return app.getCommands();
        } else {
            throw new GenieNotFoundException("No application with id " + id + " exists.");
        }
    }
View Full Code Here

        final Command command = this.commandRepo.findOne(id);
        if (command == null) {
            throw new GenieNotFoundException("No command with id " + id + " exists to delete.");
        }
        //Remove the command from the associated Application references
        final Application app = command.getApplication();
        if (app != null) {
            final Set<Command> commands = app.getCommands();
            if (commands != null) {
                commands.remove(command);
            }
        }
        this.commandRepo.delete(command);
View Full Code Here

        if (StringUtils.isBlank(application.getId())) {
            throw new GeniePreconditionException("No application id entered. Unable to set application.");
        }
        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            final Application app = this.appRepo.findOne(application.getId());
            if (app != null) {
                command.setApplication(app);
            } else {
                throw new GenieNotFoundException("No application with id " + application.getId() + " exists.");
            }
View Full Code Here

        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No command id entered. Unable to get applications.");
        }
        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            final Application app = command.getApplication();
            if (app != null) {
                return app;
            } else {
                throw new GenieNotFoundException("No application set for command with id '" + id + "'.");
            }
View Full Code Here

        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No command id entered. Unable to remove application.");
        }
        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            final Application app = command.getApplication();
            if (app != null) {
                command.setApplication(null);
                return app;
            } else {
                throw new GenieNotFoundException("No application set for command with id '" + id + "'.");
View Full Code Here

        final InputStream is = new ByteArrayInputStream(inputEntity.getBytes(Charset.forName("UTF-8")));
        Mockito.when(this.response.getInputStream()).thenReturn(is);

        Mockito.when(this.restClient.executeWithLoadBalancer(this.request)).thenReturn(this.response);

        final Application outputEntity =
                (Application) this.client.executeRequest(this.request, null, Application.class);

        Assert.assertEquals(APPLICATION.getName(), outputEntity.getName());
        Assert.assertEquals(APPLICATION.getUser(), outputEntity.getUser());
        Assert.assertEquals(APPLICATION.getVersion(), outputEntity.getVersion());
        Assert.assertEquals(APPLICATION.getStatus(), outputEntity.getStatus());

        Mockito.verify(this.response, Mockito.times(1)).isSuccess();
        Mockito.verify(this.response, Mockito.times(1)).getInputStream();
    }
View Full Code Here

TOP

Related Classes of com.netflix.genie.common.model.Application

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.