2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.common.scripts.utils
23 import org.custommonkey.xmlunit.Difference
24 import org.custommonkey.xmlunit.DifferenceConstants
25 import org.custommonkey.xmlunit.DifferenceListener
26 import org.w3c.dom.Node
28 class IgnoreNamedElementsDifferenceListener implements DifferenceListener {
29 private Set<String> blackList = new HashSet<String>();
31 public IgnoreNamedElementsDifferenceListener(String ... ignoreTags) {
32 for (String name : ignoreTags) {
37 public int differenceFound(Difference difference) {
38 if (difference.getId() == DifferenceConstants.TEXT_VALUE_ID) {
39 if (blackList.contains(difference.getControlNodeDetail().getNode().getParentNode().getNodeName())) {
40 return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
44 return DifferenceListener.RETURN_ACCEPT_DIFFERENCE;
48 public void skippedComparison(Node node, Node node1) {