Search in sources :

Example 21 with XmlPlexusConfiguration

use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project maven-plugins by apache.

the class ArtifactTypeMappingServiceTest method testConfigWithNoType.

public void testConfigWithNoType() {
    try {
        XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration("dummy");
        XmlPlexusConfiguration childConfig = new XmlPlexusConfiguration(ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT);
        childConfig.setAttribute("mapping", "ejb");
        rootConfig.addChild(childConfig);
        ArtifactTypeMappingService service = new ArtifactTypeMappingService();
        service.configure(rootConfig);
        fail("Should have failed");
    } catch (EarPluginException e) {
    // OK
    } catch (PlexusConfigurationException e) {
        e.printStackTrace();
        fail("Unexpected " + e.getMessage());
    }
}
Also used : PlexusConfigurationException(org.codehaus.plexus.configuration.PlexusConfigurationException) EarPluginException(org.apache.maven.plugins.ear.EarPluginException) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) ArtifactTypeMappingService(org.apache.maven.plugins.ear.util.ArtifactTypeMappingService)

Example 22 with XmlPlexusConfiguration

use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project maven-plugins by apache.

the class ArtifactTypeMappingServiceTest method getServiceWithRarMappingToMyRar.

// Utilities
protected ArtifactTypeMappingService getServiceWithRarMappingToMyRar() {
    try {
        XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration("artifact-type-mappings");
        XmlPlexusConfiguration childConfig = new XmlPlexusConfiguration(ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT);
        childConfig.setAttribute("type", "MyRar");
        childConfig.setAttribute("mapping", "rar");
        rootConfig.addChild(childConfig);
        ArtifactTypeMappingService service = new ArtifactTypeMappingService();
        service.configure(rootConfig);
        return service;
    } catch (EarPluginException e) {
        e.printStackTrace();
        fail(e.getMessage());
    } catch (PlexusConfigurationException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    // Won't occur
    return null;
}
Also used : PlexusConfigurationException(org.codehaus.plexus.configuration.PlexusConfigurationException) EarPluginException(org.apache.maven.plugins.ear.EarPluginException) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) ArtifactTypeMappingService(org.apache.maven.plugins.ear.util.ArtifactTypeMappingService)

Example 23 with XmlPlexusConfiguration

use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project maven-plugins by apache.

the class ArtifactTypeMappingServiceTest method testConfigWithUnknownStandardType.

public void testConfigWithUnknownStandardType() {
    try {
        XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration("dummy");
        XmlPlexusConfiguration childConfig = new XmlPlexusConfiguration(ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT);
        childConfig.setAttribute("type", "generic");
        childConfig.setAttribute("mapping", "notAStandardType");
        rootConfig.addChild(childConfig);
        ArtifactTypeMappingService service = new ArtifactTypeMappingService();
        service.configure(rootConfig);
        fail("Should have failed");
    } catch (EarPluginException e) {
    // OK
    } catch (PlexusConfigurationException e) {
        e.printStackTrace();
        fail("Unexpected " + e.getMessage());
    }
}
Also used : PlexusConfigurationException(org.codehaus.plexus.configuration.PlexusConfigurationException) EarPluginException(org.apache.maven.plugins.ear.EarPluginException) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) ArtifactTypeMappingService(org.apache.maven.plugins.ear.util.ArtifactTypeMappingService)

Aggregations

XmlPlexusConfiguration (org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)23 PlexusConfiguration (org.codehaus.plexus.configuration.PlexusConfiguration)11 EarPluginException (org.apache.maven.plugins.ear.EarPluginException)6 ArtifactTypeMappingService (org.apache.maven.plugins.ear.util.ArtifactTypeMappingService)6 PlexusConfigurationException (org.codehaus.plexus.configuration.PlexusConfigurationException)6 PluginParameterExpressionEvaluator (org.apache.maven.plugin.PluginParameterExpressionEvaluator)4 ExpressionEvaluator (org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator)4 MojoFailureException (org.apache.maven.plugin.MojoFailureException)3 ComponentConfigurationException (org.codehaus.plexus.component.configurator.ComponentConfigurationException)3 ComponentConfigurator (org.codehaus.plexus.component.configurator.ComponentConfigurator)3 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)3 ModelNode (org.jboss.dmr.ModelNode)3 IOException (java.io.IOException)2 StringReader (java.io.StringReader)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 MojoDescriptor (org.apache.maven.plugin.descriptor.MojoDescriptor)2 StringWriter (java.io.StringWriter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1