Examples of TemplateBuilder


Examples of org.jclouds.compute.domain.TemplateBuilder

        .put("hadoop-tasktracker", handler).build());

    Function<ClusterSpec, ComputeServiceContext> getCompute = mock(Function.class);
    ComputeServiceContext serviceContext = mock(ComputeServiceContext.class);
    ComputeService computeService = mock(ComputeService.class);
    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    Template template = mock(Template.class);

    when(getCompute.apply(clusterSpec)).thenReturn(serviceContext);
    when(serviceContext.getComputeService()).thenReturn(computeService);
    when(computeService.getContext()).thenReturn(serviceContext);
    when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class)));
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions) any())).thenReturn(templateBuilder);
    when(templateBuilder.build()).thenReturn(template);
   
    // here is a scenario when jt+nn fails once, then the retry is successful
    // and from the dn+tt one node fails, then the retry is successful
    Map<Set<String>, Stack<Integer>> reaction = Maps.newHashMap();
    Stack<Integer> jtnnStack = new Stack<Integer>();
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

        .put("hadoop-tasktracker", handler).build());

    Function<ClusterSpec, ComputeServiceContext> getCompute = mock(Function.class);
    ComputeServiceContext serviceContext = mock(ComputeServiceContext.class);
    ComputeService computeService = mock(ComputeService.class);
    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    Template template = mock(Template.class);

    when(getCompute.apply(clusterSpec)).thenReturn(serviceContext);
    when(serviceContext.getComputeService()).thenReturn(computeService);
    when(computeService.getContext()).thenReturn(serviceContext);
    when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class)));
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions) any())).thenReturn(templateBuilder);
    when(templateBuilder.build()).thenReturn(template);
   
    // here is a scenario when jt+nn does not fail
    // but the dn+tt one node fails 3, then in the retry fails 2
    // at the end result, the cluster will fail, throwing IOException
    Map<Set<String>, Stack<Integer>> reaction = Maps.newHashMap();
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

          ImmutableSet.of(handler));

    Function<ClusterSpec, ComputeServiceContext> getCompute = mock(Function.class);
    ComputeServiceContext serviceContext = mock(ComputeServiceContext.class);
    ComputeService computeService = mock(ComputeService.class);
    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    Template template = mock(Template.class);

    when(getCompute.apply(clusterSpec)).thenReturn(serviceContext);
    when(serviceContext.getComputeService()).thenReturn(computeService);
    when(computeService.getContext()).thenReturn(serviceContext);
    when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class)));
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions) any())).thenReturn(templateBuilder);
    when(templateBuilder.build()).thenReturn(template);
   
    Map<Set<String>, Stack<Integer>> reaction = Maps.newHashMap();
    Stack<Integer> nnStack = new Stack<Integer>();
    nnStack.push(new Integer(1));
    reaction.put(nn, nnStack);
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

      ImmutableSet.of(puppetHandlerFactory), ImmutableSet.of(handler));

    Function<ClusterSpec, ComputeServiceContext> getCompute = mock(Function.class);
    ComputeServiceContext serviceContext = mock(ComputeServiceContext.class);
    ComputeService computeService = mock(ComputeService.class);
    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    Template template = mock(Template.class);


    when(getCompute.apply(clusterSpec)).thenReturn(serviceContext);
    when(serviceContext.getComputeService()).thenReturn(computeService);
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions) any())).thenReturn(templateBuilder);
    when(templateBuilder.build()).thenReturn(template);
   
    Map<Set<String>, Stack<Integer>> reaction = Maps.newHashMap();
    Stack<Integer> nnStack = new Stack<Integer>();
    nnStack.push(1);
    reaction.put(nn, nnStack);
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

    // if (entity.getDomainToTemplateMap() == null) {
    // // we initialize it
    // entity.setDomainToTemplateMap(new HashMap<String, Template>());
    // }

    TemplateBuilder templateBuilder = iaas.getComputeService()
        .templateBuilder();
    templateBuilder.imageId(iaas.getImage());

    // to avoid creation of template objects in each and every time, we
    // create all
    // at once!
    // for (org.apache.cartridge.autoscaler.service.util.ServiceContext temp
    // :
    // serviceContexts) {

    String instanceType;

    // set instance type
    if (((instanceType = iaas.getProperty("instanceType")) != null)) {

      templateBuilder.hardwareId(instanceType);
    }

    Template template = templateBuilder.build();

    // if you wish to auto assign IPs, instance spawning call should be
    // blocking, but if you
    // wish to assign IPs manually, it can be non-blocking.
    // is auto-assign-ip mode or manual-assign-ip mode?
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

          + iaas.getName();
      log.fatal(msg);
      throw new CloudControllerException(msg);
    }

    TemplateBuilder templateBuilder = iaas.getComputeService()
        .templateBuilder();

    // set image id specified
    templateBuilder.imageId(iaas.getImage());

    if (iaas.getProperty("instanceType") != null) {
      // set instance type eg: m1.large
      templateBuilder.hardwareId(iaas.getProperty("instanceType"));
    }

    // build the Template
    Template template = templateBuilder.build();

    // if you wish to auto assign IPs, instance spawning call should be
    // blocking, but if you
    // wish to assign IPs manually, it can be non-blocking.
    // is auto-assign-ip mode or manual-assign-ip mode?
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

          + iaas.getName();
      log.fatal(msg);
      throw new CloudControllerException(msg);
    }

    TemplateBuilder templateBuilder = iaas.getComputeService()
        .templateBuilder();

    // set image id specified
    templateBuilder.imageId(iaas.getImage());

    // build the Template
    Template template = templateBuilder.build();

    // if you wish to auto assign IPs, instance spawning call should be
    // blocking, but if you
    // wish to assign IPs manually, it can be non-blocking.
    // is auto-assign-ip mode or manual-assign-ip mode? - default mode is
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

  }
 
  @Test
  public void testImageIdIsPassedThrough() {
    spec.setImageId("my-image-id");
    TemplateBuilder builder = mock(TemplateBuilder.class);
    strategy.configureTemplateBuilder(spec, builder);
    verify(builder).imageId("my-image-id");
  }
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

  }
 
  @Test
  public void testHardwareIdIsPassedThrough() {
    spec.setHardwareId("my-hardware-id");
    TemplateBuilder builder = mock(TemplateBuilder.class);
    strategy.configureTemplateBuilder(spec, builder);
    verify(builder).hardwareId("my-hardware-id");
  }
View Full Code Here

Examples of org.jclouds.compute.domain.TemplateBuilder

  }

  @Test
  public void testLocationIdIsPassedThrough() {
    spec.setLocationId("my-location-id");
    TemplateBuilder builder = mock(TemplateBuilder.class);
    strategy.configureTemplateBuilder(spec, builder);
    verify(builder).locationId("my-location-id");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.