Examples of JsonBall


Examples of org.jclouds.domain.JsonBall

   }

   public void testOneRecipeOmnibus() throws IOException {
      Optional<PrivateKey> validatorCredential = Optional.of(createMock(PrivateKey.class));
      GroupToBootScript fn = new GroupToBootScript(Suppliers.ofInstance(URI.create("http://localhost:4000")), json,
            CacheLoader.from(Functions.forMap(ImmutableMap.<String, JsonBall> of("foo", new JsonBall(
                  "{\"tomcat6\":{\"ssl_port\":8433},\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}")))),
            installChefOmnibus, validatorName, validatorCredential);

      PrivateKey validatorKey = validatorCredential.get();
      expect(validatorKey.getEncoded()).andReturn(PemsTest.PRIVATE_KEY.getBytes());
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   }

   public void testOneRecipeAndEnvironmentOmnibus() throws IOException {
      Optional<PrivateKey> validatorCredential = Optional.of(createMock(PrivateKey.class));
      GroupToBootScript fn = new GroupToBootScript(Suppliers.ofInstance(URI.create("http://localhost:4000")), json,
            CacheLoader.from(Functions.forMap(ImmutableMap.<String, JsonBall> of("foo", new JsonBall(
                  "{\"tomcat6\":{\"ssl_port\":8433},\"environment\":\"env\","
                        + "\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}")))), installChefOmnibus,
            validatorName, validatorCredential);

      PrivateKey validatorKey = validatorCredential.get();
View Full Code Here

Examples of org.jclouds.domain.JsonBall

               }
         },
         new Predicate<Node>() {
             @Override
             public boolean apply(Node input) {
                JsonBall dateLong = input.getAutomaticAttributes().get("ohai_time");
                if (dateLong == null)
                   return true;
                Calendar nodeUpdate = Calendar.getInstance();
                nodeUpdate.setTime(fromOhaiTime(dateLong));
                return expired.after(nodeUpdate);
View Full Code Here

Examples of org.jclouds.domain.JsonBall

         @Override
         protected void configure() {
            MapBinder<String, Supplier<JsonBall>> mapbinder = ohaiAutomaticAttributeBinder(binder());
            mapbinder.addBinding("test").toProvider(
                  Providers.of(Suppliers.ofInstance(new JsonBall("{\"prop1\":\"test1\"}"))));
         }

      }, new AbstractModule() {

         @Override
         protected void configure() {
            MapBinder<String, Supplier<JsonBall>> mapbinder = ohaiAutomaticAttributeBinder(binder());
            mapbinder.addBinding("test").toProvider(
                  Providers.of(Suppliers.ofInstance(new JsonBall("{\"prop2\":\"test2\"}"))));
         }

      });
      Ohai ohai = injector.getInstance(Ohai.class);
      Json json = injector.getInstance(Json.class);
View Full Code Here

Examples of org.jclouds.domain.JsonBall

            }));
      Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
      for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
         List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
         JsonBall toInsert = entry.getValue();
         try {
            putUnderContext(keyParts, toInsert, modifiableFlatMap);
         } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
         }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

      for (String k : uniques) {
         valueContext.put(k, toPut.get(k));
      }
      Set<String> conflicts = Sets.difference(toPut.keySet(), uniques);
      for (String k : conflicts) {
         JsonBall v = toPut.get(k);
         if (v.toString().matches("^\\{.*\\}$")) {
            mergeAsPeer(k, v, valueContext);
         } else {
            // replace
            valueContext.put(k, v);
         }
      }
      insertionContext.put(key, new JsonBall(json.toJson(valueContext, mapLiteral)));
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

            mergeAsPeer(key, toInsert, insertionContext);
         }
      } else {
         putUnderContext(keyParts, toInsert, insertionContext);
      }
      destination.put(rootKey, new JsonBall(json.toJson(insertionContext, mapLiteral)));
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

      assertEquals(config, "{\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}");
   }

   public void testBuildBootstrapConfigurationWithRunlistAndEmptyAttributes() {
      List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build();
      BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist).attributes(new JsonBall("{}"))
            .build();
      String config = chefService.buildBootstrapConfiguration(bootstrapConfig);
      assertEquals(config, "{\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}");
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   }

   public void testBuildBootstrapConfigurationWithRunlistAndAttributes() {
      List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build();
      BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist)
            .attributes(new JsonBall("{\"tomcat6\":{\"ssl_port\":8433}}")).build();
      String config = chefService.buildBootstrapConfiguration(bootstrapConfig);
      assertEquals(config, "{\"tomcat6\":{\"ssl_port\":8433},\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}");
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   }

   public void testBuildBootstrapConfigurationWithRunlistAndAttributesAndEnvironment() {
      List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build();
      BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist)
            .attributes(new JsonBall("{\"tomcat6\":{\"ssl_port\":8433}}")).environment("env").build();
      String config = chefService.buildBootstrapConfiguration(bootstrapConfig);
      assertEquals(config,
            "{\"tomcat6\":{\"ssl_port\":8433},\"environment\":\"env\",\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}");
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.