Revision e09f9c40
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java | ||
---|---|---|
14 | 14 |
import java.util.Set; |
15 | 15 |
|
16 | 16 |
import org.apache.log4j.Logger; |
17 |
import org.hibernate.collection.spi.PersistentCollection; |
|
18 | 17 |
import org.junit.Assert; |
19 | 18 |
import org.junit.BeforeClass; |
20 | 19 |
import org.junit.Ignore; |
... | ... | |
80 | 79 |
|
81 | 80 |
// this size call will initialise the list remotely and only return the |
82 | 81 |
// size of the list |
83 |
int remoteChildCount = commonService.size((PersistentCollection)childNodes);
|
|
82 |
int remoteChildCount = commonService.size(taxonNode.getUuid(), "childNodes");
|
|
84 | 83 |
Assert.assertEquals(childCount, remoteChildCount); |
85 | 84 |
|
86 | 85 |
String firstNodeTaxonTitle = taxonNode.getTaxon().getTitleCache(); |
... | ... | |
94 | 93 |
|
95 | 94 |
// this get call will initialise the list remotely and only return the |
96 | 95 |
// 0th element from the list |
97 |
TaxonNode remoteTaxonNode = (TaxonNode)commonService.get((PersistentCollection)childNodes,0);
|
|
96 |
TaxonNode remoteTaxonNode = (TaxonNode)commonService.get(taxonNode.getUuid(), "childNodes",0);
|
|
98 | 97 |
|
99 | 98 |
// the locally and remotely retrieved taxon node should exist in the |
100 | 99 |
// (local and remote) child nodes list, should be not-null and should be equal to each other |
101 | 100 |
Assert.assertTrue(taxonNode.getChildNodes().contains(localTaxonNode)); |
102 | 101 |
Assert.assertTrue(taxonNode.getChildNodes().contains(remoteTaxonNode)); |
103 |
Assert.assertTrue(commonService.contains((PersistentCollection)childNodes, localTaxonNode));
|
|
104 |
Assert.assertTrue(commonService.contains((PersistentCollection)childNodes, remoteTaxonNode));
|
|
102 |
Assert.assertTrue(commonService.contains(taxonNode.getUuid(), "childNodes", localTaxonNode));
|
|
103 |
Assert.assertTrue(commonService.contains(taxonNode.getUuid(), "childNodes", remoteTaxonNode));
|
|
105 | 104 |
Assert.assertNotNull(remoteTaxonNode); |
106 | 105 |
Assert.assertNotNull(localTaxonNode); |
107 | 106 |
Assert.assertEquals(remoteTaxonNode,localTaxonNode); |
... | ... | |
188 | 187 |
if(!multilanguagetextMap.isEmpty()) { |
189 | 188 |
// found a map whcih we can test! |
190 | 189 |
logger.info("Found Non-empty multilanguagetextMap"); |
191 |
boolean empty = commonService.isEmpty((PersistentCollection)multilanguagetextMap);
|
|
190 |
boolean empty = commonService.isEmpty(element.getUuid(), "multilanguageText");
|
|
192 | 191 |
Assert.assertFalse(empty); |
193 | 192 |
// test retrieval of key set, which should already by initialised |
194 | 193 |
Set<Language> langKeySet = multilanguagetextMap.keySet(); |
... | ... | |
200 | 199 |
Assert.assertTrue(localContainsKey); |
201 | 200 |
// testing 'containsKey' on remotely initialised collection |
202 | 201 |
boolean remoteContainsKey = |
203 |
commonService.containsKey((PersistentCollection)multilanguagetextMap, key);
|
|
202 |
commonService.containsKey(element.getUuid(), "multilanguageText", key);
|
|
204 | 203 |
Assert.assertTrue(remoteContainsKey); |
205 | 204 |
|
206 | 205 |
LanguageString value = multilanguagetextMap.get(key); |
... | ... | |
209 | 208 |
Assert.assertTrue(localContainsValue); |
210 | 209 |
// testing 'containsValue' on remotely initialised collection |
211 | 210 |
boolean remoteContainsValue = |
212 |
commonService.containsValue((PersistentCollection)multilanguagetextMap, value);
|
|
211 |
commonService.containsValue(element.getUuid(), "multilanguageText", value);
|
|
213 | 212 |
Assert.assertTrue(remoteContainsValue); |
214 | 213 |
|
215 | 214 |
} |
Also available in: Unified diff
#5031 Update remoting code to be compatible with new common service collection calls