public static LabelAtom findNearest(String name) { List<String> candidates = new ArrayList<String>(); for (LabelAtom a : Jenkins.getInstance().getLabelAtoms()) { candidates.add(a.getName()); } return get(EditDistance.findNearest(name, candidates)); }
/** The name should have parenthesis at the right place to preserve the tree structure. */ public void testComposite() { LabelAtom x = jenkins.getLabelAtom("x"); assertEquals("!!x", x.not().not().getName()); assertEquals("(x||x)&&x", x.or(x).and(x).getName()); assertEquals("x&&x||x", x.and(x).or(x).getName()); }
public void testLaxParsing() { // this should parse as an atom LabelAtom l = (LabelAtom) jenkins.getLabel("lucene.zones.apache.org (Solaris 10)"); assertEquals(l.getName(), "lucene.zones.apache.org (Solaris 10)"); assertEquals(l.getExpression(), "\"lucene.zones.apache.org (Solaris 10)\""); }
@Exported public LoadStatistics getLoadStatistics() { return LabelAtom.get(nodeName != null ? nodeName : "").loadStatistics; }