Examples of JsonBall


Examples of org.jclouds.domain.JsonBall

      userMetaDataIn = Maps.newHashMap();
      systemMetaDataIn = Maps.newHashMap();
      aclMetaDataIn = Lists.newArrayList();
      for (Map.Entry<String, JsonBall> entry : metadata.entrySet()) {
         String key = entry.getKey();
         JsonBall value = entry.getValue();
         if (key.startsWith("cdmi")) {
            if (key.matches("cdmi_acl")) {
               String[] cdmi_acl_array = value.toString().split("[{}]");
               for (int i = 0; i < cdmi_acl_array.length; i++) {
                  if (!(cdmi_acl_array[i].startsWith("[") || cdmi_acl_array[i].startsWith("]") || cdmi_acl_array[i]
                           .startsWith(","))) {
                     Map<String, String> aclMap = Maps.newHashMap();
                     String[] cdmi_acl_member = cdmi_acl_array[i].split(",");
                     for (String s : cdmi_acl_member) {
                        String cdmi_acl_key = s.substring(0, s.indexOf(":"));
                        String cdmi_acl_value = s.substring(s.indexOf(":") + 1);
                        cdmi_acl_value = cdmi_acl_value.replace('"', ' ').trim();
                        aclMap.put(cdmi_acl_key, cdmi_acl_value);
                     }
                     aclMetaDataIn.add(aclMap);
                  }
               }
            } else {
               systemMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
            }
         } else {
            userMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
         }
      }
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   @Override
   @Consumes(MediaType.APPLICATION_JSON)
   public Container expected() {
      return Container.builder().objectType("application/cdmi-container").objectID("00007E7F00102E230ED82694DAA975D2")
               .objectName("MyContainer/").parentURI("/")
               .metadata(ImmutableMap.<String, JsonBall> builder().put("cdmi_size", new JsonBall("\"83\"")).build())
               .children(ImmutableSet.<String> builder().add("MyDataObject.txt").build()).build();
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

            .ips(ImmutableSet.<String> builder().add("37.153.96.62").add("10.224.0.63").build())
            .memorySizeMb(1024)
            .diskSizeGb(61440)
            .metadata(
                  ImmutableMap.<String, JsonBall> builder()
                        .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
            .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
            .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T08:44:53+00:00")).build();
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

            .ips(ImmutableSet. <String>builder().add("37.153.96.62").add("10.224.0.63").build())
            .memorySizeMb(1024)
            .diskSizeGb(61440)
            .metadata(
                  ImmutableMap.<String, JsonBall> builder()
                        .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
            .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
            .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T08:44:53+00:00"))
            .build();
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

                  .ips(ImmutableSet.<String> builder().add("37.153.96.62").add("10.224.0.63").build())
                  .memorySizeMb(1024)
                  .diskSizeGb(61440)
                  .metadata(
                        ImmutableMap.<String, JsonBall> builder()
                              .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
                  .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
                  .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T09:00:33+00:00"))
                  .build()
      );
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

   private final RuntimeMXBean runtime;

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

Examples of org.jclouds.domain.JsonBall

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

Examples of org.jclouds.domain.JsonBall

   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testIllegal() {
      json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java",
            Suppliers.ofInstance(new JsonBall("java")), "java/system", Suppliers.ofInstance(new JsonBall("system")))));
   }
View Full Code Here

Examples of org.jclouds.domain.JsonBall

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

Examples of org.jclouds.domain.JsonBall

   @Test
   public void testOneDuplicate() {
      assertEquals(
            json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java",
                  Suppliers.ofInstance(new JsonBall("{\"time\":\"time\"}")), "java",
                  Suppliers.ofInstance(new JsonBall("{\"system\":\"system\"}"))))),
            "{\"java\":{\"system\":\"system\",\"time\":\"time\"}}");
   }
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.