Package org.apache.maven.continuum.model.project

Examples of org.apache.maven.continuum.model.project.ProjectNotifier


        project.setArtifactId( "maven" );

        project.setScmUrl( "scm:svn:http://svn.apache.org/repos/asf:maven/maven-1/core/trunk/" );

        ProjectNotifier notifier = new ProjectNotifier();

        Properties props = new Properties();

        props.put( "address", "dev@maven.apache.org" );

        notifier.setConfiguration( props );

        notifier.setFrom( ProjectNotifier.FROM_USER );

        List notifiers = new ArrayList();

        notifiers.add( notifier );

        project.setNotifiers( notifiers );

        project.setVersion( "1.1-SNAPSHOT" );

        // ----------------------------------------------------------------------
        //
        // ----------------------------------------------------------------------

        executor.updateProjectFromCheckOut( checkOut, project, null );

        // ----------------------------------------------------------------------
        //
        // ----------------------------------------------------------------------

        assertNotNull( project );

        assertEquals( "Maven", project.getName() );

        assertEquals( 1, project.getNotifiers().size() );

        ProjectNotifier actualNotifier = (ProjectNotifier) project.getNotifiers().get( 0 );

        assertEquals( "dev@maven.apache.org", actualNotifier.getConfiguration().get( "address" ) );

        // ----------------------------------------------------------------------
        // Updating a new time to prevent duplicated notifiers
        // ----------------------------------------------------------------------

        executor.updateProjectFromCheckOut( checkOut, project, null );

        // ----------------------------------------------------------------------
        //
        // ----------------------------------------------------------------------

        assertEquals( 1, project.getNotifiers().size() );

        actualNotifier = (ProjectNotifier) project.getNotifiers().get( 0 );

        assertEquals( "dev@maven.apache.org", actualNotifier.getConfiguration().get( "address" ) );
    }
View Full Code Here


        context.setProject( project );

        context.setBuildResult( build );

        ProjectNotifier projectNotifier = new ProjectNotifier();
        projectNotifier.setType( "mail" );
        Map<String, String> config = new HashMap<String, String>();
        config.put( MailContinuumNotifier.ADDRESS_FIELD, "foo@bar" );
        projectNotifier.setConfiguration( config );
        List<ProjectNotifier> projectNotifiers = new ArrayList<ProjectNotifier>();
        projectNotifiers.add( projectNotifier );
        context.setNotifier( projectNotifiers );

        //context.put( ContinuumNotificationDispatcher.CONTEXT_BUILD_OUTPUT, buildOutput );
View Full Code Here

        assertEquals( 1, result.getProjectGroups().size() );

        ProjectGroup projectGroup = (ProjectGroup) result.getProjectGroups().get( 0 );

        continuum.addGroupNotifier( projectGroup.getId(), new ProjectNotifier() );

        for ( Iterator i = projectGroup.getProjects().iterator(); i.hasNext(); )
        {
            Project p = (Project) i.next();
            continuum.addNotifier( p.getId(), new ProjectNotifier() );
        }

        projectGroup = continuum.getProjectGroupWithBuildDetails( projectGroup.getId() );

        assertEquals( 1, projectGroup.getNotifiers().size() );
View Full Code Here

        {
            addActionError( authzE.getMessage() );
            return REQUIRES_AUTHORIZATION;
        }

        ProjectNotifier notifier = getNotifier();

        boolean isNew = ( notifier == null || getNotifierId() == 0 );

        if ( isNew )
        {
            notifier = new ProjectNotifier();
        }

        notifier.setType( getNotifierType() );

        notifier.setSendOnSuccess( isSendOnSuccess() );

        notifier.setSendOnFailure( isSendOnFailure() );

        notifier.setSendOnError( isSendOnError() );

        notifier.setSendOnWarning( isSendOnWarning() );

        notifier.setSendOnScmFailure( isSendOnScmFailure() );

        setNotifierConfiguration( notifier );

        saveNotifier( notifier );
View Full Code Here

     * @throws ContinuumException
     */
    public String edit()
        throws ContinuumException
    {
        ProjectNotifier notifier = getNotifier();

        if ( notifier == null )
        {
            notifier = new ProjectNotifier();
        }

        try
        {
            checkAuthorization();
        }
        catch ( AuthorizationRequiredException authzE )
        {
            addActionError( authzE.getMessage() );
            return REQUIRES_AUTHORIZATION;
        }

        // setup Action fields
        setNotifierType( notifier.getType() );

        setSendOnSuccess( notifier.isSendOnSuccess() );

        setSendOnFailure( notifier.isSendOnFailure() );

        setSendOnError( notifier.isSendOnError() );

        setSendOnWarning( notifier.isSendOnWarning() );

        setSendOnScmFailure( notifier.isSendOnScmFailure() );

        initConfiguration( notifier.getConfiguration() );

        return SUCCESS;
    }
View Full Code Here

public class NotifierRecipientCell
    extends DisplayCell
{
    protected String getCellValue( TableModel tableModel, Column column )
    {
        ProjectNotifier notifier = (ProjectNotifier) tableModel.getCurrentRowBean();

        if ( "irc".equals( notifier.getType() ) )
        {
            String address = "";

            if ( notifier.getConfiguration().get( "host" ) != null )
            {
                address += notifier.getConfiguration().get( "host" ) + ":";
            }

            if ( notifier.getConfiguration().get( "port" ) != null )
            {
                address += notifier.getConfiguration().get( "port" ) + ":";
            }

            if ( notifier.getConfiguration().get( "channel" ) != null )
            {
                address += notifier.getConfiguration().get( "channel" );
            }

            return address;
        }
        else
        {
            if ( "wagon".equals( notifier.getType() ) )
            {
                return notifier.getConfiguration().get( "url" ).toString();
            }

            String address = (String) notifier.getConfiguration().get( AbstractContinuumNotifier.ADDRESS_FIELD );

            return address == null ? "" : address;
        }
    }
View Full Code Here

        if ( continuumProject.getNotifiers() != null )
        {
            for ( int i = 0; i < continuumProject.getNotifiers().size(); i++ )
            {
                ProjectNotifier notifier = (ProjectNotifier) continuumProject.getNotifiers().get( i );

                if ( notifier.isFromUser() )
                {
                    ProjectNotifier userNotifier = new ProjectNotifier();

                    userNotifier.setType( notifier.getType() );

                    userNotifier.setEnabled( notifier.isEnabled() );

                    userNotifier.setConfiguration( notifier.getConfiguration() );

                    userNotifier.setFrom( notifier.getFrom() );

                    userNotifier.setRecipientType( notifier.getRecipientType() );

                    userNotifier.setSendOnError( notifier.isSendOnError() );

                    userNotifier.setSendOnFailure( notifier.isSendOnFailure() );

                    userNotifier.setSendOnSuccess( notifier.isSendOnSuccess() );

                    userNotifier.setSendOnWarning( notifier.isSendOnWarning() );

                    userNotifier.setSendOnScmFailure( notifier.isSendOnScmFailure() );

                    userNotifiers.add( userNotifier );
                }
            }
        }
View Full Code Here

        if ( mavenProject.getCiManagement() != null && mavenProject.getCiManagement().getNotifiers() != null )
        {
            for ( Notifier projectNotifier : (List<Notifier>)mavenProject.getCiManagement().getNotifiers() )
            {
                ProjectNotifier notifier = new ProjectNotifier();

                if ( StringUtils.isEmpty( projectNotifier.getType() ) )
                {
                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_TYPE );
                    return null;
                }

                notifier.setType( projectNotifier.getType() );

                if ( projectNotifier.getConfiguration() == null )
                {
                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_CONFIGURATION );
                    return null;
                }

                notifier.setConfiguration( projectNotifier.getConfiguration() );

                notifier.setFrom( ProjectNotifier.FROM_PROJECT );

                notifier.setSendOnSuccess( projectNotifier.isSendOnSuccess() );

                notifier.setSendOnFailure( projectNotifier.isSendOnFailure() );

                notifier.setSendOnError( projectNotifier.isSendOnError() );

                notifier.setSendOnWarning( projectNotifier.isSendOnWarning() );

                notifier.setSendOnScmFailure( false );

                notifiers.add( notifier );
            }
        }
View Full Code Here

        {
            addActionError( authzE.getMessage() );
            return REQUIRES_AUTHORIZATION;
        }

        ProjectNotifier notifier = getContinuum().getGroupNotifier( projectGroupId, notifierId );

        Map configuration = notifier.getConfiguration();

        notifierType = notifier.getType();

        if ( ( "mail".equals( notifierType ) ) || ( "msn".equals( notifierType ) ) ||
            ( "jabber".equals( notifierType ) ) )
        {
            recipient = (String) configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD );
View Full Code Here

        {
            addActionError( authzE.getMessage() );
            return REQUIRES_AUTHORIZATION;
        }

        ProjectNotifier notifier = getContinuum().getNotifier( projectId, notifierId );

        Map configuration = notifier.getConfiguration();

        notifierType = notifier.getType();

        if ( ( "mail".equals( notifierType ) ) || ( "msn".equals( notifierType ) ) ||
            ( "jabber".equals( notifierType ) ) )
        {
            recipient = (String) configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD );
View Full Code Here

TOP

Related Classes of org.apache.maven.continuum.model.project.ProjectNotifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.