import hudson.DescriptorExtensionList
import hudson.model.*
import hudson.model.Descriptor.FormException
import hudson.plugins.sectioned_view.*
import hudson.util.*
import hudson.views.*
DEFAULT_COLUMNS = [
BuildButtonColumn.class ,com.robestone.hudson.compactcolumns.JobNameColumn.class ,LastDurationColumn.class ,jenkins.plugins.extracolumns.TestResultColumn.class ]
println("Init our columns ...")
myColumns = [];
DescriptorExtensionList<ListViewColumn, Descriptor<ListViewColumn>> all = ListViewColumn.all();
for (Class<? extends ListViewColumn> d: DEFAULT_COLUMNS) {
Descriptor<ListViewColumn> des = all.find(d);
if (des != null) {
println("Case " + d)
switch(d) {
case jenkins.plugins.extracolumns.TestResultColumn.class:
println("descriptor = " + des)
println("descriptor.clazz = " + des.clazz)
println()
try {
clazzInst = d.newInstance()
println("+++Successfully run TestResultColumn.newInstance() = " + clazzInst)
myColumns.add(clazzInst);
} catch (Exception exp) {
println("!!!Exception while instantiating new TestResultColumn(): " + exp.getMessage())
}
try {
clazzInst0 = d.newInstance(0)
println("+++Successfully run new TestResultColumn.newInstance(0) = " + clazzInst0)
myColumns.add(clazzInst0);
} catch (Exception exp) {
println("!!!Exception while instantiating new TestResultColumn(0): " + exp.getMessage())
}
try {
tmp = des.newInstance(null,null)
myColumns.add(tmp);
println("+++Successfully run TestResultColumn.DescriptorImpl.newInstance(null, null) = " + tmp)
} catch (Error exp) {
println("!!!Error while TestResultColumn.DescriptorImpl.newInstance(null, null): " + exp.getMessage())
}
break
default:
myColumns.add(des.newInstance(null, null));
break
}
}
else
{
println("No descriptior found for " + d)
}
}
println("\nResulting columns ...")
myColumns.each {println(it)}