Right, I now see what you mean. I hadn't quite got the right end of the stick before.

So, yes, in other to reuse the logic of the @UsingPaths you'll need to override the AnnotationBuilder.findPaths() method.

Something of this sort would work:

public class AnnotatedJiraRunner extends AnnotatedPathRunner {

    public AnnotationBuilder annotationBuilder() {
        return new AnnotationBuilder(testClass()){
              public List<String> findPaths(){
// implement your own, bearing in mind that annotationFinder() is accessible by sub-classes
              }
        };
    }
}

I would make sense to have this impl added to the jira module.

On 21/12/2011 19:21, Olmo Rigolo wrote:
Mauro,

I do so. But since I tried to use the AnnotatedPathRunner, the storyPaths are always null. Because the AnnotatedPathRunner uses the AnnotationBuilder which has a findPaths() method that is not doing the right thing for me. In my case it returns null.
This is only the case if I use the AnnotatedPathRunner.

On 21 December 2011 19:16, Mauro Talevi <[email protected] <mailto:[email protected]>> wrote:

    You already have an loader that interprets these  paths
    appropriately, so I would argue that introducing a new annotation
    is a bit redundant.

    Given that paths are just strings, you could re-interpret them as
    generic story ids (a "path" to a story).


    On Wed Dec 21 19:05:57 2011, Olmo Rigolo wrote:

        Hi!

        I already use a my own LoadFromJIRA story loader that takes
        jira story ids instead of paths as input to search for stories.
        I also use the AnnotatedPathRunner to run my tests. There is a
        @UsingPaths annotation which is read by the findPaths() method
        from the AnnotationBuilder.
        Since I dont need paths, but just Ids, the impementation of
        findPaths() is not applicable in my case.


        The idea is to implement my own ExtendedAnnotatedPathRunner
        with its own annotation @UseStories for the story ids from JIRA.
        @UseStories(stories={"story-1074", "story-2347"})

        The ExtendedAnnotatedPathRunner  uses a new
        ExtendedAnnotatedBuilder that handles the new Annotation
        @UseStories.

        The appropriate findPath() implementation in the
        ExtendedAnnotatedBuilder would be:

           public List<String> findPaths() {
               if (!finder.isAnnotationPresent(UseStories.class)) {
                   return new ArrayList<String>();
               }
               List<String> includes =
        finder.getAnnotatedValues(UseStories.class, String.class,
        "stories");
               return includes;
           }


        Is there a easier way to do this? SInce I just could use
        @UsingPaths.includes to set my story ids, but with my own
        findPaths() implementation.

        Thanks in advance.

        Olmo




    ---------------------------------------------------------------------
    To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply via email to