Search in sources :

Example 66 with Artifact

use of org.apache.archiva.repository.content.Artifact in project archiva by apache.

the class Maven2RepositoryStorage method getFilePathWithVersion.

@Override
public String getFilePathWithVersion(final String requestPath, ManagedRepositoryContent managedRepositoryContent) throws RelocationException {
    if (StringUtils.endsWith(requestPath, METADATA_FILENAME)) {
        return getFilePath(requestPath, managedRepositoryContent.getRepository());
    }
    String filePath = getFilePath(requestPath, managedRepositoryContent.getRepository());
    Artifact artifact;
    try {
        ContentItem item = managedRepositoryContent.toItem(filePath);
        artifact = managedRepositoryContent.getLayout(BaseRepositoryContentLayout.class).adaptItem(Artifact.class, item);
    } catch (LayoutException e) {
        return filePath;
    }
    if (VersionUtil.isGenericSnapshot(artifact.getArtifactVersion())) {
        // read maven metadata to get last timestamp
        StorageAsset metadataDir = managedRepositoryContent.getRepository().getAsset(filePath).getParent();
        if (!metadataDir.exists()) {
            return filePath;
        }
        StorageAsset metadataFile = metadataDir.resolve(METADATA_FILENAME);
        if (!metadataFile.exists()) {
            return filePath;
        }
        ArchivaRepositoryMetadata archivaRepositoryMetadata = null;
        try {
            archivaRepositoryMetadata = metadataReader.read(metadataFile);
        } catch (RepositoryMetadataException e) {
            log.error("Could not read metadata {}", e.getMessage(), e);
            return filePath;
        }
        int buildNumber = archivaRepositoryMetadata.getSnapshotVersion().getBuildNumber();
        String timestamp = archivaRepositoryMetadata.getSnapshotVersion().getTimestamp();
        // MRM-1846
        if (buildNumber < 1 && timestamp == null) {
            return filePath;
        }
        // org/apache/archiva/archiva-checksum/1.4-M4-SNAPSHOT/archiva-checksum-1.4-M4-SNAPSHOT.jar
        // ->  archiva-checksum-1.4-M4-20130425.081822-1.jar
        filePath = // 
        StringUtils.replace(// 
        filePath, // 
        artifact.getId() + "-" + // 
        artifact.getVersion().getId(), // 
        artifact.getId() + "-" + StringUtils.remove(artifact.getArtifactVersion(), // 
        "-" + VersionUtil.SNAPSHOT) + "-" + // 
        timestamp + "-" + buildNumber);
        throw new RelocationException("/repository/" + managedRepositoryContent.getRepository().getId() + (StringUtils.startsWith(filePath, "/") ? "" : "/") + filePath, RelocationException.RelocationType.TEMPORARY);
    }
    return filePath;
}
Also used : RepositoryMetadataException(org.apache.archiva.repository.metadata.RepositoryMetadataException) RelocationException(org.apache.archiva.metadata.repository.storage.RelocationException) LayoutException(org.apache.archiva.repository.content.LayoutException) StorageAsset(org.apache.archiva.repository.storage.StorageAsset) ArchivaRepositoryMetadata(org.apache.archiva.model.ArchivaRepositoryMetadata) Artifact(org.apache.archiva.repository.content.Artifact) ContentItem(org.apache.archiva.repository.content.ContentItem)

Example 67 with Artifact

use of org.apache.archiva.repository.content.Artifact in project archiva by apache.

the class Maven2RepositoryStorage method readArtifactsMetadata.

@Override
public Collection<ArtifactMetadata> readArtifactsMetadata(ReadMetadataRequest readMetadataRequest) throws RepositoryStorageRuntimeException {
    StorageAsset dir = pathTranslator.toFile(getRepositoryBasedir(readMetadataRequest.getRepositoryId()), readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion());
    if (!(dir.exists() && dir.isContainer())) {
        return Collections.emptyList();
    }
    // all files that are not metadata and not a checksum / signature are considered artifacts
    final Predicate<StorageAsset> dFilter = new ArtifactDirectoryFilter(readMetadataRequest.getFilter());
    // Returns a map TRUE -> (success values), FALSE -> (Exceptions)
    Map<Boolean, List<Try<ArtifactMetadata>>> result = dir.list().stream().filter(dFilter).map(path -> {
        try {
            return Try.success(getArtifactFromFile(readMetadataRequest.getRepositoryId(), readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion(), path));
        } catch (Exception e) {
            log.debug("Could not create metadata for {}:  {}", path, e.getMessage(), e);
            return Try.<ArtifactMetadata>failure(e);
        }
    }).collect(Collectors.groupingBy(Try::isSuccess));
    if (result.containsKey(Boolean.FALSE) && result.get(Boolean.FALSE).size() > 0 && (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE).size() == 0)) {
        log.error("Could not get artifact metadata. Directory: {}. Number of errors {}.", dir, result.get(Boolean.FALSE).size());
        Try<ArtifactMetadata> failure = result.get(Boolean.FALSE).get(0);
        log.error("Sample exception {}", failure.getError().getMessage(), failure.getError());
        throw new RepositoryStorageRuntimeException(readMetadataRequest.getRepositoryId(), "Could not retrieve metadata of the files");
    } else {
        if (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE) == null) {
            return Collections.emptyList();
        }
        return result.get(Boolean.TRUE).stream().map(tr -> tr.get()).collect(Collectors.toList());
    }
}
Also used : NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ArchivaRepositoryMetadata(org.apache.archiva.model.ArchivaRepositoryMetadata) Filter(org.apache.archiva.filter.Filter) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) StorageAsset(org.apache.archiva.repository.storage.StorageAsset) ZonedDateTime(java.time.ZonedDateTime) LoggerFactory(org.slf4j.LoggerFactory) DefaultModelBuilderFactory(org.apache.maven.model.building.DefaultModelBuilderFactory) RepositoryProblemFacet(org.apache.archiva.metadata.model.facets.RepositoryProblemFacet) StringUtils(org.apache.commons.lang3.StringUtils) ReleaseScheme(org.apache.archiva.repository.ReleaseScheme) MavenSystemManager(org.apache.archiva.maven.repository.MavenSystemManager) ModelBuilder(org.apache.maven.model.building.ModelBuilder) RepositoryProxyHandler(org.apache.archiva.proxy.model.RepositoryProxyHandler) Map(java.util.Map) ProjectMetadata(org.apache.archiva.metadata.model.ProjectMetadata) MavenMetadataReader(org.apache.archiva.maven.metadata.MavenMetadataReader) ItemSelector(org.apache.archiva.repository.content.ItemSelector) Try(org.apache.archiva.common.Try) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata) ContentItem(org.apache.archiva.repository.content.ContentItem) Predicate(java.util.function.Predicate) ProxyRegistry(org.apache.archiva.proxy.ProxyRegistry) Collection(java.util.Collection) RepositoryRegistry(org.apache.archiva.repository.RepositoryRegistry) ProxyDownloadException(org.apache.archiva.policies.ProxyDownloadException) ProxyConnector(org.apache.archiva.proxy.model.ProxyConnector) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) Set(java.util.Set) NetworkProxy(org.apache.archiva.proxy.model.NetworkProxy) Reader(java.io.Reader) WagonFactory(org.apache.archiva.maven.common.proxy.WagonFactory) Collectors(java.util.stream.Collectors) Scm(org.apache.maven.model.Scm) FileNotFoundException(java.io.FileNotFoundException) ZoneId(java.time.ZoneId) ManagedRepository(org.apache.archiva.repository.ManagedRepository) Relocation(org.apache.maven.model.Relocation) Organization(org.apache.maven.model.Organization) List(java.util.List) DistributionManagement(org.apache.maven.model.DistributionManagement) ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) ModelBuildingRequest(org.apache.maven.model.building.ModelBuildingRequest) PostConstruct(javax.annotation.PostConstruct) BaseRepositoryContentLayout(org.apache.archiva.repository.content.BaseRepositoryContentLayout) MavenXpp3Reader(org.apache.maven.model.io.xpp3.MavenXpp3Reader) Model(org.apache.maven.model.Model) RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) Artifact(org.apache.archiva.repository.content.Artifact) CiManagement(org.apache.maven.model.CiManagement) RepositoryPathTranslator(org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator) RelocationException(org.apache.archiva.metadata.repository.storage.RelocationException) Dependency(org.apache.maven.model.Dependency) ArchivaItemSelector(org.apache.archiva.repository.content.base.ArchivaItemSelector) ArrayUtils(org.apache.commons.lang3.ArrayUtils) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) RemoteRepository(org.apache.archiva.repository.RemoteRepository) Charset(java.nio.charset.Charset) Service(org.springframework.stereotype.Service) ChecksumAlgorithm(org.apache.archiva.checksum.ChecksumAlgorithm) RepositoryMetadataException(org.apache.archiva.repository.metadata.RepositoryMetadataException) Named(javax.inject.Named) IssueManagement(org.apache.maven.model.IssueManagement) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) SnapshotVersion(org.apache.archiva.model.SnapshotVersion) Logger(org.slf4j.Logger) ModelBuildingException(org.apache.maven.model.building.ModelBuildingException) Channels(java.nio.channels.Channels) VersionUtil(org.apache.archiva.common.utils.VersionUtil) IOException(java.io.IOException) License(org.apache.maven.model.License) RepositoryType(org.apache.archiva.repository.RepositoryType) ApplicationContext(org.springframework.context.ApplicationContext) ChecksummedFile(org.apache.archiva.checksum.ChecksummedFile) ModelProblem(org.apache.maven.model.building.ModelProblem) RepositoryStorageMetadataInvalidException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) MailingList(org.apache.maven.model.MailingList) LayoutException(org.apache.archiva.repository.content.LayoutException) Collections(java.util.Collections) RepositoryStorage(org.apache.archiva.metadata.repository.storage.RepositoryStorage) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) StorageAsset(org.apache.archiva.repository.storage.StorageAsset) List(java.util.List) ArrayList(java.util.ArrayList) MailingList(org.apache.maven.model.MailingList) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata) NoSuchFileException(java.nio.file.NoSuchFileException) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) ProxyDownloadException(org.apache.archiva.policies.ProxyDownloadException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) FileNotFoundException(java.io.FileNotFoundException) RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) RelocationException(org.apache.archiva.metadata.repository.storage.RelocationException) RepositoryMetadataException(org.apache.archiva.repository.metadata.RepositoryMetadataException) ModelBuildingException(org.apache.maven.model.building.ModelBuildingException) IOException(java.io.IOException) RepositoryStorageMetadataInvalidException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException) LayoutException(org.apache.archiva.repository.content.LayoutException)

Example 68 with Artifact

use of org.apache.archiva.repository.content.Artifact in project archiva by apache.

the class ManagedDefaultRepositoryContentTest method deleteItemNotFound.

@Test
public void deleteItemNotFound() throws IOException, URISyntaxException, ItemNotFoundException {
    ManagedRepository repo = createManagedRepoWithContent("delete-repository");
    ManagedRepositoryContent myRepoContent = repo.getContent();
    Path repoRoot = repo.getRoot().getFilePath();
    ArchivaItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.test2").build();
    ContentItem item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Namespace);
    try {
        myRepoContent.deleteItem(item);
        assertTrue("ItemNotFoundException expected for non existing namespace", false);
    } catch (ItemNotFoundException e) {
    }
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar2").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Project);
    try {
        myRepoContent.deleteItem(item);
        assertTrue("ItemNotFoundException expected for non existing project", false);
    } catch (ItemNotFoundException e) {
    }
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar").withVersion("1.1").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Version);
    try {
        myRepoContent.deleteItem(item);
        assertTrue("ItemNotFoundException expected for non existing version", false);
    } catch (ItemNotFoundException e) {
    }
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar").withVersion("1.0").withArtifactId("samplejar").withArtifactVersion("1.0").withExtension("jax").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Artifact);
    try {
        myRepoContent.deleteItem(item);
        assertTrue("ItemNotFoundException expected for non existing artifact", false);
    } catch (ItemNotFoundException e) {
    }
}
Also used : Path(java.nio.file.Path) ArchivaItemSelector(org.apache.archiva.repository.content.base.ArchivaItemSelector) Project(org.apache.archiva.repository.content.Project) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository) ManagedRepository(org.apache.archiva.repository.ManagedRepository) EditableManagedRepository(org.apache.archiva.repository.EditableManagedRepository) Version(org.apache.archiva.repository.content.Version) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) ContentItem(org.apache.archiva.repository.content.ContentItem) ArchivaContentItem(org.apache.archiva.repository.content.base.ArchivaContentItem) Namespace(org.apache.archiva.repository.content.Namespace) Artifact(org.apache.archiva.repository.content.Artifact) ItemNotFoundException(org.apache.archiva.repository.content.ItemNotFoundException) Test(org.junit.Test)

Example 69 with Artifact

use of org.apache.archiva.repository.content.Artifact in project archiva by apache.

the class ManagedDefaultRepositoryContentTest method checkArtifactListWithNamespaceSelectorRecursive.

private void checkArtifactListWithNamespaceSelectorRecursive(List<? extends Artifact> results) {
    assertNotNull(results);
    assertEquals(6, results.size());
    Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("testproj2-1.0.pom")).findFirst().get();
    assertNotNull(artifact);
    assertEquals(6, artifact.getAsset().getParent().getPath().split("/").length);
    artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("testproj1-1.0.pom")).findFirst().get();
    assertNotNull(artifact);
    assertEquals(5, artifact.getAsset().getParent().getPath().split("/").length);
}
Also used : Artifact(org.apache.archiva.repository.content.Artifact) ArchivaConfiguration(org.apache.archiva.configuration.provider.ArchivaConfiguration) ArtifactMappingProvider(org.apache.archiva.maven.repository.metadata.storage.ArtifactMappingProvider) RepositoryPathTranslator(org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository) StorageAsset(org.apache.archiva.repository.storage.StorageAsset) URISyntaxException(java.net.URISyntaxException) Namespace(org.apache.archiva.repository.content.Namespace) ArchivaItemSelector(org.apache.archiva.repository.content.base.ArchivaItemSelector) FileTime(java.nio.file.attribute.FileTime) Version(org.apache.archiva.repository.content.Version) FileType(org.apache.archiva.configuration.model.FileType) Inject(javax.inject.Inject) Charset(java.nio.charset.Charset) MavenMetadataReader(org.apache.archiva.maven.metadata.MavenMetadataReader) ItemSelector(org.apache.archiva.repository.content.ItemSelector) Named(javax.inject.Named) VersionComparator(org.apache.archiva.common.utils.VersionComparator) Path(java.nio.file.Path) ContentItem(org.apache.archiva.repository.content.ContentItem) Before(org.junit.Before) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) OutputStream(java.io.OutputStream) FileTypes(org.apache.archiva.configuration.provider.FileTypes) Project(org.apache.archiva.repository.content.Project) ArchivaContentItem(org.apache.archiva.repository.content.base.ArchivaContentItem) Files(java.nio.file.Files) FileLockManager(org.apache.archiva.common.filelock.FileLockManager) BaseArtifactTypes(org.apache.archiva.repository.content.BaseArtifactTypes) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) IOException(java.io.IOException) Reader(java.io.Reader) Collectors(java.util.stream.Collectors) ManagedRepository(org.apache.archiva.repository.ManagedRepository) DataItem(org.apache.archiva.repository.content.DataItem) List(java.util.List) RepositoryContent(org.apache.archiva.repository.RepositoryContent) Stream(java.util.stream.Stream) Paths(java.nio.file.Paths) BaseRepositoryContentLayout(org.apache.archiva.repository.content.BaseRepositoryContentLayout) LayoutException(org.apache.archiva.repository.content.LayoutException) Assert(org.junit.Assert) EditableManagedRepository(org.apache.archiva.repository.EditableManagedRepository) ItemNotFoundException(org.apache.archiva.repository.content.ItemNotFoundException) Artifact(org.apache.archiva.repository.content.Artifact)

Example 70 with Artifact

use of org.apache.archiva.repository.content.Artifact in project archiva by apache.

the class ManagedDefaultRepositoryContentTest method deleteArtifactItem.

@Test
public void deleteArtifactItem() throws IOException, URISyntaxException, ItemNotFoundException {
    ManagedRepository repo = createManagedRepoWithContent("delete-repository");
    ManagedRepositoryContent myRepoContent = repo.getContent();
    Path repoRoot = repo.getRoot().getFilePath();
    assertTrue(Files.exists(repoRoot.resolve("org/apache/maven/A/1.0/A-1.0.pom")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/maven/A/1.0/A-1.0.war")));
    ArchivaItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("A").withVersion("1.0").withArtifactId("A").withArtifactVersion("1.0").withExtension("pom").build();
    ContentItem item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Artifact);
    myRepoContent.deleteItem(item);
    assertTrue(Files.exists(repoRoot.resolve("org/apache/maven/samplejar/1.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/maven/samplejar/2.0")));
    assertFalse(Files.exists(repoRoot.resolve("org/apache/maven/A/1.0/A-1.0.pom")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/maven/A/1.0/A-1.0.war")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.md5")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.pom")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar")));
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar").withVersion("1.0").withArtifactId("samplejar").withArtifactVersion("1.0").withExtension("jar").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Artifact);
    myRepoContent.deleteItem(item);
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.md5")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.pom")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/2.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/1.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/2.0")));
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar").withVersion("1.0").withArtifactId("samplejar").withArtifactVersion("1.0").withClassifier("source").withExtension("jar").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Artifact);
    myRepoContent.deleteItem(item);
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.md5")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.pom")));
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/2.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/1.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/2.0")));
    selector = ArchivaItemSelector.builder().withNamespace("org.apache.test").withProjectId("samplejar").withVersion("1.0").withArtifactId("samplejar").withArtifactVersion("1.0").withExtension("jar.md5").build();
    item = myRepoContent.getItem(selector);
    assertTrue(item instanceof Artifact);
    myRepoContent.deleteItem(item);
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar")));
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.md5")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0.pom")));
    assertFalse(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/1.0/samplejar-1.0-source.jar.sha1")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/samplejar/2.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/1.0")));
    assertTrue(Files.exists(repoRoot.resolve("org/apache/test/sub/samplejar/2.0")));
}
Also used : Path(java.nio.file.Path) ArchivaItemSelector(org.apache.archiva.repository.content.base.ArchivaItemSelector) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository) ManagedRepository(org.apache.archiva.repository.ManagedRepository) EditableManagedRepository(org.apache.archiva.repository.EditableManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) ContentItem(org.apache.archiva.repository.content.ContentItem) ArchivaContentItem(org.apache.archiva.repository.content.base.ArchivaContentItem) Artifact(org.apache.archiva.repository.content.Artifact) Test(org.junit.Test)

Aggregations

Artifact (org.apache.archiva.repository.content.Artifact)78 BaseRepositoryContentLayout (org.apache.archiva.repository.content.BaseRepositoryContentLayout)63 Test (org.junit.Test)60 StorageAsset (org.apache.archiva.repository.storage.StorageAsset)59 Path (java.nio.file.Path)54 ArchivaItemSelector (org.apache.archiva.repository.content.base.ArchivaItemSelector)26 ItemSelector (org.apache.archiva.repository.content.ItemSelector)21 LayoutException (org.apache.archiva.repository.content.LayoutException)21 ContentItem (org.apache.archiva.repository.content.ContentItem)19 ManagedRepositoryContent (org.apache.archiva.repository.ManagedRepositoryContent)15 IOException (java.io.IOException)13 ManagedRepository (org.apache.archiva.repository.ManagedRepository)13 Project (org.apache.archiva.repository.content.Project)13 MavenMetadataReader (org.apache.archiva.maven.metadata.MavenMetadataReader)12 Version (org.apache.archiva.repository.content.Version)12 ArchivaContentItem (org.apache.archiva.repository.content.base.ArchivaContentItem)12 Reader (java.io.Reader)11 List (java.util.List)11 Collectors (java.util.stream.Collectors)11 Inject (javax.inject.Inject)11