Package org.jclouds.domain

Examples of org.jclouds.domain.JsonBall


   }

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


   @ConfiguresOhai
   static class TestOhaiModule extends OhaiModule {

      @Override
      protected Supplier<Map<String, JsonBall>> provideAutomatic(AutomaticSupplier in) {
         return Suppliers.<Map<String, JsonBall>> ofInstance(ImmutableMap.of("foo", new JsonBall("bar")));
      }
View Full Code Here

   public Statement apply(String group) {
      checkNotNull(group, "group");
      String validatorClientName = validatorName.get();
      PrivateKey validatorKey = validatorCredential.get();

      JsonBall bootstrapConfig = null;
      try {
         bootstrapConfig = bootstrapConfigForGroup.load(group);
      } catch (Exception e) {
         throw propagate(e);
      }
View Full Code Here

   public static Date fromOhaiTime(JsonBall ohaiDate) {
      return new Date(Long.parseLong(checkNotNull(ohaiDate, "ohaiDate").toString().replaceAll("\\.[0-9]*$", "")));
   }

   public static JsonBall toOhaiTime(long millis) {
      return new JsonBall(millis + "");
   }
View Full Code Here

      fn.apply("foo");
   }

   public void testOneRecipe() throws IOException {
      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]\"]}")))),
            installChefGems, validatorName, validatorCredential);

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

   private final RuntimeMXBean runtime;

   @Override
   public JsonBall get() {
      long uptimeInSeconds = runtime.getUptime() / 1000;
      return new JsonBall(uptimeInSeconds);
   }
View Full Code Here

   @Override
   public List<String> apply(String from) {
      DatabagItem bootstrapConfig = bootstrapConfigForGroup.apply(from);
      Map<String, JsonBall> config = json.fromJson(bootstrapConfig.toString(),
            BootstrapConfigForGroup.BOOTSTRAP_CONFIG_TYPE);
      JsonBall runlist = config.get("run_list");
      return json.fromJson(runlist.toString(), RUN_LIST_TYPE);
   }
View Full Code Here

   public Statement apply(String group) {
      checkNotNull(group, "group");
      String validatorClientName = validatorName.get();
      PrivateKey validatorKey = validatorCredential.get();

      JsonBall bootstrapConfig = null;
      try {
         bootstrapConfig = bootstrapConfigForGroup.load(group);
      } catch (Exception e) {
         throw propagate(e);
      }

      Map<String, JsonBall> config = json.fromJson(bootstrapConfig.toString(),
            BootstrapConfigForGroup.BOOTSTRAP_CONFIG_TYPE);
      Optional<JsonBall> environment = Optional.fromNullable(config.get("environment"));

      String chefConfigDir = "{root}etc{fs}chef";
      Statement createChefConfigDir = exec("{md} " + chefConfigDir);
View Full Code Here

   public static Date fromOhaiTime(JsonBall ohaiDate) {
      return new Date(Long.parseLong(checkNotNull(ohaiDate, "ohaiDate").toString().replaceAll("\\.[0-9]*$", "")));
   }

   public static JsonBall toOhaiTime(long millis) {
      return new JsonBall(millis + "");
   }
View Full Code Here

   public static class NullHackJsonBallAdapter extends NullHackJsonLiteralAdapter<JsonBall> {

      @Override
      protected JsonBall createJsonLiteralFromRawJson(String json) {
         return new JsonBall(json);
      }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.JsonBall

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.