[
https://jira.codehaus.org/browse/MRM-1590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Olivier Lamy updated MRM-1590:
------------------------------
Fix Version/s: 1.4-M3
Assignee: Olivier Lamy
> Wrong URL returned by SearchService.getArtifactVersions
> -------------------------------------------------------
>
> Key: MRM-1590
> URL: https://jira.codehaus.org/browse/MRM-1590
> Project: Archiva
> Issue Type: Bug
> Components: rest services
> Affects Versions: 1.4-M2
> Environment: Windows 7
> Java 1.6
> Reporter: Romain Moreau
> Assignee: Olivier Lamy
> Priority: Critical
> Fix For: 1.4-M3
>
>
> {code:title=ArchivaRestTest.java|borderStyle=solid}
> import java.util.List;
> import org.apache.archiva.rest.api.model.Artifact;
> import org.apache.archiva.rest.api.services.SearchService;
> import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
> import org.apache.cxf.jaxrs.client.WebClient;
> import org.apache.log4j.BasicConfigurator;
> import org.apache.log4j.Logger;
> import org.junit.Test;
> public class ArchivaRestTest
> {
> private final Logger logger = Logger.getLogger(ArchivaRestTest.class);
>
> @Test
> public void test() throws Exception
> {
> BasicConfigurator.configure();
>
> logger.debug("test");
>
> String authzHeader = "Basic " +
> org.apache.cxf.common.util.Base64Utility.encode("admin:admin123".getBytes());
> SearchService searchService =
> JAXRSClientFactory.create("http://localhost:8082/archiva/restServices/archivaServices/",SearchService.class);
>
> WebClient.client(searchService).header("Authorization",authzHeader);
>
> WebClient.getConfig(searchService).getHttpConduit().getClient().setReceiveTimeout(100000000);
>
> List<Artifact> artifacts =
> searchService.getArtifactVersions("org.apache.maven.reporting","maven-reporting-api","jar");
>
> if(artifacts != null)
> {
> logger.debug("artifacts != null");
>
> for(Artifact artifact : artifacts)
> {
> logger.debug("artifact[]="+artifact);
> }
> }
> else
> {
> logger.debug("artifacts == null");
> }
> }
> }
> {code}
> produces the following output :
> {noformat}
> 0 [main] DEBUG ArchivaRestTest - test
> 585 [main] DEBUG ArchivaRestTest - artifacts != null
> 585 [main] DEBUG ArchivaRestTest - artifact[]=Artifact{context='internal',
> url='http://localhost:8082/archiva/repository/internal/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar',
> groupId='org.apache.maven.reporting', artifactId='maven-reporting-api',
> repositoryId='internal', version='3', prefix='null', goals=null,
> bundleVersion='null', bundleSymbolicName='null', bundleExportPackage='null',
> bundleExportService='null', bundleDescription='null', bundleName='null',
> bundleLicense='null', bundleDocUrl='null', bundleImportPackage='null',
> bundleRequireBundle='null', classifier='null', packaging='jar',
> fileExtension='jar'}
> 585 [main] DEBUG ArchivaRestTest - artifact[]=Artifact{context='internal',
> url='http://localhost:8082/archiva/repository/internal/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar',
> groupId='org.apache.maven.reporting', artifactId='maven-reporting-api',
> repositoryId='internal', version='2.0.9', prefix='null', goals=null,
> bundleVersion='null', bundleSymbolicName='null', bundleExportPackage='null',
> bundleExportService='null', bundleDescription='null', bundleName='null',
> bundleLicense='null', bundleDocUrl='null', bundleImportPackage='null',
> bundleRequireBundle='null', classifier='null', packaging='jar',
> fileExtension='jar'}
> 586 [main] DEBUG ArchivaRestTest - artifact[]=Artifact{context='internal',
> url='http://localhost:8082/archiva/repository/internal/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar',
> groupId='org.apache.maven.reporting', artifactId='maven-reporting-api',
> repositoryId='internal', version='2.0.6', prefix='null', goals=null,
> bundleVersion='null', bundleSymbolicName='null', bundleExportPackage='null',
> bundleExportService='null', bundleDescription='null', bundleName='null',
> bundleLicense='null', bundleDocUrl='null', bundleImportPackage='null',
> bundleRequireBundle='null', classifier='null', packaging='jar',
> fileExtension='jar'}
> {noformat}
> If you look at the last two artifacts, the URL doesn't match the version, the
> URL seems to be the same for all artifacts in the returned list.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira