@Test public void testGuardedStringDefaulting() { Object defaultedValue = ((DataProvider) gdp).get(GuardedString.class, "nonexistingAttributeFooBarBaz", ""); assertNotNull(defaultedValue); assertTrue(defaultedValue instanceof GuardedString); GuardedString gs = (GuardedString) defaultedValue; gs.access((char[] clearChars) -> { String result = new String(clearChars); assertTrue(result.length() > 0); }); }
public Object get(String name, String type, boolean useDefault) { Object o = null; boolean isDefaultValue = false; boolean isFound = true; try { o = propertyRecursiveGet(name); } catch (ObjectNotFoundException onfe) { if (useDefault) { isDefaultValue = true; o = propertyRecursiveGet(type); } else { isFound = false; if (useDefault) { throw new ObjectNotFoundException("Missing property definition: " + name + ", data type: " + type); } else { throw new ObjectNotFoundException("Missing property definition: " + name); } } } finally { if (_queriedPropsOutFile != null) { logQueriedProperties(o, name, type, isDefaultValue, isFound); } } if (o instanceof ObjectNotFoundException) { throw (ObjectNotFoundException) o; } cache.put(name, o); return o; }
GroovyDataProvider implements DataProvider { public Object get(String name, String type, boolean useDefault) { Object o = null; boolean isDefaultValue = false; boolean isFound = true; try { o = propertyRecursiveGet(name); } catch (ObjectNotFoundException onfe) { if (useDefault) { isDefaultValue = true; o = propertyRecursiveGet(type); } else { isFound = false; if (useDefault) { throw new ObjectNotFoundException("Missing property definition: " + name + ", data type: " + type); } else { throw new ObjectNotFoundException("Missing property definition: " + name); } } } finally { if (_queriedPropsOutFile != null) { logQueriedProperties(o, name, type, isDefaultValue, isFound); } } if (o instanceof ObjectNotFoundException) { throw (ObjectNotFoundException) o; } cache.put(name, o); return o; } }
GroovyDataProvider implements DataProvider { public Object get(String name, String type, boolean useDefault) { Object o = null; boolean isDefaultValue = false; boolean isFound = true; try { o = propertyRecursiveGet(name); } catch (ObjectNotFoundException onfe) { if (useDefault) { isDefaultValue = true; o = propertyRecursiveGet(type); } else { isFound = false; if (useDefault) { throw new ObjectNotFoundException("Missing property definition: " + name + ", data type: " + type); } else { throw new ObjectNotFoundException("Missing property definition: " + name); } } } finally { if (_queriedPropsOutFile != null) { logQueriedProperties(o, name, type, isDefaultValue, isFound); } } if (o instanceof ObjectNotFoundException) { throw (ObjectNotFoundException) o; } cache.put(name, o); return o; } GroovyDataProvider();  GroovyDataProvider(String connectorName);   GroovyDataProvider(URL configURL); }
GroovyDataProvider implements DataProvider { public Object get(String name, String type, boolean useDefault) { Object o = null; boolean isDefaultValue = false; boolean isFound = true; try { o = propertyRecursiveGet(name); } catch (ObjectNotFoundException onfe) { if (useDefault) { isDefaultValue = true; o = propertyRecursiveGet(type); } else { isFound = false; if (useDefault) { throw new ObjectNotFoundException("Missing property definition: " + name + ", data type: " + type); } else { throw new ObjectNotFoundException("Missing property definition: " + name); } } } finally { if (_queriedPropsOutFile != null) { logQueriedProperties(o, name, type, isDefaultValue, isFound); } } if (o instanceof ObjectNotFoundException) { throw (ObjectNotFoundException) o; } cache.put(name, o); return o; } GroovyDataProvider();  GroovyDataProvider(String connectorName);   GroovyDataProvider(URL configURL); Object get(String name, String type, boolean useDefault); @Override Object get(Class<?> dataTypeName, String name, String componentName,
            int sequenceNumber, boolean isMultivalue); @Override Object get(Class<?> dataTypeName, String name, String componentName); @Override String getString(String name, String componentName, int sequenceNumber); @Override String getString(String name, String componentName); @Override Object getTestSuiteAttribute(String propName); @Override Object getTestSuiteAttribute(String propName, String testName); @Override Object getConnectorAttribute(String propName); @Override Object get(String name); @Override Object generate(String pattern, Class<?> clazz); @Override Object generate(String pattern); @Override Object get(String name, int sequenceNumber); @Override Set<Attribute> getAttributeSet(final String propertySetName); @Override void loadConfiguration(final String configName, Configuration cfg); @Override void dispose(); }
GroovyDataProvider implements DataProvider { public Object get(String name, String type, boolean useDefault) { Object o = null; boolean isDefaultValue = false; boolean isFound = true; try { o = propertyRecursiveGet(name); } catch (ObjectNotFoundException onfe) { if (useDefault) { isDefaultValue = true; o = propertyRecursiveGet(type); } else { isFound = false; if (useDefault) { throw new ObjectNotFoundException("Missing property definition: " + name + ", data type: " + type); } else { throw new ObjectNotFoundException("Missing property definition: " + name); } } } finally { if (_queriedPropsOutFile != null) { logQueriedProperties(o, name, type, isDefaultValue, isFound); } } if (o instanceof ObjectNotFoundException) { throw (ObjectNotFoundException) o; } cache.put(name, o); return o; } GroovyDataProvider();  GroovyDataProvider(String connectorName);   GroovyDataProvider(URL configURL); Object get(String name, String type, boolean useDefault); @Override Object get(Class<?> dataTypeName, String name, String componentName,
            int sequenceNumber, boolean isMultivalue); @Override Object get(Class<?> dataTypeName, String name, String componentName); @Override String getString(String name, String componentName, int sequenceNumber); @Override String getString(String name, String componentName); @Override Object getTestSuiteAttribute(String propName); @Override Object getTestSuiteAttribute(String propName, String testName); @Override Object getConnectorAttribute(String propName); @Override Object get(String name); @Override Object generate(String pattern, Class<?> clazz); @Override Object generate(String pattern); @Override Object get(String name, int sequenceNumber); @Override Set<Attribute> getAttributeSet(final String propertySetName); @Override void loadConfiguration(final String configName, Configuration cfg); @Override void dispose(); static final String MULTI_VALUE_TYPE_PREFIX; }