Class GerritNotifierFactory
- java.lang.Object
-
- com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.GerritNotifierFactory
-
public class GerritNotifierFactory extends Object
A factory for creating notification entities. This factory is mainly created and used to ease unit testing.- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
-
Constructor Summary
Constructors Constructor Description GerritNotifierFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GerritNotifier
createGerritNotifier(IGerritHudsonTriggerConfig config, com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner)
Factory method for creating a GerritNotifier.GerritNotifier
createGerritNotifier(com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner, String serverName)
Factory method for creating a GerritNotifier.IGerritHudsonTriggerConfig
getConfig(String serverName)
Shortcut method to get the config fromGerritServer
.static GerritNotifierFactory
getInstance()
Gets the singleton instance of the NotificationFactory.void
queueBuildCompleted(BuildMemory.MemoryImprint memoryImprint, TaskListener listener)
Queues a build completed command on the send-command queue.void
queueBuildStarted(Run build, TaskListener listener, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, BuildsStartedStats stats)
Queues a build started command on the send-command queue.
-
-
-
Method Detail
-
getInstance
public static GerritNotifierFactory getInstance()
Gets the singleton instance of the NotificationFactory.- Returns:
- the NotificationFactory.
-
getConfig
public IGerritHudsonTriggerConfig getConfig(String serverName)
Shortcut method to get the config fromGerritServer
.- Parameters:
serverName
- the name of the server.- Returns:
- the server-config.
-
createGerritNotifier
public GerritNotifier createGerritNotifier(com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner, String serverName)
Factory method for creating a GerritNotifier.- Parameters:
cmdRunner
- - something capable of sending commands to Gerrit.serverName
- the name of the server.- Returns:
- a GerritNotifier
-
createGerritNotifier
public GerritNotifier createGerritNotifier(IGerritHudsonTriggerConfig config, com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner)
Factory method for creating a GerritNotifier.- Parameters:
config
- - a configuration to use for parameter expansion.cmdRunner
- - something capable of sending commands to Gerrit.- Returns:
- a GerritNotifier
-
queueBuildCompleted
public void queueBuildCompleted(BuildMemory.MemoryImprint memoryImprint, TaskListener listener)
Queues a build completed command on the send-command queue.- Parameters:
memoryImprint
- the memory of the builds.listener
- a listener.- See Also:
GerritSendCommandQueue.queue(com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob)
,BuildCompletedCommandJob
-
queueBuildStarted
public void queueBuildStarted(Run build, TaskListener listener, com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, BuildsStartedStats stats)
Queues a build started command on the send-command queue.- Parameters:
build
- the build.listener
- a listener.event
- the event.stats
- the started stats.- See Also:
GerritSendCommandQueue.queue(com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob)
,BuildStartedCommandJob
-
-