Package org.apache.whirr.service

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(puppetHandlerFactory.create("module::manifest")).thenReturn(handler);
    when(handler.getRole()).thenReturn("something-else");

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

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


    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");

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

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

    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

    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

      statementBuilder.addStatement(Statements.call("install_runurl"));
      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

TOP

Related Classes of org.apache.whirr.service.ClusterActionHandler

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.