Package org.jclouds.chef.domain

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


      }
   }

   @Test(dependsOnMethods = "testCreateNewCookbook")
   public void testUpdateCookbook() throws Exception {
      CookbookVersion cookbook = api.getCookbook(PREFIX, "0.0.0");
      assertNotNull(cookbook, "Cookbook not found: " + PREFIX);
      assertNotNull(api.updateCookbook(PREFIX, "0.0.0", cookbook), "Updated cookbook was null");
   }
View Full Code Here


   public void testUpdateCookbook() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(ChefApi.class, "updateCookbook", String.class, String.class,
            CookbookVersion.class);
      GeneratedHttpRequest httpRequest = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of("cookbook", "1.0.1", new CookbookVersion("cookbook", "1.0.1"))));

      assertRequestLineEquals(httpRequest, "PUT http://localhost:4000/cookbooks/cookbook/1.0.1 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nX-Chef-Version: " + ChefApi.VERSION
            + "-test\n");
      assertPayloadEquals(httpRequest,
View Full Code Here

      } catch (RuntimeException e) {
         api.commitSandbox(site.getSandboxId(), false);
      }

      // create a new cookbook
      CookbookVersion cookbook = new CookbookVersion(PREFIX, "0.0.0");
      cookbook.getRootFiles().add(new Resource(content));

      // upload the cookbook to the remote server
      api.updateCookbook(PREFIX, "0.0.0", cookbook);
   }
View Full Code Here

      Set<String> cookbookNames = api.listCookbooks();
      assertFalse(cookbookNames.isEmpty());

      for (String cookbook : cookbookNames) {
         for (String version : api.getVersionsOfCookbook(cookbook)) {
            CookbookVersion cookbookO = api.getCookbook(cookbook, version);
            for (Resource resource : ImmutableList.<Resource> builder().addAll(cookbookO.getDefinitions())
                  .addAll(cookbookO.getFiles()).addAll(cookbookO.getLibraries()).addAll(cookbookO.getSuppliers())
                  .addAll(cookbookO.getRecipes()).addAll(cookbookO.getResources()).addAll(cookbookO.getRootFiles())
                  .addAll(cookbookO.getTemplates()).build()) {
               try {
                  InputStream stream = api.getResourceContents(resource);
                  byte[] md5 = asByteSource(stream).hash(md5()).asBytes();
                  assertEquals(md5, resource.getChecksum());
               } catch (NullPointerException e) {
View Full Code Here

      }
   }

   @Test(dependsOnMethods = "testCreateNewCookbook")
   public void testUpdateCookbook() throws Exception {
      CookbookVersion cookbook = api.getCookbook(PREFIX, "0.0.0");
      assertNotNull(api.updateCookbook(PREFIX, "0.0.0", cookbook));
   }
View Full Code Here

      }));
   }

   @Test(enabled = false)
   public void testBrew() throws IOException {
      CookbookVersion cookbook = handler.apply(HttpResponse.builder().statusCode(200).message("ok")
            .payload(ParseCookbookVersionFromJsonTest.class.getResourceAsStream("/brew-cookbook.json")).build());

      assertEquals(cookbook,
            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }
View Full Code Here

            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }

   @Test(enabled = false)
   public void testTomcat() {
      CookbookVersion cookbook = handler.apply(HttpResponse.builder().statusCode(200).message("ok")
            .payload(ParseCookbookVersionFromJsonTest.class.getResourceAsStream("/tomcat-cookbook.json")).build());

      assertEquals(cookbook,
            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }
View Full Code Here

            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }

   @Test(enabled = false)
   public void testMysql() throws IOException {
      CookbookVersion cookbook = handler.apply(HttpResponse.builder().statusCode(200).message("ok")
            .payload(ParseCookbookVersionFromJsonTest.class.getResourceAsStream("/mysql-cookbook.json")).build());

      assertEquals(cookbook,
            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }
View Full Code Here

                  .statusCode(200)
                  .message("ok")
                  .payload(
                        ParseCookbookVersionFromJsonTest.class.getResourceAsStream("/apache-chef-demo-cookbook.json"))
                  .build()),
            new CookbookVersion(
                  "apache-chef-demo-0.0.0",
                  ImmutableSet.<Resource> of(),
                  ImmutableSet.<Attribute> of(),
                  ImmutableSet.<Resource> of(),
                  new Metadata("Apache v2.0", "Your Name", ImmutableMap.<String, String> of(), ImmutableMap
View Full Code Here

      handler = injector.getInstance(Key.get(new TypeLiteral<ParseJson<CookbookVersion>>() {
      }));
   }

   public void testBrew() throws IOException {
      CookbookVersion cookbook = handler.apply(HttpResponse.builder().statusCode(200).message("ok")
            .payload(ParseCookbookVersionFromJsonTest.class.getResourceAsStream("/brew-cookbook.json")).build());

      assertEquals(cookbook,
            handler.apply(HttpResponse.builder().statusCode(200).message("ok").payload(json.toJson(cookbook)).build()));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.chef.domain.CookbookVersion$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.