Package com.netflix.genie.common.model

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


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


    public Set<Cluster> getClustersForCommand(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No command id entered. Unable to get clusters.");
        }
        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            return command.getClusters();
        } else {
            throw new GenieNotFoundException("No command with id " + id + " exists.");
        }
    }
View Full Code Here

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

        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            command.getTags().remove(tag);
            return command.getTags();
        } else {
            throw new GenieNotFoundException("No command with id " + id + " exists.");
        }
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testAddCommandsForCluster() throws GenieException {
        final Command command1 = this.commandService.createCommand(
                new Command(
                        "name",
                        "user",
                        CommandStatus.ACTIVE,
                        "pig",
                        "23.1.0"
                )
        );
        final Command command2 = this.commandService.createCommand(
                new Command(
                        "name2",
                        "user2",
                        CommandStatus.INACTIVE,
                        "pig2",
                        "23.1.1"
View Full Code Here

     */
    @Test(expected = GenieNotFoundException.class)
    public void testAddCommandsForClusterCommandDoesntExist()
            throws GenieException {
        final List<Command> commands = new ArrayList<>();
        final Command command = new Command();
        command.setId(UUID.randomUUID().toString());
        commands.add(command);
        this.service.addCommandsForCluster(
                CLUSTER_1_ID, commands);
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testUpdateCommandsForCluster() throws GenieException {
        final Command command1 = this.commandService.createCommand(
                new Command(
                        "name",
                        "user",
                        CommandStatus.ACTIVE,
                        "pig",
                        "23.1.0"
                )
        );
        final Command command2 = this.commandService.createCommand(
                new Command(
                        "name2",
                        "user2",
                        CommandStatus.INACTIVE,
                        "pig2",
                        "23.1.1"
View Full Code Here

     */
    @Test(expected = GenieNotFoundException.class)
    public void testUpdateCommandsForClusterCommandDoesntExist()
            throws GenieException {
        final List<Command> commands = new ArrayList<>();
        final Command command = new Command();
        command.setId(UUID.randomUUID().toString());
        commands.add(command);
        this.service.updateCommandsForCluster(
                CLUSTER_1_ID, commands);
    }
View Full Code Here

    public Command getCommand(final String id) throws GenieException {
        LOG.debug("called");
        if (StringUtils.isEmpty(id)) {
            throw new GeniePreconditionException("Id can't be null or empty.");
        }
        final Command command = this.commandRepo.findOne(id);
        if (command != null) {
            return command;
        } else {
            throw new GenieNotFoundException("No command with id " + id + " exists.");
        }
View Full Code Here

        //Set the id if it's not set so we can merge
        if (StringUtils.isBlank(updateCommand.getId())) {
            updateCommand.setId(id);
        }
        LOG.debug("Called to update command with id " + id + " " + updateCommand.toString());
        final Command command = this.em.merge(updateCommand);
        command.validate();
        return command;
    }
View Full Code Here

    public Command deleteCommand(final String id) throws GenieException {
        LOG.debug("Called to delete command config with id " + id);
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No id entered. Unable to delete.");
        }
        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);
            }
View Full Code Here

TOP

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

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.