@Test public void testWithNoRunlist() { ChefApi chef = createMock(ChefApi.class); Supplier<Map<String, JsonBall>> automaticSupplier = Suppliers.<Map<String, JsonBall>> ofInstance(ImmutableMap.<String, JsonBall> of()); Node nodeWithAutomatic = Node.builder().name("name").environment("_default") .automaticAttributes(automaticSupplier.get()).build(); chef.createNode(nodeWithAutomatic); replay(chef); CreateNodeAndPopulateAutomaticAttributesImpl updater = new CreateNodeAndPopulateAutomaticAttributesImpl(chef, automaticSupplier); updater.execute("name", ImmutableSet.<String> of()); verify(chef); }
@Override public Node execute(Node node) { logger.trace("creating node %s", node.getName()); Node withAutomatic = Node.builder() .name(node.getName()) .normalAttributes(node.getNormalAttributes()) .overrideAttributes(node.getOverrideAttributes()) .defaultAttributes(node.getDefaultAttributes()) .automaticAttributes(node.getAutomaticAttributes()) .automaticAttributes(automaticSupplier.get()) .runList(node.getRunList()) .environment(node.getEnvironment()) .build(); chef.createNode(withAutomatic); logger.debug("created node %s", withAutomatic.getName()); return node; }
CreateNodeAndPopulateAutomaticAttributesImpl implements CreateNodeAndPopulateAutomaticAttributes { @Override public Node execute(Node node) { logger.trace("creating node %s", node.getName()); Node withAutomatic = Node.builder() .name(node.getName()) .normalAttributes(node.getNormalAttributes()) .overrideAttributes(node.getOverrideAttributes()) .defaultAttributes(node.getDefaultAttributes()) .automaticAttributes(node.getAutomaticAttributes()) .automaticAttributes(automaticSupplier.get()) .runList(node.getRunList()) .environment(node.getEnvironment()) .build(); chef.createNode(withAutomatic); logger.debug("created node %s", withAutomatic.getName()); return node; } }
CreateNodeAndPopulateAutomaticAttributesImpl implements CreateNodeAndPopulateAutomaticAttributes { @Override public Node execute(Node node) { logger.trace("creating node %s", node.getName()); Node withAutomatic = Node.builder() .name(node.getName()) .normalAttributes(node.getNormalAttributes()) .overrideAttributes(node.getOverrideAttributes()) .defaultAttributes(node.getDefaultAttributes()) .automaticAttributes(node.getAutomaticAttributes()) .automaticAttributes(automaticSupplier.get()) .runList(node.getRunList()) .environment(node.getEnvironment()) .build(); chef.createNode(withAutomatic); logger.debug("created node %s", withAutomatic.getName()); return node; } @Inject  CreateNodeAndPopulateAutomaticAttributesImpl(ChefApi chef,
         @Automatic Supplier<Map<String, JsonBall>> automaticSupplier); }
CreateNodeAndPopulateAutomaticAttributesImpl implements CreateNodeAndPopulateAutomaticAttributes { @Override public Node execute(Node node) { logger.trace("creating node %s", node.getName()); Node withAutomatic = Node.builder() .name(node.getName()) .normalAttributes(node.getNormalAttributes()) .overrideAttributes(node.getOverrideAttributes()) .defaultAttributes(node.getDefaultAttributes()) .automaticAttributes(node.getAutomaticAttributes()) .automaticAttributes(automaticSupplier.get()) .runList(node.getRunList()) .environment(node.getEnvironment()) .build(); chef.createNode(withAutomatic); logger.debug("created node %s", withAutomatic.getName()); return node; } @Inject  CreateNodeAndPopulateAutomaticAttributesImpl(ChefApi chef,
         @Automatic Supplier<Map<String, JsonBall>> automaticSupplier); @Override Node execute(Node node); @Override Node execute(String nodeName, Iterable<String> runList); }
CreateNodeAndPopulateAutomaticAttributesImpl implements CreateNodeAndPopulateAutomaticAttributes { @Override public Node execute(Node node) { logger.trace("creating node %s", node.getName()); Node withAutomatic = Node.builder() .name(node.getName()) .normalAttributes(node.getNormalAttributes()) .overrideAttributes(node.getOverrideAttributes()) .defaultAttributes(node.getDefaultAttributes()) .automaticAttributes(node.getAutomaticAttributes()) .automaticAttributes(automaticSupplier.get()) .runList(node.getRunList()) .environment(node.getEnvironment()) .build(); chef.createNode(withAutomatic); logger.debug("created node %s", withAutomatic.getName()); return node; } @Inject  CreateNodeAndPopulateAutomaticAttributesImpl(ChefApi chef,
         @Automatic Supplier<Map<String, JsonBall>> automaticSupplier); @Override Node execute(Node node); @Override Node execute(String nodeName, Iterable<String> runList);  }