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>
|
<artifactId>maven2-repository</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</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>
|
</project>
|
||||||
|
|
|
@ -34,7 +34,6 @@ import javax.inject.Named;
|
||||||
* ArtifactReference.
|
* ArtifactReference.
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @todo no need to be a component once legacy path parser is not
|
|
||||||
* <p/>
|
* <p/>
|
||||||
*/
|
*/
|
||||||
public class RepositoryRequest
|
public class RepositoryRequest
|
||||||
|
|
|
@ -41,6 +41,17 @@ public abstract class AbstractRepositoryLayerTestCase
|
||||||
extends TestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static String getBasedir()
|
||||||
|
{
|
||||||
|
String basedir = System.getProperty( "basedir" );
|
||||||
|
if ( basedir == null )
|
||||||
|
{
|
||||||
|
basedir = new File( "" ).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return basedir;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ApplicationContext applicationContext;
|
protected ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,14 @@ import java.io.File;
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @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
|
public class RepositoryRequestTest
|
||||||
extends AbstractRepositoryLayerTestCase
|
extends AbstractRepositoryLayerTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject @Named(value = "archivaConfiguration#repo-request-test")
|
@Inject
|
||||||
|
@Named( value = "archivaConfiguration#repo-request-test" )
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
private RepositoryRequest repoRequest;
|
private RepositoryRequest repoRequest;
|
||||||
|
@ -367,7 +369,7 @@ public class RepositoryRequestTest
|
||||||
private ManagedRepositoryContent createManagedRepo( String layout )
|
private ManagedRepositoryContent createManagedRepo( String layout )
|
||||||
throws Exception
|
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 );
|
return createManagedRepositoryContent( "test-internal", "Internal Test Repo", repoRoot, layout );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,8 +446,8 @@ public class RepositoryRequestTest
|
||||||
ManagedRepositoryContent repository = createManagedRepo( "default" );
|
ManagedRepositoryContent repository = createManagedRepo( "default" );
|
||||||
|
|
||||||
// Test (pom) legacy to default
|
// Test (pom) legacy to default
|
||||||
assertEquals( "mygroup/myejb/1.0/myejb-1.0.jar",
|
String result = repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository );
|
||||||
repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository ) );
|
assertEquals( "mygroup/myejb/1.0/myejb-1.0.jar", result );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -24,14 +24,15 @@
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
http://www.springframework.org/schema/context
|
http://www.springframework.org/schema/context
|
||||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||||
default-lazy-init="false">
|
|
||||||
|
|
||||||
|
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||||
<bean name="archivaConfiguration#repo-request-test" class="org.apache.maven.archiva.configuration.DefaultArchivaConfiguration">
|
<bean name="archivaConfiguration#repo-request-test" class="org.apache.maven.archiva.configuration.DefaultArchivaConfiguration">
|
||||||
<property name="registry" ref="registry#configured"/>
|
<property name="registry" ref="registry#configured"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<alias name="archivaConfiguration#repo-request-test" alias="archivaConfiguration#default"/>
|
<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">
|
<bean name="registry#configured" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
|
||||||
<property name="properties">
|
<property name="properties">
|
||||||
|
|
Loading…
Reference in New Issue