mirror of https://github.com/apache/archiva.git
fix unit in fact fix issue :-)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1388176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c747a1ffe8
commit
af2f301fb4
|
@ -261,7 +261,7 @@ public class Maven2RepositoryMerger
|
||||||
if ( !projectMetadataFileInTargetRepo.exists() )
|
if ( !projectMetadataFileInTargetRepo.exists() )
|
||||||
{
|
{
|
||||||
|
|
||||||
copyFile( projectMetadataFileInSourceRepo, projectMetadataFileInSourceRepo );
|
copyFile( projectMetadataFileInSourceRepo, projectMetadataFileInTargetRepo );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.archiva.configuration.RepositoryScanningConfiguration;
|
import org.apache.archiva.configuration.RepositoryScanningConfiguration;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
|
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -36,7 +37,6 @@ import javax.inject.Inject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
@ -84,6 +84,10 @@ public class Maven2RepositoryMergerTest
|
||||||
public void testMerge()
|
public void testMerge()
|
||||||
throws Exception
|
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();
|
Configuration c = new Configuration();
|
||||||
ManagedRepositoryConfiguration testRepo = new ManagedRepositoryConfiguration();
|
ManagedRepositoryConfiguration testRepo = new ManagedRepositoryConfiguration();
|
||||||
testRepo.setId( TEST_REPO_ID );
|
testRepo.setId( TEST_REPO_ID );
|
||||||
|
@ -97,7 +101,7 @@ public class Maven2RepositoryMergerTest
|
||||||
|
|
||||||
ManagedRepositoryConfiguration targetRepo = new ManagedRepositoryConfiguration();
|
ManagedRepositoryConfiguration targetRepo = new ManagedRepositoryConfiguration();
|
||||||
targetRepo.setId( "target-rep" );
|
targetRepo.setId( "target-rep" );
|
||||||
targetRepo.setLocation( "target" );
|
targetRepo.setLocation( targetRepoPath );
|
||||||
c.addManagedRepository( testRepo );
|
c.addManagedRepository( testRepo );
|
||||||
c.addManagedRepository( targetRepo );
|
c.addManagedRepository( targetRepo );
|
||||||
configuration.save( c );
|
configuration.save( c );
|
||||||
|
@ -105,6 +109,7 @@ public class Maven2RepositoryMergerTest
|
||||||
when( metadataRepository.getArtifacts( TEST_REPO_ID ) ).thenReturn( getArtifacts() );
|
when( metadataRepository.getArtifacts( TEST_REPO_ID ) ).thenReturn( getArtifacts() );
|
||||||
repositoryMerger.merge( metadataRepository, TEST_REPO_ID, "target-rep" );
|
repositoryMerger.merge( metadataRepository, TEST_REPO_ID, "target-rep" );
|
||||||
verify( metadataRepository ).getArtifacts( TEST_REPO_ID );
|
verify( metadataRepository ).getArtifacts( TEST_REPO_ID );
|
||||||
|
assertTrue( mergedArtifact.exists() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue