Package com.googlecode.memwords.web.integration.util

Source Code of com.googlecode.memwords.web.integration.util.CoberturaFlusher

package com.googlecode.memwords.web.integration.util;

import static com.googlecode.memwords.web.integration.util.IntegrationUtils.*;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;

/**
* Class used to call a special action of the wabapp which flushes cobertura
* @author JB
*/
public class CoberturaFlusher {

    public static void main(String[] args) throws FailingHttpStatusCodeException,
                                                  MalformedURLException,
                                                  IOException {
        WebClient wc = IntegrationUtils.startWebClient();
        Page page = wc.getPage(url("/util/IntegrationTests.action?flushCobertura="));
        String outputFileName = System.getProperty("com.googlecode.memwords.test.web.integration.datafile");
        if (outputFileName == null) {
            outputFileName = "cobertura/report/cobertura-integration.ser";
        }
        BufferedOutputStream out = null;
        try {
            out = new BufferedOutputStream(new FileOutputStream(new File(outputFileName)));
            out.write(page.getWebResponse().getContentAsBytes());
        }
        finally {
            try {
                out.close();
            }
            catch (IOException e) {
                // ignore
            }
        }
    }
}
TOP

Related Classes of com.googlecode.memwords.web.integration.util.CoberturaFlusher

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.