public void testFindNewPublishedPrivate() throws Exception { initializeData(); Screen screen1NotPublished = createScreen("SDSL TEST1 Not Published"); genericEntityDao.persistEntity(screen1NotPublished); Screen screen2Published = createScreen("SDSL TEST2 Published"); screen2Published.createScreenResult(); Publication publication = new Publication(); publication.setAuthors("Test Authors"); publication.setJournal("Test Journal"); publication.setTitle("Test Publication Title"); screen2Published.addPublication(publication); genericEntityDao.persistEntity(screen2Published); Screen screen3Mutual = createScreen("SDSL screen3Mutual"); screen3Mutual.createScreenResult(); screen3Mutual.setDataSharingLevel(ScreenDataSharingLevel.MUTUAL_SCREENS); publication = new Publication(); publication.setAuthors("Test Authors x"); publication.setJournal("Test Journal x"); publication.setTitle("Test Publication Title x"); screen3Mutual.addPublication(publication); genericEntityDao.persistEntity(screen3Mutual); Screen screen4Private = createScreen("SDSL private"); screen4Private.createScreenResult(); screen4Private.setDataSharingLevel(ScreenDataSharingLevel.PRIVATE); publication = new Publication(); publication.setAuthors("Test Authors x"); publication.setJournal("Test Journal x"); publication.setTitle("Test Publication Title x"); screen4Private.addPublication(publication); genericEntityDao.persistEntity(screen4Private); Screen screenPrivatePublishedTransferred = createScreen("SDSL screenPrivatePublishedTransferred"); screenPrivatePublishedTransferred.createScreenResult(); screenPrivatePublishedTransferred.setDataSharingLevel(ScreenDataSharingLevel.PRIVATE); publication = new Publication(); publication.setAuthors("Test Authors x"); publication.setJournal("Test Journal x"); publication.setTitle("Test Publication Title x"); screenPrivatePublishedTransferred.createStatusItem( new LocalDate(), ScreenStatus.TRANSFERRED_TO_BROAD_INSTITUTE); screenPrivatePublishedTransferred.addPublication(publication); genericEntityDao.persistEntity(screenPrivatePublishedTransferred); Screen screen4Public = createScreen("SDSL screen4Public"); screen4Public.createScreenResult(); screen4Public.setDataSharingLevel(ScreenDataSharingLevel.SHARED); publication = new Publication(); publication.setAuthors("Test Authors xx"); publication.setJournal("Test Journal xx"); publication.setTitle("Test Publication Title xx"); screen4Public.addPublication(publication); genericEntityDao.persistEntity(screen4Public); flushAndClear(); screen2Published = genericEntityDao.reloadEntity(screen2Published); screen3Mutual = genericEntityDao.reloadEntity(screen3Mutual); screen4Private = genericEntityDao.reloadEntity(screen4Private); Set<Screen> publishedScreens = Sets.newHashSet( screenDataSharingLevelUpdater.findNewPublishedPrivate( ScreenType.SMALL_MOLECULE)); // TODO: Test RNAi as well assertNotNull(publishedScreens); assertEquals( Sets.newHashSet(screen2Published, screen3Mutual, screen4Private), publishedScreens); }