improved test
This commit is contained in:
parent
9d9ec44b90
commit
8c5dcd0341
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.instances;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
|
@ -15,8 +14,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.core.JsonParseException;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import org.gcube.common.encryption.encrypter.StringEncrypter;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
|
@ -743,22 +740,21 @@ public class ERManagementTest extends ContextTest {
|
|||
setContextByName(GCUBE);
|
||||
|
||||
ServerRequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||
int limit = 2;
|
||||
int limit = 4;
|
||||
requestInfo.setLimit(limit);
|
||||
requestInfo.setOffset(0);
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(HostingNode.NAME);
|
||||
String ret = resourceManagement.all(true);
|
||||
logger.debug("{}", ret);
|
||||
|
||||
List<HostingNode> list = ElementMapper.unmarshalList(HostingNode.class, ret);
|
||||
if(list.size()==0) {
|
||||
return;
|
||||
}
|
||||
Assert.assertTrue(list.size() < 3);
|
||||
Assert.assertTrue(list.size() <= limit);
|
||||
|
||||
if(list.size()<2) {
|
||||
if(list.size()<limit) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -769,12 +765,12 @@ public class ERManagementTest extends ContextTest {
|
|||
logger.debug("Found {} with UUID {}", HostingNode.NAME, uuid);
|
||||
}
|
||||
|
||||
requestInfo.setOffset(2);
|
||||
requestInfo.setOffset(limit);
|
||||
requestInfo.setLimit(limit);
|
||||
ret = resourceManagement.all(true);
|
||||
logger.debug("{}", ret);
|
||||
list = ElementMapper.unmarshalList(HostingNode.class, ret);
|
||||
if(list.size()>0) {
|
||||
Assert.assertTrue(list.size() < 3);
|
||||
Assert.assertTrue(list.size() <= limit);
|
||||
|
||||
for(HostingNode hn : list) {
|
||||
UUID uuid = hn.getID();
|
||||
|
@ -783,7 +779,7 @@ public class ERManagementTest extends ContextTest {
|
|||
logger.debug("Found {} with UUID {}", HostingNode.NAME, uuid);
|
||||
}
|
||||
|
||||
if(list.size()<2) {
|
||||
if(list.size()<limit) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -792,7 +788,6 @@ public class ERManagementTest extends ContextTest {
|
|||
requestInfo.setOffset(0);
|
||||
requestInfo.setLimit(doubleLimit);
|
||||
ret = resourceManagement.all(true);
|
||||
logger.debug("{}", ret);
|
||||
list = ElementMapper.unmarshalList(HostingNode.class, ret);
|
||||
|
||||
Assert.assertTrue(list.size() <= doubleLimit);
|
||||
|
@ -808,9 +803,10 @@ public class ERManagementTest extends ContextTest {
|
|||
requestInfo.setOffset(0);
|
||||
requestInfo.setLimit(-1);
|
||||
ret = resourceManagement.all(true);
|
||||
logger.debug("{}", ret);
|
||||
list = ElementMapper.unmarshalList(HostingNode.class, ret);
|
||||
|
||||
Assert.assertTrue(list.size()>=uuids.size());
|
||||
|
||||
for(HostingNode hn : list) {
|
||||
UUID uuid = hn.getID();
|
||||
logger.debug("No limit listing: Got {} with UUID {}", HostingNode.NAME, uuid);
|
||||
|
|
Loading…
Reference in New Issue