All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.diff.model.compare.CompareContext Maven / Gradle / Ivy

There is a newer version: 0.2.15
Show newest version
package com.arextest.diff.model.compare;

import com.arextest.diff.handler.log.LogProcess;
import com.arextest.diff.model.key.ReferenceEntity;
import com.arextest.diff.model.log.LogEntity;
import com.arextest.diff.model.log.NodeEntity;
import com.arextest.diff.model.parse.MsgStructure;
import com.arextest.diff.model.pathparse.ExpressionNodeEntity;
import com.arextest.diff.model.script.ScriptCompareConfig.ScriptMethod;
import com.arextest.diff.model.script.ScriptSandbox;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class CompareContext {

  // baseObj and testObj are the original objects to be compared
  public Object baseObj;
  public Object testObj;

  // currentBaseObj and currentTestObj are the objects being compared
  public Object currentBaseObj;
  public Object currentTestObj;

  public List> exclusions;
  public Map>, LinkedList>> conditionExclusions;
  public Set ignoreNodeSet;
  public boolean notDistinguishNullAndEmpty = false;
  public boolean nullEqualsNotExist = false;
  public LogProcess logProcess;
  public boolean quickCompare;


  public Map, Object> refPkListNodeCacheLeft = new HashMap<>();
  public Map, Object> refPkListNodeCacheRight = new HashMap<>();

  public List currentListKeysLeft = new ArrayList<>();
  public List currentListKeysRight = new ArrayList<>();
  // compare reference trace
  public List> currentTraceLeft;
  public List> currentTraceRight;

  public List> currentTraceLeftForShow;
  public List> currentTraceRightForShow;

  public List currentNodeLeft = new ArrayList<>();
  public List currentNodeRight = new ArrayList<>();

  public List responseReferences;
  public HashSet> pkNodePaths;
  // store the pkList has compared the paired index,
  // because of the situation that the paired indexes compared by the reference
  public Map, List> pkListIndexPair;
  public HashMap, HashMap> listIndexKeysLeft = new HashMap<>();
  public HashMap, HashMap> listIndexKeysRight = new HashMap<>();

  public List logs;

  public MsgStructure baseMsgStructure;
  public MsgStructure testMsgStructure;

  public ScriptSandbox scriptSandbox;

  public Map, ScriptMethod> scriptCompareConfigMap;

  public byte ignoreReferenceNotFound = 0;

  // 0:object 1:array
  public int parentNodeType;

  public CompareContext() {
    this.currentTraceLeft = new ArrayList<>();
    this.currentTraceRight = new ArrayList<>();
    this.currentTraceLeftForShow = new ArrayList<>();
    this.currentTraceRightForShow = new ArrayList<>();
  }

  public void setResponseReferences(List responseReferences) {
    this.responseReferences = responseReferences;
    HashSet> pkNodePaths = new HashSet<>();
    pkListIndexPair = new HashMap<>();
    for (ReferenceEntity responseReference : responseReferences) {
      pkNodePaths.add(responseReference.getPkNodePath());
      pkListIndexPair.put(responseReference.getPkNodeListPath(), new ArrayList<>());
    }
    this.pkNodePaths = pkNodePaths;
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy