@SuppressWarnings("unchecked") @Test public void testProcess() throws Exception { Date whenGatheredDate = new Date( 123456789 ); ZonedDateTime whenGathered = ZonedDateTime.ofInstant(whenGatheredDate.toInstant(), ZoneId.systemDefault()); ArtifactMetadata artifact1 = createArtifact( whenGathered, "1.0.1" ); ArtifactMetadata artifact2 = createArtifact( whenGathered, "1.0.2" ); Date whenGatheredNextDate = new Date( 345678912 ); ZonedDateTime whenGatheredNext = ZonedDateTime.ofInstant(whenGatheredNextDate.toInstant(), ZoneId.systemDefault()); ArtifactMetadata artifact3 = createArtifact( whenGatheredNext, "1.0.3-SNAPSHOT" ); Map<String, String> reqParams = new HashMap<>(); reqParams.put( RssFeedProcessor.KEY_GROUP_ID, GROUP_ID ); reqParams.put( RssFeedProcessor.KEY_ARTIFACT_ID, ARTIFACT_ID ); expect(metadataRepository.getProjectVersions(session, TEST_REPO, GROUP_ID, ARTIFACT_ID)).andReturn( Arrays.asList("1.0.1", "1.0.2", "1.0.3-SNAPSHOT")); expect(metadataRepository.getArtifacts(session, TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.1")).andReturn( Collections.singletonList(artifact1)); expect(metadataRepository.getArtifacts(session, TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.2")).andReturn( Collections.singletonList(artifact2)); expect(metadataRepository.getArtifacts(session, TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.3-SNAPSHOT")).andReturn( Collections.singletonList(artifact3)); metadataRepositoryControl.replay(); SyndFeed feed = newVersionsProcessor.process( reqParams ); assertEquals( "New Versions of Artifact 'org.apache.archiva:artifact-two'", feed.getTitle() ); assertEquals( "New versions of artifact 'org.apache.archiva:artifact-two' found during repository scan.", feed.getDescription() ); assertEquals( "en-us", feed.getLanguage() ); assertEquals( whenGatheredNext.toInstant(), ZonedDateTime.ofInstant(feed.getPublishedDate().toInstant(), ZoneId.systemDefault()).toInstant() ); List<SyndEntry> entries = feed.getEntries(); assertEquals( 2, entries.size() ); assertTrue( entries.get(0).getTitle().contains("New Versions of Artifact 'org.apache.archiva:artifact-two' as of ")); assertEquals( whenGathered.toInstant(), entries.get( 0 ).getPublishedDate().toInstant() ); assertTrue(entries.get(1).getTitle().contains("New Versions of Artifact 'org.apache.archiva:artifact-two' as of ")); assertEquals( whenGatheredNext.toInstant(), entries.get( 1 ).getPublishedDate().toInstant() ); metadataRepositoryControl.verify(); }
@Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( groupId, artifactId ); } return null; }
NewVersionsOfArtifactRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( groupId, artifactId ); } return null; } }
NewVersionsOfArtifactRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( groupId, artifactId ); } return null; }  }
NewVersionsOfArtifactRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( groupId, artifactId ); } return null; }  @Override SyndFeed process( Map<String, String> reqParams ); @Override String getTitle(); @Override String getDescription(); RssFeedGenerator getGenerator(); void setGenerator( RssFeedGenerator generator ); RepositorySessionFactory getRepositorySessionFactory( ); void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory ); RepositoryRegistry getRepositoryRegistry( ); void setRepositoryRegistry( RepositoryRegistry repositoryRegistry ); }
NewVersionsOfArtifactRssFeedProcessor extends AbstractArtifactsRssFeedProcessor { @Override public SyndFeed process( Map<String, String> reqParams ) throws FeedException { String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( groupId, artifactId ); } return null; }  @Override SyndFeed process( Map<String, String> reqParams ); @Override String getTitle(); @Override String getDescription(); RssFeedGenerator getGenerator(); void setGenerator( RssFeedGenerator generator ); RepositorySessionFactory getRepositorySessionFactory( ); void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory ); RepositoryRegistry getRepositoryRegistry( ); void setRepositoryRegistry( RepositoryRegistry repositoryRegistry );  }