Package com.netflix.simianarmy.conformity

Examples of com.netflix.simianarmy.conformity.Cluster


    @Test
    public void testCheckSoloInstances() throws Exception {
        Set<String> list = Sets.newHashSet();
        list.add(VPC_INSTANCE_ID);
        list.add(INSTANCE_ID);
        Cluster cluster = new Cluster("SoloInstances", REGION, list);
        Conformity result = instanceInVPC.check(cluster);
        Assert.assertNotNull(result);
        Assert.assertEquals(result.getRuleId(), instanceInVPC.getName());
        Assert.assertEquals(result.getFailedComponents().size(), 1);
        Assert.assertEquals(result.getFailedComponents().iterator().next(), INSTANCE_ID);
View Full Code Here


    }

    @Test
    public void testAsgInstances() throws Exception {
        AutoScalingGroup autoScalingGroup = new AutoScalingGroup("Conforming", VPC_INSTANCE_ID);
        Cluster conformingCluster = new Cluster("Conforming", REGION, autoScalingGroup);
        Conformity result = instanceInVPC.check(conformingCluster);
        Assert.assertNotNull(result);
        Assert.assertEquals(result.getRuleId(), instanceInVPC.getName());
        Assert.assertEquals(result.getFailedComponents().size(), 0);

        autoScalingGroup = new AutoScalingGroup("NonConforming", INSTANCE_ID);
        Cluster nonConformingCluster = new Cluster("NonConforming", REGION, autoScalingGroup);
        result = instanceInVPC.check(nonConformingCluster);
        Assert.assertNotNull(result);
        Assert.assertEquals(result.getRuleId(), instanceInVPC.getName());
        Assert.assertEquals(result.getFailedComponents().size(), 1);
        Assert.assertEquals(result.getFailedComponents().iterator().next(), INSTANCE_ID);
View Full Code Here

        Validate.isTrue(items.size() <= 1);
        if (items.size() == 0) {
            LOGGER.info(String.format("Not found cluster with name %s in region %s", clusterName, region));
            return null;
        } else {
            Cluster cluster = null;
            try {
                cluster = parseCluster(items.get(0));
            } catch (Exception e) {
                // Ignore the item that cannot be parsed.
                LOGGER.error(String.format("SimpleDB item %s cannot be parsed into a cluster.", items.get(0)));
View Full Code Here

                        LOGGER.info(String.format("ASG %s is suspended: %s", asg.getAutoScalingGroupName(),
                                asg.getSuspendedProcesses()));
                        conformityAsg.setSuspended(true);
                    }
                }
                Cluster cluster = new Cluster(asg.getAutoScalingGroupName(), region, conformityAsg);
                updateCluster(cluster);
                list.add(cluster);
            }
            //Cluster containing all solo instances
            Set<String> instances = Sets.newHashSet();
            for (com.amazonaws.services.ec2.model.Instance awsInstance : awsClient.describeInstances()) {
                if (!asgInstances.contains(awsInstance.getInstanceId())) {
                    LOGGER.info(String.format("Adding instance %s to soloInstances cluster.",
                            awsInstance.getInstanceId()));
                    instances.add(awsInstance.getInstanceId());
                }
            }
            //Only create cluster if we have solo instances.
            if (!instances.isEmpty()) {
                Cluster cluster = new Cluster("SoloInstances", region, instances);
                updateCluster(cluster);
                list.add(cluster);
            }
        }
        return list;
View Full Code Here

TOP

Related Classes of com.netflix.simianarmy.conformity.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.