Ejemplo n.º 1
0
 private Builder setVal(@Nullable RuleKey ruleKey) {
   if (ruleKey != null) {
     if (logElms != null) {
       logElms.add(
           String.format(
               "%sruleKey(sha1=%s):",
               ruleKey.isIdempotent() ? "" : "non-idempotent ", ruleKey.toString()));
     }
     feed(ruleKey.toString().getBytes()).mergeIdempotence(ruleKey.isIdempotent());
   }
   return separate();
 }
Ejemplo n.º 2
0
 public RuleKey build() {
   RuleKey ruleKey = idempotent ? new RuleKey(hasher.hash()) : new RuleKey(null);
   if (logElms != null) {
     logger.info(
         String.format(
             "%sRuleKey %s=%s",
             ruleKey.isIdempotent() ? "" : "non-idempotent ",
             ruleKey.toString(),
             Joiner.on("").join(logElms)));
   }
   return ruleKey;
 }
Ejemplo n.º 3
0
 @Test
 public void testRuleKeyFromHashString() {
   RuleKey ruleKey = new RuleKey("19d2558a6bd3a34fb3f95412de9da27ed32fe208");
   assertEquals("19d2558a6bd3a34fb3f95412de9da27ed32fe208", ruleKey.toString());
 }