|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.topia.persistence.util.TopiaEntityRefTester<T>
public abstract class TopiaEntityRefTester<T extends org.nuiton.topia.persistence.TopiaEntityEnum>
A abstract class to help testing TopiaEntityRef as detectes types, or
detects or references.
TopiaEntityRefTesterTest.
| Field Summary | |
|---|---|
protected T[] |
contracts
|
protected java.util.SortedMap<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>> |
detected
|
protected java.util.Map.Entry<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>> |
entry
|
protected int |
index
|
protected java.util.Iterator<java.util.Map.Entry<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>>> |
itr
|
protected java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef> |
refs
|
| Constructor Summary | |
|---|---|
TopiaEntityRefTester()
|
|
| Method Summary | ||
|---|---|---|
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,
java.lang.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,
java.lang.String association,
java.lang.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,
java.lang.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(java.util.Collection<? extends org.nuiton.topia.persistence.TopiaEntity> entity,
int nb,
java.lang.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,
java.lang.String... ids)
Detects the references from the given entity which have their
topiaId in the given list of ids. |
|
protected void |
detectTypes(java.lang.Class<?>[] expected,
org.nuiton.topia.persistence.TopiaEntity... data)
Detects the type of entities fro the given data. |
|
protected java.lang.String |
getAssociationRef(java.lang.String associationName,
java.lang.String e)
Obtain the reference of an association for a given id. |
|
protected java.lang.String |
getAssociationRef(java.lang.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
|
newEntity(org.nuiton.topia.persistence.TopiaEntityEnum constant,
java.lang.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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.SortedMap<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>> detected
protected java.util.Iterator<java.util.Map.Entry<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>>> itr
protected java.util.Map.Entry<org.nuiton.topia.persistence.TopiaEntity,java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef>> entry
protected java.util.List<org.nuiton.topia.persistence.util.TopiaEntityRef> refs
protected T extends org.nuiton.topia.persistence.TopiaEntityEnum[] contracts
protected int index
| Constructor Detail |
|---|
public TopiaEntityRefTester()
| Method Detail |
|---|
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,
java.lang.String topiaId)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
topiaId (will use the TopiaEntityEnum.getImplementation() class).
T - the type of entityconstant - the constant defining the entitytopiaId - the topia to assign
java.lang.IllegalAccessException - if can no access entity constructor
java.lang.InstantiationException - if can no instanciate the entity
protected java.lang.String getAssociationRef(java.lang.String associationName,
org.nuiton.topia.persistence.TopiaEntity e)
pet[@topiaId='pudding']invoke
getAssociationRef('pet',pet);
associationName - the name of the associatione - the required entity
protected java.lang.String getAssociationRef(java.lang.String associationName,
java.lang.String e)
pet[@topiaId='pudding']invoke
getAssociationRef('pet','pudding');
associationName - the name of the associatione - the id
protected void nextEntry()
index.
protected void detectReferences(org.nuiton.topia.persistence.TopiaEntity entity,
int nb,
java.lang.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 seek
org.nuiton.topia.TopiaException - if any pb while visiting entities
protected void detectReferences(java.util.Collection<? extends org.nuiton.topia.persistence.TopiaEntity> entity,
int nb,
java.lang.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 seek
org.nuiton.topia.TopiaException - if any pb while visiting entities
protected void detectTypes(java.lang.Class<?>[] expected,
org.nuiton.topia.persistence.TopiaEntity... data)
throws org.nuiton.topia.TopiaException
data.
expected - the array of expected typesdata - the data to seek
org.nuiton.topia.TopiaException - if any pb while visiting data
protected void assertNextEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
java.lang.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 target
protected void assertNextAssociationEntityRef(org.nuiton.topia.persistence.TopiaEntity invoker,
java.lang.String association,
java.lang.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
target
protected void assertEntityRef(int index,
org.nuiton.topia.persistence.TopiaEntity invoker,
java.lang.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 target
protected 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 entries
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||