/** * Get the value of the <code>name</code> property as a <code>boolean</code>. * If no such property is specified, or if the specified value is not a valid * <code>boolean</code>, then <code>defaultValue</code> is returned. * * @param name property name. * @param defaultValue default value. * @return property value as a <code>boolean</code>, * or <code>defaultValue</code>. */ public boolean getBoolean(String name, boolean defaultValue) { String valueString = getTrimmed(name); if (null == valueString || valueString.isEmpty()) { return defaultValue; } if (StringUtils.equalsIgnoreCase("true", valueString)) return true; else if (StringUtils.equalsIgnoreCase("false", valueString)) return false; else return defaultValue; }
/** * Get the value of the <code>name</code> property as a <code>boolean</code>. * If no such property is specified, or if the specified value is not a valid * <code>boolean</code>, then <code>defaultValue</code> is returned. * * @param name property name. * @param defaultValue default value. * @return property value as a <code>boolean</code>, * or <code>defaultValue</code>. */ public boolean getBoolean(String name, boolean defaultValue) { String valueString = getTrimmed(name); if (null == valueString || valueString.isEmpty()) { return defaultValue; } if (StringUtils.equalsIgnoreCase("true", valueString)) return true; else if (StringUtils.equalsIgnoreCase("false", valueString)) return false; else return defaultValue; }
/** * Get the value of the <code>name</code> property as a <code>boolean</code>. * If no such property is specified, or if the specified value is not a valid * <code>boolean</code>, then <code>defaultValue</code> is returned. * * @param name property name. * @param defaultValue default value. * @return property value as a <code>boolean</code>, * or <code>defaultValue</code>. */ public boolean getBoolean(String name, boolean defaultValue) { String valueString = getTrimmed(name); if (null == valueString || valueString.isEmpty()) { return defaultValue; } if (StringUtils.equalsIgnoreCase("true", valueString)) return true; else if (StringUtils.equalsIgnoreCase("false", valueString)) return false; else return defaultValue; }
if (xmlInput && StringUtils.equalsIgnoreCase("xml", processor)) { System.err.println("XML format input file is not allowed" + " to be processed by XML processor."); return -1; } else if(!xmlInput && StringUtils.equalsIgnoreCase("binary", processor)) { System.err.println("Binary format input file is not allowed" + " to be processed by Binary processor.");
if(StringUtils.equalsIgnoreCase("binary", processor)) { return new BinaryEditsVisitor(filename); out = new TeeOutputStream(outs); if(StringUtils.equalsIgnoreCase("xml", processor)) { vis = new XmlEditsVisitor(out); } else if(StringUtils.equalsIgnoreCase("stats", processor)) { vis = new StatisticsEditsVisitor(out); } else {
@JsonIgnore public boolean isConstraintType(String name) { return StringUtils.equalsIgnoreCase(name, this.type); }
public static AtlasAttributeDef findAttribute(Collection<AtlasAttributeDef> attributeDefs, String attrName) { AtlasAttributeDef ret = null; if (CollectionUtils.isNotEmpty(attributeDefs)) { for (AtlasAttributeDef attributeDef : attributeDefs) { if (StringUtils.equalsIgnoreCase(attributeDef.getName(), attrName)) { ret = attributeDef; break; } } } return ret; }
private static AtlasEnumElementDef findElement(List<AtlasEnumElementDef> elementDefs, String elemValue) { AtlasEnumElementDef ret = null; if (CollectionUtils.isNotEmpty(elementDefs)) { for (AtlasEnumElementDef elementDef : elementDefs) { if (StringUtils.equalsIgnoreCase(elementDef.getValue(), elemValue)) { ret = elementDef; break; } } } return ret; }
private static AtlasEnumElementDef findElement(List<AtlasEnumElementDef> elementDefs, String elemValue) { AtlasEnumElementDef ret = null; if (CollectionUtils.isNotEmpty(elementDefs)) { for (AtlasEnumElementDef elementDef : elementDefs) { if (StringUtils.equalsIgnoreCase(elementDef.getValue(), elemValue)) { ret = elementDef; break; } } } return ret; }
public static AtlasAttributeDef findAttribute(Collection<AtlasAttributeDef> attributeDefs, String attrName) { AtlasAttributeDef ret = null; if (CollectionUtils.isNotEmpty(attributeDefs)) { for (AtlasAttributeDef attributeDef : attributeDefs) { if (StringUtils.equalsIgnoreCase(attributeDef.getName(), attrName)) { ret = attributeDef; break; } } } return ret; }
@JsonIgnore public boolean isConstraintType(String name) { return StringUtils.equalsIgnoreCase(name, this.type); }
public void removeAttribute(String attrName) { List<AtlasAttributeDef> a = this.attributeDefs; if (hasAttribute(a, attrName)) { List<AtlasAttributeDef> tmpList = new ArrayList<>(); // copy existing attributes, except ones having same name as the attribute being removed for (AtlasAttributeDef existingAttrDef : a) { if (!StringUtils.equalsIgnoreCase(existingAttrDef.getName(), attrName)) { tmpList.add(existingAttrDef); } } this.attributeDefs = tmpList; } }
public void removeAttribute(String attrName) { List<AtlasAttributeDef> a = this.attributeDefs; if (hasAttribute(a, attrName)) { List<AtlasAttributeDef> tmpList = new ArrayList<>(); // copy existing attributes, except ones having same name as the attribute being removed for (AtlasAttributeDef existingAttrDef : a) { if (!StringUtils.equalsIgnoreCase(existingAttrDef.getName(), attrName)) { tmpList.add(existingAttrDef); } } this.attributeDefs = tmpList; } }
public void removeElement(String elemValue) { List<AtlasEnumElementDef> e = this.elementDefs; // if element doesn't exist, no need to create the tmpList below if (hasElement(e, elemValue)) { List<AtlasEnumElementDef> tmpList = new ArrayList<>(); // copy existing elements, except ones having same value as the element being removed for (AtlasEnumElementDef existingElem : e) { if (!StringUtils.equalsIgnoreCase(existingElem.getValue(), elemValue)) { tmpList.add(existingElem); } } this.elementDefs = tmpList; } }
public void addElement(AtlasEnumElementDef elementDef) { List<AtlasEnumElementDef> e = this.elementDefs; List<AtlasEnumElementDef> tmpList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(e)) { // copy existing elements, except ones having same value as the element being added for (AtlasEnumElementDef existingElem : e) { if (!StringUtils.equalsIgnoreCase(existingElem.getValue(), elementDef.getValue())) { tmpList.add(existingElem); } } } tmpList.add(new AtlasEnumElementDef(elementDef)); this.elementDefs = tmpList; }
public void addElement(AtlasEnumElementDef elementDef) { List<AtlasEnumElementDef> e = this.elementDefs; List<AtlasEnumElementDef> tmpList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(e)) { // copy existing elements, except ones having same value as the element being added for (AtlasEnumElementDef existingElem : e) { if (!StringUtils.equalsIgnoreCase(existingElem.getValue(), elementDef.getValue())) { tmpList.add(existingElem); } } } tmpList.add(new AtlasEnumElementDef(elementDef)); this.elementDefs = tmpList; }
@Test(enabled=false) public void testGetAppConfigurationEntryStringForKafkaClient() { AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry("KafkaClient"); Assert.assertNotNull(entries); Assert.assertEquals(1, entries.length); String principal = (String) entries[0].getOptions().get("principal"); Assert.assertNotNull(principal); String[] components = principal.split("[/@]"); Assert.assertEquals(3, components.length); Assert.assertEquals(false, StringUtils.equalsIgnoreCase(components[1], "_HOST")); }
@Test(enabled=false) public void testGetAppConfigurationEntryStringForKafkaClient() { AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry("KafkaClient"); Assert.assertNotNull(entries); Assert.assertEquals(1, entries.length); String principal = (String) entries[0].getOptions().get("principal"); Assert.assertNotNull(principal); String[] components = principal.split("[/@]"); Assert.assertEquals(3, components.length); Assert.assertEquals(false, StringUtils.equalsIgnoreCase(components[1], "_HOST")); }
@Test(enabled=false) public void testGetAppConfigurationEntryStringForMyClient() { AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry("myClient"); Assert.assertNotNull(entries); Assert.assertEquals(2, entries.length); String principal = (String) entries[0].getOptions().get("principal"); Assert.assertNotNull(principal); String[] components = principal.split("[/@]"); Assert.assertEquals(3, components.length); Assert.assertEquals(true, StringUtils.equalsIgnoreCase(components[1], "abcd")); principal = (String) entries[1].getOptions().get("principal"); Assert.assertNotNull(principal); components = principal.split("[/@]"); Assert.assertEquals(2, components.length); }
void replaceQueueFromPlacementContext( ApplicationPlacementContext placementContext, ApplicationSubmissionContext context) { // Set it to ApplicationSubmissionContext //apply queue mapping only to new application submissions if (placementContext != null && !StringUtils.equalsIgnoreCase( context.getQueue(), placementContext.getQueue())) { LOG.info("Placed application=" + context.getApplicationId() + " to queue=" + placementContext.getQueue() + ", original queue=" + context .getQueue()); context.setQueue(placementContext.getQueue()); } } }