Search in sources :

Example 1 with CmisTestGroup

use of org.apache.chemistry.opencmis.tck.CmisTestGroup in project copper-cms by PogeyanOSS.

the class CoreHtmlReport method createReport.

@Override
public void createReport(Map<String, String> parameters, List<CmisTestGroup> groups, Writer writer) throws IOException {
    stackTraceCounter = 0;
    if (parameters != null) {
        revision = parameters.get(AbstractRunner.TCK_REVISION_PARAMETER);
    }
    writer.write("<h1>OpenCMIS TCK Report</h1>\n");
    writer.write((new Date()) + "\n");
    writer.write("\n<h2>Parameters</h2>\n");
    if (parameters != null) {
        writer.write("<table>\n");
        for (Map.Entry<String, String> p : (new TreeMap<String, String>(parameters)).entrySet()) {
            String value = p.getValue();
            if (SessionParameter.PASSWORD.endsWith(p.getKey())) {
                value = "*****";
            }
            writer.write("<tr><td>" + escape(p.getKey()) + "</td><td>" + escape(value) + "</td></tr>\n");
        }
        writer.write("</table>\n");
    }
    writer.write("\n<h2>Groups</h2>\n");
    if (groups != null) {
        for (CmisTestGroup group : groups) {
            printGroupResults(group, writer);
        }
    }
    writer.flush();
}
Also used : CmisTestGroup(org.apache.chemistry.opencmis.tck.CmisTestGroup) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map) Date(java.util.Date)

Example 2 with CmisTestGroup

use of org.apache.chemistry.opencmis.tck.CmisTestGroup in project copper-cms by PogeyanOSS.

the class JsonReport method createReport.

@Override
public void createReport(Map<String, String> parameters, List<CmisTestGroup> groups, Writer writer) throws IOException {
    JSONObject jsonReport = new JSONObject();
    JSONObject jsonParameters = new JSONObject();
    jsonReport.put("parameters", jsonParameters);
    if (parameters != null) {
        for (Map.Entry<String, String> p : (new TreeMap<String, String>(parameters)).entrySet()) {
            jsonParameters.put(p.getKey(), p.getValue());
        }
    }
    if (groups != null) {
        JSONArray jsonGroups = new JSONArray();
        jsonReport.put("groups", jsonGroups);
        for (CmisTestGroup group : groups) {
            printGroupResults(group, jsonGroups);
        }
    }
    jsonReport.writeJSONString(writer);
    writer.flush();
}
Also used : JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) JSONArray(org.apache.chemistry.opencmis.commons.impl.json.JSONArray) CmisTestGroup(org.apache.chemistry.opencmis.tck.CmisTestGroup) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 3 with CmisTestGroup

use of org.apache.chemistry.opencmis.tck.CmisTestGroup in project copper-cms by PogeyanOSS.

the class XmlReport method createReport.

@Override
public void createReport(Map<String, String> parameters, List<CmisTestGroup> groups, Writer writer) throws Exception {
    XMLOutputFactory factory = XMLOutputFactory.newInstance();
    XMLStreamWriter xml = factory.createXMLStreamWriter(writer);
    // start doc
    xml.writeStartDocument();
    xml.writeStartElement(TAG_REPORT);
    if (parameters != null) {
        xml.writeStartElement(TAG_PARAMETERS);
        for (Map.Entry<String, String> p : (new TreeMap<String, String>(parameters)).entrySet()) {
            xml.writeStartElement(TAG_PARAMETER);
            xml.writeAttribute(ATTR_KEY, p.getKey());
            if (p.getValue() != null) {
                xml.writeAttribute(ATTR_VALUE, p.getValue());
            }
            xml.writeEndElement();
        }
        xml.writeEndElement();
    }
    if (groups != null) {
        for (CmisTestGroup group : groups) {
            printGroupResults(group, xml);
        }
    }
    xml.writeEndElement();
    // end document
    xml.writeEndDocument();
    xml.flush();
}
Also used : XMLOutputFactory(javax.xml.stream.XMLOutputFactory) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) CmisTestGroup(org.apache.chemistry.opencmis.tck.CmisTestGroup) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 4 with CmisTestGroup

use of org.apache.chemistry.opencmis.tck.CmisTestGroup in project copper-cms by PogeyanOSS.

the class TextReport method createReport.

@Override
public void createReport(Map<String, String> parameters, List<CmisTestGroup> groups, Writer writer) throws IOException {
    writer.write("***************************************************************" + NL);
    writer.write("Test Report: " + (new Date()) + NL);
    writer.write("***************************************************************" + NL);
    if (parameters != null) {
        for (Map.Entry<String, String> p : (new TreeMap<String, String>(parameters)).entrySet()) {
            writer.write(p.getKey() + " = " + p.getValue() + NL);
        }
    }
    writer.write("***************************************************************" + NL);
    if (groups != null) {
        for (CmisTestGroup group : groups) {
            printGroupResults(group, writer);
        }
    }
    writer.flush();
}
Also used : CmisTestGroup(org.apache.chemistry.opencmis.tck.CmisTestGroup) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map) Date(java.util.Date)

Example 5 with CmisTestGroup

use of org.apache.chemistry.opencmis.tck.CmisTestGroup in project copper-cms by PogeyanOSS.

the class AbstractRunner method addGroup.

public void addGroup(String groupClass) throws Exception {
    if (groupClass == null) {
        return;
    }
    groupClass = groupClass.trim();
    if (groupClass.length() == 0) {
        return;
    }
    Class<?> clazz = ClassLoaderUtil.loadClass(groupClass);
    Object o = clazz.newInstance();
    CmisTestGroup group = null;
    if (o instanceof CmisTestGroup) {
        group = (CmisTestGroup) o;
    } else if (o instanceof CmisTest) {
        group = new WrapperCmisTestGroup((CmisTest) o);
    } else {
        throw new InstantiationException("Not a CmisTestGroup or CmisTest class!");
    }
    addGroup(group);
}
Also used : CmisTestGroup(org.apache.chemistry.opencmis.tck.CmisTestGroup) WrapperCmisTestGroup(org.apache.chemistry.opencmis.tck.impl.WrapperCmisTestGroup) WrapperCmisTestGroup(org.apache.chemistry.opencmis.tck.impl.WrapperCmisTestGroup) CmisTest(org.apache.chemistry.opencmis.tck.CmisTest)

Aggregations

CmisTestGroup (org.apache.chemistry.opencmis.tck.CmisTestGroup)6 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 Date (java.util.Date)2 WrapperCmisTestGroup (org.apache.chemistry.opencmis.tck.impl.WrapperCmisTestGroup)2 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 JSONArray (org.apache.chemistry.opencmis.commons.impl.json.JSONArray)1 JSONObject (org.apache.chemistry.opencmis.commons.impl.json.JSONObject)1 CmisTest (org.apache.chemistry.opencmis.tck.CmisTest)1