Package org.apache.whirr.service

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;
    } catch (UncheckedExecutionException e) {
View Full Code Here


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

    TestNodeStarterFactory nodeStarterFactory = null;

    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    LoadingCache<String, ClusterActionHandler> handlerMap = convertMapToLoadingCache(
      ImmutableMap.<String, ClusterActionHandler>builder()
        .put("hadoop-jobtracker", handler)
        .put("hadoop-namenode", handler)
        .put("hadoop-datanode", handler)
View Full Code Here

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

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);  
    LoadingCache<String, ClusterActionHandler> handlerMap = convertMapToLoadingCache(
      ImmutableMap.<String, ClusterActionHandler>builder()
        .put("hadoop-jobtracker", handler)
        .put("hadoop-namenode", handler)
        .put("hadoop-datanode", handler)
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(puppetHandlerFactory.create("module::manifest")).thenReturn(handler);
    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

    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

   * 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;
    } catch (UncheckedExecutionException e) {
View Full Code Here

        });
        LOG.debug("role {} starts with a configured prefix {}", role, prefix);
        ClusterActionHandlerFactory factory = factoryMap.get(prefix);
        checkArgument(factory != null, "could not create action handler factory %s", prefix);
        String subrole = role.substring(prefix.length());
        ClusterActionHandler returnVal = factory.create(subrole);
        checkArgument(returnVal != null, "action handler factory %s could not create action handler for role %s",
            prefix, subrole);
        return returnVal;
      } catch (NoSuchElementException e) {
        LOG.debug("role {} didn't start with any of the configured prefixes {}", role, prefixes);
        ClusterActionHandler returnVal = handlerMap.get(role);
        checkArgument(returnVal != null, "Action handler not found for role: %s; configured roles %s", role,
            handlerMap.keySet());
        return returnVal;
      }
View Full Code Here

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

    TestNodeStarterFactory nodeStarterFactory = null;

    ClusterActionHandler handler = mock(ClusterActionHandler.class);    
    LoadingCache<String, ClusterActionHandler> handlerMap = convertMapToLoadingCache(
      ImmutableMap.<String, ClusterActionHandler>builder()
        .put("hadoop-jobtracker", handler)
        .put("hadoop-namenode", handler)
        .put("hadoop-datanode", handler)
View Full Code Here

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

    TestNodeStarterFactory nodeStarterFactory = null;
   
    ClusterActionHandler handler = mock(ClusterActionHandler.class);  
    LoadingCache<String, ClusterActionHandler> handlerMap = convertMapToLoadingCache(
      ImmutableMap.<String, ClusterActionHandler>builder()
        .put("hadoop-jobtracker", handler)
        .put("hadoop-namenode", handler)
        .put("hadoop-datanode", handler)
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(puppetHandlerFactory.create("module::manifest")).thenReturn(handler);
    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

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.