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

pl.pragmatists.concordion.rest.ExpectedXmlResponseCommand Maven / Gradle / Ivy

package pl.pragmatists.concordion.rest;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.xml.transform.TransformerException;

import nu.xom.Builder;
import nu.xom.Document;
import nu.xom.Serializer;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.concordion.api.AbstractCommand;
import org.concordion.api.CommandCall;
import org.concordion.api.Element;
import org.concordion.api.Evaluator;
import org.concordion.api.Result;
import org.concordion.api.ResultRecorder;
import org.concordion.api.listener.AssertEqualsListener;
import org.concordion.api.listener.AssertFailureEvent;
import org.concordion.api.listener.AssertSuccessEvent;
import org.concordion.internal.util.Announcer;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.xml.sax.SAXException;

public class ExpectedXmlResponseCommand extends AbstractCommand {

    private Announcer listeners = Announcer.to(AssertEqualsListener.class);

    public ExpectedXmlResponseCommand() {
        listeners.addListener(new RestResultRenderer());
    }
    
    public void verify(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) {

        Element element = commandCall.getElement();
        element.addStyleClass("xml");
        StringBuilder xml = new StringBuilder();
        
        Element[] child = element.getChildElements();
        for(int c=0; c




© 2015 - 2025 Weber Informatics LLC | Privacy Policy