Hi

I'm new to writing my own plugin after using Jenkins for a while

I was trying to get a repeatableProperty working in global.config. I want 
to display the selenium capabilities currently available - for info here 
but then use them in a build step

However it never shows any data. just a name and textbox field for each of 
my list items. it does work with <f:repeatable ...>.  

I think I'm missing something obvious

this is in my global.jelly for my plugin

    <f:entry title="Capabilities" field="seleniumCapabilities">
       <f:repeatableProperty field="seleniumCapabilities"  />
    </f:entry>

This for the nested global.plugin - which I get an error for not having but 
never seems to get used
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" 
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" 
xmlns:f="/lib/form">
    <f:entry title="Platform" field="platformName" >
      <f:readOnlyTextbox/>
    </f:entry>
</j:jelly>


and this is my selenium class (which is a ArrayList in the main class) 
Please excuse the rudimentary code. I'm more of a perl developer
package org.jenkinsci.plugins.MultiMatrix;

import java.util.regex.Pattern;
import java.util.regex.Matcher;

import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.Extension;
import org.kohsuke.stapler.DataBoundConstructor;

public final class SeleniumCapability  extends 
AbstractDescribableImpl<SeleniumCapability> implements Comparable{

    @Extension
    public static class DescriptorImpl extends 
Descriptor<SeleniumCapability> {
        @Override
        public String getDisplayName() { return "";}
    }

    public Integer maxInstances;
    public String  browserName;
    public String  platformName;
    public String  browserVersion;

    private static final Pattern pattern = 
Pattern.compile("(platform|browserName|version)=(\\w+)");


    public SeleniumCapability(  ){
        browserName = "Any";
        platformName = "Any";
        browserVersion = "Any";
        maxInstances = 1;
    }

    public SeleniumCapability( SeleniumCapability s){
        this.browserName = s.browserName;
        this.platformName = s.platformName;
        this.browserVersion = s.browserVersion;
        this.maxInstances = s.maxInstances;
    }

    @DataBoundConstructor
    public SeleniumCapability( String browserName, String platformName, 
String browserVersion ){
        this.browserName = browserName;
        this.platformName = platformName;
        this.browserVersion = browserVersion;
        this.maxInstances = 1;
    }

    public SeleniumCapability( String titleAttr){

        this();

        Matcher m = pattern.matcher(titleAttr);

        while(m.find()){
            if (m.group(1).equals("platform"))
                this.platformName = m.group(2);
            else if (m.group(1).equals("browserName"))
                this.browserName = m.group(2);
            else if (m.group(1).equals("version"))
                this.browserVersion = m.group(2);

        }
    }

    public Integer getMaxInstances() {
        return maxInstances;
    }

    public String getBrowserName() {
        return browserName;
    }

    public String getPlatformName() {
        return platformName;
    }

    public String getBrowserVersion() {
        return browserVersion;
    }

    public Integer incr(){
        return maxInstances++;
    }

    @Override
    public String toString(){
        return String.format("%s %s %s", platformName, browserName, 
browserVersion);
    }

    public String toString2(){
        return String.format("Platform: %s Browser: %s (v: %s) Instances: 
%d", platformName, browserName, browserVersion, maxInstances);
    }

    @Override
    public boolean equals(Object object)
    {
        boolean sameSame = false;

        if (object != null && object instanceof SeleniumCapability)
            sameSame = this.toString().equals(((SeleniumCapability) 
object).toString());

        return sameSame;
    }

    public int compareTo(Object o) {

        if (o != null && o instanceof SeleniumCapability){
            SeleniumCapability c = (SeleniumCapability) o;
            return this.toString().compareTo(c.toString());
        }
        return 0;
    }
}



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to