public abstract class TopiaEntityRefTester<T extends org.nuiton.topia.persistence.TopiaEntityEnum> extends Object
TopiaEntityRef as detectes types, or
detects or references.
An example of use if given in the test TopiaEntityRefTesterTest.| Modifier and Type | Field and Description |
|---|---|
protected T[] |
contracts |
protected SortedMap<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>> |
detected |
protected Map.Entry<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>> |
entry |
protected int |
index |
protected Iterator<Map.Entry<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>>> |
itr |
protected List<org.nuiton.topia.persistence.util.TopiaEntityRef> |
refs |
| Constructor and Description |
|---|
TopiaEntityRefTester() |
| Modifier and Type | Method and Description |
|---|---|
void |
after() |
protected void |
assertCurrentEntry(org.nuiton.topia.persistence.TopiaEntity expected,
int nbPath)
Asserts if the given
expected entity is equals to the source of
the internal state entry. |
protected void |
assertDetected(int size)
Asserts that the number of detected entries (store in internal state
detected) is ok. |
protected void |
assertEntityRef(int index,
org.nuiton.topia.persistence.TopiaEntity invoker,
String invokerProperty,
org.nuiton.topia.persistence.TopiaEntity... expected)
Asserts if the given entry definition is equals to the reference entry at
position
index on internal state entry. |
protected void |
assertNextAssociationEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
String association,
String id,
org.nuiton.topia.persistence.TopiaEntity... expected)
Asserts if the given entry definition (of an association) is equals to
the next entry reference on internal state
entry. |
protected void |
assertNextEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
String invokerProperty,
org.nuiton.topia.persistence.TopiaEntity... expected)
Asserts if the given entry definition is equals to the next entry
references on internal state state
entry. |
protected void |
detectReferences(Collection<? extends org.nuiton.topia.persistence.TopiaEntity> entity,
int nb,
String... ids)
Detects the references from the given
entity which have their
topiaId in the given list of ids. |
protected void |
detectReferences(org.nuiton.topia.persistence.TopiaEntity entity,
int nb,
String... ids)
Detects the references from the given
entity which have their
topiaId in the given list of ids. |
protected void |
detectTypes(Class<?>[] expected,
org.nuiton.topia.persistence.TopiaEntity... data)
Detects the type of entities fro the given
data. |
protected String |
getAssociationRef(String associationName,
String e)
Obtain the reference of an association for a given id.
|
protected String |
getAssociationRef(String associationName,
org.nuiton.topia.persistence.TopiaEntity e)
Obtain the reference of an association for a given entity.
|
protected T[] |
getContracts() |
protected abstract T[] |
getContracts0() |
protected <T extends org.nuiton.topia.persistence.TopiaEntity> |
newEntity(org.nuiton.topia.persistence.TopiaEntityEnum constant,
String topiaId)
Creates a new entity with the given
topiaId (will use the TopiaEntityEnum.getImplementation() class). |
protected void |
nextEntry()
Obtain the next entry from the iterator.
|
protected SortedMap<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>> detected
protected Iterator<Map.Entry<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>>> itr
protected Map.Entry<org.nuiton.topia.persistence.TopiaEntity,List<org.nuiton.topia.persistence.util.TopiaEntityRef>> entry
protected List<org.nuiton.topia.persistence.util.TopiaEntityRef> refs
protected T extends org.nuiton.topia.persistence.TopiaEntityEnum[] contracts
protected int index
protected T[] getContracts()
protected abstract T[] getContracts0()
TopiaEntityEnum to be usedpublic void after()
protected <T extends org.nuiton.topia.persistence.TopiaEntity> T newEntity(org.nuiton.topia.persistence.TopiaEntityEnum constant,
String topiaId)
throws IllegalAccessException,
InstantiationException
topiaId (will use the TopiaEntityEnum.getImplementation() class).T - the type of entityconstant - the constant defining the entitytopiaId - the topia to assignIllegalAccessException - if can no access entity constructorInstantiationException - if can no instanciate the entityprotected String getAssociationRef(String associationName, org.nuiton.topia.persistence.TopiaEntity e)
pet[@topiaId='pudding']invoke
getAssociationRef('pet',pet);associationName - the name of the associatione - the required entityprotected String getAssociationRef(String associationName, String e)
pet[@topiaId='pudding']invoke
getAssociationRef('pet','pudding');associationName - the name of the associatione - the idprotected void nextEntry()
index.protected void detectReferences(org.nuiton.topia.persistence.TopiaEntity entity,
int nb,
String... ids)
throws org.nuiton.topia.TopiaException
entity which have their
topiaId in the given list of ids.
As a side-effect, it will update the states detected and set the
iterator itr to the first position on detected entries.entity - the entity to seeknb - the required number of entriesids - the ids to seekorg.nuiton.topia.TopiaException - if any pb while visiting entitiesprotected void detectReferences(Collection<? extends org.nuiton.topia.persistence.TopiaEntity> entity, int nb, String... ids) throws org.nuiton.topia.TopiaException
entity which have their
topiaId in the given list of ids.
As a side-effect, it will update the states detected and set the
iterator itr to the first position on detected entries.entity - the entity to seeknb - the required number of entriesids - the ids to seekorg.nuiton.topia.TopiaException - if any pb while visiting entitiesprotected void detectTypes(Class<?>[] expected, org.nuiton.topia.persistence.TopiaEntity... data) throws org.nuiton.topia.TopiaException
data.expected - the array of expected typesdata - the data to seekorg.nuiton.topia.TopiaException - if any pb while visiting dataprotected void assertNextEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
String invokerProperty,
org.nuiton.topia.persistence.TopiaEntity... expected)
entry.invoker - the invoker of the referenceinvokerProperty - the access path of the referenceexpected - the expected topia entities path to access
reference targetprotected void assertNextAssociationEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
String association,
String id,
org.nuiton.topia.persistence.TopiaEntity... expected)
entry.invoker - the invoker of the referenceassociation - the association nameid - the id of the association ( see getAssociationRef(String, TopiaEntity)expected - the expected topia entities path to access reference
targetprotected void assertEntityRef(int index,
org.nuiton.topia.persistence.TopiaEntity invoker,
String invokerProperty,
org.nuiton.topia.persistence.TopiaEntity... expected)
index on internal state entry.index - the index of the reference to test in entryinvoker - the invoker of the referenceinvokerProperty - the path of the referenceexpected - th expected topia entities path to access
reference targetprotected void assertCurrentEntry(org.nuiton.topia.persistence.TopiaEntity expected,
int nbPath)
expected entity is equals to the source of
the internal state entry.expected - the required source of the entrynbPath - the expected number of references of the given entryprotected void assertDetected(int size)
detected) is ok.
As a side-effect, it will reset the internal state itr on the
first entry of the detected list.size - the expected number of detected entriesCopyright © 2004–2018 CodeLutin. All rights reserved.