Search in sources :

Example 1 with BrowsePaths

use of org.sonatype.nexus.repository.browse.BrowsePaths in project nexus-repository-r by sonatype-nexus-community.

the class RBrowseNodeGeneratorTest method shouldComputeAssetAndComponentPathWithoutNameDuplication.

@Test
public void shouldComputeAssetAndComponentPathWithoutNameDuplication() {
    final String commonPath = "src/contrib/Archive/ggplot2";
    final String lastSegment = "ggplot2_0.9.0.tar.gz";
    final String assetPath = commonPath + "/" + lastSegment;
    final String componentName = "ggplot2";
    final String componentVersion = "0.9.0";
    // Browse path should not have name duplicates
    final String componentBrowsePath = commonPath + "/" + componentVersion;
    final String assetBrowsePath = componentBrowsePath + "/" + lastSegment;
    Component component = createComponent(componentName, commonPath, componentVersion);
    Asset asset = createAsset(assetPath);
    List<BrowsePaths> pathsAsset = generator.computeAssetPaths(asset, component);
    List<BrowsePaths> pathsComponent = generator.computeComponentPaths(asset, component);
    assertPaths(Arrays.asList(assetBrowsePath.split("/")), pathsAsset);
    assertPaths(Arrays.asList(componentBrowsePath.split("/")), pathsComponent, true);
}
Also used : Asset(org.sonatype.nexus.repository.storage.Asset) BrowsePaths(org.sonatype.nexus.repository.browse.BrowsePaths) Component(org.sonatype.nexus.repository.storage.Component) Test(org.junit.Test)

Example 2 with BrowsePaths

use of org.sonatype.nexus.repository.browse.BrowsePaths in project nexus-repository-r by sonatype-nexus-community.

the class RBrowseNodeGeneratorTest method shouldComputeAssetAndComponentPath.

@Test
public void shouldComputeAssetAndComponentPath() {
    final String commonPath = "bin/macosx/el-capitan/contrib/3.6";
    final String lastSegment = "devtools_2.2.1.tgz";
    final String assetPath = commonPath + "/" + lastSegment;
    final String componentName = "devtools";
    final String componentVersion = "2.2.1";
    final String componentBrowsePath = commonPath + "/" + componentName + "/" + componentVersion;
    final String assetBrowsePath = componentBrowsePath + "/" + lastSegment;
    Component component = createComponent(componentName, commonPath, componentVersion);
    Asset asset = createAsset(assetPath);
    List<BrowsePaths> pathsAsset = generator.computeAssetPaths(asset, component);
    List<BrowsePaths> pathsComponent = generator.computeComponentPaths(asset, component);
    assertPaths(Arrays.asList(assetBrowsePath.split("/")), pathsAsset);
    assertPaths(Arrays.asList(componentBrowsePath.split("/")), pathsComponent, true);
}
Also used : Asset(org.sonatype.nexus.repository.storage.Asset) BrowsePaths(org.sonatype.nexus.repository.browse.BrowsePaths) Component(org.sonatype.nexus.repository.storage.Component) Test(org.junit.Test)

Example 3 with BrowsePaths

use of org.sonatype.nexus.repository.browse.BrowsePaths in project nexus-repository-r by sonatype-nexus-community.

the class RBrowseNodeGeneratorTest method shouldComputeAssetPathWithoutComponent.

@Test
public void shouldComputeAssetPathWithoutComponent() {
    final String assetPath = "bin/macosx/el-capitan/contrib/3.6/devtools_2.2.1.tgz";
    Asset asset = createAsset(assetPath);
    List<BrowsePaths> pathsAsset = generator.computeAssetPaths(asset, null);
    assertPaths(Arrays.asList(assetPath.split("/")), pathsAsset, false);
}
Also used : Asset(org.sonatype.nexus.repository.storage.Asset) BrowsePaths(org.sonatype.nexus.repository.browse.BrowsePaths) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 BrowsePaths (org.sonatype.nexus.repository.browse.BrowsePaths)3 Asset (org.sonatype.nexus.repository.storage.Asset)3 Component (org.sonatype.nexus.repository.storage.Component)2