Package org.codehaus.plexus.util.xml

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


  }
 
  @Test
  public void testExecute() throws Exception {
   
        final Xpp3Dom cleanConfig = Xpp3DomBuilder.build(TearDownMojoTest.class.getResourceAsStream("teardown-clean-mojo-config.xml"), "UTF-8");
       
        doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        assertEquals(cleanConfig,
View Full Code Here


  }
 
  @Test
  public void testClean() throws Exception {
   
        final Xpp3Dom cleanConfig = Xpp3DomBuilder.build(SetUpMojoTest.class.getResourceAsStream("setup-clean-mojo-config.xml"), "UTF-8");
        cleanConfig.getChild("filesets").getChild(0).getChild("directory").setValue(helper.workingDir.getCanonicalPath());
       
        doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        assertEquals(cleanConfig,
View Full Code Here

  }
 
  @Test
  public void testUnpack() throws Exception {
   
        final Xpp3Dom unpackConfig = Xpp3DomBuilder.build(SetUpMojoTest.class.getResourceAsStream("unpack-mojo-config.xml"), "UTF-8");
        unpackConfig.getChild("artifactItems").getChild(0).getChild("outputDirectory").setValue(helper.workingDir.getCanonicalPath());
        unpackConfig.getChild("artifactItems").getChild(1).getChild("outputDirectory").setValue(helper.workingDir.getCanonicalPath() + "/FitNesseRoot/files");
       
        doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        assertEquals(unpackConfig,
View Full Code Here

  }
 
  @Test
  public void testMove() throws Exception {
   
        final Xpp3Dom antrunConfig = Xpp3DomBuilder.build(SetUpMojoTest.class.getResourceAsStream("antrun-mojo-config.xml"), "UTF-8");
        // Because the tmp directory differs by OS
        antrunConfig.getChild("target").getChild(0).setAttribute("todir", helper.workingDir.getCanonicalPath());
        antrunConfig.getChild("target").getChild(0).setAttribute("file", helper.workingDir.getCanonicalPath() + "/" + SetUpMojo.FIT_ROOT);
        antrunConfig.getChild("target").getChild(1).setAttribute("todir", helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files");
        antrunConfig.getChild("target").getChild(1).getChild("fileset").setAttribute("dir",
            helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files/" + SetUpMojo.FIT_FILES);
       
        doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
View Full Code Here

            if ( is == null )
            {
                return false;
            }

            Xpp3Dom dom = Xpp3DomBuilder.build( new InputStreamReader( is ) );

            Xpp3Dom[] components = dom.getChild( "components" ).getChildren( "component" );

            for ( int i = 0; i < components.length; i++ )
            {
                if ( components[i].getChild( "role" ).getValue().equals( "org.apache.maven.lifecycle.mapping.LifecycleMapping" ) )
                {
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 )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAG, configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAG, "" );
                            }

                            configuration = dom.getChild( "tag" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAG, configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAG, "" );
                            }

                            configuration = dom.getChild( "tagBase" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAGBASE,
                                                       configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_TAGBASE, "" );
                            }

                            configuration = dom.getChild( "preparationGoals" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_PREPARE_GOALS,
                                                       configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_PREPARE_GOALS, "" );
                            }

                            configuration = dom.getChild( "arguments" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_ARGUMENTS,
                                                       configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_ARGUMENTS, "" );
                            }

                            configuration = dom.getChild( "scmCommentPrefix" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_COMMENT_PREFIX,
                                                       configuration.getValue() );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_SCM_COMMENT_PREFIX, "" );
                            }

                            configuration = dom.getChild( "autoVersionSubmodules" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_AUTO_VERSION_SUBMODULES,
                                                       Boolean.valueOf( configuration.getValue() ) );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_AUTO_VERSION_SUBMODULES, false );
                            }

                            configuration = dom.getChild( "addSchema" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_ADD_SCHEMA,
                                                       Boolean.valueOf( configuration.getValue() ) );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_ADD_SCHEMA, false );
                            }

                            configuration = dom.getChild( "useReleaseProfile" );
                            if ( configuration != null )
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_USE_RELEASE_PROFILE,
                                                       Boolean.valueOf( configuration.getValue() ) );
                            }
                            else
                            {
                                releaseParameters.put( ContinuumBuildAgentUtil.KEY_USE_RELEASE_PROFILE, false );
                            }

                            configuration = dom.getChild( "goals" );
                            if ( configuration != null )
                            {
                                String goals = configuration.getValue();
                                if ( model.getDistributionManagement() != null &&
                                    model.getDistributionManagement().getSite() != null )
                                {
                                    goals += "site-deploy";
                                }
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( "useReleaseProfile" );
                        if ( configuration != null )
                        {
                            useReleaseProfile = Boolean.valueOf( configuration.getValue() );
                        }

                        configuration = dom.getChild( "goals" );
                        if ( configuration != null )
                        {
                            goals = configuration.getValue();
                            if ( model.getDistributionManagement() != null &&
                                model.getDistributionManagement().getSite() != null )
                            {
                                goals += " site-deploy";
                            }
                        }

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

                    }
                }
            }
View Full Code Here

    }

    private Xpp3Dom mergeConfiguration( PlexusConfiguration mojoConf, PlexusConfiguration pluginConf,
                                        PlexusConfiguration reportSetConf, Set<String> parameters )
    {
        Xpp3Dom mojoConfig = ( mojoConf != null ) ? convert( mojoConf ) : new Xpp3Dom( "configuration" );

        if ( pluginConf != null || reportSetConf != null )
        {
            Xpp3Dom reportConfiguration = pluginConf == null ? new Xpp3Dom( "fake" ) : convert( pluginConf );

            // MSITE-512 configuration from ReportSet must win
            Xpp3Dom mergedConfigurationWithReportSet =
                Xpp3DomUtils.mergeXpp3Dom( convert( reportSetConf ), reportConfiguration );

            Xpp3Dom mergedConfiguration = Xpp3DomUtils.mergeXpp3Dom( mergedConfigurationWithReportSet, mojoConfig );

            Xpp3Dom cleanedConfiguration = new Xpp3Dom( "configuration" );
            if ( mergedConfiguration.getChildren() != null )
            {
                for ( Xpp3Dom parameter : mergedConfiguration.getChildren() )
                {
                    if ( parameters.contains( parameter.getName() ) )
                    {
                        cleanedConfiguration.addChild( parameter );
                    }
                }
            }
            if ( getLog().isDebugEnabled() )
            {
View Full Code Here

        if ( config == null )
        {
            return null;
        }

        Xpp3Dom dom = new Xpp3Dom( config.getName() );
        dom.setValue( config.getValue( null ) );

        for ( String attrib : config.getAttributeNames() )
        {
            dom.setAttribute( attrib, config.getAttribute( attrib, null ) );
        }

        for ( int n = config.getChildCount(), i = 0; i < n; i++ )
        {
            dom.addChild( convert( config.getChild( i ) ) );
        }

        return dom;
    }
View Full Code Here

        repository.setId( "id=" + protocol );

        repository.setProtocol( protocol );

        Xpp3Dom conf = new Xpp3Dom( "configuration" );

        Xpp3Dom configurableField = new Xpp3Dom( "configurableField" );

        configurableField.setValue( s );

        conf.addChild( configurableField );

        wagonManager.addConfiguration( repository.getId(), conf );
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.