source/tools/jboss-v7-tool/src/main/java/com/uc4/ara/feature/jbossv7/CompareJBossV7Snapshot.java
private boolean compareNodes(Node snapNode, Node compareNode) {

        String sNodeContent = XmlUtil.getFirstLevelTextContent(snapNode);
        String cNodeContent = XmlUtil.getFirstLevelTextContent(compareNode);

        if ( !sNodeContent.equals(cNodeContent))
        {
            Logger.log("Different: " + snapNode.getNodeName() + " ( " + sNodeContent + " >< " + cNodeContent + " )", "INFO");
            return true;
        }

        Set<String> compareSet = new HashSet<String>();
        NamedNodeMap cMap = compareNode.getAttributes();
        NamedNodeMap sMap = snapNode.getAttributes();

        for (int i = 0; i < cMap.getLength(); i++)
        {
            Node node = cMap.item(i);
            compareSet.add(node.getNodeName() + " :: " +node.getNodeValue());
        }

        for (int i = 0; i < sMap.getLength(); i++)
        {
            Node node = sMap.item(i);

            boolean missing = ! compareSet.remove(node.getNodeName() + " :: " + node.getNodeValue());
            if(missing && ! node.getNodeName().equals("lastModified"))
            {
                String diffStr = "Different: " + snapNode.getNodeName() + ":" + ((Element)snapNode).getAttribute("name") + " (";
                for (String attr : compareSet)
                    if (attr.contains(node.getNodeName() + " :: "))
                        diffStr += attr + " >< " + node.getNodeValue() + " ";
                Logger.log(diffStr + " )", "INFO");

                return true;
            }
        }

        if( compareSet.size() > 0 )
        {
            for (String attr : compareSet)
                if (attr.contains("lastModified :: ")) {
                    compareSet.remove(attr);
                    break;
                }

            if (compareSet.size() > 0) {
                Logger.log("Different: " + ( (Element)snapNode ).getAttribute("name") + compareSet.toString(), "INFO");
                return true;
            }
        }

        return false;

    }
/** Compare attributes or text content of a single node.
     * @param snapNode
     * @param compareNode
     * @return true if nodes are different
     */
Compare attributes or text content of a single node.
@param snapNode
@param compareNode
@return true if nodes are different
Compare attributes or text content of a single node . @param snapNode @param compareNode @return true if nodes are different
private boolean compareNodes(Node snapNode, Node compareNode) {
        String sNodeContent = XmlUtil.getFirstLevelTextContent(snapNode);
        String cNodeContent = XmlUtil.getFirstLevelTextContent(compareNode);
        if ( !sNodeContent.equals(cNodeContent))
        {
            Logger.log("Different: " + snapNode.getNodeName() + " ( " + sNodeContent + " >< " + cNodeContent + " )", "INFO");
            return true;
        }
        Set<String> compareSet = new HashSet<String>();
        NamedNodeMap cMap = compareNode.getAttributes();
        NamedNodeMap sMap = snapNode.getAttributes();
        for (int i = 0; i < cMap.getLength(); i++)
        {
            Node node = cMap.item(i);
            compareSet.add(node.getNodeName() + " :: " +node.getNodeValue());
        }
        for (int i = 0; i < sMap.getLength(); i++)
        {
            Node node = sMap.item(i);
            boolean missing = ! compareSet.remove(node.getNodeName() + " :: " + node.getNodeValue());
            if(missing && ! node.getNodeName().equals("lastModified"))
            {
                String diffStr = "Different: " + snapNode.getNodeName() + ":" + ((Element)snapNode).getAttribute("name") + " (";
                for (String attr : compareSet)
                    if (attr.contains(node.getNodeName() + " :: "))
                        diffStr += attr + " >< " + node.getNodeValue() + " ";
                Logger.log(diffStr + " )", "INFO");
                return true;
            }
        }
        if( compareSet.size() > 0 )
        {
            for (String attr : compareSet)
                if (attr.contains("lastModified :: ")) {
                    compareSet.remove(attr);
                    break;
                }
            if (compareSet.size() > 0) {
                Logger.log("Different: " + ( (Element)snapNode ).getAttribute("name") + compareSet.toString(), "INFO");
                return true;
            }
        }
        return false;
    }
private boolean compareNodes ( Node snapNode , Node compareNode ) { String sNodeContent = XmlUtil . getFirstLevelTextContent ( snapNode ) ; String cNodeContent = XmlUtil . getFirstLevelTextContent ( compareNode ) ; if ( ! sNodeContent . equals ( cNodeContent ) ) { Logger . log ( "Different: " + snapNode . getNodeName ( ) + " ( " + sNodeContent + " >< " + cNodeContent + " )" , "INFO" ) ; return true ; } Set < String > compareSet = new HashSet < String > ( ) ; NamedNodeMap cMap = compareNode . getAttributes ( ) ; NamedNodeMap sMap = snapNode . getAttributes ( ) ; for ( int i = 0 ; i < cMap . getLength ( ) ; i ++ ) { Node node = cMap . item ( i ) ; compareSet . add ( node . getNodeName ( ) + " :: " + node . getNodeValue ( ) ) ; } for ( int i = 0 ; i < sMap . getLength ( ) ; i ++ ) { Node node = sMap . item ( i ) ; boolean missing = ! compareSet . remove ( node . getNodeName ( ) + " :: " + node . getNodeValue ( ) ) ; if ( missing && ! node . getNodeName ( ) . equals ( "lastModified" ) ) { String diffStr = "Different: " + snapNode . getNodeName ( ) + ":" + ( ( Element ) snapNode ) . getAttribute ( "name" ) + " (" ; for ( String attr : compareSet ) if ( attr . contains ( node . getNodeName ( ) + " :: " ) ) diffStr += attr + " >< " + node . getNodeValue ( ) + " " ; Logger . log ( diffStr + " )" , "INFO" ) ; return true ; } } if ( compareSet . size ( ) > 0 ) { for ( String attr : compareSet ) if ( attr . contains ( "lastModified :: " ) ) { compareSet . remove ( attr ) ; break ; } if ( compareSet . size ( ) > 0 ) { Logger . log ( "Different: " + ( ( Element ) snapNode ) . getAttribute ( "name" ) + compareSet . toString ( ) , "INFO" ) ; return true ; } } return false ; }
Compare attributes or text content of a single node.
Compare attributes or text content of a single node .