@Override public <Type> void setDynamicNodeProperty (final @Nonnull Key<Type> key, final @Nonnull Type value) { ResourceProperties properties = dynamicNodePropertiesHolder.get(); dynamicNodePropertiesHolder.set(properties.withProperty(key, value)); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public ResourceProperties merged (@Nonnull ResourceProperties properties) { final DefaultResourceProperties otherProperties = (DefaultResourceProperties)properties; if (!id.equals(otherProperties.id)) { throw new IllegalArgumentException("Id mismatch " + id + " vs " + otherProperties.id); } ResourceProperties result = new DefaultResourceProperties(this); for (final Entry<Key<?>, Object> entry : otherProperties.propertyMap.entrySet()) { result = result.withProperty((Key<Object>)entry.getKey(), entry.getValue()); } for (final Entry<Id, DefaultResourceProperties> entry : otherProperties.groupMap.entrySet()) { final Id groupId = entry.getKey(); final ResourceProperties propertyGroup = entry.getValue(); result = (!groupMap.containsKey(groupId)) ? result.withProperties(propertyGroup) : result.withProperties(groupMap.get(groupId).merged(propertyGroup)); } return result; }
@BeforeClass public void prepareProperties() { factory = new AdminModelFactory(); properties = factory.createProperties().build() .withProperty(Properties.PROPERTY_CREATION_TIME2, new DateTime(1342536534636L)) .withProperty(Properties.PROPERTY_TITLE, "the title"); PropertyUtilities.setLocale(Locale.UK); PropertyUtilities.setZone(DateTimeZone.forID("CET")); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() throws IOException { ContextManager.Locator.set(new DefaultContextManagerProvider()); modelFactory = new ModelFactorySupport() { @Override @Nonnull public ResourceProperties build (final @Nonnull ResourceProperties.Builder builder) { return new DefaultResourceProperties(builder); } }; properties = modelFactory.createProperties().build().withProperty(PROPERTY_1, ORIGINAL_PROPERTY_1_VALUE) .withProperty(PROPERTY_2, ORIGINAL_PROPERTY_2_VALUE); callback = mock(UpdateCallback.class); underTest = new ResourcePropertiesBinder(properties); }