Re: [jbehave-dev] Generics doesn't work for StringListConverter, List is not recognized as a ParameterType

2014-10-01 Thread Matthieu Mestrez
Nice ! You fixed it that fast !

Thanks for that.

Do you know when i can expect a release ?



2014-10-01 10:15 GMT+02:00 Matthieu Mestrez :

> Thanks for the follow-up
>
> I've created a Jira issue here :
>
> https://jira.codehaus.org/browse/JBEHAVE-1049
>
> 2014-10-01 1:02 GMT+02:00 Mauro Talevi :
>
>>  Yes, there is a problem but not in the converter.   Rather, the
>> StepCreator tries to use the parameter types instead of the generic
>> parameter types.
>>
>> Could you please raise a Jira issue for this?
>>
>> Cheers
>>
>>
>> On 30/09/2014 15:19, Matthieu Mestrez wrote:
>>
>> Since i'm behind a proxy at work i can only give you a zip file to work
>> with by this way :
>>
>>  http://www.filedropper.com/meta-string-list
>>
>> 2014-09-30 15:52 GMT+02:00 Matthieu Mestrez :
>>
>>> Since i'm behind a proxy at work i can only give you a zip file to work
>>> with by this way :
>>>
>>>  http://www.filedropper.com/meta-string-list
>>>
>>>  Or attached here, not sure it will work through a mailing list though :
>>>
>>>
>>> 2014-09-30 15:00 GMT+02:00 Mauro Talevi :
>>>
 Could you provide a sample project that reproduces the desired
 behaviour?


 > On 30 Sep 2014, at 13:01, Matthieu Mestrez <
 mestrez.matth...@gmail.com> wrote:
 >
  > Hello,
 >
 > I've been trying to make use of a list of strings in a Meta in this
 context :
 >
 > Scenario: 1. First Case
 > Meta :
 > @Dataset firstDataset.xml, secondDataset.xml
 > Given ...
 > When ..
 > Then ...
 >
 > And in the
 > @BeforeScenario
 > public void initializeDataset(@Named("Dataset") List
 dbUnitFiles) {
 > ...
 > }
 >
 >
 > The scenario fails because
 "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No
 parameter converter for interface java.util.List'
 >
 >
 > If i debug, he passes through the StringListConverter, but in the
 accept method the type is not an instance of ParameterizedType, because in
 the StepCreator class you use method.getParameterTypes() that doesn't
 retrieve de generics but the Class type (so java.util.List)
 >
 > I think that you should use for that Parameter class the Type and not
 the Class
 >
 >
 > Or maybe i've made a mistake somewhere

   -
 To unsubscribe from this list, please visit:

 http://xircles.codehaus.org/manage_email



>>>
>>>
>>>   --
>>> Mestrez Matthieu
>>> avenue Jolé 11
>>> 1160 Auderghem
>>> GSM : 0494/77.26.87
>>> e-mail : mestrez.matth...@gmail.com
>>>
>>
>>
>>
>>  --
>> Mestrez Matthieu
>> avenue Jolé 11
>> 1160 Auderghem
>> GSM : 0494/77.26.87
>> e-mail : mestrez.matth...@gmail.com
>>
>>
>>
>
>
> --
> Mestrez Matthieu
> avenue Jolé 11
> 1160 Auderghem
> GSM : 0494/77.26.87
> e-mail : mestrez.matth...@gmail.com
>



-- 
Mestrez Matthieu
avenue Jolé 11
1160 Auderghem
GSM : 0494/77.26.87
e-mail : mestrez.matth...@gmail.com


[jbehave-scm] [scm-core/jbehave-4.x][1/1] JBEHAVE-1049: Support generic parameter types in StepCreator.

2014-10-01 Thread Mauro Talevi
commit ba6ad54984c91ff7ab1b53a862c60d6233f6078e
Author: Mauro Talevi 
AuthorDate: Wed, 1 Oct 2014 21:10:53 +0100
Commit: Mauro Talevi 
CommitDate: Wed, 1 Oct 2014 21:15:12 +0100

JBEHAVE-1049:  Support generic parameter types in StepCreator.

diff --git a/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java 
b/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
index ba6aa89..db76ef7 100755
--- a/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
@@ -787,14 +787,14 @@ public class StepCreator {
 private final ParameterConverters parameterConverters;
 private final Paranamer paranamer;
 private final Meta meta;
-private int methodArity;
+private final Type[] parameterTypes;
 
 public MethodInvoker(Method method, ParameterConverters 
parameterConverters, Paranamer paranamer, Meta meta) {
 this.method = method;
 this.parameterConverters = parameterConverters;
 this.paranamer = paranamer;
 this.meta = meta;
-this.methodArity = method.getParameterTypes().length;
+this.parameterTypes = method.getGenericParameterTypes();
 }
 
 public void invoke() throws InvocationTargetException, 
IllegalAccessException {
@@ -802,36 +802,35 @@ public class StepCreator {
 }
 
 private Parameter[] methodParameters() {
-Parameter[] parameters = new Parameter[methodArity];
-String[] annotationNamedParameters = 
annotatedParameterNames(method);
-String[] parameterNames = paranamer.lookupParameterNames(method, 
false);
-Class[] parameterTypes = method.getParameterTypes();
+Parameter[] parameters = new Parameter[parameterTypes.length];
+String[] annotatedNames = annotatedParameterNames(method);
+String[] paranamerNames = paranamer.lookupParameterNames(method, 
false);
 
-for (int paramPosition = 0; paramPosition < methodArity; 
paramPosition++) {
-String paramName = parameterNameFor(paramPosition, 
annotationNamedParameters, parameterNames);
-parameters[paramPosition] = new Parameter(paramPosition, 
parameterTypes[paramPosition], paramName);
+for (int position = 0; position < parameterTypes.length; 
position++) {
+String name = parameterNameFor(position, annotatedNames, 
paranamerNames);
+parameters[position] = new Parameter(position, 
parameterTypes[position], name);
 }
 
 return parameters;
 }
 
-private String parameterNameFor(int paramPosition, String[] 
annotationNamedParameters, String[] parameterNames) {
-String nameFromAnnotation = 
nameIfValidPositionInArray(annotationNamedParameters, paramPosition);
-String parameterName = nameIfValidPositionInArray(parameterNames, 
paramPosition);
-if (nameFromAnnotation != null) {
-return nameFromAnnotation;
-} else if (parameterName != null) {
-return parameterName;
+private String parameterNameFor(int position, String[] annotatedNames, 
String[] paranamerNames) {
+String annotatedName = nameByPosition(annotatedNames, position);
+String paranamerName = nameByPosition(paranamerNames, position);
+if (annotatedName != null) {
+return annotatedName;
+} else if (paranamerName != null) {
+return paranamerName;
 }
 return null;
 }
 
-private String nameIfValidPositionInArray(String[] paramNames, int 
paramPosition) {
-return paramPosition < paramNames.length ? 
paramNames[paramPosition] : null;
+private String nameByPosition(String[] names, int position) {
+return position < names.length ? names[position] : null;
 }
 
 private Object[] parameterValuesFrom(Meta meta) {
-Object[] values = new Object[methodArity];
+Object[] values = new Object[parameterTypes.length];
 for (Parameter parameter : methodParameters()) {
values[parameter.position] = 
parameterConverters.convert(parameter.valueFrom(meta), parameter.type);
 }
@@ -840,10 +839,10 @@ public class StepCreator {
 
 private class Parameter {
 private final int position;
-private final Class type;
+private final Type type;
 private final String name;
 
-public Parameter(int position, Class type, String name) {
+public Parameter(int position, Type type, String name) {
 this.position = position;
 this.type = type;
 this.name = name;





[jbehave-dev] [jira] (JBEHAVE-1049) StepCreator doesn't support method generics parameters

2014-10-01 Thread Mauro Talevi (JIRA)
Title: Message Title










 

 Mauro Talevi resolved an issue as Fixed











 






 JBehave /  JBEHAVE-1049



  StepCreator doesn't support method generics parameters 










Change By:

 Mauro Talevi




Resolution:

 Fixed




Assignee:

 Mauro Talevi




Status:

 Open Resolved












   

 Add Comment











 










 This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)




 












-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-scm] [scm-core][1/1] JBEHAVE-1049: Support generic parameter types in StepCreator.

2014-10-01 Thread Mauro Talevi
commit e8030b13b05183d1fcb12e1f6a910c10b0e5c2cd
Author: Mauro Talevi 
AuthorDate: Wed, 1 Oct 2014 21:10:53 +0100
Commit: Mauro Talevi 
CommitDate: Wed, 1 Oct 2014 21:10:53 +0100

JBEHAVE-1049:  Support generic parameter types in StepCreator.

diff --git a/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java 
b/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
index bb1171a..f61138d 100755
--- a/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java
@@ -784,14 +784,14 @@ public class StepCreator {
 private final ParameterConverters parameterConverters;
 private final Paranamer paranamer;
 private final Meta meta;
-private int methodArity;
+private final Type[] parameterTypes;
 
 public MethodInvoker(Method method, ParameterConverters 
parameterConverters, Paranamer paranamer, Meta meta) {
 this.method = method;
 this.parameterConverters = parameterConverters;
 this.paranamer = paranamer;
 this.meta = meta;
-this.methodArity = method.getParameterTypes().length;
+this.parameterTypes = method.getGenericParameterTypes();
 }
 
 public void invoke() throws InvocationTargetException, 
IllegalAccessException {
@@ -799,36 +799,35 @@ public class StepCreator {
 }
 
 private Parameter[] methodParameters() {
-Parameter[] parameters = new Parameter[methodArity];
-String[] annotationNamedParameters = 
annotatedParameterNames(method);
-String[] parameterNames = paranamer.lookupParameterNames(method, 
false);
-Class[] parameterTypes = method.getParameterTypes();
+Parameter[] parameters = new Parameter[parameterTypes.length];
+String[] annotatedNames = annotatedParameterNames(method);
+String[] paranamerNames = paranamer.lookupParameterNames(method, 
false);
 
-for (int paramPosition = 0; paramPosition < methodArity; 
paramPosition++) {
-String paramName = parameterNameFor(paramPosition, 
annotationNamedParameters, parameterNames);
-parameters[paramPosition] = new Parameter(paramPosition, 
parameterTypes[paramPosition], paramName);
+for (int position = 0; position < parameterTypes.length; 
position++) {
+String name = parameterNameFor(position, annotatedNames, 
paranamerNames);
+parameters[position] = new Parameter(position, 
parameterTypes[position], name);
 }
 
 return parameters;
 }
 
-private String parameterNameFor(int paramPosition, String[] 
annotationNamedParameters, String[] parameterNames) {
-String nameFromAnnotation = 
nameIfValidPositionInArray(annotationNamedParameters, paramPosition);
-String parameterName = nameIfValidPositionInArray(parameterNames, 
paramPosition);
-if (nameFromAnnotation != null) {
-return nameFromAnnotation;
-} else if (parameterName != null) {
-return parameterName;
+private String parameterNameFor(int position, String[] annotatedNames, 
String[] paranamerNames) {
+String annotatedName = nameByPosition(annotatedNames, position);
+String paranamerName = nameByPosition(paranamerNames, position);
+if (annotatedName != null) {
+return annotatedName;
+} else if (paranamerName != null) {
+return paranamerName;
 }
 return null;
 }
 
-private String nameIfValidPositionInArray(String[] paramNames, int 
paramPosition) {
-return paramPosition < paramNames.length ? 
paramNames[paramPosition] : null;
+private String nameByPosition(String[] names, int position) {
+return position < names.length ? names[position] : null;
 }
 
 private Object[] parameterValuesFrom(Meta meta) {
-Object[] values = new Object[methodArity];
+Object[] values = new Object[parameterTypes.length];
 for (Parameter parameter : methodParameters()) {
values[parameter.position] = 
parameterConverters.convert(parameter.valueFrom(meta), parameter.type);
 }
@@ -837,10 +836,10 @@ public class StepCreator {
 
 private class Parameter {
 private final int position;
-private final Class type;
+private final Type type;
 private final String name;
 
-public Parameter(int position, Class type, String name) {
+public Parameter(int position, Type type, String name) {
 this.position = position;
 this.type = type;
 this.name = name;





[jbehave-dev] [jira] (JBEHAVE-1049) StepCreator doesn't support method generics parameters

2014-10-01 Thread Matthieu Mestrez (JIRA)
Title: Message Title










 

 Matthieu Mestrez updated an issue











 






 JBehave /  JBEHAVE-1049



  StepCreator doesn't support method generics parameters 










Change By:

 Matthieu Mestrez









 The issue is described here :http://www.mail-archive.com/dev@jbehave.codehaus.org/msg09141.htmlThere is an example project attached * Description  : *  >> >  The scenario fails because >>  "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No >>  parameter converter for interface java.util.List' >> >  >> >>> >  If i debug, he passes through the StringListConverter, but in the >>  accept method the type is not an instance of ParameterizedType, because in >>  the StepCreator class you use method.getParameterTypes() that doesn't >>  retrieve de generics but the Class type (so java.util.List) >> >  >> > I think that you should use for that Parameter class the *Solution*StepCreator at line 805 :https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.javaShould be :  Type  and not [] parameterTypes = method.getGenericParameterTypes();  >> And  the  Parameter class should receive a Type instead of a  Class  type












   

 Add Comment











 










 This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)




 












-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-1049) StepCreator doesn't support method generics parameters

2014-10-01 Thread Mauro Talevi (JIRA)
Title: Message Title










 

 Mauro Talevi updated an issue











 






 JBehave /  JBEHAVE-1049



  StepCreator doesn't support method generics parameters 










Change By:

 Mauro Talevi




Summary:

 StepCreator doesn't  take Type  support method generics  parameters  but Class of parameters












   

 Add Comment











 










 This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)




 












-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-1049) StepCreator doesn't take Type parameters but Class of parameters

2014-10-01 Thread Mauro Talevi (JIRA)
Title: Message Title










 

 Mauro Talevi updated an issue











 






 JBehave /  JBEHAVE-1049



  StepCreator doesn't take Type parameters but Class of parameters 










Change By:

 Mauro Talevi




Affects Version/s:

 3.9.5




Affects Version/s:

 3.9.4












   

 Add Comment











 










 This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)




 












-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




Re: [jbehave-dev] Generics doesn't work for StringListConverter, List is not recognized as a ParameterType

2014-10-01 Thread Matthieu Mestrez
Thanks for the follow-up

I've created a Jira issue here :

https://jira.codehaus.org/browse/JBEHAVE-1049

2014-10-01 1:02 GMT+02:00 Mauro Talevi :

>  Yes, there is a problem but not in the converter.   Rather, the
> StepCreator tries to use the parameter types instead of the generic
> parameter types.
>
> Could you please raise a Jira issue for this?
>
> Cheers
>
>
> On 30/09/2014 15:19, Matthieu Mestrez wrote:
>
> Since i'm behind a proxy at work i can only give you a zip file to work
> with by this way :
>
>  http://www.filedropper.com/meta-string-list
>
> 2014-09-30 15:52 GMT+02:00 Matthieu Mestrez :
>
>> Since i'm behind a proxy at work i can only give you a zip file to work
>> with by this way :
>>
>>  http://www.filedropper.com/meta-string-list
>>
>>  Or attached here, not sure it will work through a mailing list though :
>>
>>
>> 2014-09-30 15:00 GMT+02:00 Mauro Talevi :
>>
>>> Could you provide a sample project that reproduces the desired behaviour?
>>>
>>>
>>> > On 30 Sep 2014, at 13:01, Matthieu Mestrez 
>>> wrote:
>>> >
>>>  > Hello,
>>> >
>>> > I've been trying to make use of a list of strings in a Meta in this
>>> context :
>>> >
>>> > Scenario: 1. First Case
>>> > Meta :
>>> > @Dataset firstDataset.xml, secondDataset.xml
>>> > Given ...
>>> > When ..
>>> > Then ...
>>> >
>>> > And in the
>>> > @BeforeScenario
>>> > public void initializeDataset(@Named("Dataset") List
>>> dbUnitFiles) {
>>> > ...
>>> > }
>>> >
>>> >
>>> > The scenario fails because
>>> "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No
>>> parameter converter for interface java.util.List'
>>> >
>>> >
>>> > If i debug, he passes through the StringListConverter, but in the
>>> accept method the type is not an instance of ParameterizedType, because in
>>> the StepCreator class you use method.getParameterTypes() that doesn't
>>> retrieve de generics but the Class type (so java.util.List)
>>> >
>>> > I think that you should use for that Parameter class the Type and not
>>> the Class
>>> >
>>> >
>>> > Or maybe i've made a mistake somewhere
>>>
>>>   -
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>>   --
>> Mestrez Matthieu
>> avenue Jolé 11
>> 1160 Auderghem
>> GSM : 0494/77.26.87
>> e-mail : mestrez.matth...@gmail.com
>>
>
>
>
>  --
> Mestrez Matthieu
> avenue Jolé 11
> 1160 Auderghem
> GSM : 0494/77.26.87
> e-mail : mestrez.matth...@gmail.com
>
>
>


-- 
Mestrez Matthieu
avenue Jolé 11
1160 Auderghem
GSM : 0494/77.26.87
e-mail : mestrez.matth...@gmail.com


[jbehave-dev] [jira] (JBEHAVE-1049) StepCreator doesn't take Type parameters but Class of parameters

2014-10-01 Thread Matthieu Mestrez (JIRA)
Title: Message Title










 

 Matthieu Mestrez created an issue











 






 JBehave /  JBEHAVE-1049



  StepCreator doesn't take Type parameters but Class of parameters 










Issue Type:

  Bug




Affects Versions:


 3.9.5




Assignee:


 Unassigned




Attachments:


 meta-string-list.zip




Components:


 Core




Created:


 01/Oct/14 3:04 AM




Fix Versions:


 3.9.5




Priority:

  Critical




Reporter:

 Matthieu Mestrez










The issue is described here : http://www.mail-archive.com/dev@jbehave.codehaus.org/msg09141.html
There is an example project attached
Description : >> > The scenario fails because >> "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No >> parameter converter for interface java.util.List' >> > >> > >> > If i debug, he passes through t