Examples of JsonBall


Examples of org.jclouds.domain.JsonBall

   @Test
   public void testMerge() {
      assertEquals(
            json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java",
                  Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":\"hello\"}}")), "java/time",
                  Suppliers.ofInstance(new JsonBall("{\"2\":\"goodbye\"}"))))),
            "{\"java\":{\"time\":{\"2\":\"goodbye\",\"1\":\"hello\"}}}");
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   @Test
   public void testMergeNestedTwice() {
      assertEquals(
            json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java",
                  Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":\"hello\"}}")), "java",
                  Suppliers.ofInstance(new JsonBall("{\"time\":{\"2\":\"goodbye\"}}"))))),
            "{\"java\":{\"time\":{\"2\":\"goodbye\",\"1\":\"hello\"}}}");
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   @Test
   public void testReplaceList() {
      assertEquals(
            json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java",
                  Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":[\"hello\"]}}")), "java/time",
                  Suppliers.ofInstance(new JsonBall("{\"1\":[\"goodbye\"]}"))))),
            "{\"java\":{\"time\":{\"1\":[\"goodbye\"]}}}");
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   }

   public void test() {
      Node node = Node.builder() //
            .name("adrian-jcloudstest") //
            .normalAttribute("tomcat6", new JsonBall("{\"ssl_port\":8433}")) //
            .runListElement("recipe[java]") //
            .environment("prod") //
            .build();

      assertEquals(
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   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

Examples of org.jclouds.domain.JsonBall

         this.systemProperties = systemProperties;
      }

      @Override
      public JsonBall get() {
         return new JsonBall(json.toJson(systemProperties));
      }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

         super("os.name", systemProperties);
      }

      @Override
      public JsonBall get() {
         JsonBall returnValue = super.get();
         return returnValue != null ? new JsonBall(returnValue.toString().replaceAll("[ -]", "").toLowerCase()) : null;
      }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

         this.systemProperties = systemProperties;
      }

      @Override
      public JsonBall get() {
         return systemProperties.containsKey(property) ? new JsonBall(systemProperties.getProperty(property)) : null;
      }
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
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.