mirror of https://github.com/apache/archiva.git
[MRM-1473] remove use of plexus-spring
fix archiva-rss module git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1130146 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ee78778213
commit
09292c0037
|
@ -60,5 +60,10 @@
|
|||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -31,15 +31,19 @@ import com.sun.syndication.feed.synd.SyndEntry;
|
|||
import com.sun.syndication.feed.synd.SyndEntryImpl;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
import com.sun.syndication.feed.synd.SyndFeedImpl;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Generates RSS feeds.
|
||||
*
|
||||
* @plexus.component role="org.apache.archiva.rss.RssFeedGenerator"
|
||||
* plexus.component role="org.apache.archiva.rss.RssFeedGenerator"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*
|
||||
* @version
|
||||
*/
|
||||
@Service("rssFeedGenerator#default")
|
||||
@Scope("prototype")
|
||||
public class RssFeedGenerator
|
||||
{
|
||||
private Logger log = LoggerFactory.getLogger( RssFeedGenerator.class );
|
||||
|
@ -65,7 +69,7 @@ public class RssFeedGenerator
|
|||
feed.setFeedType( DEFAULT_FEEDTYPE );
|
||||
feed.setEntries( getEntries( dataEntries ) );
|
||||
|
||||
log.debug( "Finished generating the feed \'" + title + "\'." );
|
||||
log.debug( "Finished generating the feed \'{}\'.", title );
|
||||
|
||||
return feed;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,9 @@ import org.apache.archiva.rss.RssFeedEntry;
|
|||
import org.apache.archiva.rss.RssFeedGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -41,8 +43,9 @@ import java.util.TimeZone;
|
|||
* The artifacts will be grouped by the date when the artifacts were gathered.
|
||||
* Each group will appear as one entry in the feed.
|
||||
*
|
||||
* @plexus.component role="org.apache.archiva.rss.processor.RssFeedProcessor" role-hint="new-artifacts"
|
||||
* plexus.component role="org.apache.archiva.rss.processor.RssFeedProcessor" role-hint="new-artifacts"
|
||||
*/
|
||||
@Service("rssFeedProcessor#new-artifacts")
|
||||
public class NewArtifactsRssFeedProcessor
|
||||
extends AbstractArtifactsRssFeedProcessor
|
||||
{
|
||||
|
@ -53,8 +56,9 @@ public class NewArtifactsRssFeedProcessor
|
|||
private static final String desc = "These are the new artifacts found in the repository ";
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
* plexus.requirement
|
||||
*/
|
||||
@Inject
|
||||
private RssFeedGenerator generator;
|
||||
|
||||
private Logger log = LoggerFactory.getLogger( NewArtifactsRssFeedProcessor.class );
|
||||
|
|
|
@ -29,7 +29,9 @@ import org.apache.archiva.rss.RssFeedEntry;
|
|||
import org.apache.archiva.rss.RssFeedGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
@ -41,8 +43,9 @@ import java.util.Map;
|
|||
* generate a rss feed. The versions will be grouped by the date when the artifact
|
||||
* was gathered. Each group will appear as one entry in the feed.
|
||||
*
|
||||
* @plexus.component role="org.apache.archiva.rss.processor.RssFeedProcessor" role-hint="new-versions"
|
||||
* plexus.component role="org.apache.archiva.rss.processor.RssFeedProcessor" role-hint="new-versions"
|
||||
*/
|
||||
@Service("rssFeedProcessor#new-versions")
|
||||
public class NewVersionsOfArtifactRssFeedProcessor
|
||||
extends AbstractArtifactsRssFeedProcessor
|
||||
{
|
||||
|
@ -53,8 +56,9 @@ public class NewVersionsOfArtifactRssFeedProcessor
|
|||
private static final String desc = "These are the new versions of artifact ";
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
* plexus.requirement
|
||||
*/
|
||||
@Inject
|
||||
private RssFeedGenerator generator;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<context:annotation-config/>
|
||||
<context:component-scan base-package="org.apache.archiva.rss"/>
|
||||
|
||||
</beans>
|
|
@ -19,32 +19,41 @@ package org.apache.archiva.rss;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
||||
/**
|
||||
* @version
|
||||
*/
|
||||
@RunWith( SpringJUnit4ClassRunner.class )
|
||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml"} )
|
||||
public class RssFeedGeneratorTest
|
||||
extends PlexusInSpringTestCase
|
||||
extends TestCase
|
||||
{
|
||||
@Inject
|
||||
private RssFeedGenerator generator;
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
generator = (RssFeedGenerator) lookup( RssFeedGenerator.class );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testNewFeed()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -81,7 +90,8 @@ public class RssFeedGeneratorTest
|
|||
assertEquals( "Item 2", syndEntries.get( 1 ).getTitle() );
|
||||
assertEquals( "Item 3", syndEntries.get( 2 ).getTitle() );
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNoDataEntries()
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.archiva.rss.processor;
|
|||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.model.MetadataFacet;
|
||||
import org.apache.archiva.metadata.model.ProjectMetadata;
|
||||
|
@ -29,7 +30,10 @@ import org.apache.archiva.metadata.model.ProjectVersionReference;
|
|||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
||||
import org.apache.archiva.rss.RssFeedGenerator;
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -40,8 +44,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@RunWith( JUnit4.class )
|
||||
public class NewArtifactsRssFeedProcessorTest
|
||||
extends PlexusInSpringTestCase
|
||||
extends TestCase
|
||||
{
|
||||
private static final String TEST_REPO = "test-repo";
|
||||
|
||||
|
@ -49,7 +54,7 @@ public class NewArtifactsRssFeedProcessorTest
|
|||
|
||||
private MetadataRepositoryMock metadataRepository;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -62,6 +67,7 @@ public class NewArtifactsRssFeedProcessorTest
|
|||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Test
|
||||
public void testProcess()
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -21,11 +21,15 @@ package org.apache.archiva.rss.processor;
|
|||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.rss.RssFeedGenerator;
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
import org.easymock.MockControl;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -34,8 +38,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith( JUnit4.class )
|
||||
public class NewVersionsOfArtifactRssFeedProcessorTest
|
||||
extends PlexusInSpringTestCase
|
||||
extends TestCase
|
||||
{
|
||||
private NewVersionsOfArtifactRssFeedProcessor newVersionsProcessor;
|
||||
|
||||
|
@ -49,7 +54,7 @@ public class NewVersionsOfArtifactRssFeedProcessorTest
|
|||
|
||||
private MetadataRepository metadataRepository;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -63,6 +68,7 @@ public class NewVersionsOfArtifactRssFeedProcessorTest
|
|||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Test
|
||||
public void testProcess()
|
||||
throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue