Search in sources :

Example 1 with StringEC2UserData

use of org.apache.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData in project druid by druid-io.

the class WorkerBehaviorConfigTest method testSerde.

@Test
public void testSerde() throws Exception {
    WorkerBehaviorConfig config = new WorkerBehaviorConfig(new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost")))), new EC2AutoScaler(7, 11, new EC2EnvironmentConfig("us-east-1a", new EC2NodeData("amiid", "instanceType", 3, 5, Arrays.asList("securityGroupIds"), "keyNames", "subnetId", null, null), new StringEC2UserData("availZone", "replace", "version")), null, null));
    final ObjectMapper mapper = new DefaultObjectMapper();
    mapper.setInjectableValues(new InjectableValues() {

        @Override
        public Object findInjectableValue(Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance) {
            return null;
        }
    });
    Assert.assertEquals(config, mapper.readValue(mapper.writeValueAsBytes(config), WorkerBehaviorConfig.class));
}
Also used : EC2EnvironmentConfig(io.druid.indexing.overlord.autoscaling.ec2.EC2EnvironmentConfig) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) EC2AutoScaler(io.druid.indexing.overlord.autoscaling.ec2.EC2AutoScaler) BeanProperty(com.fasterxml.jackson.databind.BeanProperty) StringEC2UserData(io.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData) DeserializationContext(com.fasterxml.jackson.databind.DeserializationContext) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) EC2NodeData(io.druid.indexing.overlord.autoscaling.ec2.EC2NodeData) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Example 2 with StringEC2UserData

use of org.apache.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData in project druid by druid-io.

the class WorkerBehaviorConfigTest method testSerde.

@Test
public void testSerde() throws Exception {
    DefaultWorkerBehaviorConfig config = new DefaultWorkerBehaviorConfig(new FillCapacityWithAffinityWorkerSelectStrategy(new AffinityConfig(ImmutableMap.of("foo", ImmutableSet.of("localhost")), false)), new EC2AutoScaler(7, 11, new EC2EnvironmentConfig("us-east-1a", new EC2NodeData("amiid", "instanceType", 3, 5, Collections.singletonList("securityGroupIds"), "keyNames", "subnetId", null, null), new StringEC2UserData("availZone", "replace", "version")), null, null));
    final ObjectMapper mapper = new DefaultObjectMapper();
    mapper.registerSubtypes(EC2AutoScaler.class);
    mapper.setInjectableValues(new InjectableValues() {

        @Override
        public Object findInjectableValue(Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance) {
            return null;
        }
    });
    Assert.assertEquals(config, mapper.readValue(mapper.writeValueAsBytes(config), DefaultWorkerBehaviorConfig.class));
}
Also used : EC2EnvironmentConfig(org.apache.druid.indexing.overlord.autoscaling.ec2.EC2EnvironmentConfig) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) EC2AutoScaler(org.apache.druid.indexing.overlord.autoscaling.ec2.EC2AutoScaler) BeanProperty(com.fasterxml.jackson.databind.BeanProperty) StringEC2UserData(org.apache.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData) DeserializationContext(com.fasterxml.jackson.databind.DeserializationContext) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) EC2NodeData(org.apache.druid.indexing.overlord.autoscaling.ec2.EC2NodeData) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Aggregations

BeanProperty (com.fasterxml.jackson.databind.BeanProperty)2 DeserializationContext (com.fasterxml.jackson.databind.DeserializationContext)2 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2 EC2AutoScaler (io.druid.indexing.overlord.autoscaling.ec2.EC2AutoScaler)1 EC2EnvironmentConfig (io.druid.indexing.overlord.autoscaling.ec2.EC2EnvironmentConfig)1 EC2NodeData (io.druid.indexing.overlord.autoscaling.ec2.EC2NodeData)1 StringEC2UserData (io.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData)1 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)1 EC2AutoScaler (org.apache.druid.indexing.overlord.autoscaling.ec2.EC2AutoScaler)1 EC2EnvironmentConfig (org.apache.druid.indexing.overlord.autoscaling.ec2.EC2EnvironmentConfig)1 EC2NodeData (org.apache.druid.indexing.overlord.autoscaling.ec2.EC2NodeData)1 StringEC2UserData (org.apache.druid.indexing.overlord.autoscaling.ec2.StringEC2UserData)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1