Examples of ClusterActionHandler


Examples of org.apache.whirr.service.ClusterActionHandler

    nn.add("something-else");    

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandlerFactory puppetHandlerFactory = mock(ClusterActionHandlerFactory.class);
    ClusterActionHandler handler = mock(ClusterActionHandler.class);
    when(puppetHandlerFactory.getRolePrefix()).thenReturn("puppet");
    when(handler.getRole()).thenReturn("something-else");

    LoadingCache<String, ClusterActionHandler> handlerMap = new HandlerMapFactory().create(
      ImmutableSet.of(puppetHandlerFactory), ImmutableSet.of(handler));

    Function<ClusterSpec, ComputeServiceContext> getCompute = mock(Function.class);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

      statementBuilder.addStatement(Statements.call("installRunUrl"));
      ClusterActionEvent event = new ClusterActionEvent(getAction(),
          clusterSpec, newCluster, statementBuilder);
      eventMap.put(instanceTemplate, event);
      for (String role : instanceTemplate.getRoles()) {
        ClusterActionHandler handler = handlerMap.get(role);
        if (handler == null) {
          throw new IllegalArgumentException("No handler for role " + role);
        }
        handler.beforeAction(event);
      }
      newCluster = event.getCluster(); // cluster may have been updated by handler
    }
   
    doAction(eventMap);
   
    // cluster may have been updated by action
    newCluster = Iterables.get(eventMap.values(), 0).getCluster();

    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      for (String role : instanceTemplate.getRoles()) {
        ClusterActionHandler handler = handlerMap.get(role);
        if (handler == null) {
          throw new IllegalArgumentException("No handler for role " + role);
        }
        ClusterActionEvent event = eventMap.get(instanceTemplate);
        event.setCluster(newCluster);
        handler.afterAction(event);
        newCluster = event.getCluster(); // cluster may have been updated by handler
      }
    }
   
    return newCluster;
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

      ClusterActionEvent event = new ClusterActionEvent(getAction(),
          clusterSpec, newCluster, statementBuilder, getCompute(), firewallManager);

      eventMap.put(instanceTemplate, event);
      for (String role : instanceTemplate.getRoles()) {
        ClusterActionHandler handler = handlerMap.get(role);
        if (handler == null) {
          throw new IllegalArgumentException("No handler for role " + role);
        }
        handler.beforeAction(event);
      }
      newCluster = event.getCluster(); // cluster may have been updated by handler
    }
   
    doAction(eventMap);
   
    // cluster may have been updated by action
    newCluster = Iterables.get(eventMap.values(), 0).getCluster();

    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      for (String role : instanceTemplate.getRoles()) {
        ClusterActionHandler handler = handlerMap.get(role);
        if (handler == null) {
          throw new IllegalArgumentException("No handler for role " + role);
        }
        ClusterActionEvent event = eventMap.get(instanceTemplate);
        event.setCluster(newCluster);
        handler.afterAction(event);
        newCluster = event.getCluster(); // cluster may have been updated by handler
      }
    }
   
    return newCluster;
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

   * Try to get an {@see ClusterActionHandler } instance or throw an
   * IllegalArgumentException if not found for this role name
   */
  private ClusterActionHandler safeGetActionHandler(String role) {
    try {
      ClusterActionHandler handler = handlerMap.get(role);
      if (handler == null) {
        throw new IllegalArgumentException("No handler for role " + role);
      }
      return handler;

View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
View Full Code Here

Examples of org.apache.whirr.service.ClusterActionHandler

    dntt.add("hadoop-datanode");
    dntt.add("hadoop-tasktracker");

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    Map<String, ClusterActionHandler> handlerMap = Maps.newHashMap();
    handlerMap.put("hadoop-jobtracker", handler);
    handlerMap.put("hadoop-namenode", handler);
    handlerMap.put("hadoop-datanode", handler);
    handlerMap.put("hadoop-tasktracker", handler);
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.