/** * Method addConfiguration * * @param key * @param value */ public void addConfiguration(Object key, String value) { getConfiguration().put( key, value ); } //-- void addConfiguration(Object, String)
/** * Method addConfiguration. * * @param key * @param value */ public void addConfiguration( Object key, String value ) { getConfiguration().put( key, value ); } //-- void addConfiguration( Object, String )
private String getFromMailbox( List<ProjectNotifier> notifiers ) { if ( fromMailbox != null ) { return fromMailbox; } String address = null; for ( ProjectNotifier notifier : notifiers ) { Map<String, String> configuration = notifier.getConfiguration(); if ( configuration != null && StringUtils.isNotEmpty( configuration.get( ADDRESS_FIELD ) ) ) { address = configuration.get( ADDRESS_FIELD ); break; } } if ( StringUtils.isEmpty( address ) ) { return FALLBACK_FROM_MAILBOX; } // olamy : CONTINUUM-860 if address contains commas we use only the first one if ( address != null && address.contains( "," ) ) { String[] addresses = StringUtils.split( address, "," ); return addresses[0]; } return address; }
private void prepareBuildComplete( ProjectScmRoot projectScmRoot, ProjectNotifier projectNotifier ) throws NotificationException { // ---------------------------------------------------------------------- // Check if the message should be sent at all // ---------------------------------------------------------------------- if ( !shouldNotify( projectScmRoot, projectNotifier ) ) { return; } sendMessage( projectNotifier.getConfiguration(), generateMessage( projectScmRoot, configurationService ) ); }
private void prepareBuildComplete( ProjectScmRoot projectScmRoot, ProjectNotifier notifier ) throws NotificationException { if ( !shouldNotify( projectScmRoot, notifier ) ) { return; } sendMessage( notifier.getConfiguration(), generateMessage( projectScmRoot, configurationService ) ); }
if ( notifier.getConfiguration() != null ) map.put( ContinuumBuildAgentUtil.KEY_NOTIFIER_CONFIGURATION, notifier.getConfiguration() );
serializer.writeEndElement(); if ( projectNotifier.getConfiguration() != null && projectNotifier.getConfiguration().size() > 0 ) for ( Iterator iter = projectNotifier.getConfiguration().keySet().iterator(); iter.hasNext(); ) String value = (String) projectNotifier.getConfiguration().get( key ); serializer.writeStartElement( "" + key + "" ); serializer.writeCharacters( value );
notifier.getConfiguration().containsKey( ADDRESS_FIELD ) )
private void buildComplete( Project project, ProjectNotifier notifier, BuildResult build, BuildDefinition buildDef ) throws NotificationException { // ---------------------------------------------------------------------- // Check if the message should be sent at all // ---------------------------------------------------------------------- BuildResult previousBuild = getPreviousBuild( project, buildDef, build ); if ( !shouldNotify( build, previousBuild, notifier ) ) { return; } sendMessage( notifier.getConfiguration(), generateMessage( project, build, configurationService ) ); }
private void addNotifierAdresses( ProjectNotifier notifier, Set<String> recipients, Project project, Map context ) throws NotificationException if ( notifier.getConfiguration() != null ) String addressField = (String) notifier.getConfiguration().get( ADDRESS_FIELD ); String committerField = (String) notifier.getConfiguration().get( COMMITTER_FIELD ); if ( StringUtils.isNotEmpty( committerField ) )
public void assertProjectEquals( String name, List<ProjectNotifier> notifiers, String version, Project actual ) { assertEquals( "project.name", name, actual.getName() ); // assertEquals( "project.scmUrl", scmUrl, actual.getScmUrl() ); if ( notifiers != null ) { assertNotNull( "project.notifiers", actual.getNotifiers() ); assertEquals( "project.notifiers.size", notifiers.size(), actual.getNotifiers().size() ); for ( int i = 0; i < notifiers.size(); i++ ) { ProjectNotifier notifier = notifiers.get( i ); ProjectNotifier actualNotifier = (ProjectNotifier) actual.getNotifiers().get( i ); assertEquals( "project.notifiers.notifier.type", notifier.getType(), actualNotifier.getType() ); assertEquals( "project.notifiers.notifier.configuration.address", notifier.getConfiguration().get( "address" ), actualNotifier.getConfiguration().get( "address" ) ); } } assertEquals( "project.version", version, actual.getVersion() ); }
public void assertProjectEquals( String name, List notifiers, String version, Project actual ) { assertEquals( "project.name", name, actual.getName() ); // assertEquals( "project.scmUrl", scmUrl, actual.getScmUrl() ); if ( notifiers != null ) { assertNotNull( "project.notifiers", actual.getNotifiers() ); assertEquals( "project.notifiers.size", notifiers.size(), actual.getNotifiers().size() ); for ( int i = 0; i < notifiers.size(); i++ ) { ProjectNotifier notifier = (ProjectNotifier) notifiers.get( i ); ProjectNotifier actualNotifier = (ProjectNotifier) actual.getNotifiers().get( i ); assertEquals( "project.notifiers.notifier.type", notifier.getType(), actualNotifier.getType() ); assertEquals( "project.notifiers.notifier.configuration.address", notifier.getConfiguration().get( "address" ), actualNotifier.getConfiguration().get( "address" ) ); } } assertEquals( "project.version", version, actual.getVersion() ); }
private void buildComplete( Project project, ProjectNotifier projectNotifier, BuildResult build, BuildDefinition buildDef ) throws NotificationException { // ---------------------------------------------------------------------- // Check if the message should be sent at all // ---------------------------------------------------------------------- BuildResult previousBuild = getPreviousBuild( project, buildDef, build ); if ( !shouldNotify( build, previousBuild, projectNotifier ) ) { return; } sendMessage( projectNotifier.getConfiguration(), generateMessage( project, build, configurationService ) ); }
for ( ProjectNotifier notifier : notifiers ) Map<String, String> configuration = notifier.getConfiguration(); if ( configuration != null && StringUtils.isNotEmpty( configuration.get( ADDRESS_FIELD ) ) )
Map<String, String> conf = notifier.getConfiguration(); if ( conf != null )
private void sendNotification( String messageId, ProjectNotifier projectNotifier, Map context ) { String notifierType = projectNotifier.getType(); if ( !projectNotifier.isEnabled() ) { getLogger().info( notifierType + " notifier (id=" + projectNotifier.getId() + ") is disabled." ); return; } Map configuration = projectNotifier.getConfiguration(); try { context.put( CONTEXT_PROJECT_NOTIFIER, projectNotifier ); Notifier notifier = notifierManager.getNotifier( notifierType ); Set recipients = recipientSource.getRecipients( String.valueOf( projectNotifier.getId() ), messageId, configuration, context ); notifier.sendNotification( messageId, recipients, configuration, context ); } catch ( NotificationException e ) { getLogger().error( "Error while trying to use the " + notifierType + " notifier.", e ); } } }
public ProjectNotifier addNotifier( int projectId, ProjectNotifier notifier ) throws ContinuumException { ProjectNotifier notif = new ProjectNotifier(); notif.setSendOnSuccess( notifier.isSendOnSuccess() ); notif.setSendOnFailure( notifier.isSendOnFailure() ); notif.setSendOnError( notifier.isSendOnError() ); notif.setSendOnWarning( notifier.isSendOnWarning() ); notif.setConfiguration( notifier.getConfiguration() ); notif.setType( notifier.getType() ); notif.setFrom( ProjectNotifier.FROM_USER ); Project project = getProjectWithAllDetails( projectId ); project.addNotifier( notif ); updateProject( project ); return notif; }
public ProjectNotifier addNotifier( int projectId, ProjectNotifier notifier ) throws ContinuumException { ProjectNotifier notif = new ProjectNotifier(); notif.setSendOnSuccess( notifier.isSendOnSuccess() ); notif.setSendOnFailure( notifier.isSendOnFailure() ); notif.setSendOnError( notifier.isSendOnError() ); notif.setSendOnWarning( notifier.isSendOnWarning() ); notif.setSendOnScmFailure( notifier.isSendOnScmFailure() ); notif.setConfiguration( notifier.getConfiguration() ); notif.setType( notifier.getType() ); notif.setFrom( ProjectNotifier.FROM_USER ); Project project = getProjectWithAllDetails( projectId ); project.addNotifier( notif ); updateProject( project ); return notif; }
public ProjectNotifier addGroupNotifier( int projectGroupId, ProjectNotifier notifier ) throws ContinuumException { ProjectNotifier notif = new ProjectNotifier(); notif.setSendOnSuccess( notifier.isSendOnSuccess() ); notif.setSendOnFailure( notifier.isSendOnFailure() ); notif.setSendOnError( notifier.isSendOnError() ); notif.setSendOnWarning( notifier.isSendOnWarning() ); notif.setConfiguration( notifier.getConfiguration() ); notif.setType( notifier.getType() ); notif.setFrom( ProjectNotifier.FROM_USER ); ProjectGroup projectGroup = getProjectGroupWithBuildDetails( projectGroupId ); projectGroup.addNotifier( notif ); try { store.updateProjectGroup( projectGroup ); } catch ( ContinuumStoreException cse ) { throw new ContinuumException( "unable to add notifier to project group", cse ); } return notif; }
public ProjectNotifier addGroupNotifier( int projectGroupId, ProjectNotifier notifier ) throws ContinuumException { ProjectNotifier notif = new ProjectNotifier(); notif.setSendOnSuccess( notifier.isSendOnSuccess() ); notif.setSendOnFailure( notifier.isSendOnFailure() ); notif.setSendOnError( notifier.isSendOnError() ); notif.setSendOnWarning( notifier.isSendOnWarning() ); notif.setSendOnScmFailure( notifier.isSendOnScmFailure() ); notif.setConfiguration( notifier.getConfiguration() ); notif.setType( notifier.getType() ); notif.setFrom( ProjectNotifier.FROM_USER ); ProjectGroup projectGroup = getProjectGroupWithBuildDetails( projectGroupId ); projectGroup.addNotifier( notif ); try { projectGroupDao.updateProjectGroup( projectGroup ); } catch ( ContinuumStoreException cse ) { throw new ContinuumException( "unable to add notifier to project group", cse ); } return notif; }