mirror of https://github.com/apache/archiva.git
correctly use basedir for configuration and tests : pass it tru sysprops via surefire
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1127584 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1736600c3c
commit
a3c891b60d
|
@ -72,4 +72,17 @@
|
|||
<artifactId>maven2-repository</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<basedir>${basedir}</basedir>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -34,7 +34,6 @@ import javax.inject.Named;
|
|||
* ArtifactReference.
|
||||
*
|
||||
* @version $Id$
|
||||
* @todo no need to be a component once legacy path parser is not
|
||||
* <p/>
|
||||
*/
|
||||
public class RepositoryRequest
|
||||
|
|
|
@ -41,6 +41,17 @@ public abstract class AbstractRepositoryLayerTestCase
|
|||
extends TestCase
|
||||
{
|
||||
|
||||
public static String getBasedir()
|
||||
{
|
||||
String basedir = System.getProperty( "basedir" );
|
||||
if ( basedir == null )
|
||||
{
|
||||
basedir = new File( "" ).getAbsolutePath();
|
||||
}
|
||||
|
||||
return basedir;
|
||||
}
|
||||
|
||||
@Inject
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
|
|
|
@ -38,12 +38,14 @@ import java.io.File;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-repo-request-test.xml" } )
|
||||
@ContextConfiguration(
|
||||
locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-repo-request-test.xml" } )
|
||||
public class RepositoryRequestTest
|
||||
extends AbstractRepositoryLayerTestCase
|
||||
{
|
||||
|
||||
@Inject @Named(value = "archivaConfiguration#repo-request-test")
|
||||
@Inject
|
||||
@Named( value = "archivaConfiguration#repo-request-test" )
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
private RepositoryRequest repoRequest;
|
||||
|
@ -367,7 +369,7 @@ public class RepositoryRequestTest
|
|||
private ManagedRepositoryContent createManagedRepo( String layout )
|
||||
throws Exception
|
||||
{
|
||||
File repoRoot = new File( "target/test-repo" );
|
||||
File repoRoot = new File( getBasedir() + "/target/test-repo" );
|
||||
return createManagedRepositoryContent( "test-internal", "Internal Test Repo", repoRoot, layout );
|
||||
}
|
||||
|
||||
|
@ -444,8 +446,8 @@ public class RepositoryRequestTest
|
|||
ManagedRepositoryContent repository = createManagedRepo( "default" );
|
||||
|
||||
// Test (pom) legacy to default
|
||||
assertEquals( "mygroup/myejb/1.0/myejb-1.0.jar",
|
||||
repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository ) );
|
||||
String result = repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository );
|
||||
assertEquals( "mygroup/myejb/1.0/myejb-1.0.jar", result );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,14 +24,15 @@
|
|||
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="false">
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||
<bean name="archivaConfiguration#repo-request-test" class="org.apache.maven.archiva.configuration.DefaultArchivaConfiguration">
|
||||
<property name="registry" ref="registry#configured"/>
|
||||
</bean>
|
||||
|
||||
<alias name="archivaConfiguration#repo-request-test" alias="archivaConfiguration#default"/>
|
||||
<alias name="archivaConfiguration#repo-request-test" alias="archivaConfiguration"/>
|
||||
|
||||
<bean name="registry#configured" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
|
||||
<property name="properties">
|
||||
|
|
Loading…
Reference in New Issue