Package org.jclouds.chef.domain

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


   public void testCookbokDefinitionListParsing() throws URISyntaxException {
      CookbookDefinition.Version v510 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/apache2/5.1.0")).version("5.1.0").build();
      CookbookDefinition.Version v420 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/apache2/4.2.0")).version("4.2.0").build();
      CookbookDefinition apache2 = CookbookDefinition.builder()
            .name("apache2").url(new URI("http://localhost:4000/cookbooks/apache2")).version(v510).version(v420).build();
     
      CookbookDefinition.Version v100 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/nginx/1.0.0")).version("1.0.0").build();
      CookbookDefinition.Version v030 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/nginx/0.3.0")).version("0.3.0").build();
      CookbookDefinition nginx = CookbookDefinition.builder()
            .name("nginx").url(new URI("http://localhost:4000/cookbooks/nginx")).version(v100).version(v030).build();
     
      assertEquals(handler.apply(HttpResponse
            .builder()
            .statusCode(200)
View Full Code Here


   public void testCookbokDefinitionParsing() throws URISyntaxException {
      CookbookDefinition.Version v510 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/apache2/5.1.0")).version("5.1.0").build();
      CookbookDefinition.Version v420 = CookbookDefinition.Version.builder()
            .url(new URI("http://localhost:4000/cookbooks/apache2/4.2.0")).version("4.2.0").build();
      CookbookDefinition definition = CookbookDefinition.builder()
            .name("apache2").url(new URI("http://localhost:4000/cookbooks/apache2")).version(v510).version(v420).build();

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

   @Override
   public CookbookDefinition apply(HttpResponse response) {
      Map<String, CookbookDefinition> result = parser.apply(response);
      String cookbookName = result.keySet().iterator().next();
      CookbookDefinition def = result.values().iterator().next();
      return CookbookDefinition.builder() //
             .from(def) //
             .name(cookbookName) //
             .build();
   }
View Full Code Here

      this.parser = parser;
   }

   @Override
   public Set<String> apply(HttpResponse response) {
      CookbookDefinition def = getFirst(parser.apply(response).values(), null);
      return newLinkedHashSet(transform(def.getVersions(), new Function<Version, String>() {
         @Override
         public String apply(Version input) {
            return input.getVersion();
         }
      }));
View Full Code Here

      Set<Map.Entry<String, CookbookDefinition>> result = parser.apply(response).entrySet();
      return newLinkedHashSet(transform(result, new Function<Map.Entry<String, CookbookDefinition>, CookbookDefinition>() {
         @Override
         public CookbookDefinition apply(Map.Entry<String, CookbookDefinition> input) {
            String cookbookName = input.getKey();
            CookbookDefinition def = input.getValue();
            return CookbookDefinition.builder() //
                   .from(def) //             
                   .name(cookbookName) //
                   .build();
         }
View Full Code Here

                        + "\"version\" => \"1.0.0\"},"
                        + "{\"url\" => \"http://localhost:4000/cookbooks/nginx/0.3.0\","
                        + "\"version\" => \"0.3.0\"}"
                        + "]}" +
                        "}").build()),
            ImmutableSet.of(new CookbookDefinition(new URI("http://localhost:4000/cookbooks/apache2"),
                  ImmutableSet.of(new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/apache2/5.1.0"), "5.1.0"),
                        new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/apache2/4.2.0"), "4.2.0"))),
                  new CookbookDefinition(new URI("http://localhost:4000/cookbooks/nginx"),
                        ImmutableSet.of(new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/nginx/1.0.0"), "1.0.0"),
                              new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/nginx/0.3.0"), "0.3.0")))));
   }
View Full Code Here

                  "{" + "\"apache2\" => {" + "\"url\" => \"http://localhost:4000/cookbooks/apache2\","
                        + "\"versions\" => [" + "{\"url\" => \"http://localhost:4000/cookbooks/apache2/5.1.0\","
                        + "\"version\" => \"5.1.0\"},"
                        + "{\"url\" => \"http://localhost:4000/cookbooks/apache2/4.2.0\","
                        + "\"version\" => \"4.2.0\"}" + "]" + "}" + "}").build()),
            new CookbookDefinition(new URI("http://localhost:4000/cookbooks/apache2"),
                  ImmutableSet.of(new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/apache2/5.1.0"), "5.1.0"),
                        new CookbookDefinition.Version(new URI("http://localhost:4000/cookbooks/apache2/4.2.0"), "4.2.0"))));
   }
View Full Code Here

      this.parser = parser;
   }

   @Override
   public Set<String> apply(HttpResponse response) {
      CookbookDefinition def = Iterables.getFirst(parser.apply(response).values(), null);
      return Sets.newLinkedHashSet(Iterables.transform(def.getVersions(), new Function<Version, String>() {
         @Override
         public String apply(Version input) {
            return input.getVersion();
         }
      }));
View Full Code Here

      this.parser = parser;
   }

   @Override
   public Set<String> apply(HttpResponse response) {
      CookbookDefinition def = getFirst(parser.apply(response).values(), null);
      return newLinkedHashSet(transform(def.getVersions(), new Function<Version, String>() {
         @Override
         public String apply(Version input) {
            return input.getVersion();
         }
      }));
View Full Code Here

      Set<Map.Entry<String, CookbookDefinition>> result = parser.apply(response).entrySet();
      return newLinkedHashSet(transform(result, new Function<Map.Entry<String, CookbookDefinition>, CookbookDefinition>() {
         @Override
         public CookbookDefinition apply(Map.Entry<String, CookbookDefinition> input) {
            String cookbookName = input.getKey();
            CookbookDefinition def = input.getValue();
            return CookbookDefinition.builder() //
                   .from(def) //             
                   .name(cookbookName) //
                   .build();
         }
View Full Code Here

TOP

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