@Test public void testGetDefaultReferenceNameWhenDefinedInConfiguration() { this.mockery.checking(new Expectations() {{ oneOf(mockSource).getProperty(with(equal("model.reference.default.wiki")), with(any(String.class))); will(returnValue("defaultWiki")); oneOf(mockSource).getProperty(with(equal("model.reference.default.document")), with(any(String.class))); will(returnValue("defaultDocument")); oneOf(mockSource).getProperty(with(equal("model.reference.default.space")), with(any(String.class))); will(returnValue("defaultSpace")); oneOf(mockSource).getProperty(with(equal("model.reference.default.attachment")), with(any(String.class))); will(returnValue("defaultFilename")); oneOf(mockSource).getProperty(with(equal("model.reference.default.object")), with(any(String.class))); will(returnValue("defaultObject")); oneOf(mockSource).getProperty(with(equal("model.reference.default.object_property")), with(any(String.class))); will(returnValue("defaultProperty")); }}); Assert.assertEquals("defaultWiki", this.configuration.getDefaultReferenceValue(EntityType.WIKI)); Assert.assertEquals("defaultDocument", this.configuration.getDefaultReferenceValue(EntityType.DOCUMENT)); Assert.assertEquals("defaultSpace", this.configuration.getDefaultReferenceValue(EntityType.SPACE)); Assert.assertEquals("defaultFilename", this.configuration.getDefaultReferenceValue(EntityType.ATTACHMENT)); Assert.assertEquals("defaultObject", this.configuration.getDefaultReferenceValue(EntityType.OBJECT)); Assert.assertEquals("defaultProperty", this.configuration.getDefaultReferenceValue(EntityType.OBJECT_PROPERTY)); }
public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.lookup(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { getLogger().debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }
DefaultModelConfiguration extends AbstractLogEnabled implements ModelConfiguration { public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.lookup(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { getLogger().debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; } }
DefaultModelConfiguration extends AbstractLogEnabled implements ModelConfiguration { public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.lookup(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { getLogger().debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  }
DefaultModelConfiguration extends AbstractLogEnabled implements ModelConfiguration { public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.lookup(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { getLogger().debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  String getDefaultReferenceValue(EntityType type); }
DefaultModelConfiguration extends AbstractLogEnabled implements ModelConfiguration { public String getDefaultReferenceValue(EntityType type) { String name; try { ConfigurationSource configuration = this.componentManager.lookup(ConfigurationSource.class, "xwikiproperties"); name = configuration.getProperty(PREFIX + "reference.default." + type.toString().toLowerCase(), DEFAULT_VALUES.get(type)); } catch (ComponentLookupException e) { getLogger().debug("Failed to load [" + ConfigurationSource.class.getName() + "]. Using default Model values", e); name = DEFAULT_VALUES.get(type); } return name; }  String getDefaultReferenceValue(EntityType type);  }