Package com.netflix.genie.common.model

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


        }

        // save the command name, application id and application name
        this.jobService.setCommandInfoForJob(this.job.getId(), command.getId(), command.getName());

        final Application application = command.getApplication();
        if (application != null) {
            this.jobService.setApplicationInfoForJob(this.job.getId(), application.getId(), application.getName());
        }

        // Refresh the job in memory to get the changes
        this.job = this.jobService.getJob(this.job.getId());
View Full Code Here


        if (StringUtils.isNotBlank(command.getEnvPropFile())) {
            processBuilder.environment().put("COMMAND_ENV_FILE", command.getEnvPropFile());
        }

        final Application application = command.getApplication();
        if (application != null) {
            if (application.getConfigs() != null && !application.getConfigs().isEmpty()) {
                processBuilder.environment()
                        .put("S3_APPLICATION_CONF_FILES", convertCollectionToCSV(application.getConfigs()));
            }

            if (application.getJars() != null && !application.getJars().isEmpty()) {
                processBuilder.environment()
                        .put("S3_APPLICATION_JAR_FILES", convertCollectionToCSV(application.getJars()));
            }

            if (StringUtils.isNotBlank(application.getEnvPropFile())) {
                processBuilder.environment()
                        .put("APPLICATION_ENV_FILE", application.getEnvPropFile());
            }
        }
    }
View Full Code Here

    public Response createApplication(
            @ApiParam(value = "The application to create.", required = true)
            final Application app,
            @Context UriInfo uriInfo) throws GenieException {
        LOG.info("Called to create new application");
        final Application createdApp = this.acs.createApplication(app);
        return Response.created(
                uriInfo.getAbsolutePathBuilder().path(createdApp.getId()).build()).
                entity(createdApp).
                build();
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testGetApplication() throws GenieException {
        final Application app = this.service.getApplication(APP_1_ID);
        Assert.assertEquals(APP_1_ID, app.getId());
        Assert.assertEquals(APP_1_NAME, app.getName());
        Assert.assertEquals(APP_1_USER, app.getUser());
        Assert.assertEquals(APP_1_VERSION, app.getVersion());
        Assert.assertEquals(APP_1_STATUS, app.getStatus());
        Assert.assertEquals(3, app.getTags().size());
        Assert.assertEquals(2, app.getConfigs().size());
        Assert.assertEquals(2, app.getJars().size());

        final Application app2 = this.service.getApplication(APP_2_ID);
        Assert.assertEquals(APP_2_ID, app2.getId());
        Assert.assertEquals(APP_2_NAME, app2.getName());
        Assert.assertEquals(APP_2_USER, app2.getUser());
        Assert.assertEquals(APP_2_VERSION, app2.getVersion());
        Assert.assertEquals(APP_2_STATUS, app2.getStatus());
        Assert.assertEquals(4, app2.getTags().size());
        Assert.assertEquals(2, app2.getConfigs().size());
        Assert.assertEquals(1, app2.getJars().size());

        final Application app3 = this.service.getApplication(APP_3_ID);
        Assert.assertEquals(APP_3_ID, app3.getId());
        Assert.assertEquals(APP_3_NAME, app3.getName());
        Assert.assertEquals(APP_3_USER, app3.getUser());
        Assert.assertEquals(APP_3_VERSION, app3.getVersion());
        Assert.assertEquals(APP_3_STATUS, app3.getStatus());
        Assert.assertEquals(3, app3.getTags().size());
        Assert.assertEquals(1, app3.getConfigs().size());
        Assert.assertEquals(2, app3.getJars().size());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testCreateApplication() throws GenieException {
        final Application app = new Application(
                APP_1_NAME,
                APP_1_USER,
                ApplicationStatus.ACTIVE,
                APP_1_VERSION
        );
        final String id = UUID.randomUUID().toString();
        app.setId(id);
        final Application created = this.service.createApplication(app);
        Assert.assertNotNull(this.service.getApplication(id));
        Assert.assertEquals(id, created.getId());
        Assert.assertEquals(APP_1_NAME, created.getName());
        Assert.assertEquals(APP_1_USER, created.getUser());
        Assert.assertEquals(ApplicationStatus.ACTIVE, created.getStatus());
        this.service.deleteApplication(id);
        try {
            this.service.getApplication(id);
            Assert.fail("Should have thrown exception");
        } catch (final GenieException ge) {
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testCreateApplicationNoId() throws GenieException {
        final Application app = new Application(
                APP_1_NAME,
                APP_1_USER,
                ApplicationStatus.ACTIVE,
                APP_1_VERSION
        );
        final Application created = this.service.createApplication(app);
        Assert.assertNotNull(this.service.getApplication(created.getId()));
        Assert.assertEquals(APP_1_NAME, created.getName());
        Assert.assertEquals(APP_1_USER, created.getUser());
        Assert.assertEquals(ApplicationStatus.ACTIVE, created.getStatus());
        this.service.deleteApplication(created.getId());
        try {
            this.service.getApplication(created.getId());
            Assert.fail();
        } catch (final GenieException ge) {
            Assert.assertEquals(
                    HttpURLConnection.HTTP_NOT_FOUND,
                    ge.getErrorCode()
View Full Code Here

     *
     * @throws GenieException
     */
    @Test(expected = GenieConflictException.class)
    public void testCreateApplicationAlreadyExists() throws GenieException {
        final Application app = new Application(
                APP_1_NAME,
                APP_1_USER,
                ApplicationStatus.ACTIVE,
                APP_1_VERSION
        );
        app.setId(APP_1_ID);
        this.service.createApplication(app);
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testUpdateApplicationNoId() throws GenieException {
        final Application init = this.service.getApplication(APP_1_ID);
        Assert.assertEquals(APP_1_USER, init.getUser());
        Assert.assertEquals(ApplicationStatus.INACTIVE, init.getStatus());
        Assert.assertEquals(3, init.getTags().size());

        final Application updateApp = new Application();
        updateApp.setStatus(ApplicationStatus.ACTIVE);
        updateApp.setUser(APP_2_USER);
        final Set<String> tags = new HashSet<>();
        tags.add("prod");
        tags.add("tez");
        tags.add("yarn");
        tags.add("hadoop");
        updateApp.setTags(tags);
        this.service.updateApplication(APP_1_ID, updateApp);

        final Application updated = this.service.getApplication(APP_1_ID);
        Assert.assertEquals(APP_2_USER, updated.getUser());
        Assert.assertEquals(ApplicationStatus.ACTIVE, updated.getStatus());
        Assert.assertEquals(6, updated.getTags().size());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testUpdateApplicationWithId() throws GenieException {
        final Application init = this.service.getApplication(APP_1_ID);
        Assert.assertEquals(APP_1_USER, init.getUser());
        Assert.assertEquals(ApplicationStatus.INACTIVE, init.getStatus());
        Assert.assertEquals(3, init.getTags().size());

        final Application updateApp = new Application();
        updateApp.setId(APP_1_ID);
        updateApp.setStatus(ApplicationStatus.ACTIVE);
        updateApp.setUser(APP_2_USER);
        final Set<String> tags = new HashSet<>();
        tags.add("prod");
        tags.add("tez");
        tags.add("yarn");
        tags.add("hadoop");
        updateApp.setTags(tags);
        this.service.updateApplication(APP_1_ID, updateApp);

        final Application updated = this.service.getApplication(APP_1_ID);
        Assert.assertEquals(APP_2_USER, updated.getUser());
        Assert.assertEquals(ApplicationStatus.ACTIVE, updated.getStatus());
        Assert.assertEquals(6, updated.getTags().size());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test(expected = GeniePreconditionException.class)
    public void testUpdateApplicationNullId() throws GenieException {
        this.service.updateApplication(null, new Application());
    }
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.