@Test public void post_change_strategy_by_meta_data() { String pageName = "foo.Bar"; String nestedId = "nested"; String fieldName = "field"; String strategyName = "foo"; ComponentResources resources = mockComponentResources(); ComponentModel model = mockComponentModel(); PersistentFieldStrategy strat = newPersistentFieldStrategy(); MetaDataLocator locator = mockMetaDataLocator(); Object value = new Object(); Map<String, PersistentFieldStrategy> strategies = newMap(); strategies.put(strategyName, strat); train_getComponentModel(resources, model); train_getFieldPersistenceStrategy(model, fieldName, ""); train_findMeta(locator, SymbolConstants.PERSISTENCE_STRATEGY, resources, String.class, strategyName); train_getNestedId(resources, nestedId); strat.postChange(pageName, nestedId, fieldName, value); replay(); PersistentFieldManager manager = new PersistentFieldManagerImpl(locator, strategies); manager.postChange(pageName, resources, fieldName, value); verify(); }
public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue) { String strategyName = findStrategy(resources, fieldName); PersistentFieldStrategy strategy = getStrategy(strategyName); strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue); }
PersistentFieldManagerImpl implements PersistentFieldManager { public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue) { String strategyName = findStrategy(resources, fieldName); PersistentFieldStrategy strategy = getStrategy(strategyName); strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue); } }
PersistentFieldManagerImpl implements PersistentFieldManager { public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue) { String strategyName = findStrategy(resources, fieldName); PersistentFieldStrategy strategy = getStrategy(strategyName); strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue); } PersistentFieldManagerImpl(MetaDataLocator locator, Map<String, PersistentFieldStrategy> strategies); }
PersistentFieldManagerImpl implements PersistentFieldManager { public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue) { String strategyName = findStrategy(resources, fieldName); PersistentFieldStrategy strategy = getStrategy(strategyName); strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue); } PersistentFieldManagerImpl(MetaDataLocator locator, Map<String, PersistentFieldStrategy> strategies); PersistentFieldBundle gatherChanges(String pageName); void discardChanges(String pageName); void discardChanges(String pageName, String strategyName); void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue); }
PersistentFieldManagerImpl implements PersistentFieldManager { public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue) { String strategyName = findStrategy(resources, fieldName); PersistentFieldStrategy strategy = getStrategy(strategyName); strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue); } PersistentFieldManagerImpl(MetaDataLocator locator, Map<String, PersistentFieldStrategy> strategies); PersistentFieldBundle gatherChanges(String pageName); void discardChanges(String pageName); void discardChanges(String pageName, String strategyName); void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue);  }