@Test
 public void testTransformMacAddressToBSDFormat() {
   assertEquals(
       MacAddressToBSD.INSTANCE.apply(
           Joiner.on(":").join(Splitter.fixedLength(2).split(vboxMacAddressFormat)).toLowerCase()),
       bsdMacAddressFormat);
 }
Example #2
0
 public void fillBody(String newMessage) {
   info("Fill body: [" + StringUtils.left(newMessage, 100) + "...]");
   getMainBodyArea().clear();
   for (String token : Splitter.fixedLength(100).split(newMessage)) {
     getMainBodyArea().sendKeys(token);
   }
 }
Example #3
0
 private void fillTopicBody(String body) {
   info("Filling topic body: [" + StringUtils.left(body, 100) + "...]");
   getMainBodyArea().clear();
   for (String token : Splitter.fixedLength(100).split(body)) {
     getMainBodyArea().sendKeys(token);
   }
 }
  @VisibleForTesting
  HttpRequest calculateAndReplaceAuthorizationHeaders(HttpRequest request, String toSign)
      throws HttpException {
    String signature = sign(toSign);
    if (signatureWire.enabled()) signatureWire.input(Strings2.toInputStream(signature));
    String[] signatureLines =
        Iterables.toArray(Splitter.fixedLength(60).split(signature), String.class);

    Multimap<String, String> headers = ArrayListMultimap.create();
    for (int i = 0; i < signatureLines.length; i++) {
      headers.put("X-Ops-Authorization-" + (i + 1), signatureLines[i]);
    }
    return request.toBuilder().replaceHeaders(headers).build();
  }
Example #5
0
 /** Chop a string into an array of string no longer then the specified chop length */
 public static String[] stringChopper(String string, int chopLength) {
   return Iterables.toArray(Splitter.fixedLength(chopLength).split(string), String.class);
 }
Example #6
0
 public static String toHexDump(InputStream in) throws IOException {
   return Joiner.on("\n")
       .join(
           Splitter.fixedLength(128)
               .split(DatatypeConverter.printHexBinary(ByteStreams.toByteArray(in))));
 }