Class GerritNotifierFactory
java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.GerritNotifierFactory
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 -
Method Summary
Modifier and TypeMethodDescriptioncreateGerritNotifier
(IGerritHudsonTriggerConfig config, com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner) Factory method for creating a GerritNotifier.createGerritNotifier
(com.sonymobile.tools.gerrit.gerritevents.GerritCmdRunner cmdRunner, String serverName) Factory method for creating a GerritNotifier.Shortcut method to get the config fromGerritServer
.static GerritNotifierFactory
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.
-
Constructor Details
-
GerritNotifierFactory
public GerritNotifierFactory()
-
-
Method Details
-
getInstance
Gets the singleton instance of the NotificationFactory.- Returns:
- the NotificationFactory.
-
getConfig
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
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
-