Class BaseTestHarness

    • Constructor Detail

      • BaseTestHarness

        public BaseTestHarness()
    • Method Detail

      • getXmlDocumentBuilder

        public static DocumentBuilder getXmlDocumentBuilder()
      • getXpath

        public static XPath getXpath()
      • makeSimpleDoc

        public static String makeSimpleDoc​(String... fieldsAndValues)
        A helper that creates an xml <doc> containing all of the fields and values specified
        Parameters:
        fieldsAndValues - 0 and Even numbered args are fields names odds are field values.
      • deleteByQuery

        public static String deleteByQuery​(String q,
                                           String... args)
        Generates a delete by query xml string
        Parameters:
        q - Query that has not already been xml escaped
        args - The attributes of the delete tag
      • deleteById

        public static String deleteById​(String id,
                                        String... args)
        Generates a delete by id xml string
        Parameters:
        id - ID that has not already been xml escaped
        args - The attributes of the delete tag
      • optimize

        public static String optimize​(String... args)
        Helper that returns an <optimize> String with optional key/val pairs.
        Parameters:
        args - 0 and Even numbered args are params, Odd numbered args are values.
      • commit

        public static String commit​(String... args)
        Helper that returns an <commit> String with optional key/val pairs.
        Parameters:
        args - 0 and Even numbered args are params, Odd numbered args are values.
      • reload

        public abstract void reload()
                             throws Exception
        Reloads the core
        Throws:
        Exception
      • update

        public abstract String update​(String xml)
        Processes an "update" (add, commit or optimize) and returns the response as a String.

        This method does NOT commit after the request.

        Parameters:
        xml - The XML of the update
        Returns:
        The XML response to the update
      • validateUpdate

        public String validateUpdate​(String xml)
                              throws SAXException
        Validates that an "update" (add, commit or optimize) results in success.

        :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved

        Parameters:
        xml - The XML of the update
        Returns:
        null if successful, otherwise the XML response to the update
        Throws:
        SAXException
      • validateErrorUpdate

        public String validateErrorUpdate​(String xml)
                                   throws SAXException
        Validates that an "update" (add, commit or optimize) results in success.

        :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved

        Parameters:
        xml - The XML of the update
        Returns:
        null if successful, otherwise the XML response to the update
        Throws:
        SAXException
      • checkUpdateStatus

        public String checkUpdateStatus​(String xml,
                                        String code)
                                 throws SAXException
        Validates that an "update" (add, commit or optimize) results in success.

        :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved

        Parameters:
        xml - The XML of the update
        Returns:
        null if successful, otherwise the XML response to the update
        Throws:
        SAXException