aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-09-20 19:43:05 +0000
committerOlivier Lamy <olamy@apache.org>2012-09-20 19:43:05 +0000
commitaf2f301fb4303471e4ed82db02fc51ffd6c4c950 (patch)
tree2284573315fc47711f5f8e29d68b935129d8640a /archiva-modules
parentc747a1ffe82ee83d005cf3fb32a5146591d906b5 (diff)
downloadarchiva-af2f301fb4303471e4ed82db02fc51ffd6c4c950.tar.gz
archiva-af2f301fb4303471e4ed82db02fc51ffd6c4c950.zip
fix unit in fact fix issue :-)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1388176 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java2
-rw-r--r--archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java13
2 files changed, 10 insertions, 5 deletions
diff --git a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
index 36704f072..aaaaf2977 100644
--- a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
+++ b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
@@ -261,7 +261,7 @@ public class Maven2RepositoryMerger
if ( !projectMetadataFileInTargetRepo.exists() )
{
- copyFile( projectMetadataFileInSourceRepo, projectMetadataFileInSourceRepo );
+ copyFile( projectMetadataFileInSourceRepo, projectMetadataFileInTargetRepo );
}
else
{
diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
index 259af59f5..866953d7a 100644
--- a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
+++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
@@ -26,6 +26,7 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.RepositoryScanningConfiguration;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,12 +37,11 @@ import javax.inject.Inject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.*;
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+@RunWith (ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" })
public class Maven2RepositoryMergerTest
extends TestCase
{
@@ -84,6 +84,10 @@ public class Maven2RepositoryMergerTest
public void testMerge()
throws Exception
{
+ String targetRepoPath = "target" + File.separatorChar + "test-repository-target";
+ File mergedArtifact = new File( targetRepoPath,
+ "com/example/test/test-artifact/1.0-SNAPSHOT/test-artifact-1.0-20100308.230825-1.jar" );
+ assertFalse( mergedArtifact.exists() );
Configuration c = new Configuration();
ManagedRepositoryConfiguration testRepo = new ManagedRepositoryConfiguration();
testRepo.setId( TEST_REPO_ID );
@@ -97,7 +101,7 @@ public class Maven2RepositoryMergerTest
ManagedRepositoryConfiguration targetRepo = new ManagedRepositoryConfiguration();
targetRepo.setId( "target-rep" );
- targetRepo.setLocation( "target" );
+ targetRepo.setLocation( targetRepoPath );
c.addManagedRepository( testRepo );
c.addManagedRepository( targetRepo );
configuration.save( c );
@@ -105,6 +109,7 @@ public class Maven2RepositoryMergerTest
when( metadataRepository.getArtifacts( TEST_REPO_ID ) ).thenReturn( getArtifacts() );
repositoryMerger.merge( metadataRepository, TEST_REPO_ID, "target-rep" );
verify( metadataRepository ).getArtifacts( TEST_REPO_ID );
+ assertTrue( mergedArtifact.exists() );
}
@Test