Examples of Xpp3Dom


Examples of org.codehaus.plexus.util.xml.Xpp3Dom

        getLog().debug( "Loading supplements complete." );

        Map<String, Model> supplementMap = new HashMap<String, Model>();
        for ( Supplement sd : supplements )
        {
            Xpp3Dom dom = (Xpp3Dom) sd.getProject();

            Model m = getSupplement( dom );
            supplementMap.put( generateSupplementMapKey( m.getGroupId(), m.getArtifactId() ), m );
        }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     */
    private static List<Map<String, String>> pluginConfigurations(PluginExecution execution) {
        List<Map<String, String>> configurations = new ArrayList<Map<String,String>>();
        Map<String, String> topConfiguration = new HashMap<String, String>();
       
        Xpp3Dom dom = (Xpp3Dom)execution.getConfiguration();
        for (Xpp3Dom element: dom.getChildren()) {
            if (element.getChildCount() != 0) {
                // Handle nested configuration element, create a child configuration
                // for each
                for (Xpp3Dom childConfigurationElement: element.getChildren()) {
                    Map<String, String> childConfiguration = new HashMap<String, String>();
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

    public void testSucceeded(Test test) {
        super.testSucceeded();

        long runTime = this.m_endTime - this.m_startTime;

        Xpp3Dom testCase = createTestElement(test, runTime);

        m_results.add(testCase);
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     */
    private void writeTestProblems(Test test, Throwable e, String name, String out, String err, String log) {

        long runTime = m_endTime - m_startTime;

        Xpp3Dom testCase = createTestElement(test, runTime);

        Xpp3Dom element = createElement(testCase, name);

        String stackTrace = getStackTrace(test, e);

        Throwable t = e;

        if (t != null) {

            String message = t.getMessage();

            if (message != null) {
                element.setAttribute("message", message);

                element.setAttribute("type",
                        stackTrace.indexOf(":") > -1 ? stackTrace.substring(0,
                                stackTrace.indexOf(":")) : stackTrace);
            } else {
                element.setAttribute("type", new StringTokenizer(stackTrace)
                        .nextToken());
            }
        }

        if (stackTrace != null) {
            element.setValue(stackTrace);
        }
       
        addOutputStreamElement(out, "system-out", testCase);

        addOutputStreamElement(err, "system-err", testCase);
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     */
    public void generateReport(Test test, TestResult tr, File reportsDirectory,
            BundleContext bc, Map configuration) throws Exception {
        long runTime = this.m_endTime - this.m_startTime;

        Xpp3Dom testSuite = createTestSuiteElement(test, runTime);

        showProperties(testSuite, bc, configuration);

        testSuite.setAttribute("tests", String.valueOf(tr.runCount()));

        testSuite.setAttribute("errors", String.valueOf(tr.errorCount()));

        testSuite.setAttribute("failures", String.valueOf(tr.failureCount()));

        for (Iterator i = m_results.iterator(); i.hasNext();) {
            Xpp3Dom testcase = (Xpp3Dom) i.next();
            testSuite.addChild(testcase);
        }

        File reportFile = new File(reportsDirectory, "TEST-"
                + getReportName(test).replace(' ', '_') + ".xml");
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     * @param test the test
     * @param runTime the elapsed time to execute the test.
     * @return the XML element describing the given test.
     */
    private Xpp3Dom createTestElement(Test test, long runTime) {
        Xpp3Dom testCase = new Xpp3Dom("testcase");
        testCase.setAttribute("name", getReportName(test));
        testCase.setAttribute("time", Long.toString(runTime) + " sec");
        return testCase;
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     * @param test the test
     * @param runTime the elapsed time to execute the test suite.
     * @return the XML element describing the given test suite.
     */
    private Xpp3Dom createTestSuiteElement(Test test, long runTime) {
        Xpp3Dom testCase = new Xpp3Dom("testsuite");
        testCase.setAttribute("name", getReportName(test));
        testCase.setAttribute("time", Long.toString(runTime) + " sec");
        return testCase;
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     * @param element the parent element
     * @param name the name of the element to create
     * @return the resulting XML tree.
     */
    private Xpp3Dom createElement(Xpp3Dom element, String name) {
        Xpp3Dom component = new Xpp3Dom(name);

        element.addChild(component);

        return component;
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

     * @param testSuite the XML element.
     * @param bc the bundle context
     * @param configuration the configuration of the underlying OSGi platform
     */
    private void showProperties(Xpp3Dom testSuite, BundleContext bc, Map configuration) {
        Xpp3Dom properties = createElement(testSuite, "properties");
       
        Properties systemProperties = System.getProperties();

        if (systemProperties != null) {
            Enumeration propertyKeys = systemProperties.propertyNames();

            while (propertyKeys.hasMoreElements()) {
                String key = (String) propertyKeys.nextElement();

                String value = systemProperties.getProperty(key);

                if (value == null) {
                    value = "null";
                }

                Xpp3Dom property = createElement(properties, "property");

                property.setAttribute("name", key);

                property.setAttribute("value", value);

            }
        }
       
        if (configuration != null) {
            Iterator it = configuration.keySet().iterator();

            while (it.hasNext()) {
                String key = (String) it.next();

                Object obj = (Object) configuration.get(key);
                String value = null;
                if (obj == null) {
                    value = "null";
                } else if (obj instanceof String) {
                    value = (String) obj;
                } else {
                    value  = obj.toString();
                }

                Xpp3Dom property = createElement(properties, "property");

                property.setAttribute("name", key);

                property.setAttribute("value", value);

            }
        }

        Xpp3Dom buns = createElement(properties, "bundles");
        Bundle[] bundles = bc.getBundles();
        for (int i = 0; i < bundles.length; i++) {
            String sn = bundles[i].getSymbolicName();
            String state = "UNKNOWN";
            switch (bundles[i].getState()) {
                case Bundle.ACTIVE:
                    state = "ACTIVE";
                    break;
                case Bundle.INSTALLED:
                    state = "INSTALLED";
                    break;
                case Bundle.RESOLVED:
                    state = "RESOLVED";
                    break;
                case Bundle.UNINSTALLED:
                    state = "UNINSTALLED";
                    break;
                default:
                    break;
            }
            Xpp3Dom bundle = createElement(buns, "bundle");
            bundle.setAttribute("symbolic-name", sn);
            bundle.setAttribute("state", state);
        }

    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.Xpp3Dom

        filter.addComponentsXml( reader );

        assertFalse( filter.components.isEmpty() );

        final Xpp3Dom componentDom = filter.components.get( "role" );

        assertEquals( "role", componentDom.getChild( "role" )
                                          .getValue() );
        assertNull( componentDom.getChild( "role-hint" ) );
        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" )
                                                           .getValue() );
    }
View Full Code Here
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.