Package org.codehaus.plexus.util.xml

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


        return component;
    }

    private void testSucceeded() {
        long runTime = System.currentTimeMillis() - this.startTime;
        Xpp3Dom testCase = createTestElement("testcase", testName, runTime);
        results.add(testCase);
    }
View Full Code Here


    }

    private void writeTestProblems(String testName, String stdErr) {
        long runTime = System.currentTimeMillis() - this.startTime;

        Xpp3Dom testCase = createTestElement("testcase", testName, runTime);
        Xpp3Dom element = createElement(testCase, "failure");

        element.setAttribute("message", escapeAttribute(getMessage(stdErr)));
        element.setAttribute("type", getType(stdErr));
        element.setValue(stdErr);

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

    /**
     * Adds system properties to the XML report.
     */
    private void showProperties(Xpp3Dom testSuite) {
        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", escapeAttribute(value));
            }
        }
    }
View Full Code Here

        if ( artifact.isSnapshot() )
        {
            File metadataFile = new File( file.getParentFile(), "maven-metadata-local.xml" );

            Xpp3Dom metadata = new Xpp3Dom( "metadata" );
            addChild( metadata, "groupId", artifact.getGroupId() );
            addChild( metadata, "artifactId", artifact.getArtifactId() );
            addChild( metadata, "version", artifact.getBaseVersion() );
            Xpp3Dom versioning = new Xpp3Dom( "versioning" );
            versioning.addChild( addChild( new Xpp3Dom( "snapshot" ), "localCopy", "true" ) );
            addChild( versioning, "lastUpdated", timestamp );
            metadata.addChild( versioning );

            writeMetadata( metadataFile, metadata );
        }

        {
            File metadataFile = new File( file.getParentFile().getParentFile(), "maven-metadata-local.xml" );

            Set allVersions = new LinkedHashSet();

            Xpp3Dom metadata = readMetadata( metadataFile );

            if ( metadata != null )
            {
                Xpp3Dom versioning = metadata.getChild( "versioning" );
                if ( versioning != null )
                {
                    Xpp3Dom versions = versioning.getChild( "versions" );
                    if ( versions != null )
                    {

                        Xpp3Dom[] children = versions.getChildren( "version" );
                        for ( int i = 0; i < children.length; i++ )
                        {
                            allVersions.add( children[i].getValue() );
                        }
                    }
                }
            }

            allVersions.add( artifact.getBaseVersion() );

            metadata = new Xpp3Dom( "metadata" );
            addChild( metadata, "groupId", artifact.getGroupId() );
            addChild( metadata, "artifactId", artifact.getArtifactId() );
            Xpp3Dom versioning = new Xpp3Dom( "versioning" );
            versioning.addChild( addChildren( new Xpp3Dom( "versions" ), "version", allVersions ) );
            addChild( versioning, "lastUpdated", timestamp );
            metadata.addChild( versioning );

            metadata = Xpp3DomUtils.mergeXpp3Dom( metadata, readMetadata( metadataFile ) );
View Full Code Here

        }
    }

    private static Xpp3Dom addChild( Xpp3Dom parent, String childName, String childValue )
    {
        Xpp3Dom child = new Xpp3Dom( childName );
        child.setValue( childValue );
        parent.addChild( child );
        return parent;
    }
View Full Code Here

    {
//        p.getGoalConfiguration( pluginGroupId, pluginArtifactId, executionId, goalId );
        Plugin plugin = getPlugin( p, pluginId );
        if ( plugin != null )
        {
            Xpp3Dom xpp3Dom = (Xpp3Dom) plugin.getConfiguration();
            if ( xpp3Dom != null && xpp3Dom.getChild( param ) != null
                && StringUtils.isNotEmpty( xpp3Dom.getChild( param ).getValue() ) )
            {
                return xpp3Dom.getChild( param ).getValue();
            }
        }

        return null;
    }
View Full Code Here

              try {
                unpack(file, tempLocation);
                String version = null;
                String resourcePath = null;
                try {
                  Xpp3Dom xpp3Dom = Xpp3DomBuilder.build(new StringReader(descriptor));
                  Xpp3Dom themeDefinitions = xpp3Dom.getChild("theme-definitions");
                  if (themeDefinitions != null && !ignoreVersioned) {
                    for (Xpp3Dom themeDefinition : themeDefinitions.getChildren()) {
                      Xpp3Dom versionedDom = themeDefinition.getChild("versioned");
                      if (versionedDom != null) {
                        boolean versioned = Boolean.parseBoolean(versionedDom.getValue());
                        if (versioned) {
                          Xpp3Dom resourcePathDom = themeDefinition.getChild("resource-path");
                          resourcePath = resourcePathDom.getValue();
                          Properties properties = new Properties();
                          String metaInf = tempLocation + "/META-INF/MANIFEST.MF";
                          properties.load(new ByteArrayInputStream(FileUtils.fileRead(metaInf).getBytes()));
                          version = properties.getProperty("Implementation-Version");
                          if (version == null) {
View Full Code Here

            fw = new FileWriter( temporaryContextFile );
            // format to modify/create <Context backgroundProcessorDelay="5" reloadable="false">
            if ( contextFile != null && contextFile.exists() )
            {
                fr = new FileReader( contextFile );
                Xpp3Dom xpp3Dom = Xpp3DomBuilder.build( fr );
                xpp3Dom.setAttribute( "backgroundProcessorDelay", Integer.toString( backgroundProcessorDelay ) );
                xpp3Dom.setAttribute( "reloadable", Boolean.toString( isContextReloadable() ) );
                Xpp3DomWriter.write( fw, xpp3Dom );
                Xpp3DomWriter.write( sw, xpp3Dom );
                getLog().debug( " generated context file " + sw.toString() );
            }
            else
View Full Code Here

                mavenFileFilterRequest.setFiltering( true );

                mavenFileFilter.copyFile( mavenFileFilterRequest );

                fr = new FileReader( temporaryContextFile );
                Xpp3Dom xpp3Dom = Xpp3DomBuilder.build( fr );
                xpp3Dom.setAttribute( "backgroundProcessorDelay", Integer.toString( backgroundProcessorDelay ) );
                xpp3Dom.setAttribute( "reloadable", Boolean.toString( isContextReloadable() ) );
                fw = new FileWriter( temporaryContextFile );
                Xpp3DomWriter.write( fw, xpp3Dom );
                Xpp3DomWriter.write( sw, xpp3Dom );
                getLog().debug( " generated context file " + sw.toString() );
            }
View Full Code Here

            for ( Plugin plugin : (List<Plugin>) model.getBuild().getPlugins() )
            {
                if ( plugin.getGroupId() != null && plugin.getGroupId().equals( "org.apache.maven.plugins" ) &&
                    plugin.getArtifactId() != null && plugin.getArtifactId().equals( "maven-release-plugin" ) )
                {
                    Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();

                    if ( dom != null )
                    {
                        Xpp3Dom configuration = dom.getChild( "releaseLabel" );
                        if ( configuration != null )
                        {
                            scmTag = configuration.getValue();
                        }

                        configuration = dom.getChild( "tag" );
                        if ( configuration != null )
                        {
                            scmTag = configuration.getValue();
                        }

                        configuration = dom.getChild( "tagBase" );
                        if ( configuration != null )
                        {
                            scmTagBase = configuration.getValue();
                        }

                        configuration = dom.getChild( "preparationGoals" );
                        if ( configuration != null )
                        {
                            prepareGoals = configuration.getValue();
                        }

                        configuration = dom.getChild( "arguments" );
                        if ( configuration != null )
                        {
                            arguments = configuration.getValue();
                        }

                        configuration = dom.getChild( "scmCommentPrefix" );
                        if ( configuration != null )
                        {
                            scmCommentPrefix = configuration.getValue();
                        }

                        configuration = dom.getChild( "autoVersionSubmodules" );
                        if ( configuration != null )
                        {
                            autoVersionSubmodules = Boolean.valueOf( configuration.getValue() );
                        }

                        configuration = dom.getChild( "addSchema" );
                        if ( configuration != null )
                        {
                            addSchema = Boolean.valueOf( configuration.getValue() );
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.xml.Xpp3Dom

Copyright © 2018 www.massapicom. 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.