You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "james strachan (JIRA)" <ji...@apache.org> on 2013/07/31 21:25:51 UTC

[jira] [Commented] (ARIES-1091) have a JUnit runner for blueprint-web like the spring test runners that create a BlueprintContainer and inject values from the container into the test case

    [ https://issues.apache.org/jira/browse/ARIES-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13725621#comment-13725621 ] 

james strachan commented on ARIES-1091:
---------------------------------------

Actually given the way blueprint-web tends to find XML files, its maybe better to use an annotation to specify the names of files to search for on the classpath or something. e.g. in hawtio we tend to just use the name "OSGI-INF/blueprint/blueprint.xml" and we search for all of those names to find the blueprint resources to boot up. Or maybe we could use a static method to find all the URLs to use; then folks could find the files however they like?

Here's an example of a test case for using blueprint-web where we using a base class approach (rather than JUnitRunner and injection of values)
https://github.com/hawtio/hawtio/blob/master/hawtio-file-dynamic-jaxb/src/test/java/io/hawt/jaxb/dynamic/file/BlueprintTestSupport.java#L49-49

So it might be nice to annotate static methods on the test class which define the list of URLs to load and the Map of properties to use for configuration parameters (which could be loaded from resource files or be generated programatically).



                
> have a JUnit runner for blueprint-web like the spring test runners that create a BlueprintContainer and inject values from the container into the test case
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-1091
>                 URL: https://issues.apache.org/jira/browse/ARIES-1091
>             Project: Aries
>          Issue Type: Improvement
>          Components: Blueprint
>            Reporter: james strachan
>
> it'd be nice to be able to write simple stand alone JUnit test cases that take a blueprint.xml file (by default called $ClassName-blueprint.xml) and inject values from the container. e.g.
> {code}
> @RunWith(BlueprintJUnitTestRunner.class)
> public class MyTest {
>    @Inject BlueprintContainer blueprintContainer;
>    @Inject Cheese cheese;
>    @Test
>    public void doTest() { 
>       // use the injected values
>    }
> }
> {code}
> using the @Inject annotations from JSR 330
> http://jcp.org/en/jsr/detail?id=330

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira