@SuppressWarnings ("unchecked") @Test public void testProcess() throws Exception { List<ArtifactMetadata> newArtifacts = new ArrayList<>(); ZonedDateTime whenGathered = ZonedDateTime.now(); newArtifacts.add( createArtifact( "artifact-one", "1.0", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-one", "1.1", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-one", "2.0", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-two", "1.0.1", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-two", "1.0.2", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-two", "1.0.3-SNAPSHOT", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-three", "2.0-SNAPSHOT", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-four", "1.1-beta-2", whenGathered ) ); metadataRepository.setArtifactsByDateRange( newArtifacts ); Map<String, String> reqParams = new HashMap<>(); reqParams.put( RssFeedProcessor.KEY_REPO_ID, TEST_REPO ); SyndFeed feed = newArtifactsProcessor.process( reqParams ); ZonedDateTime cal = ZonedDateTime.now().minusDays(30); assertTrue(ChronoUnit.SECONDS.between(cal.toInstant(), metadataRepository.getFrom().toInstant())<5); assertEquals( null, metadataRepository.getTo() ); assertEquals( TEST_REPO, metadataRepository.getRepoId() ); assertTrue( feed.getTitle().equals( "New Artifacts in Repository 'test-repo'" ) ); assertTrue( feed.getDescription().equals( "New artifacts found in repository 'test-repo' during repository scan." ) ); assertTrue( feed.getLanguage().equals( "en-us" ) ); assertTrue( feed.getPublishedDate().toInstant().truncatedTo( ChronoUnit.MILLIS ).equals( whenGathered.toInstant().truncatedTo( ChronoUnit.MILLIS ) ) ); List<SyndEntry> entries = feed.getEntries(); assertEquals( entries.size(), 1 ); assertTrue( entries.get( 0 ).getTitle().contains( "New Artifacts in Repository 'test-repo' as of " )); assertTrue( entries.get( 0 ).getPublishedDate().toInstant().truncatedTo( ChronoUnit.MILLIS ).equals( whenGathered.toInstant().truncatedTo( ChronoUnit.MILLIS ) ) ); }
@Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { log.debug( "Process new artifacts into rss feeds." ); String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); if ( repoId != null ) { return processNewArtifactsInRepo( repoId ); } return null; }
NewArtifactsRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { log.debug( "Process new artifacts into rss feeds." ); String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); if ( repoId != null ) { return processNewArtifactsInRepo( repoId ); } return null; } }
NewArtifactsRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { log.debug( "Process new artifacts into rss feeds." ); String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); if ( repoId != null ) { return processNewArtifactsInRepo( repoId ); } return null; }  }
NewArtifactsRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { log.debug( "Process new artifacts into rss feeds." ); String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); if ( repoId != null ) { return processNewArtifactsInRepo( repoId ); } return null; }  @Override SyndFeed process( Map<String, String> reqParams ); @Override String getTitle(); @Override String getDescription(); RssFeedGenerator getGenerator(); void setGenerator( RssFeedGenerator generator ); int getNumberOfDaysBeforeNow(); void setNumberOfDaysBeforeNow( int numberOfDaysBeforeNow ); RepositorySessionFactory getRepositorySessionFactory( ); void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory ); }
NewArtifactsRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { log.debug( "Process new artifacts into rss feeds." ); String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); if ( repoId != null ) { return processNewArtifactsInRepo( repoId ); } return null; }  @Override SyndFeed process( Map<String, String> reqParams ); @Override String getTitle(); @Override String getDescription(); RssFeedGenerator getGenerator(); void setGenerator( RssFeedGenerator generator ); int getNumberOfDaysBeforeNow(); void setNumberOfDaysBeforeNow( int numberOfDaysBeforeNow ); RepositorySessionFactory getRepositorySessionFactory( ); void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory );  }