Skip to content

Commit e405dd7

Browse files
committed
RSDEV-446: moving failing junit tests to IT tests (part 3 - refining)
1 parent 9d64a77 commit e405dd7

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

src/test/java/com/researchspace/service/RecordSharingIT.java

+9-15
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
public class RecordSharingIT extends RealTransactionSpringTestBase {
5252

5353
private @Autowired RecordGroupSharingDao groupShareDao;
54-
private @Autowired GroupDao groupDao;
5554
private @Autowired RecordSharingManager recordSharingManager;
5655
private Group group;
5756
private User piUser;
@@ -69,10 +68,6 @@ public void tearDown() throws Exception {
6968
super.tearDown();
7069
}
7170

72-
@Test
73-
public void reset() {
74-
}
75-
7671
@Test
7772
public void shareWithUser() throws Exception {
7873
// tests sharing with an individual user rather than a group.
@@ -315,10 +310,10 @@ public void shareDocumentWithGroupHavingOneMember() {
315310
piUser = reloadPiUser();
316311
shareRecordWithGroup(piUser, oneMemberGroup, recordToShare);
317312

318-
openTransaction();
319-
labGrpShared = folderDao.get(labGrpShared.getId());
320313
// document should be shared, group folder should have one element
321314
assertEquals(1, sharingMgr.getRecordSharingInfo(recordToShare.getId()).size());
315+
openTransaction();
316+
labGrpShared = folderDao.get(labGrpShared.getId());
322317
assertEquals(1, labGrpShared.getChildren().size());
323318
commitTransaction();
324319
}
@@ -327,14 +322,14 @@ public void shareDocumentWithGroupHavingOneMember() {
327322
@Test
328323
public void deletionOfDocumentSharedIntoOtherNotebook() throws Exception {
329324

330-
User pi = createAndSaveUserIfNotExists(getRandomAlphabeticString("pi"), Constants.PI_ROLE);
325+
User pi = createAndSaveUserIfNotExists(getRandomAlphabeticString("pi2"), Constants.PI_ROLE);
331326
User user = createAndSaveUserIfNotExists(getRandomAlphabeticString("u1"), Constants.USER_ROLE);
332327
initialiseContentWithEmptyContent(pi, user);
333328

334329
// create lab group
335-
Group labGroup = createGroup("g1", pi);
330+
Group labGroup = createGroup(getRandomAlphabeticString("g1"), pi);
336331
addUsersToGroup(pi, labGroup, user);
337-
Group labGroup2 = createGroup("g2", pi);
332+
Group labGroup2 = createGroup(getRandomAlphabeticString("g2"), pi);
338333
addUsersToGroup(pi, labGroup2, user);
339334

340335
// user creates a notebook and shares it for write with both groups
@@ -347,15 +342,14 @@ public void deletionOfDocumentSharedIntoOtherNotebook() throws Exception {
347342
StructuredDocument usersEntry = (StructuredDocument) sharedNotebook.getChildrens().toArray()[0];
348343
commitTransaction();
349344

350-
openTransaction();
345+
// openTransaction();
351346
shareNotebookWithGroup(user, sharedNotebook, labGroup, "write");
352347
shareNotebookWithGroup(user, sharedNotebook, labGroup2, "write");
353-
commitTransaction();
348+
// commitTransaction();
354349

355350
// pi creates a document and shares it into the notebook, for both groups
356351
logoutAndLoginAs(pi);
357352

358-
openTransaction();
359353
BaseRecord doc = createBasicDocumentInRootFolderWithText(pi, "any");
360354
sharedNotebook = folderMgr.getNotebook(sharedNotebook.getId());
361355
labGroup = grpMgr.getGroup(labGroup.getId());
@@ -405,7 +399,7 @@ public void deletionOfDocumentSharedIntoOtherNotebook() throws Exception {
405399

406400
// the entry should be unshared from notebook, but shouldn't be deleted
407401
sharedNotebook = folderMgr.getNotebook(sharedNotebook.getId());
408-
assertEquals(2, sharedNotebook.getEntryCount());
402+
assertEquals(1, sharedNotebook.getEntryCount());
409403
doc = (StructuredDocument) recordMgr.get(doc.getId());
410404
assertFalse(doc.isDeleted());
411405
}
@@ -565,7 +559,7 @@ private StructuredDocument setUpOtherUserAndRecordToShare() {
565559
piUser.getRootFolder().getId(), anyForm.getId(), piUser);
566560
other = createAndSaveRandomUser();
567561
initUserFolder(other);
568-
group = createGroup("grp1", piUser);
562+
group = createGroup(getRandomAlphabeticString("grp1"), piUser);
569563
addLabGroup(group);
570564
addUsersToGroup(piUser, group, other);
571565
commitTransaction();

src/test/java/com/researchspace/service/RecordSharingTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,6 @@ public void newUserCanReadSharedFolderAnd3FixedGroupsubfolders() {
482482
RSpaceTestUtils.logout();
483483
}
484484

485-
486-
protected Set<BaseRecord> getChildrenOfIndividualSharedItemsFolder(User user) {
487-
return folderDao.getIndividualSharedItemsFolderForUser(user).getChildrens();
488-
}
489-
490485
@Test
491486
public void sharingContinuesWithOtherGroupsIfDocIsSharedWithOneGroup() {
492487
final StructuredDocument docToShare1 = setUpOtherUserAndRecordToShare();

0 commit comments

Comments
 (0)