Added the possibility to get unbounded instances using -1
This commit is contained in:
parent
38668d8a21
commit
9d9ec44b90
|
@ -517,7 +517,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
|||
entityManagement.setAsEntryPoint();
|
||||
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
||||
arrayNode.add(jsonNode);
|
||||
if(++count >= limit) {
|
||||
if(limit > 0 && ++count >= limit) {
|
||||
break;
|
||||
}
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
|
|
@ -806,7 +806,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
oDatabaseDocument, edge);
|
||||
// visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources);
|
||||
serilizedEdges.add(relationManagement.serializeAsJsonNode());
|
||||
if(++count >= limit) {
|
||||
if(limit > 0 && ++count >= limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -739,7 +739,9 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testLimitOffsetWithHostingNode() throws ResourceRegistryException, JsonParseException, JsonMappingException, IOException {
|
||||
public void testLimitOffsetWithHostingNode() throws Exception {
|
||||
setContextByName(GCUBE);
|
||||
|
||||
ServerRequestInfo requestInfo = RequestUtility.getRequestInfo().get();
|
||||
int limit = 2;
|
||||
requestInfo.setLimit(limit);
|
||||
|
@ -803,6 +805,15 @@ public class ERManagementTest extends ContextTest {
|
|||
}
|
||||
}
|
||||
|
||||
requestInfo.setOffset(0);
|
||||
requestInfo.setLimit(-1);
|
||||
ret = resourceManagement.all(true);
|
||||
logger.debug("{}", ret);
|
||||
list = ElementMapper.unmarshalList(HostingNode.class, ret);
|
||||
|
||||
for(HostingNode hn : list) {
|
||||
UUID uuid = hn.getID();
|
||||
logger.debug("No limit listing: Got {} with UUID {}", HostingNode.NAME, uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue