1 | package fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.client; | |
2 | ||
3 | import java.net.URI; | |
4 | import java.net.URISyntaxException; | |
5 | import java.util.Map; | |
6 | ||
7 | import org.apache.http.client.utils.URIBuilder; | |
8 | import org.apache.http.impl.client.CloseableHttpClient; | |
9 | ||
10 | import com.sendgrid.Client; | |
11 | import com.sendgrid.SendGrid; | |
12 | ||
13 | /** | |
14 | * Override default {@link SendGrid} implementation in order to be able to | |
15 | * change protocol and port. | |
16 | * | |
17 | * @author Aurélien Baudet | |
18 | */ | |
19 | public class CustomizableUrlClient extends Client { | |
20 | ||
21 | private final String protocol; | |
22 | private final int port; | |
23 | ||
24 | public CustomizableUrlClient(String protocol, int port) { | |
25 | super(); | |
26 | this.protocol = protocol; | |
27 | this.port = port; | |
28 | } | |
29 | ||
30 | public CustomizableUrlClient(Boolean test, String protocol, int port) { | |
31 | super(test); | |
32 | this.protocol = protocol; | |
33 | this.port = port; | |
34 | } | |
35 | ||
36 | public CustomizableUrlClient(CloseableHttpClient httpClient, String protocol, int port) { | |
37 | super(httpClient); | |
38 | this.protocol = protocol; | |
39 | this.port = port; | |
40 | } | |
41 | ||
42 | @Override | |
43 | public URI buildUri(String baseUri, String endpoint, Map<String, String> queryParams) throws URISyntaxException { | |
44 | URI base = super.buildUri(baseUri, endpoint, queryParams); | |
45 | URIBuilder builder = new URIBuilder(base); | |
46 | builder.setScheme(protocol); | |
47 | builder.setPort(port); | |
48 |
2
1. buildUri : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/client/CustomizableUrlClient::buildUri → NO_COVERAGE 2. buildUri : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/client/CustomizableUrlClient::buildUri → KILLED |
return builder.build(); |
49 | } | |
50 | ||
51 | } | |
Mutations | ||
48 |
1.1 2.2 |