Package com.netflix.genie.common.model

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


            final String id) throws GenieException {
        final Set<String> configs = new HashSet<>();
        configs.add("s3://mybucket/core-site.xml");
        configs.add("s3://mybucket/hdfs-site.xml");
        configs.add("s3://mybucketyarn-site.xml");
        final Cluster cluster = new Cluster(
                NAME,
                "tgianos",
                ClusterStatus.OUT_OF_SERVICE,
                "com.netflix.genie.server.jobmanager.impl.YarnJobManager",
                configs,
                "2.4.0");
        if (StringUtils.isNotBlank(id)) {
            cluster.setId(id);
        }
        final Set<String> tags = new HashSet<>();
        tags.add("adhoc");
        tags.add("h2query");
        tags.add(cluster.getId());
        cluster.setTags(tags);

        return cluster;
    }
View Full Code Here


     *
     * @throws GenieException
     */
    @Test
    public void testGetCluster() throws GenieException {
        final Cluster cluster1 = this.service.getCluster(CLUSTER_1_ID);
        Assert.assertEquals(CLUSTER_1_ID, cluster1.getId());
        Assert.assertEquals(CLUSTER_1_NAME, cluster1.getName());
        Assert.assertEquals(CLUSTER_1_USER, cluster1.getUser());
        Assert.assertEquals(CLUSTER_1_VERSION, cluster1.getVersion());
        Assert.assertEquals(CLUSTER_1_STATUS, cluster1.getStatus());
        Assert.assertEquals(CLUSTER_1_TYPE, cluster1.getClusterType());
        Assert.assertEquals(5, cluster1.getTags().size());
        Assert.assertEquals(1, cluster1.getConfigs().size());
        Assert.assertEquals(3, cluster1.getCommands().size());

        final Cluster cluster2 = this.service.getCluster(CLUSTER_2_ID);
        Assert.assertEquals(CLUSTER_2_ID, cluster2.getId());
        Assert.assertEquals(CLUSTER_2_NAME, cluster2.getName());
        Assert.assertEquals(CLUSTER_2_USER, cluster2.getUser());
        Assert.assertEquals(CLUSTER_2_VERSION, cluster2.getVersion());
        Assert.assertEquals(CLUSTER_2_STATUS, cluster2.getStatus());
        Assert.assertEquals(CLUSTER_2_TYPE, cluster2.getClusterType());
        Assert.assertEquals(5, cluster2.getTags().size());
        Assert.assertEquals(2, cluster2.getConfigs().size());
        Assert.assertEquals(3, cluster1.getCommands().size());
    }
View Full Code Here

    public void testCreateCluster() throws GenieException {
        final Set<String> configs = new HashSet<>();
        configs.add("a config");
        configs.add("another config");
        configs.add("yet another config");
        final Cluster cluster = new Cluster(
                CLUSTER_1_NAME,
                CLUSTER_1_USER,
                ClusterStatus.OUT_OF_SERVICE,
                CLUSTER_1_TYPE,
                configs,
                CLUSTER_1_VERSION
        );
        final String id = UUID.randomUUID().toString();
        cluster.setId(id);
        final Cluster created = this.service.createCluster(cluster);
        Assert.assertNotNull(this.service.getCluster(id));
        Assert.assertEquals(id, created.getId());
        Assert.assertEquals(CLUSTER_1_NAME, created.getName());
        Assert.assertEquals(CLUSTER_1_USER, created.getUser());
        Assert.assertEquals(ClusterStatus.OUT_OF_SERVICE, created.getStatus());
        Assert.assertEquals(CLUSTER_1_TYPE, created.getClusterType());
        Assert.assertEquals(3, created.getConfigs().size());
        this.service.deleteCluster(id);
        try {
            this.service.getCluster(id);
            Assert.fail("Should have thrown exception");
        } catch (final GenieException ge) {
View Full Code Here

    public void testCreateClusterNoId() throws GenieException {
        final Set<String> configs = new HashSet<>();
        configs.add("a config");
        configs.add("another config");
        configs.add("yet another config");
        final Cluster cluster = new Cluster(
                CLUSTER_1_NAME,
                CLUSTER_1_USER,
                ClusterStatus.OUT_OF_SERVICE,
                CLUSTER_1_TYPE,
                configs,
                CLUSTER_1_VERSION
        );
        final Cluster created = this.service.createCluster(cluster);
        Assert.assertNotNull(created.getId());
        Assert.assertEquals(CLUSTER_1_NAME, created.getName());
        Assert.assertEquals(CLUSTER_1_USER, created.getUser());
        Assert.assertEquals(ClusterStatus.OUT_OF_SERVICE, created.getStatus());
        Assert.assertEquals(CLUSTER_1_TYPE, created.getClusterType());
        Assert.assertEquals(3, created.getConfigs().size());
        this.service.deleteCluster(created.getId());
        try {
            this.service.getCluster(created.getId());
            Assert.fail("Should have thrown exception");
        } catch (final GenieException ge) {
            Assert.assertEquals(
                    HttpURLConnection.HTTP_NOT_FOUND,
                    ge.getErrorCode()
View Full Code Here

    public void testCreateClusterAlreadyExists() throws GenieException {
        final Set<String> configs = new HashSet<>();
        configs.add("a config");
        configs.add("another config");
        configs.add("yet another config");
        final Cluster cluster = new Cluster(
                CLUSTER_1_NAME,
                CLUSTER_1_USER,
                ClusterStatus.OUT_OF_SERVICE,
                CLUSTER_1_TYPE,
                configs,
                CLUSTER_1_VERSION
        );
        cluster.setId(CLUSTER_1_ID);
        this.service.createCluster(cluster);
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testUpdateClusterNoId() throws GenieException {
        final Cluster init = this.service.getCluster(CLUSTER_1_ID);
        Assert.assertEquals(CLUSTER_1_USER, init.getUser());
        Assert.assertEquals(ClusterStatus.UP, init.getStatus());
        Assert.assertEquals(5, init.getTags().size());

        final Cluster updateCluster = new Cluster();
        updateCluster.setStatus(ClusterStatus.OUT_OF_SERVICE);
        updateCluster.setUser(CLUSTER_2_USER);
        final Set<String> tags = new HashSet<>();
        tags.add("prod");
        tags.add("tez");
        tags.add("yarn");
        tags.add("hadoop");
        updateCluster.setTags(tags);
        this.service.updateCluster(CLUSTER_1_ID, updateCluster);

        final Cluster updated = this.service.getCluster(CLUSTER_1_ID);
        Assert.assertEquals(CLUSTER_2_USER, updated.getUser());
        Assert.assertEquals(ClusterStatus.OUT_OF_SERVICE, updated.getStatus());
        Assert.assertEquals(6, updated.getTags().size());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test
    public void testUpdateClusterWithId() throws GenieException {
        final Cluster init = this.service.getCluster(CLUSTER_1_ID);
        Assert.assertEquals(CLUSTER_1_USER, init.getUser());
        Assert.assertEquals(ClusterStatus.UP, init.getStatus());
        Assert.assertEquals(5, init.getTags().size());

        final Cluster updateApp = new Cluster();
        updateApp.setId(CLUSTER_1_ID);
        updateApp.setStatus(ClusterStatus.OUT_OF_SERVICE);
        updateApp.setUser(CLUSTER_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.updateCluster(CLUSTER_1_ID, updateApp);

        final Cluster updated = this.service.getCluster(CLUSTER_1_ID);
        Assert.assertEquals(CLUSTER_2_USER, updated.getUser());
        Assert.assertEquals(ClusterStatus.OUT_OF_SERVICE, updated.getStatus());
        Assert.assertEquals(6, updated.getTags().size());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test(expected = GeniePreconditionException.class)
    public void testUpdateClusterNullId() throws GenieException {
        this.service.updateCluster(null, new Cluster());
    }
View Full Code Here

     * @throws GenieException
     */
    @Test(expected = GenieNotFoundException.class)
    public void testUpdateClusterNoClusterExists() throws GenieException {
        this.service.updateCluster(
                UUID.randomUUID().toString(), new Cluster());
    }
View Full Code Here

     *
     * @throws GenieException
     */
    @Test(expected = GenieBadRequestException.class)
    public void testUpdateClusterIdsDontMatch() throws GenieException {
        final Cluster updateApp = new Cluster();
        updateApp.setId(UUID.randomUUID().toString());
        this.service.updateCluster(CLUSTER_1_ID, updateApp);
    }
View Full Code Here

TOP

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

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.