Class OrderByDateTest

  • All Implemented Interfaces:
    junit.framework.Test

    public class OrderByDateTest
    extends AbstractQueryTest
    Test cases for order by queries on date properties.
    • testroot path to node that accepts child nodes of type nodetype
    • nodetype name of a node type
    • nodename1 name of a child node of type nodetype
    • nodename2 name of a child node of type nodetype
    • nodename3 name of a child node of type nodetype
    • nodename4 name of a child node of type nodetype
    • propertyname1 name of a single value calendar property.
    • Field Detail

      • checkSQL

        protected boolean checkSQL
        If true this repository supports sql queries
    • Constructor Detail

      • OrderByDateTest

        public OrderByDateTest()
    • Method Detail

      • testDateOrder

        public void testDateOrder()
                           throws Exception
        Tests order by queries with calendar properties.
        Throws:
        Exception
      • testDateOrderMillis

        public void testDateOrderMillis()
                                 throws Exception
        Tests order by queries with calendar properties where the calendar values only have a millisecond difference.
        Throws:
        Exception
      • testDateOrderPositiveTimeZone

        public void testDateOrderPositiveTimeZone()
                                           throws Exception
        Tests order by queries with calendar properties where the calendar values have different time zones.
        Throws:
        Exception
      • testDateOrderNegativeTimeZone

        public void testDateOrderNegativeTimeZone()
                                           throws Exception
        Tests order by queries with calendar properties where the calendar values have different time zones.
        Throws:
        Exception
      • setUp

        protected void setUp()
                      throws Exception
        Description copied from class: AbstractQueryTest
        Set-up the configuration values used for the test. Per default retrieves a session, configures testRoot, and nodetype and checks if the query language for the current language is available.
        Overrides:
        setUp in class AbstractQueryTest
        Throws:
        Exception
      • populate

        protected void populate​(String[] values)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a String value set in property with name propertyname1.
        Parameters:
        values - the String values.
        Throws:
        RepositoryException
      • populate

        protected void populate​(String[] values,
                                int type)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a value set in property with name propertyname1. The actual value is created by using the sessions value factory and the given type.
        Parameters:
        values - the String values.
        type - a JCR property type.
        Throws:
        RepositoryException
      • populate

        protected void populate​(Calendar[] values)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a calendar value set in property with name propertyname1.
        Parameters:
        values - the calendar values.
        Throws:
        RepositoryException
      • populate

        protected void populate​(long[] values)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a long value set in property with name propertyname1.
        Parameters:
        values - the long values.
        Throws:
        RepositoryException
      • populate

        protected void populate​(double[] values)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a double value set in property with name propertyname1.
        Parameters:
        values - the double values.
        Throws:
        RepositoryException
      • populate

        protected void populate​(BigDecimal[] values)
                         throws RepositoryException
        Populates the workspace with child nodes under testroot with each node has a decimal value set in property with name propertyname1.
        Parameters:
        values - the decimal values.
        Throws:
        RepositoryException
      • checkOrder

        protected void checkOrder​(String[] nodeNames)
                           throws RepositoryException
        Runs queries on the workspace and checks if the ordering is according to the nodeNames.
        Parameters:
        nodeNames - the sequence of node names required in the result set.
        Throws:
        RepositoryException
      • checkResultOrder

        protected void checkResultOrder​(QueryResult result,
                                        String[] nodeNames)
                                 throws RepositoryException
        Checks if the node ordering in result is according to nodeNames.
        Parameters:
        result - the query result.
        nodeNames - the node names.
        Throws:
        RepositoryException
      • createSQL

        protected String createSQL()
        Returns:
        a basic SQL statement to test order by queries. Returns null if SQL is not supported.
      • createXPath

        protected String createXPath()
                              throws RepositoryException
        Returns:
        a basic XPath statement to test order by queries. Returns null is XPath is not supported.
        Throws:
        RepositoryException - if an error occurs.