Diff对比

  public static void main(String[] args) {
       String primary = "{ \"name\" : \"zs\", \"age\" : 18 }";
       String candidate = "{ \"name\" : \"liufei\", \"age\" : 18 }";
       String secondary = "{ \"name\" : \"zs\", \"age\" : 18 }";

       String endpoint = "/user/12";

       Map<String, Difference> rawDiff = Difference.apply(primary, candidate).flattened();
       Map<String, Difference> noiseDiff = Difference.apply(primary, secondary).flattened();

       InMemoryDifferenceCounter inMemoryDifferenceCounter = new InMemoryDifferenceCounter();
       inMemoryDifferenceCounter.count(endpoint, rawDiff);
       RawDifferenceCounter rawDifferenceCounter = RawDifferenceCounter.apply(inMemoryDifferenceCounter);

       InMemoryDifferenceCounter inMemoryDifferenceCounter2 = new InMemoryDifferenceCounter();
       inMemoryDifferenceCounter.count(endpoint, noiseDiff);
       NoiseDifferenceCounter noiseDifferenceCounter = NoiseDifferenceCounter.apply(inMemoryDifferenceCounter);

       DifferenceAnalyzer differenceAnalyzer = new DifferenceAnalyzer(IsotopeClient);


       if (rawDiff.size() > 0) {
           DifferenceResult apply = DifferenceResult.apply(Long.MAX_VALUE - System.currentTimeMillis(),
                   Option.apply("123456"),
                   endpoint,
                   System.currentTimeMillis(),
                   differenceAnalyzer.differencesToJson(rawDiff),
                   JsonLifter.encode(""),
                   Responses.apply(JsonLifter.encode(primary), JsonLifter.encode(candidate), JsonLifter.encode(secondary)));
           scala.collection.Map<String, String> differences = apply.differences();
           System.out.println(differences);
       }

//        DifferenceResult.apply()
//
//
//        DifferenceAnalyzer differenceAnalyzer = new DifferenceAnalyzer();
//        differenceAnalyzer.apply(Message(endpiont, null), Message(endpiont, left), Message(endpiont, middle), Message(endpiont, right));
//
//        InMemoryDifferenceCollector.DifferenceResultNotFoundException().p
//
//        Difference apply = Difference.apply(left, right);
//        System.out.println(apply.flattened());
//        DifferenceAnalyzer differenceAnalyzer = new DifferenceAnalyzer();
//        differenceAnalyzer.differencesToJson()

   }
posted @ 2021-03-02 08:33  刘翊扬  阅读(124)  评论(0编辑  收藏  举报