Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #18 from SumoLogic/mccartney-refreshing
Browse files Browse the repository at this point in the history
Refreshing dependencies
  • Loading branch information
mccartney authored Mar 14, 2019
2 parents 8a9a501 + 5e2ce00 commit 070bbbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,24 @@
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.5</version>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.0</version>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<version>2.25.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -69,7 +74,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0.1</version>
<version>4.5.7</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.localserver.LocalTestServer;
import org.apache.http.localserver.LocalServerTestBase;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestHandler;
import org.junit.*;
Expand All @@ -21,36 +21,32 @@

import static org.mockito.Mockito.atLeast;

public class SumoBuildNotifierTest {
public class SumoBuildNotifierTest extends LocalServerTestBase {
@Rule
public JenkinsRule j = new JenkinsRule();
@Mock
HttpRequestHandler handler;
private LocalTestServer server = null;
private String serverUrl;


@Before
public void setUp() throws Exception {
super.setUp();
handler = Mockito.mock(HttpRequestHandler.class);
server = new LocalTestServer(null, null);
server.register("/jenkinstest/*", handler);
server.start();
this.serverBootstrap.registerHandler("/jenkinstest/*", handler);
start();

serverUrl = "http://" + server.getServiceHostName() + ":"
+ server.getServicePort() + "/jenkinstest/123";
serverUrl = "http://" + server.getInetAddress().getCanonicalHostName() + ":"
+ server.getLocalPort() + "/jenkinstest/123";

// report how to access the server
System.out.println("LocalTestServer available at " + serverUrl);
j.get(PluginDescriptorImpl.class).setUrl(serverUrl);

}

@After
public void tearDown() throws Exception {

server.stop();

super.shutDown();
}

@Test
Expand Down Expand Up @@ -91,8 +87,5 @@ public void testSendJenkinsData() throws Exception {
HttpEntityEnclosingRequest request = (HttpEntityEnclosingRequest) captor.getValue();

Assert.assertTrue("Wrong message length.", ModelFactory.createJenkinsModel(j.getInstance()).toJson().length() >= request.getEntity().getContentLength());



}
}
}

0 comments on commit 070bbbd

Please sign in to comment.