@Test public void getDefaultReferenceNameWhenDefinedInConfiguration() { this.configurationSource.setProperty("model.reference.default.wiki", "defaultWiki"); this.configurationSource.setProperty("model.reference.default.document", "defaultDocument"); this.configurationSource.setProperty("model.reference.default.space", "defaultSpace"); this.configurationSource.setProperty("model.reference.default.attachment", "defaultFilename"); this.configurationSource.setProperty("model.reference.default.object", "defaultObject"); this.configurationSource.setProperty("model.reference.default.object_property", "defaultProperty"); assertEquals("defaultWiki", this.configuration.getDefaultReferenceValue(EntityType.WIKI)); assertEquals("defaultDocument", this.configuration.getDefaultReferenceValue(EntityType.DOCUMENT)); assertEquals("defaultSpace", this.configuration.getDefaultReferenceValue(EntityType.SPACE)); assertEquals("defaultFilename", this.configuration.getDefaultReferenceValue(EntityType.ATTACHMENT)); assertEquals("defaultObject", this.configuration.getDefaultReferenceValue(EntityType.OBJECT)); assertEquals("defaultProperty", this.configuration.getDefaultReferenceValue(EntityType.OBJECT_PROPERTY)); }
@Override public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.getInstance(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { this.logger .debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }
DefaultModelConfiguration implements ModelConfiguration { @Override public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.getInstance(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { this.logger .debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; } }
DefaultModelConfiguration implements ModelConfiguration { @Override public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.getInstance(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { this.logger .debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  }
DefaultModelConfiguration implements ModelConfiguration { @Override public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.getInstance(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { this.logger .debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  @Override String getDefaultReferenceValue(EntityType type); }
DefaultModelConfiguration implements ModelConfiguration { @Override public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.getInstance(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { this.logger .debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  @Override String getDefaultReferenceValue(EntityType type);  }