org.apache.maven.model.Developer Java Examples

The following examples show how to use org.apache.maven.model.Developer. 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: RequireRolesTest.java    From extra-enforcer-rules with Apache License 2.0 5 votes vote down vote up
private void addProjectHavingAnArchitectAsDeveloperAndABusinessEngineerAsContributorToHelper() throws Exception
{
    final MavenProject mavenProject = new MavenProject();
    final Developer developer = new Developer();
    developer.addRole( "architect" );
    mavenProject.addDeveloper( developer );
    final Contributor contributor = new Contributor();
    contributor.addRole( "business engineer" );
    mavenProject.addContributor( contributor );
    Mockito.when( helper.evaluate( "${project}" ) ).thenReturn( mavenProject );
}
 
Example #2
Source File: PomIntegrationTest.java    From buck with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldUseTemplateIfProvided() throws Exception {
  MavenPublishable withoutTemplate =
      createMavenPublishable("//example:no-template", "example.com:project:1.0.0", null);
  Model noTemplate = parse(Pom.generatePomFile(pathResolver, withoutTemplate));

  MavenPublishable withTemplate =
      createMavenPublishable(
          "//example:template",
          "example.com:project:1.0.0",
          FakeSourcePath.of(
              TestDataHelper.getTestDataDirectory(getClass())
                  .resolve("poms/template-pom.xml")
                  .toString()));
  Model templated = parse(Pom.generatePomFile(pathResolver, withTemplate));

  // Template sets developers and an example dep. Check that these aren't in the non-templated
  // version
  assertTrue(noTemplate.getDevelopers().isEmpty());
  assertTrue(noTemplate.getDependencies().isEmpty());

  // Now check the same fields in the templated version.
  Developer seenDev = Iterables.getOnlyElement(templated.getDevelopers());
  assertEquals("susan", seenDev.getId());
  assertEquals("Susan The Developer", seenDev.getName());
  assertEquals(ImmutableList.of("Owner"), seenDev.getRoles());

  Dependency seenDep = Iterables.getOnlyElement(templated.getDependencies());
  assertEquals("com.google.guava", seenDep.getGroupId());
  assertEquals("guava", seenDep.getArtifactId());
  assertEquals("19.0", seenDep.getVersion());
}
 
Example #3
Source File: HelmMojoTest.java    From jkube with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void executeInternalWithNoConfigShouldInitConfigWithDefaultValuesAndGenerate(
    @Mocked Scm scm, @Mocked Developer developer) throws Exception {

  // Given
  assertThat(helmMojo.helm, nullValue());
  new Expectations() {{
    mavenProject.getProperties();
    result = new Properties();
    mavenProject.getBuild().getOutputDirectory();
    result = "target/classes";
    mavenProject.getBuild().getDirectory();
    result = "target";
    mavenProject.getArtifactId();
    result = "artifact-id";
    mavenProject.getVersion();
    result = "1337";
    mavenProject.getDescription();
    result = "A description from Maven";
    mavenProject.getUrl();
    result = "https://project.url";
    mavenProject.getScm();
    result = scm;
    scm.getUrl();
    result = "https://scm.url";
    mavenProject.getDevelopers();
    result = Arrays.asList(developer, developer);
    developer.getName();
    result = "John"; result = "John"; result = null;
    developer.getEmail();
    result = "[email protected]"; result = null;
  }};
  // When
  helmMojo.executeInternal();
  // Then
  assertThat(helmMojo.helm, notNullValue());
  assertThat(helmMojo.helm.getChart(), is("artifact-id"));
  assertThat(helmMojo.helm.getChartExtension(), is("tar.gz"));
  assertThat(helmMojo.helm.getVersion(), is("1337"));
  assertThat(helmMojo.helm.getDescription(), is("A description from Maven"));
  assertThat(helmMojo.helm.getHome(), is("https://project.url"));
  assertThat(helmMojo.helm.getSources(), contains("https://scm.url"));
  assertThat(helmMojo.helm.getMaintainers(), contains(
      new Maintainer("John", "[email protected]")
  ));
  assertThat(helmMojo.helm.getIcon(), nullValue());
  assertThat(helmMojo.helm.getAdditionalFiles(), empty());
  assertThat(helmMojo.helm.getTemplates(), empty());
  assertThat(helmMojo.helm.getTypes(), contains(HelmConfig.HelmType.KUBERNETES));
  assertThat(helmMojo.helm.getSourceDir(), is("target/classes/META-INF/jkube/"));
  assertThat(helmMojo.helm.getOutputDir(), is("target/jkube/helm/artifact-id"));
  assertThat(helmMojo.helm.getTarballOutputDir(), is("target"));
  new Verifications() {{
    HelmService.generateHelmCharts(null, helmMojo.helm);
    times = 1;
  }};
}
 
Example #4
Source File: ProjectTeamRenderer.java    From maven-confluence-plugin with Apache License 2.0 4 votes vote down vote up
private void renderTeamMember( Contributor member, int rowId, Map<String, Boolean> headersMap,
                               StringBuilder javascript )
{
    sink.tableRow();

    if ( headersMap.get( IMAGE ) == Boolean.TRUE && showAvatarImages )
    {
        Properties properties = member.getProperties();
        String picUrl = properties.getProperty( "picUrl" );
        if ( StringUtils.isEmpty( picUrl ) )
        {
            picUrl = getGravatarUrl( member.getEmail() );
        }
        if ( StringUtils.isEmpty( picUrl ) )
        {
            picUrl = getSpacerGravatarUrl();
        }
        sink.tableCell();
        sink.figure();
        sink.figureGraphics( picUrl );
        sink.figure_();
        sink.tableCell_();
    }
    //String type = "contributor";
    if ( member instanceof Developer )
    {
        //type = "developer";
        if ( headersMap.get( ID ) == Boolean.TRUE )
        {
            String id = ( (Developer) member ).getId();
            if ( id == null )
            {
                tableCell( null );
            }
            else
            {
                //tableCell( "<a name=\"" + id + "\"></a>" + id, true );
                tableCell( id, true );
            }
        }
    }
    if ( headersMap.get( NAME ) == Boolean.TRUE )
    {
        tableCell( member.getName() );
    }
    if ( headersMap.get( EMAIL ) == Boolean.TRUE )
    {
        tableCell( createLinkPatternedText( member.getEmail(), member.getEmail() ) );
    }
    if ( headersMap.get( URL ) == Boolean.TRUE )
    {
        tableCellForUrl( member.getUrl() );
    }
    if ( headersMap.get( ORGANIZATION ) == Boolean.TRUE )
    {
        tableCell( member.getOrganization() );
    }
    if ( headersMap.get( ORGANIZATION_URL ) == Boolean.TRUE )
    {
        tableCellForUrl( member.getOrganizationUrl() );
    }
    if ( headersMap.get( ROLES ) == Boolean.TRUE )
    {
        if ( member.getRoles() != null )
        {
            // Comma separated roles
            List<String> var = member.getRoles();
            tableCell( StringUtils.join( var.toArray( new String[var.size()] ), ", " ) );
        }
        else
        {
            tableCell( null );
        }
    }
    if ( headersMap.get( TIME_ZONE ) == Boolean.TRUE )
    {
        tableCell( member.getTimezone() );
    }

    if ( headersMap.get( PROPERTIES ) == Boolean.TRUE )
    {
        Properties props = member.getProperties();
        if ( props != null )
        {
            tableCell( propertiesToString( props ) );
        }
        else
        {
            tableCell( null );
        }
    }

    sink.tableRow_();
}
 
Example #5
Source File: ProjectTeamRenderer.java    From maven-confluence-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * @param units contributors and developers to check
 * @return required headers
 */
private Map<String, Boolean> checkRequiredHeaders( List<? extends Contributor> units )
{
    Map<String, Boolean> requiredHeaders = new HashMap<String, Boolean>();

    requiredHeaders.put( IMAGE, Boolean.FALSE );
    requiredHeaders.put( ID, Boolean.FALSE );
    requiredHeaders.put( NAME, Boolean.FALSE );
    requiredHeaders.put( EMAIL, Boolean.FALSE );
    requiredHeaders.put( URL, Boolean.FALSE );
    requiredHeaders.put( ORGANIZATION, Boolean.FALSE );
    requiredHeaders.put( ORGANIZATION_URL, Boolean.FALSE );
    requiredHeaders.put( ROLES, Boolean.FALSE );
    requiredHeaders.put( TIME_ZONE, Boolean.FALSE );
    requiredHeaders.put( PROPERTIES, Boolean.FALSE );

    for ( Contributor unit : units )
    {
        if ( unit instanceof Developer )
        {
            Developer developer = (Developer) unit;
            if ( StringUtils.isNotEmpty( developer.getId() ) )
            {
                requiredHeaders.put( ID, Boolean.TRUE );
            }
        }
        if ( StringUtils.isNotEmpty( unit.getName() ) )
        {
            requiredHeaders.put( NAME, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getEmail() ) )
        {
            requiredHeaders.put( EMAIL, Boolean.TRUE );
            requiredHeaders.put( IMAGE, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getUrl() ) )
        {
            requiredHeaders.put( URL, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getOrganization() ) )
        {
            requiredHeaders.put( ORGANIZATION, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getOrganizationUrl() ) )
        {
            requiredHeaders.put( ORGANIZATION_URL, Boolean.TRUE );
        }
        if ( !isEmpty( unit.getRoles() ) )
        {
            requiredHeaders.put( ROLES, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getTimezone() ) )
        {
            requiredHeaders.put( TIME_ZONE, Boolean.TRUE );
        }
        Properties properties = unit.getProperties();
        boolean hasPicUrl = properties.containsKey( "picUrl" );
        if ( hasPicUrl )
        {
            requiredHeaders.put( IMAGE, Boolean.TRUE );
        }
        boolean isJustAnImageProperty = properties.size() == 1 && hasPicUrl;
        if ( !isJustAnImageProperty && !properties.isEmpty() )
        {
            requiredHeaders.put( PROPERTIES, Boolean.TRUE );
        }
    }
    return requiredHeaders;
}
 
Example #6
Source File: RequireDeveloperRoles.java    From extra-enforcer-rules with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Developer> getRoles( MavenProject mavenProject )
{
    return mavenProject.getDevelopers();
}
 
Example #7
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public List<Developer> get( Model model )
{
    return model.getDevelopers();
}
 
Example #8
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void set( Model model, List<Developer> value )
{
    model.setDevelopers( value );
}