Hi Mauro, hi Christiano,
so I did the right thing by extending the AnnotatedPathRunner. I took your
idea with the anonymous class for the AnnotationBuilder and deleted my own
implementation.
Till now I was using the @UsingPaths annotation, but I think its nicer to
have a new Annotation like
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface UsingStories {
String[] storyies() default {};
}
Thank you Cristiano for your hint! This is a nice idea and I tested it.
These conversations are very useful.
Best regards,
Olmo
On 22 December 2011 01:44, Cristiano Gavião <[email protected]> wrote:
> Hi Olmo,
>
> As Mauro have said you can extend and findPaths() and you will be fine.
>
> Now that you found Annotated stuffs, one cool thing to be aware is about
> the embedder annotations inheritance... all multi-value annotations
> attributes can be merged...
>
> with that, you could group stories in one embeder hierarchy and reference
> the leaf in the maven plugin.
>
> cheers
>
> Cristiano
>
>
>
>
>
> On 21/12/11 19:56, Mauro Talevi wrote:
>
> 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]>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
>>
>>
>>
>
>
>