Java Code Examples for org.sonatype.nexus.repository.storage.Component#group()

The following examples show how to use org.sonatype.nexus.repository.storage.Component#group() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Maven2BrowseNodeGeneratorTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void computeAssetPathForAssetWithComponent() {
  String baseVersion = "1.0.0";
  NestedAttributesMap attributes = new NestedAttributesMap("attributes",
      singletonMap("maven2", singletonMap("baseVersion", baseVersion)));

  Asset asset = createAsset("com/sonatype/example/1.0.0/example-1.0.0.jar");
  Component component = new DefaultComponent();
  component.group("com.sonatype");
  component.name("example");
  component.version(baseVersion);
  component.attributes(attributes);

  List<BrowsePaths> paths = generator.computeAssetPaths(asset, component);

  assertPaths(asList("com", "sonatype", "example", "1.0.0", "example-1.0.0.jar"), paths);
}
 
Example 2
Source File: Maven2BrowseNodeGeneratorTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void computeAssetPathForSnapshotAssetWithComponent() {
  String baseVersion = "1.0-SNAPSHOT";
  NestedAttributesMap attributes = new NestedAttributesMap("attributes",
      singletonMap("maven2", singletonMap("baseVersion", baseVersion)));

  Asset asset = createAsset("org/foo/bar/example/1.0-SNAPSHOT/example-1.0-20171213.212030-158.jar");
  Component component = new DefaultComponent();
  component.group("org.foo.bar");
  component.name("example");
  component.version("1.0-20171213.212030-158");
  component.attributes(attributes);

  List<BrowsePaths> paths = generator.computeAssetPaths(asset, component);

  assertSNAPSHOTPaths(asList("org", "foo", "bar", "example", "1.0-SNAPSHOT", "1.0-20171213.212030-158",
      "example-1.0-20171213.212030-158.jar"), paths, false);
}
 
Example 3
Source File: Maven2BrowseNodeGeneratorTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void computeComponentPath() {
  String baseVersion = "1.0.0";
  NestedAttributesMap attributes = new NestedAttributesMap("attributes",
      singletonMap("maven2", singletonMap("baseVersion", baseVersion)));

  Asset asset = createAsset("group/name/1.0.0/name-1.0.0.jar");
  Component component = new DefaultComponent();
  component.group("group");
  component.name("name");
  component.version(baseVersion);
  component.attributes(attributes);

  List<BrowsePaths> paths = generator.computeComponentPaths(asset, component);

  assertPaths(asList(component.group(), component.name(), component.version()), paths, true);
}
 
Example 4
Source File: Maven2BrowseNodeGeneratorTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void computeSnapshotComponentPath() {
  String baseVersion = "1.0.0-SNAPSHOT";
  NestedAttributesMap attributes = new NestedAttributesMap("attributes",
      singletonMap("maven2", singletonMap("baseVersion", baseVersion)));


  Asset asset = createAsset("group/name/1.0.0-SNAPSHOT/name-1.0.0-20171213.212030-158.jar");

  Component component = new DefaultComponent();
  component.group("group");
  component.name("name");
  component.version("1.0.0-20171213.212030-158");
  component.attributes(attributes);

  List<BrowsePaths> paths = generator.computeComponentPaths(asset, component);

  assertSNAPSHOTPaths(asList(component.group(), component.name(), baseVersion, component.version()), paths, true);
}
 
Example 5
Source File: OrientBrowseNodeManagerTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
private Component createComponent(final String name,
                                  final String group,
                                  final String version,
                                  final String componentId)
{
  EntityMetadata metadata = mock(EntityMetadata.class);
  when(metadata.getId()).thenReturn(new DetachedEntityId(componentId));

  Component component = new DefaultComponent();
  component.name(name);
  component.group(group);
  component.version(version);
  component.setEntityMetadata(metadata);

  when(componentStore.read(EntityHelper.id(component))).thenReturn(component);

  return component;
}
 
Example 6
Source File: ComponentComponentTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private Component makeTestComponent(final String format) {
  Component component = new DefaultComponent();
  component.setEntityMetadata(new DetachedEntityMetadata(
      new DetachedEntityId("testComponentId"),
      new DetachedEntityVersion("1.0")
  ));
  component.format(format);
  component.group("testGroup");
  component.name("testComponentName");
  return component;
}
 
Example 7
Source File: BrowseTestSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
protected Component createComponent(final String name, final String group, final String version) {
  Component component = new DefaultComponent();
  component.name(name);
  component.group(group);
  component.version(version);

  return component;
}