Hi Vladimir
CC'ing the Jenkins users mailing list, so other users of the plug-in can chime 
in or revisit this thread in the future if they have similar issues.
>As it turned out, the parameter has actually no value until the user manually 
>selects one of the radio-buttons. Unfortunately the user can select nothing in 
>the case of only one radio-button.
I haven't tried your example but tried to follow the logic and it matches with 
your description. 

If your parameter contains the :selected suffix, I think the plug-in was 
supposed to automatically mark is as selected for you, so it looks like a bug. 
Could you file an issue in https://issues.jenkins-ci.org, 
component=active-choices-plugin, please?
I'll debug the issue as soon as I start another development cycle for the 
plug-in.
ThanksBruno

 
      From: Vladimir Krumov <vkru...@ifao.net>
 To: brunodepau...@yahoo.com.br 
 Sent: Saturday, July 4, 2015 2:52 AM
 Subject: Re: Fw: Fwd: Problem with Active Choices 1.0 and jQuery
   
 Hello Bruno,
 
 Thank you for the quick fix of the previous problem! :-)
 
 Now I found another ... quirk with AC 1.1. This time it is with the 
":selected" "keyword". It is highly probable I my usage or expectations to be 
incorrect, that is why I will try to explain the problem in short and you will 
notify me if you need more details or more investigation.
 
 On my "clean" Jenkins installation (from the previous letter) I put one 
Validating String Parameter and one Active Choices Reactive Parameter with the 
following Groovy script:
 
 def result = []; // Return an empty list by default
 
 if ( validStr != null ) {
   def v = validStr.trim().split( /\./ );
 
   if ( v.size() > 0 ) {
       result = ["A"];
   }
   if ( v.size() > 1 ) {
     result.add( "B" );
   }
 
   result[0] += ":selected"; //Select the first choice by default
 }
 
 println( "1: ${result}" )
 return result;
 
 As you can see, it parses another parameter by dots and displays one or two 
radio buttons (well, the latter is not quite visible ;-) )  while always marks 
the first one as selected. It works perfect ... until you try to get the value 
for the parameter: As it turned out, the parameter has actually no value until 
the user manually selects one of the radio-buttons. Unfortunately the user can 
select nothing in the case of only one radio-button.
 
 Please advise if I'm doing something wrong or should I create a Jira issue.
 
 Cheers,
 Vladimir
 
 

On 06/24/2015 10:59, Bruno P. Kinoshita wrote:
  
 
 Forwarding to the users list, regarding not being able to find a parameter, 
and no error messages. I'm trying to start a development cycle to work on the 
plug-in (and probably on nunit, tap, etc, too). 
  But if anyone else have similar problems, Vladimir is filing an issue in 
JIRA, feel free to chime in and comment with your settings and I'll take a look 
as soon as possible. If you have similar problems, maybe following Vladimir's 
instructions may work for you too. 
  Thank you
  Bruno 
 
    ----- Forwarded Message -----
  From: Vladimir Krumov <vkru...@ifao.net>
 To: brunodepau...@yahoo.com.br 
 Sent: Wednesday, June 24, 2015 6:36 PM
 Subject: Fwd: Problem with Active Choices 1.0 and jQuery
   
   Hello Bruno,
  
 In short: I tried to migrate our project from Uno Choice 0.19 to Active Choice 
1.0 and I found that I can not reach the referred parameter. I tried various 
methods to get the value of the referred parameter with no success. I tried to 
reproduce  the problem on a clean Jenkins copy and everything worked like a 
charm. What was going on, then?!
 
 Here you are the details: 
 1. I installed a fresh copy of Jenkins - I took jenkins.war version 1.617 and 
started it with 
   java -jar jenkins.war
 2. Entered the management console and:
   - Dismissed the "Unsecured Jenkins" warning;
   - Updated all plugins;
   - installed Validating String Parameter Plugin ( 
https://wiki.jenkins-ci.org/display/JENKINS/Validating+String+Parameter+Plugin 
) because our original project uses it (and, to be honest, because in the 
beginning I thought that it is the one that is not compatible with Active 
Choices plugin);
   - Installed Active Choices Plugin version 1.0 ( 
https://wiki.jenkins-ci.org/display/JENKINS/Active+Choices+Plugin );
   - Setup a new Jenkins logger according to 
https://wiki.jenkins-ci.org/display/JENKINS/Troubleshooting
   - restarted Jenkins;
 
   Here is the list of the installed plugins with their versions:
   Active Choices Plug-in              | 1.0
  Ant Plugin                          | 1.2
  Credentials Plugin                  | 1.22
  CVS Plug-in                         | 2.12
  External Monitor Job Type Plugin    | 1.4
  GIT client plugin                   | 1.17.1
  GIT plugin                          | 2.3.5
  Git server plugin                   | 1.6
  Javadoc Plugin                      | 1.3
  JUnit Plugin                        | 1.6
  LDAP Plugin                         | 1.11
  Mailer Plugin                       | 1.15
  MapDB API Plugin                    | 1.0.6.0
  Matrix Authorization Strategy Plugin| 1.2
  Matrix Project Plugin               | 1.6
  Maven Integration plugin            | 2.10
  OWASP Markup Formatter Plugin       | 1.3
  PAM Authentication plugin           | 1.2
  SCM API Plugin                      | 0.2
  Script Security Plugin              | 1.14
  Scriptler                           | 2.7
  SSH Credentials Plugin              | 1.11
  SSH Slaves plugin                   | 1.9
  Subversion Plug-in                  | 2.5
  Token Macro Plugin                  | 1.10
  Translation Assistance plugin       | 1.12
  Validating String Parameter Plugin  | 2.3
  Windows Slaves Plugin               | 1.1
 
 3. Created a simple test project (attached). You can see that its only purpose 
is to get the value of the Validating String parameter using different paths;
 
 4. Opened the test project and hit "Build with Parameters"
 
 The observations on the script running:
 A. There is always one error thrown on the projects' parameters page load:
 Jun 23, 2015 4:57:02 PM FINEST org.biouno.unochoice.model.GroovyScript
 
 Fallback to default script...
 groovy.lang.MissingPropertyException: No such property: validStr for class: 
Script1
     
atorg.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
     
atorg.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
     
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
     at Script1.run(Script1.groovy:2)
     at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
     at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
     at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
     at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:128)
     at org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:69)
     
atorg.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:138)
     
atorg.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:104)
     
atorg.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:93)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:483)
     
atorg.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
     at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
     atorg.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
     at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
     
atorg.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
     at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
     
athudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:74)
         ...
 
 B. Immediately after that the (valid) script output is observed in the console:
    ---------------------------------------------
    ---> validStr=
    ---> validStr=
    ---> binding.variables.get =
    ---> binding = groovy.lang.Binding@2d47c5ae
    ---> binding.variables = [validStr:]
    ---> binding.getProperty =
    ---> getBinding = groovy.lang.Binding@2d47c5ae
    ---> getProperty =
 
 C. Entering a value in the Validating String parameter, on the exit (lost 
focus) of the text field, the correct value is observed in the Active Choices 
parameter:
    ---------------------------------------------
    ---> validStr= 123
    ---> validStr= 123
    ---> binding.variables.get = 123
    ---> binding = groovy.lang.Binding@2c331bee
    ---> binding.variables = [validStr:123]
    ---> binding.getProperty = 123
    ---> getBinding = groovy.lang.Binding@2c331bee
    ---> getProperty = 123
 
 So far - so good :-) 
 
 5. (In short) Installed jQuery Plugin ( 
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin ) and restarted 
Jenkins. The newly installed plugin is
  jQuery plugin                       | 1.11.2-0
 
 6. Opened the test project and hit "Build with Parameters"
 
 The observations on the script running:
 A. The "No such property" exception is still there;
 
 B. Immediately after that the (valid) script output is observed in the console:
    ---------------------------------------------
    ---> validStr=
    ---> validStr=
    ---> binding.variables.get =
    ---> binding = groovy.lang.Binding@2d47c5ae
    ---> binding.variables = [validStr:]
    ---> binding.getProperty =
    ---> getBinding = groovy.lang.Binding@2d47c5ae
    ---> getProperty =
 
 C. Entering a value in the Validating String parameter, on the exit (lost 
focus) of the text field, the NO value is observed in the Active Choices 
parameter:
     ---------------------------------------------
    ---> validStr=
    ---> validStr=
    ---> binding.variables.get =
    ---> binding = groovy.lang.Binding@1af9ece6
    ---> binding.variables = [validStr:]
    ---> binding.getProperty =
    ---> getBinding = groovy.lang.Binding@1af9ece6
    ---> getProperty =
 
 7. Edited the test project and gave the Validating String parameter a default 
value - "234". Saved the new definition and hit "Build with Parameters"
 The observations on the script running:
 A. The "No such property" exception is still there;
 
 B. Immediately after that the (valid) script output is observed in the console 
- the default value is displayed:
    ---------------------------------------------
    ---> validStr= 234
    ---> validStr= 234
    ---> binding.variables.get = 234
    ---> binding = groovy.lang.Binding@4ae9665a
    ---> binding.variables = [validStr:234]
    ---> binding.getProperty = 234
    ---> getBinding = groovy.lang.Binding@4ae9665a
    ---> getProperty = 234
 
 C. Entering a different value ("123" in the Validating String parameter, on 
the exit (lost focus) of the text field, the default value is observed in the 
Active Choices parameter:
    ---------------------------------------------
    ---> validStr= 234
    ---> validStr= 234
    ---> binding.variables.get = 234
    ---> binding = groovy.lang.Binding@77a897d5
    ---> binding.variables = [validStr:234]
    ---> binding.getProperty = 234
    ---> getBinding = groovy.lang.Binding@77a897d5
    ---> getProperty = 234
 
 9. Removed the jQuery plugin, restarted Jenkins and the correct behavior of 
Active Choices parameter came back. :-)
 
 Note that during all experiments there are no other errors registered in 
Jenkins logs except the "No such property" one.
 
 To be honest, I repeated the above scenario (from the Jenkins installation) 
several times due to different technical reasons and the result was always the 
same - jQuery interferes with Active Choices Plugin :-(
 
 I hope this could help for the Active Choices plugin improvement.
 
 Cheers,
 Vladimir Krumov
 
  
   
 
    
  
 

   

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2076052836.980188.1435968290843.JavaMail.yahoo%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to