Class MockJsoupSetupContext
- java.lang.Object
-
- com.funnelback.common.filter.jsoup.MockJsoupSetupContext
-
- All Implemented Interfaces:
com.funnelback.common.filter.jsoup.SetupContext
,PluginConfigurationFileSettingMock
,com.funnelback.plugin.PluginBaseConfigContext
,com.funnelback.plugin.PluginBaseConfigFileContext
,com.funnelback.plugin.PluginBaseContext
public class MockJsoupSetupContext extends Object implements com.funnelback.common.filter.jsoup.SetupContext, PluginConfigurationFileSettingMock
This can be used when testing Jsoup filters that need aSetupContext
. This supports setting the search home, the collection name as well as mocking setting keys in collection.cfg. Example:MockJsoupSetupContext setupContext = new MockJsoupSetupContext(); // Simulate setting keys in collection.cfg setupContext.getConfigSettings().put("myfilter.enable.this", "true"); setupContext.getConfigSettings().put("myfilter.enable.that", "false");
-
-
Field Summary
Fields Modifier and Type Field Description private String
collectionName
private MapBackedConfig
mapBackedConfig
private MapBackedPluginConfigurationFiles
mapBackedPluginConfigurationFiles
private File
searchHome
-
Constructor Summary
Constructors Constructor Description MockJsoupSetupContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getCollectionConfigFile(String filename)
String
getCollectionName()
Set<String>
getConfigKeys()
Map<String,List<String>>
getConfigKeysMatchingPattern(String pattern)
Set<String>
getConfigKeysWithPrefix(String prefix)
String
getConfigSetting(String key)
File
getSearchHome()
Optional<String>
pluginConfigurationFile(String filename)
Optional<byte[]>
pluginConfigurationFileAsBytes(String filename)
void
setCollectionName(String collectionName)
void
setConfigSetting(String key, String value)
void
setPlugingConfigurationFileContent(String filename, String content)
Sets the content of a plugin configuration file on the mock.void
setPlugingConfigurationFileContentAsBytes(String filename, byte[] content)
Sets the content of a plugin configuration file on the mock.void
setSearchHome(File searchHome)
-
-
-
Field Detail
-
searchHome
private File searchHome
-
collectionName
private String collectionName
-
mapBackedConfig
private final MapBackedConfig mapBackedConfig
-
mapBackedPluginConfigurationFiles
private final MapBackedPluginConfigurationFiles mapBackedPluginConfigurationFiles
-
-
Method Detail
-
getCollectionConfigFile
public File getCollectionConfigFile(String filename)
- Specified by:
getCollectionConfigFile
in interfacecom.funnelback.common.filter.jsoup.SetupContext
-
getSearchHome
public File getSearchHome()
- Specified by:
getSearchHome
in interfacecom.funnelback.plugin.PluginBaseContext
-
setSearchHome
public void setSearchHome(File searchHome)
-
getCollectionName
public String getCollectionName()
- Specified by:
getCollectionName
in interfacecom.funnelback.plugin.PluginBaseContext
-
setCollectionName
public void setCollectionName(String collectionName)
-
setConfigSetting
public void setConfigSetting(String key, String value)
- Specified by:
setConfigSetting
in interfacecom.funnelback.common.filter.jsoup.SetupContext
-
getConfigSetting
public String getConfigSetting(String key)
- Specified by:
getConfigSetting
in interfacecom.funnelback.plugin.PluginBaseConfigContext
-
getConfigKeysWithPrefix
public Set<String> getConfigKeysWithPrefix(String prefix)
- Specified by:
getConfigKeysWithPrefix
in interfacecom.funnelback.plugin.PluginBaseConfigContext
-
getConfigKeysMatchingPattern
public Map<String,List<String>> getConfigKeysMatchingPattern(String pattern)
- Specified by:
getConfigKeysMatchingPattern
in interfacecom.funnelback.plugin.PluginBaseConfigContext
-
setPlugingConfigurationFileContent
public void setPlugingConfigurationFileContent(String filename, String content)
Description copied from interface:PluginConfigurationFileSettingMock
Sets the content of a plugin configuration file on the mock.- Specified by:
setPlugingConfigurationFileContent
in interfacePluginConfigurationFileSettingMock
- Parameters:
filename
- the name of the plugins configuration file e.g. maps.cfg
-
setPlugingConfigurationFileContentAsBytes
public void setPlugingConfigurationFileContentAsBytes(String filename, byte[] content)
Description copied from interface:PluginConfigurationFileSettingMock
Sets the content of a plugin configuration file on the mock.- Specified by:
setPlugingConfigurationFileContentAsBytes
in interfacePluginConfigurationFileSettingMock
- Parameters:
filename
- the name of the plugins configuration file e.g. maps.cfg
-
pluginConfigurationFileAsBytes
public Optional<byte[]> pluginConfigurationFileAsBytes(String filename)
- Specified by:
pluginConfigurationFileAsBytes
in interfacecom.funnelback.plugin.PluginBaseConfigFileContext
-
-