@Test public void storeTo() { Properties p = new Properties(); p.setProperty(ResourceProfile.KEY_PREFIX + "testing", MockResourceProvider.class.getName()); Collection<? extends ResourceProfile> profiles = ResourceProfile.loadFrom(p, ProfileContext.system(getClass().getClassLoader())); Properties restored = new Properties(); for (ResourceProfile profile : profiles) { profile.storeTo(restored); } assertThat(restored, is(p)); }
public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } LOG.debug("Saving process profile: {}", getName()); String providerKey = KEY_PREFIX + name; String keyPrefix = providerKey + QUALIFIER; PropertiesUtil.checkAbsentKey(properties, providerKey); PropertiesUtil.checkAbsentKeyPrefix(properties, keyPrefix); properties.setProperty(providerKey, providerClass.getName()); for (Map.Entry<String, String> entry : configuration.entrySet()) { properties.setProperty(keyPrefix + entry.getKey(), entry.getValue()); } }
ResourceProfile extends BaseProfile<ResourceProfile, ResourceProvider> { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } LOG.debug("Saving process profile: {}", getName()); String providerKey = KEY_PREFIX + name; String keyPrefix = providerKey + QUALIFIER; PropertiesUtil.checkAbsentKey(properties, providerKey); PropertiesUtil.checkAbsentKeyPrefix(properties, keyPrefix); properties.setProperty(providerKey, providerClass.getName()); for (Map.Entry<String, String> entry : configuration.entrySet()) { properties.setProperty(keyPrefix + entry.getKey(), entry.getValue()); } } }
ResourceProfile extends BaseProfile<ResourceProfile, ResourceProvider> { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } LOG.debug("Saving process profile: {}", getName()); String providerKey = KEY_PREFIX + name; String keyPrefix = providerKey + QUALIFIER; PropertiesUtil.checkAbsentKey(properties, providerKey); PropertiesUtil.checkAbsentKeyPrefix(properties, keyPrefix); properties.setProperty(providerKey, providerClass.getName()); for (Map.Entry<String, String> entry : configuration.entrySet()) { properties.setProperty(keyPrefix + entry.getKey(), entry.getValue()); } } ResourceProfile(
            String name,
            Class<? extends ResourceProvider> providerClass,
            ProfileContext context,
            Map<String, String> configuration); }
ResourceProfile extends BaseProfile<ResourceProfile, ResourceProvider> { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } LOG.debug("Saving process profile: {}", getName()); String providerKey = KEY_PREFIX + name; String keyPrefix = providerKey + QUALIFIER; PropertiesUtil.checkAbsentKey(properties, providerKey); PropertiesUtil.checkAbsentKeyPrefix(properties, keyPrefix); properties.setProperty(providerKey, providerClass.getName()); for (Map.Entry<String, String> entry : configuration.entrySet()) { properties.setProperty(keyPrefix + entry.getKey(), entry.getValue()); } } ResourceProfile(
            String name,
            Class<? extends ResourceProvider> providerClass,
            ProfileContext context,
            Map<String, String> configuration); String getName(); @Override Class<? extends ResourceProvider> getProviderClass(); @Override ProfileContext getContext(); Map<String, String> getConfiguration(); @Deprecated static Collection<? extends ResourceProfile> loadFrom(Properties properties, ClassLoader loader); static Collection<? extends ResourceProfile> loadFrom(Properties properties, ProfileContext context); void storeTo(Properties properties); static void removeCorrespondingKeys(Properties properties); }
ResourceProfile extends BaseProfile<ResourceProfile, ResourceProvider> { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } LOG.debug("Saving process profile: {}", getName()); String providerKey = KEY_PREFIX + name; String keyPrefix = providerKey + QUALIFIER; PropertiesUtil.checkAbsentKey(properties, providerKey); PropertiesUtil.checkAbsentKeyPrefix(properties, keyPrefix); properties.setProperty(providerKey, providerClass.getName()); for (Map.Entry<String, String> entry : configuration.entrySet()) { properties.setProperty(keyPrefix + entry.getKey(), entry.getValue()); } } ResourceProfile(
            String name,
            Class<? extends ResourceProvider> providerClass,
            ProfileContext context,
            Map<String, String> configuration); String getName(); @Override Class<? extends ResourceProvider> getProviderClass(); @Override ProfileContext getContext(); Map<String, String> getConfiguration(); @Deprecated static Collection<? extends ResourceProfile> loadFrom(Properties properties, ClassLoader loader); static Collection<? extends ResourceProfile> loadFrom(Properties properties, ProfileContext context); void storeTo(Properties properties); static void removeCorrespondingKeys(Properties properties); static final Pattern NAME_PATTERN; static final String KEY_PREFIX; }