Class TestDriver


  • @Beta
    public class TestDriver
    extends java.lang.Object
    Test driver for testing config models. Add custom builders for plugins to be tested. Builds a model from the xml string and returns a config producer that can be use to test getConfig.
    Since:
    5.1.20
    Author:
    Ulf Lilleengen
    • Constructor Summary

      Constructors 
      Constructor Description
      TestDriver()  
      TestDriver​(boolean validate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TestDriver addBuilder​(ConfigModelBuilder builder)
      Add a new builder to the tester.
      TestRoot buildModel​(com.yahoo.config.application.api.ApplicationPackage applicationPackage)
      Build a model from an application package.
      TestRoot buildModel​(DeployState deployState)
      Build a model given a deploy state.
      TestRoot buildModel​(java.lang.String servicesXml)
      Build a model from an XML string.
      TestRoot buildModel​(java.lang.String servicesXml, java.lang.String hostsXml)
      Build a model from an XML string of services and one of hosts.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestDriver

        public TestDriver​(boolean validate)
      • TestDriver

        public TestDriver()
    • Method Detail

      • addBuilder

        public TestDriver addBuilder​(ConfigModelBuilder builder)
        Add a new builder to the tester.
        Parameters:
        builder - builder to add.
        Returns:
        this for chaining
      • buildModel

        public TestRoot buildModel​(java.lang.String servicesXml)
        Build a model from an XML string. The hosts referenced in services must be set to 'mockhost' when using this method, as it automatically generates a hosts file for you.
        Parameters:
        servicesXml - The xml for services.xml
        Returns:
        a producer root capable of answering getConfig requests.
      • buildModel

        public TestRoot buildModel​(java.lang.String servicesXml,
                                   java.lang.String hostsXml)
        Build a model from an XML string of services and one of hosts.
        Parameters:
        servicesXml - The xml for services.xml
        hostsXml - The xml for hosts.xml
        Returns:
        a producer root capable of answering getConfig requests.
      • buildModel

        public TestRoot buildModel​(com.yahoo.config.application.api.ApplicationPackage applicationPackage)
        Build a model from an application package.
        Parameters:
        applicationPackage - Any type of application package.
        Returns:
        a producer root capable of answering getConfig requests.
      • buildModel

        public TestRoot buildModel​(DeployState deployState)
        Build a model given a deploy state.
        Parameters:
        deployState - An instance of DeployState
        Returns:
        a producer root capable of answering getConfig requests.