@Test public void shouldTestCRUDShortTermRecommendations() throws URISyntaxException, MalformedURLException { try { recommendationsStorage.deleteShortTermResourceRecommendations(new URI(USER_URI)); } catch (RecommendationsStorageException e) { fail("failed deleting short term recs"); } List<WebResourceEnhanced> expectedRecs = PersistenceDomainFixtures.getResources(); try { recommendationsStorage.storeShortTermResourceRecommendations(new URI(USER_URI), expectedRecs); } catch (RecommendationsStorageException e) { fail("failed storing short term recs"); } List<WebResourceEnhanced> actualRecs = new ArrayList<WebResourceEnhanced>(); try { actualRecs.addAll( recommendationsStorage.getShortTermResourceRecommendations(new URI(USER_URI))); } catch (RecommendationsStorageException e) { fail("failed getting short term recs"); } assertNotNull(actualRecs); assertEqualsNoOrder(actualRecs.toArray(), expectedRecs.toArray()); try { recommendationsStorage.deleteShortTermResourceRecommendations(new URI(USER_URI)); } catch (RecommendationsStorageException e) { fail("failed deleting short term recs"); } }
@Test public void testExpertsRecommendationsCRUD() throws URISyntaxException, RecommendationsStorageException { recommendationsStorage.deleteExpertsRecommandationsForProject(new URI(PROJECT_URI)); List<UserProfile> expected = PersistenceDomainFixtures.getUserProfiles(); recommendationsStorage.storeExpertsRecommendations(new URI(PROJECT_URI), expected); List<UserProfile> actual = recommendationsStorage.getExpertsRecommendations(new URI(PROJECT_URI)); Assert.assertNotNull(actual); Assert.assertEqualsNoOrder(actual.toArray(), expected.toArray()); recommendationsStorage.deleteExpertsRecommandationsForProject(new URI(PROJECT_URI)); }
@Test public void testProjectRecommendationsCRUD() throws URISyntaxException, MalformedURLException, RecommendationsStorageException { List<ProjectProfile> expected = PersistenceDomainFixtures.getProjects(); recommendationsStorage.deleteProjectProfileRecommendations(new URI(USER_URI)); recommendationsStorage.storeProjectProfileRecommendations(new URI(USER_URI), expected); List<ProjectProfile> actual = recommendationsStorage.getProjectRecommendations(new URI(USER_URI)); Assert.assertNotNull(actual); Assert.assertEqualsNoOrder(actual.toArray(), expected.toArray()); recommendationsStorage.deleteProjectProfileRecommendations(new URI(USER_URI)); }