hudson.model.StreamBuildListener Java Examples
The following examples show how to use
hudson.model.StreamBuildListener.
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: AddLabelTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testExpandValues() throws Exception { AddLabel addLabel = new AddLabel("Test Label $FOO"); addLabel.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); EnvVars envVars = new EnvVars(); envVars.put("FOO", "BAR"); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label BAR")); }
Example #2
Source File: AddLabelToFieldTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testExpandValues() throws Exception { AddLabelToField addLabelToField = new AddLabelToField("CustomField_123", "Completed-$FOO"); addLabelToField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); EnvVars envVars = new EnvVars(); envVars.put("FOO", "BAR"); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addLabelToField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToField(eq("SSD-101"), eq("CustomField_123"), eq("Completed-BAR")); }
Example #3
Source File: AddLabelToFieldTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception processing the first JIRA should not affect the second */ @Test public void testResiliency() throws Exception { AddLabelToField addLabelToField = new AddLabelToField("CustomField_123", "Completed"); addLabelToField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).addLabelToField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); addLabelToField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); verify(jiraClientSvc, times(1)).addLabelToField(eq("SSD-102"), eq("CustomField_123"), eq("Completed")); }
Example #4
Source File: UpdateFieldTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception adding the first label add should not disrupt the next label */ @Test public void testResiliency() throws Exception { UpdateField updateField = new UpdateField("CustomField_123", "Completed"); updateField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-102"), eq("CustomField_123"), eq("Completed")); }
Example #5
Source File: UpdateFieldTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testExpandValues() throws Exception { UpdateField updateField = new UpdateField("CustomField_123", "Completed $FOO"); updateField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); EnvVars envVars = new EnvVars(); envVars.put("FOO", "BAR"); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed BAR")); }
Example #6
Source File: JiraBuildStepPublisherTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testInvokeOperations() { IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class); JiraOperationExtension mockOperation = mock(JiraOperationExtension.class); Descriptor mockDescriptor = mock(Descriptor.class); when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor"); when(mockOperation.getDescriptor()).thenReturn(mockDescriptor); JiraExtBuildStep builder = new JiraExtBuildStep(mockStrategy, Arrays.asList(mockOperation)); List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101", MockChangeLogUtil.mockChangeLogSetEntry("example ticket"))); when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class))) .thenReturn(commits); assertTrue(builder.perform(mock(AbstractBuild.class), mock(Launcher.class), new StreamBuildListener(System.out))); verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class)); }
Example #7
Source File: AddLabelTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception adding the first label add should not disrupt the next label */ @Test public void testResiliency() throws Exception { AddLabel addLabel = new AddLabel("Test Label"); addLabel.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).addLabelToTicket("SSD-101", "Test Label"); addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label")); verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-102"), eq("Test Label")); }
Example #8
Source File: AddLabelTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testAddLabel() throws Exception { AddLabel addLabel = new AddLabel("Test Label"); addLabel.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label")); }
Example #9
Source File: JiraPublisherStepTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testInvokeOperations() throws Exception { IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class); JiraOperationExtension mockOperation = mock(JiraOperationExtension.class); Descriptor mockDescriptor = mock(Descriptor.class); when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor"); when(mockOperation.getDescriptor()).thenReturn(mockDescriptor); JiraExtPublisherStep publisher = new JiraExtPublisherStep(mockStrategy, Arrays.asList(mockOperation)); List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101", MockChangeLogUtil.mockChangeLogSetEntry("example ticket"))); when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class))) .thenReturn(commits); assertTrue(publisher.perform(mock(AbstractBuild.class), mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()))); verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class)); }
Example #10
Source File: TransitionTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception adding the first label add should not disrupt the next label */ @Test public void testResiliency() throws Exception { Transition transition = new Transition("Resolve"); transition.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).changeWorkflowOfTicket("SSD-101", "Test Comment"); transition.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-101"), eq("Resolve")); verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-102"), eq("Resolve")); }
Example #11
Source File: AddCommentTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception adding the first label add should not disrupt the next label */ @Test public void testResiliency() throws Exception { AddComment addComment = new AddComment(false, "Test Comment"); addComment.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).addCommentToTicket("SSD-101", "Test Comment"); addComment.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addCommentToTicket("SSD-101", "Test Comment"); verify(jiraClientSvc, times(1)).addCommentToTicket("SSD-102", "Test Comment"); }
Example #12
Source File: AddFixVersionTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
/** * An exception updating a ticket should not impact other issues being updated */ @Test public void testResiliency() throws Exception { AddFixVersion addFixVersion = new AddFixVersion("Beta Release"); addFixVersion.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101")); jiraCommits.add(new JiraCommit("SSD-102")); doThrow(new RuntimeException("Issue is invalid")) .when(jiraClientSvc).addFixVersion("SSD-101", "Beta Release"); addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); // no exception - good! verify(jiraClientSvc, times(1)).addFixVersion("SSD-101", "Beta Release"); verify(jiraClientSvc, times(1)).addFixVersion("SSD-102", "Beta Release"); }
Example #13
Source File: AddFixVersionTest.java From jira-ext-plugin with Apache License 2.0 | 6 votes |
@Test public void testExpandValues() throws Exception { AddFixVersion addFixVersion = new AddFixVersion("Beta Release $FOO"); addFixVersion.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); EnvVars envVars = new EnvVars(); envVars.put("FOO", "BAR"); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101")); jiraCommits.add(new JiraCommit("SSD-101")); addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addFixVersion(eq("SSD-101"), eq("Beta Release BAR")); }
Example #14
Source File: RemotingTest.java From git-client-plugin with MIT License | 5 votes |
/** * Makes sure {@link GitClient} is remotable. */ @Test public void testRemotability() throws Exception { DumbSlave agent = j.createSlave(); GitClient jgit = new JGitAPIImpl(tempFolder.getRoot(), StreamBuildListener.fromStdout()); Computer c = agent.toComputer(); c.connect(false).get(); VirtualChannel channel = c.getChannel(); channel.call(new Work(jgit)); channel.close(); }
Example #15
Source File: AddCommentTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testOnlyCommentOncePerIssue() throws Exception { AddComment addComment = new AddComment(false, "Test Comment"); addComment.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addComment.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addCommentToTicket(eq("SSD-101"), eq("Test Comment")); }
Example #16
Source File: AddCommentTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testCommentOnEveryCommit() throws Exception { AddComment addComment = new AddComment(true, "Test Comment"); addComment.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addComment.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(2)).addCommentToTicket(eq("SSD-101"), eq("Test Comment")); }
Example #17
Source File: SingleTicketStrategyTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testErrorInExpansion() throws Exception { AbstractBuild mockBuild = mock(AbstractBuild.class); SingleTicketStrategy strategy = new SingleTicketStrategy("$FOO"); when(mockBuild.getEnvironment(any(BuildListener.class))).thenThrow(new IOException()); List<JiraCommit> commits = strategy.getJiraCommits(mockBuild, new StreamBuildListener(System.out, Charset.defaultCharset())); assertEquals(1, commits.size()); assertEquals("$FOO", commits.get(0).getJiraTicket()); }
Example #18
Source File: UpdateApprovalEvent.java From kubernetes-pipeline-plugin with Apache License 2.0 | 5 votes |
/** * Java main to test updating events in elasticsearch. Set the following ENV VARS to point to a local ES running in OpenShift * * PIPELINE_ELASTICSEARCH_HOST=elasticsearch.vagrant.f8 * ELASTICSEARCH_SERVICE_PORT=80 */ public static void main(String[] args) { final ApprovalEventDTO approval = createTestApprovalEvent(); hudson.model.BuildListener listener = new StreamBuildListener(System.out, Charset.defaultCharset()); try { ObjectMapper mapper = JsonUtils.createObjectMapper(); String json = mapper.writeValueAsString(approval); boolean success = ElasticsearchClient.updateEvent("AVVy4MSZ_YLNT2M2J-83", json, ElasticsearchClient.APPROVE , listener); assertTrue(success); } catch (Exception e) { LOG.log(Level.SEVERE, "Error when updating event: " + approval, e); } }
Example #19
Source File: AddLabelToFieldTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testAddLabelToField() throws Exception { AddLabelToField addLabelToField = new AddLabelToField("CustomField_123", "Completed"); addLabelToField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); addLabelToField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addLabelToField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); }
Example #20
Source File: UpdateFieldTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testUpdateField() throws Exception { UpdateField updateField = new UpdateField("CustomField_123", "Completed"); updateField.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed")); }
Example #21
Source File: FirstWordOfCommitStrategyTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testFirstWordOfCommit() throws Exception { FirstWordOfCommitStrategy strategy = new FirstWordOfCommitStrategy(); ChangeLogSet mockChangeSet = MockChangeLogUtil.mockChangeLogSet( new MockChangeLogUtil.MockChangeLog("FOO-101 first", "dalvizu"), new MockChangeLogUtil.MockChangeLog("BAR-102 again", "jsmith"), new MockChangeLogUtil.MockChangeLog("BAR-103: third", "jsmith"), new MockChangeLogUtil.MockChangeLog("[BAR-104] fourth", "jsmith"), new MockChangeLogUtil.MockChangeLog("[BAR-105][section] fifth", "jsmith"), new MockChangeLogUtil.MockChangeLog("[BAR-106]: sixth", "jsmith"), new MockChangeLogUtil.MockChangeLog("MY_EXAMPLE_PROJECT-107 seventh", "jsmith"), new MockChangeLogUtil.MockChangeLog("2013PROJECT-108 eighth", "jsmith"), new MockChangeLogUtil.MockChangeLog("No Valid Ticket", "build robot")); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getChangeSet()).thenReturn(mockChangeSet); List<JiraCommit> commits = strategy.getJiraCommits(mockBuild, new StreamBuildListener(System.out, Charset.defaultCharset())); assertEquals(commits.size(), 7); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("FOO-101")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-102")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-103")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-104")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-105")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-106")))); assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("MY_EXAMPLE_PROJECT-107")))); assertThat(commits, is(not(hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("2013PROJECT-108")))))); }
Example #22
Source File: TransitionTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testTransition() throws Exception { Transition transition = new Transition("Resolve"); transition.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment"))); transition.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-101"), eq("Resolve")); }
Example #23
Source File: AddFixVersionTest.java From jira-ext-plugin with Apache License 2.0 | 5 votes |
@Test public void testAddFixVersion() throws Exception { AddFixVersion addFixVersion = new AddFixVersion("Beta Release"); addFixVersion.setJiraClientSvc(jiraClientSvc); AbstractBuild mockBuild = mock(AbstractBuild.class); when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars()); List<JiraCommit> jiraCommits = new ArrayList<>(); jiraCommits.add(new JiraCommit("SSD-101")); jiraCommits.add(new JiraCommit("SSD-101")); addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset())); verify(jiraClientSvc, times(1)).addFixVersion(eq("SSD-101"), eq("Beta Release")); }
Example #24
Source File: BaseSendEvent.java From kubernetes-pipeline-plugin with Apache License 2.0 | 5 votes |
/** * Java main to test creating events in elasticsearch. Set the following ENV VARS to point to a local ES running in OpenShift * * PIPELINE_ELASTICSEARCH_HOST=elasticsearch.vagrant.f8 * ELASTICSEARCH_SERVICE_PORT=80 * * @param event to send to elasticsearch */ public static void send (DTOSupport event, String type){ hudson.model.BuildListener listener = new StreamBuildListener(System.out, Charset.defaultCharset()); try { ObjectMapper mapper = JsonUtils.createObjectMapper(); String json = mapper.writeValueAsString(event); String id = ElasticsearchClient.createEvent(json, type , listener); listener.getLogger().println("Added events id: " + id); } catch (Exception e) { LOG.log(Level.SEVERE, "Error when sending build data: " + event, e); } }
Example #25
Source File: DeflakeActionIntegrationTest.java From flaky-test-handler-plugin with Apache License 2.0 | 4 votes |
public FailingTestResultAction() { super(new TestResult(), new StreamBuildListener(System.out)); }
Example #26
Source File: GitLabVotePublisherTest.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@Before public void setup() { listener = new StreamBuildListener(jenkins.createTaskListener().getLogger(), Charset.defaultCharset()); mockServerClient = new MockServerClient("localhost", mockServer.getPort()); mockUser(1, "jenkins"); }
Example #27
Source File: GitLabAcceptMergeRequestPublisherTest.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@Before public void setup() { listener = new StreamBuildListener(jenkins.createTaskListener().getLogger(), Charset.defaultCharset()); mockServerClient = new MockServerClient("localhost", mockServer.getPort()); }
Example #28
Source File: GitLabCommitStatusPublisherTest.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@Before public void setup() { listener = new StreamBuildListener(jenkins.createTaskListener().getLogger(), Charset.defaultCharset()); mockServerClient = new MockServerClient("localhost", mockServer.getPort()); }
Example #29
Source File: GitLabMessagePublisherTest.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@Before public void setup() { listener = new StreamBuildListener(jenkins.createTaskListener().getLogger(), Charset.defaultCharset()); mockServerClient = new MockServerClient("localhost", mockServer.getPort()); }
Example #30
Source File: GitLabEnvironmentContributorTest.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@Before public void setup() { listener = new StreamBuildListener(jenkins.createTaskListener().getLogger(), Charset.defaultCharset()); }