Package org.jclouds.chef.domain

Examples of org.jclouds.chef.domain.Node$Builder


      }));
   }

   public void test() {

      Node node = new Node("adrian-jcloudstest", ImmutableMap.<String, JsonBall> of("tomcat6", new JsonBall(
            "{\"ssl_port\":8433}")), ImmutableMap.<String, JsonBall> of(), ImmutableMap.<String, JsonBall> of(),
            ImmutableMap.<String, JsonBall> of(), Collections.singleton("recipe[java]"), "prod");

      assertEquals(
            handler.apply(HttpResponse.builder().statusCode(200).message("ok")
View Full Code Here


      return node;
   }

   @Override
   public Node execute(String nodeName, Iterable<String> runList) {
      return execute(new Node(nodeName, runList, "_default"));
   }
View Full Code Here

   }

   @Override
   public void execute(String nodeName) {
      logger.trace("updating node %s", nodeName);
      Node node = chef.getNode(nodeName);
      Node mutable = new Node(node.getName(), node.getNormal(), node.getOverride(), node.getDefault(),
            automaticSupplier.get(), node.getRunList(), node.getChefEnvironment());
      chef.updateNode(mutable);
      logger.debug("updated node %s", nodeName);
   }
View Full Code Here

         logger.trace("creating client connection");

         ChefService client = createService(overrides, servletContextEvent);
         logger.debug("created client connection");

         Node node;
         String nodeName;
         while (true) {
            nodeName = findNextNodeName(client, getInitParam(servletContextEvent, CHEF_NODE_PATTERN));
            try {
               node = client.createNodeAndPopulateAutomaticAttributes(nodeName,
View Full Code Here

    * removes the node and client if found, and closes the client context.
    */
   @Override
   public void contextDestroyed(ServletContextEvent servletContextEvent) {
      ChefService client = getContextAttributeOrNull(servletContextEvent, CHEF_SERVICE_CLIENT);
      Node node = getContextAttributeOrNull(servletContextEvent, CHEF_NODE);
      if (node != null && client != null) {
         client.deleteAllNodesInList(singleton(node.getName()));
      }
      if (client != null) {
         Closeables.closeQuietly(client.getContext());
      }
   }
View Full Code Here

   }

   @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;
   }
View Full Code Here

   }

   @Override
   public void execute(String nodeName) {
      logger.trace("updating node %s", nodeName);
      Node node = chef.getNode(nodeName);
      Node updated = Node.builder() //
            .name(node.getName()) //
            .normalAttributes(node.getNormalAttributes()) //
            .overrideAttributes(node.getOverrideAttributes()) //
            .defaultAttributes(node.getDefaultAttributes()) //
            .automaticAttributes(automaticSupplier.get()) //
View Full Code Here

   @Test(dependsOnMethods = "testCreateRole")
   public void testCreateNode() throws Exception {
      api.deleteNode(PREFIX);
      api.createNode(Node.builder().name(PREFIX).runListElement("role[" + PREFIX + "]").environment("_default").build());
      Node node = api.getNode(PREFIX);
      // TODO check recipes
      assertNotNull(node, "Created node should not be null");
      Set<String> nodes = api.listNodes();
      assertTrue(nodes.contains(PREFIX), String.format("node %s not in %s", PREFIX, nodes));
   }
View Full Code Here

   }

   @Test(dependsOnMethods = "testCreateNode")
   public void testUpdateNode() throws Exception {
      for (String nodename : api.listNodes()) {
         Node node = api.getNode(nodename);
         api.updateNode(node);
      }
   }
View Full Code Here

   @Test(dependsOnMethods = "testCreateEnvironment")
   public void testListNodesInEnvironment() {
      api.deleteNode(ENV_NODE);
      api.createNode(Node.builder().name(ENV_NODE).runListElement("role[" + PREFIX + "]").environment(PREFIX).build());
      Node node = api.getNode(ENV_NODE);
      assertNotNull(node, "Created node should not be null");
      Set<String> nodeList = api.listNodesInEnvironment(PREFIX);
      assertTrue(!nodeList.isEmpty());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.chef.domain.Node$Builder

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.