Class EntityQueryTestSuite

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.ofbiz.entity.testtools.EntityTestCase
org.apache.ofbiz.entity.test.EntityQueryTestSuite
All Implemented Interfaces:
junit.framework.Test

public class EntityQueryTestSuite extends EntityTestCase
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cursorForwardOnly(): Indicate that the ResultSet object's cursor may move only forward assert: Compared first record found by both the iterator.
    void
    cursorScrollInSensitive(): ResultSet object's cursor is scrollable but generally not sensitive to changes to the data that underlies the ResultSet.
    void
    cursorScrollSensitive(): ResultSet object's cursor is scrollable but generally sensitive to changes to the data that underlies the ResultSet.
    void
    distinct(): This method is used to get distinct values of records from entity field.
    void
    fetchSize(): This method sets the fetch size for the records to be fetched from the entity.
    void
    filteByDate(): This method return only values that are currently active using from/thruDate fields.
    void
    maxRows(): This method sets the maximum number of records to be fetched by the query.
    void
    orderBy(): This method sorts the records found according to the given field or combination of fields.
    void
    queryCount(): This method returns number of records found for the particular query.
    void
    queryFirst(): Returns first record from result of query.
    void
    queryIterator(): This method is used to get iterator object over the entity.
    void
    queryList(): Returns all records from the given entity.
    void
    queryOne(): This method returns only one record based on the conditions given.
    void
    queryOne(): This method returns only one record based on the conditions given, resolve from a context Map.
    void
    select(): This method is used to select particular fields only from the entity.
    void
    where(): This method is used for setting condition of which records to fetch from entity.

    Methods inherited from class org.apache.ofbiz.entity.testtools.EntityTestCase

    getDelegator, setDelegator

    Methods inherited from class junit.framework.TestCase

    assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EntityQueryTestSuite

      public EntityQueryTestSuite(String name)
  • Method Details

    • testQueryCount

      public void testQueryCount() throws GenericEntityException
      queryCount(): This method returns number of records found for the particular query. assert: Compared count of number of records found by Entity Engine method with count of number of records found by EntityQuery method.
      Throws:
      GenericEntityException
    • testWhere

      public void testWhere() throws GenericEntityException
      where(): This method is used for setting condition of which records to fetch from entity. assert 1: Compared size of the list returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingTypeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testQueryList

      public void testQueryList() throws GenericEntityException
      queryList(): Returns all records from the given entity. assert 1: Compared size of the list returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingTypeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testQueryFirst

      public void testQueryFirst() throws GenericEntityException
      queryFirst(): Returns first record from result of query. assert 1: Compared 'testingTypeId' field of record fetched by Entity Engine method and by EntityQuery method. assert 2: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testQueryOne

      public void testQueryOne() throws GenericEntityException
      queryOne(): This method returns only one record based on the conditions given. assert 1: Compared 'testingTypeId' field of record fetched by Entity Engine method and by EntityQuery method. assert 2: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testQueryOneWithContext

      public void testQueryOneWithContext() throws GenericEntityException
      queryOne(): This method returns only one record based on the conditions given, resolve from a context Map. assert 1: Check the TestingType entity queryOneMap-2 has been resolve assert 2: Check the TestingType entity queryOneMap-3 has been resolve with the parameters map present in context
      Throws:
      GenericEntityException
    • testSelect

      public void testSelect() throws GenericEntityException
      select(): This method is used to select particular fields only from the entity. assert 1: Compared value of first record of selected 'description' field by both EntityEngine method and EntityQuery method. assert 2: Compared 'testingTypeId' field for null which is fetched by EntityQuery method.
      Throws:
      GenericEntityException
    • testDistinctAndSelect

      public void testDistinctAndSelect() throws GenericEntityException
      distinct(): This method is used to get distinct values of records from entity field. (Note: Distinct method is generally used with select method) assert 1: Compared size of the list returned by Entity Engine method and by EntityQuery method. assert 2: Compared value of first record of selected 'description' field by both EntityEngine method and EntityQuery method. assert 3: Compared 'testingTypeId' field for null which is fetched by EntityQuery method.
      Throws:
      GenericEntityException
    • testOrderBy

      public void testOrderBy() throws GenericEntityException
      orderBy(): This method sorts the records found according to the given field or combination of fields. assert 1: Compared number of records returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingTypeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testFilterByDate

      public void testFilterByDate() throws GenericEntityException
      filteByDate(): This method return only values that are currently active using from/thruDate fields. assert 1: Compared number of records returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingNodeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'testingId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 4: Compared 'fromDate' field of first record fetched by Entity Engine method and by EntityQuery method. assert 5: Compared 'thruDate' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testMaxRows

      public void testMaxRows() throws GenericEntityException
      maxRows(): This method sets the maximum number of records to be fetched by the query. assert 1: Compared number of records returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingTypeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testFetchSize

      public void testFetchSize() throws GenericEntityException
      fetchSize(): This method sets the fetch size for the records to be fetched from the entity. assert 1: Compared number of records returned by Entity Engine method and by EntityQuery method. assert 2: Compared 'testingTypeId' field of first record fetched by Entity Engine method and by EntityQuery method. assert 3: Compared 'description' field of first record fetched by Entity Engine method and by EntityQuery method.
      Throws:
      GenericEntityException
    • testQueryIterator

      public void testQueryIterator() throws GenericEntityException
      queryIterator(): This method is used to get iterator object over the entity. assert: Compared first record of both the iterator.
      Throws:
      GenericEntityException
    • testCursorForwardOnly

      public void testCursorForwardOnly() throws GenericEntityException
      cursorForwardOnly(): Indicate that the ResultSet object's cursor may move only forward assert: Compared first record found by both the iterator.
      Throws:
      GenericEntityException
    • testCursorScrollSensitive

      public void testCursorScrollSensitive() throws GenericEntityException
      cursorScrollSensitive(): ResultSet object's cursor is scrollable but generally sensitive to changes to the data that underlies the ResultSet. assert: Compared first record found by both the iterators.
      Throws:
      GenericEntityException
    • testCursorScrollInSensitive

      public void testCursorScrollInSensitive() throws GenericEntityException
      cursorScrollInSensitive(): ResultSet object's cursor is scrollable but generally not sensitive to changes to the data that underlies the ResultSet. assert: Compared first record found by both the iterators.
      Throws:
      GenericEntityException