diff --git a/dspace-api/src/test/java/org/dspace/content/EntityServiceImplTest.java b/dspace-api/src/test/java/org/dspace/content/EntityServiceImplTest.java index 34648b9186..2bcf31b44e 100644 --- a/dspace-api/src/test/java/org/dspace/content/EntityServiceImplTest.java +++ b/dspace-api/src/test/java/org/dspace/content/EntityServiceImplTest.java @@ -146,7 +146,7 @@ public class EntityServiceImplTest { relationshipList.add(relationship); // Mock the state of objects utilized in getRelationsByType() to meet the success criteria of an invocation - when(relationshipService.findAll(context)).thenReturn(relationshipList); + when(relationshipService.findAll(context, -1, -1)).thenReturn(relationshipList); when(relationship.getRelationshipType()).thenReturn(relationshipType); when(relationshipType.getLeftwardType()).thenReturn("leftwardType"); when(relationshipType.getRightwardType()).thenReturn("rightwardType"); @@ -178,8 +178,8 @@ public class EntityServiceImplTest { when(metadataValue.getValue()).thenReturn("testType"); when(entity.getItem()).thenReturn(item); when(itemService.getMetadata(item, "relationship", "type", null, Item.ANY)).thenReturn(list); - when(relationshipTypeDAO.findAll(context, RelationshipType.class)).thenReturn(relationshipTypeList); - when(relationshipTypeService.findAll(context)).thenReturn(relationshipTypeList); + when(relationshipTypeDAO.findAll(context, RelationshipType.class, -1, -1)).thenReturn(relationshipTypeList); + when(relationshipTypeService.findAll(context, -1, -1)).thenReturn(relationshipTypeList); when(relationshipType.getLeftType()).thenReturn(leftType); when(relationshipType.getRightType()).thenReturn(rightType); when(entityTypeService.findByEntityType(context, "value")).thenReturn(leftType); @@ -212,7 +212,7 @@ public class EntityServiceImplTest { when(itemService.getMetadata(any(), any(), any(), any(), any())).thenReturn(metsList); when(entity.getItem()).thenReturn(item); when(entityType.getID()).thenReturn(0); - when(relationshipTypeService.findAll(any())).thenReturn(relationshipTypeList); + when(relationshipTypeService.findAll(context, -1, -1)).thenReturn(relationshipTypeList); when(relationshipType.getLeftType()).thenReturn(entityType); when(entityService.getType(context, entity)).thenReturn(entityType); when(entityTypeService.findByEntityType(any(), any())).thenReturn(entityType); @@ -242,7 +242,7 @@ public class EntityServiceImplTest { when(itemService.getMetadata(any(), any(), any(), any(), any())).thenReturn(metsList); when(entity.getItem()).thenReturn(item); when(entityType.getID()).thenReturn(0); - when(relationshipTypeService.findAll(any())).thenReturn(relationshipTypeList); + when(relationshipTypeService.findAll(context, -1, -1)).thenReturn(relationshipTypeList); when(relationshipType.getRightType()).thenReturn(entityType); when(entityService.getType(context, entity)).thenReturn(entityType); when(entityTypeService.findByEntityType(any(), any())).thenReturn(entityType); @@ -262,7 +262,7 @@ public class EntityServiceImplTest { // Mock the state of objects utilized in getRelationshipTypesByTypeName() // to meet the success criteria of the invocation - when(relationshipTypeService.findAll(context)).thenReturn(list); + when(relationshipTypeService.findAll(context, -1, -1)).thenReturn(list); when(relationshipType.getLeftwardType()).thenReturn("leftwardType"); when(relationshipType.getRightwardType()).thenReturn("rightwardType"); diff --git a/dspace-api/src/test/java/org/dspace/content/RelationshipServiceImplTest.java b/dspace-api/src/test/java/org/dspace/content/RelationshipServiceImplTest.java index 37c71a6d36..4e587eccaa 100644 --- a/dspace-api/src/test/java/org/dspace/content/RelationshipServiceImplTest.java +++ b/dspace-api/src/test/java/org/dspace/content/RelationshipServiceImplTest.java @@ -66,7 +66,7 @@ public class RelationshipServiceImplTest { @Test public void testFindAll() throws Exception { // Mock DAO to return our mocked relationshipsList - when(relationshipDAO.findAll(context, Relationship.class)).thenReturn(relationshipsList); + when(relationshipDAO.findAll(context, Relationship.class, -1, -1)).thenReturn(relationshipsList); // The reported Relationship(s) should match our relationshipsList assertEquals("TestFindAll 0", relationshipsList, relationshipService.findAll(context)); } @@ -96,11 +96,10 @@ public class RelationshipServiceImplTest { relationshipTest.add(getRelationship(cindy, hank, hasFather,0,0)); relationshipTest.add(getRelationship(fred, cindy, hasMother,0,0)); relationshipTest.add(getRelationship(bob, cindy, hasMother,1,0)); - when(relationshipService.findByItem(context, cindy)).thenReturn(relationshipTest); - when(relationshipDAO.findByItem(context, cindy)).thenReturn(relationshipTest); + when(relationshipService.findByItem(context, cindy, -1, -1)).thenReturn(relationshipTest); // Mock the state of objects utilized in findByItem() to meet the success criteria of the invocation - when(relationshipDAO.findByItem(context, cindy)).thenReturn(relationshipTest); + when(relationshipDAO.findByItem(context, cindy, -1, -1)).thenReturn(relationshipTest); List results = relationshipService.findByItem(context, cindy); assertEquals("TestFindByItem 0", relationshipTest, results); diff --git a/dspace-api/src/test/java/org/dspace/content/RelationshipTypeTest.java b/dspace-api/src/test/java/org/dspace/content/RelationshipTypeTest.java index bea48e2deb..5e59c3b3cb 100644 --- a/dspace-api/src/test/java/org/dspace/content/RelationshipTypeTest.java +++ b/dspace-api/src/test/java/org/dspace/content/RelationshipTypeTest.java @@ -107,7 +107,7 @@ public class RelationshipTypeTest { mockedList.add(secondRelationshipType); // Mock DAO to return our mockedList - when(relationshipTypeDAO.findAll(context, RelationshipType.class)).thenReturn(mockedList); + when(relationshipTypeDAO.findAll(context, RelationshipType.class, -1, -1)).thenReturn(mockedList); // Invoke findAll() List foundRelationshipTypes = relationshipTypeService.findAll(context); @@ -124,7 +124,7 @@ public class RelationshipTypeTest { mockedList.add(firstRelationshipType); // Mock DAO to return our mockedList - when(relationshipTypeDAO.findByLeftwardOrRightwardTypeName(any(), any())).thenReturn(mockedList); + when(relationshipTypeDAO.findByLeftwardOrRightwardTypeName(context, "mock", -1, -1)).thenReturn(mockedList); // Invoke findByLeftwardOrRightwardTypeName() List found = relationshipTypeService.findByLeftwardOrRightwardTypeName(context, "mock"); @@ -142,10 +142,11 @@ public class RelationshipTypeTest { mockedList.add(firstRelationshipType); // Mock DAO to return our mockedList - when(relationshipTypeDAO.findByEntityType(any(), any())).thenReturn(mockedList); + when(relationshipTypeDAO.findByEntityType(any(), any(), any(), any())).thenReturn(mockedList); // Invoke findByEntityType() - List found = relationshipTypeService.findByEntityType(context, mock(EntityType.class)); + List found = relationshipTypeService + .findByEntityType(context, mock(EntityType.class), -1, -1); // Assert that our expected list contains our expected RelationshipType and nothing more assertThat(found, notNullValue()); diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/RelationshipTypeRestController.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/RelationshipTypeRestController.java index f6f7a28067..303fe6c7e9 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/RelationshipTypeRestController.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/RelationshipTypeRestController.java @@ -71,7 +71,7 @@ public class RelationshipTypeRestController { HttpServletRequest request) throws SQLException { Context context = ContextUtil.obtainContext(request); EntityType entityType = entityTypeService.find(context, id); - List list = relationshipTypeService.findByEntityType(context, entityType); + List list = relationshipTypeService.findByEntityType(context, entityType, -1, -1); List relationshipTypeRests = new LinkedList<>();