Class MockIndexConfigProviderContext

  • All Implemented Interfaces:
    PluginConfigurationFileSettingMock, com.funnelback.plugin.index.IndexConfigProviderContext, com.funnelback.plugin.PluginBaseConfigContext, com.funnelback.plugin.PluginBaseConfigFileContext, com.funnelback.plugin.PluginBaseContext

    public class MockIndexConfigProviderContext
    extends Object
    implements com.funnelback.plugin.index.IndexConfigProviderContext, PluginConfigurationFileSettingMock
    A mock IndexConfigProviderContext that may be used when testig the IndexingConfigProvider. Example:
    
     MockIndexConfigProviderContext mockContext = new MockIndexConfigProviderContext();
     // Set collection or profile config setting 'foo=bar'.
     mockContext.setConfigSetting("foo", "bar");
     
     // This conext is for a profile and the method being tested needs to know the
     // profile name, so set that with the mock.
     mockContext.setProfile(Optional.of("dummy-profile"));
     
    • Constructor Detail

      • MockIndexConfigProviderContext

        public MockIndexConfigProviderContext()
    • Method Detail

      • readCollectionConfigFile

        public Optional<byte[]> readCollectionConfigFile​(String... pathsBelowConf)
                                                  throws IOException
        Specified by:
        readCollectionConfigFile in interface com.funnelback.plugin.index.IndexConfigProviderContext
        Throws:
        IOException
      • getSearchHome

        public File getSearchHome()
        Specified by:
        getSearchHome in interface com.funnelback.plugin.PluginBaseContext
      • setSearchHome

        public void setSearchHome​(File searchHome)
      • getCollectionName

        public String getCollectionName()
        Specified by:
        getCollectionName in interface com.funnelback.plugin.PluginBaseContext
      • setCollectionName

        public void setCollectionName​(String collectionName)
      • getProfileWithView

        @NonNull
        public @NonNull Optional<String> getProfileWithView()
        Specified by:
        getProfileWithView in interface com.funnelback.plugin.index.IndexConfigProviderContext
      • setProfileWithView

        public void setProfileWithView​(@NonNull
                                       @NonNull Optional<String> profileWithView)
      • getProfile

        @NonNull
        public @NonNull Optional<String> getProfile()
        Specified by:
        getProfile in interface com.funnelback.plugin.index.IndexConfigProviderContext
      • setProfile

        public void setProfile​(@NonNull
                               @NonNull Optional<String> profile)
      • setConfigSetting

        public void setConfigSetting​(String key,
                                     String value)
      • getConfigSetting

        public String getConfigSetting​(String key)
        Specified by:
        getConfigSetting in interface com.funnelback.plugin.PluginBaseConfigContext
      • getConfigKeys

        public Set<String> getConfigKeys()
      • getConfigKeysWithPrefix

        public Set<String> getConfigKeysWithPrefix​(String prefix)
        Specified by:
        getConfigKeysWithPrefix in interface com.funnelback.plugin.PluginBaseConfigContext
      • getConfigKeysMatchingPattern

        public Map<String,​List<String>> getConfigKeysMatchingPattern​(String pattern)
        Specified by:
        getConfigKeysMatchingPattern in interface com.funnelback.plugin.PluginBaseConfigContext
      • pluginConfigurationFileAsBytes

        public Optional<byte[]> pluginConfigurationFileAsBytes​(String filename)
        Specified by:
        pluginConfigurationFileAsBytes in interface com.funnelback.plugin.PluginBaseConfigFileContext
      • pluginConfigurationFile

        public Optional<String> pluginConfigurationFile​(String filename)
        Specified by:
        pluginConfigurationFile in interface com.funnelback.plugin.PluginBaseConfigFileContext