public PlexusContainer getContainer() { return testCase.getContainer(); }
/** * We should make sure this is called in each method that makes use of the container, * otherwise we throw ugly NPE's * * crops up when the subclassing code defines the setUp method but doesn't call super.setUp() * * @throws Exception */ private void validateContainerStatus() throws Exception { if ( getContainer() != null ) { return; } throw new Exception( "container is null, make sure super.setUp() is called" ); } }
/** * Configure the mojo with the given plexus configuration * * @param mojo * @param pluginConfiguration * @return a Mojo instance * @throws Exception */ protected Mojo configureMojo( Mojo mojo, PlexusConfiguration pluginConfiguration ) throws Exception { validateContainerStatus(); ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub(); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() ); return mojo; }
LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class ); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
/** * Configure the mojo * * @param mojo * @param artifactId * @param pom * @return a Mojo instance * @throws Exception */ protected Mojo configureMojo( Mojo mojo, String artifactId, File pom ) throws Exception { validateContainerStatus(); PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom ); ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub(); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() ); return mojo; }
protected void setUp() throws Exception { assertTrue( "Maven 3.2.4 or better is required", MAVEN_VERSION == null || new DefaultArtifactVersion( "3.2.3" ).compareTo( MAVEN_VERSION ) < 0 ); configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); XmlStreamReader reader = new XmlStreamReader( is ); InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), pluginDescriptor.getVersion(), ".jar" ); artifact.setFile( getPluginArtifactFile() ); pluginDescriptor.setPluginArtifact( artifact ); pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() ) { getContainer().addComponentDescriptor( desc ); } mojoDescriptors = new HashMap<String, MojoDescriptor>(); for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) { mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); } }
public PlexusContainer getContainer() { return testCase.getContainer(); }
configurator = getContainer().lookup( ComponentConfigurator.class, mojoDescriptor.getComponentConfigurator() ); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
/** * We should make sure this is called in each method that makes use of the container, * otherwise we throw ugly NPE's * * crops up when the subclassing code defines the setUp method but doesn't call super.setUp() * * @throws Exception */ private void validateContainerStatus() throws Exception { if ( getContainer() != null ) { return; } throw new Exception( "container is null, make sure super.setUp() is called" ); } }
@Override public PlexusContainer getContainer() { return super.getContainer(); } }
/** * Configure the mojo with the given plexus configuration * * @param mojo * @param pluginConfiguration * @return a Mojo instance * @throws Exception */ protected Mojo configureMojo( Mojo mojo, PlexusConfiguration pluginConfiguration ) throws Exception { validateContainerStatus(); ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub(); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() ); return mojo; }
protected void setUp() throws Exception { configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); XmlStreamReader reader = new XmlStreamReader( is ); InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), pluginDescriptor.getVersion(), ".jar" ); artifact.setFile( new File( getBasedir() ).getCanonicalFile() ); pluginDescriptor.setPluginArtifact( artifact ); pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() ) { getContainer().addComponentDescriptor( desc ); } mojoDescriptors = new HashMap<String, MojoDescriptor>(); for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) { mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); } }
LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class ); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
/** * Configure the mojo * * @param mojo * @param artifactId * @param pom * @return a Mojo instance * @throws Exception */ protected Mojo configureMojo( Mojo mojo, String artifactId, File pom ) throws Exception { validateContainerStatus(); PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom ); ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub(); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() ); return mojo; }
configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );