Package org.apache.ofbiz.entity.test
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
-
Constructor Details
-
EntityQueryTestSuite
-
-
Method Details
-
testQueryCount
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
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
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
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
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
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
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
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
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
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
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
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
queryIterator(): This method is used to get iterator object over the entity. assert: Compared first record of both the iterator.- Throws:
GenericEntityException
-
testCursorForwardOnly
cursorForwardOnly(): Indicate that the ResultSet object's cursor may move only forward assert: Compared first record found by both the iterator.- Throws:
GenericEntityException
-
testCursorScrollSensitive
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
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
-