1 | package fr.sii.ogham.email.sendgrid.v4.builder.sendgrid; | |
2 | ||
3 | import java.net.URL; | |
4 | ||
5 | import org.apache.http.client.HttpClient; | |
6 | import org.apache.http.impl.client.CloseableHttpClient; | |
7 | import org.slf4j.Logger; | |
8 | import org.slf4j.LoggerFactory; | |
9 | ||
10 | import com.sendgrid.Client; | |
11 | import com.sendgrid.SendGrid; | |
12 | ||
13 | import fr.sii.ogham.core.builder.MessagingBuilder; | |
14 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilder; | |
15 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderHelper; | |
16 | import fr.sii.ogham.core.builder.configurer.Configurer; | |
17 | import fr.sii.ogham.core.builder.context.BuildContext; | |
18 | import fr.sii.ogham.core.builder.context.DefaultBuildContext; | |
19 | import fr.sii.ogham.core.message.content.MayHaveStringContent; | |
20 | import fr.sii.ogham.core.message.content.MultiContent; | |
21 | import fr.sii.ogham.core.mimetype.MimeTypeProvider; | |
22 | import fr.sii.ogham.email.builder.EmailBuilder; | |
23 | import fr.sii.ogham.email.message.Email; | |
24 | import fr.sii.ogham.email.message.content.ContentWithAttachments; | |
25 | import fr.sii.ogham.email.sendgrid.builder.AbstractSendGridBuilder; | |
26 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.SendGridV4Sender; | |
27 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.client.CustomizableUrlClient; | |
28 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.client.DelegateSendGridClient; | |
29 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.client.SendGridClient; | |
30 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.client.SendGridInterceptor; | |
31 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.compat.CompatUtil; | |
32 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.handler.ContentWithAttachmentsHandler; | |
33 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.handler.MultiContentHandler; | |
34 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.handler.PriorizedContentHandler; | |
35 | import fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.handler.StringContentHandler; | |
36 | ||
37 | /** | |
38 | * Configures how SendGrid implementation will send {@link Email}s. | |
39 | * | |
40 | * This implementation uses SendGrid HTTP API. | |
41 | * | |
42 | * <p> | |
43 | * To send {@link Email} using SendGrid, you need to register this builder into | |
44 | * a {@link MessagingBuilder} like this: | |
45 | * | |
46 | * <pre> | |
47 | * <code> | |
48 | * MessagingBuilder msgBuilder = ... | |
49 | * msgBuilder.email() | |
50 | * .sender(SendGridV4Builder.class) // registers the builder and accesses to that builder for configuring it | |
51 | * </code> | |
52 | * </pre> | |
53 | * | |
54 | * Once the builder is registered, sending email through SendGrid requires | |
55 | * either an API key or a username/password pair. You can define it using: | |
56 | * | |
57 | * <pre> | |
58 | * <code> | |
59 | * msgBuilder.email() | |
60 | * .sender(SendGridV4Builder.class) // registers the builder and accesses to that builder for configuring it | |
61 | * .apiKey("foo") | |
62 | * </code> | |
63 | * </pre> | |
64 | * | |
65 | * Or you can also use property keys (using interpolation): | |
66 | * | |
67 | * <pre> | |
68 | * <code> | |
69 | * msgBuilder | |
70 | * .environment() | |
71 | * .properties() | |
72 | * .set("custom.property.for.api-key", "foo") | |
73 | * .and() | |
74 | * .and() | |
75 | * .email() | |
76 | * .sender(SendGridV4Builder.class) // registers the builder and accesses to that builder for configuring it | |
77 | * .apiKey("${custom.property.for.api-key}") | |
78 | * </code> | |
79 | * </pre> | |
80 | * | |
81 | * <p> | |
82 | * Finally, Ogham will transform general {@link Email} object into | |
83 | * {@link SendGrid}.Email object. This transformation will fit almost all use | |
84 | * cases but you may need to customize a part of the SendGrid message. Instead | |
85 | * of doing again the same work Ogham does, this builder allows you to intercept | |
86 | * the message to modify it just before sending it: | |
87 | * | |
88 | * <pre> | |
89 | * <code> | |
90 | * .sender(SendGridV4Builder.class) | |
91 | * .intercept(new MyCustomInterceptor()) | |
92 | * </code> | |
93 | * </pre> | |
94 | * | |
95 | * See {@link SendGridInterceptor} for more information. | |
96 | * | |
97 | * @author Aurélien Baudet | |
98 | * | |
99 | */ | |
100 | public class SendGridV4Builder extends AbstractSendGridBuilder<SendGridV4Builder, EmailBuilder> { | |
101 | private static final Logger LOG = LoggerFactory.getLogger(SendGridV4Builder.class); | |
102 | ||
103 | private SendGridClient client; | |
104 | private SendGridInterceptor interceptor; | |
105 | private Client clientHelper; | |
106 | private final ConfigurationValueBuilderHelper<SendGridV4Builder, Boolean> unitTestingValueBuilder; | |
107 | ||
108 | /** | |
109 | * Default constructor when using SendGrid sender without all Ogham work. | |
110 | * | |
111 | * <strong>WARNING: use is only if you know what you are doing !</strong> | |
112 | */ | |
113 | public SendGridV4Builder() { | |
114 | this(null, new DefaultBuildContext()); | |
115 | } | |
116 | ||
117 | /** | |
118 | * Constructor that is called when using Ogham builder: | |
119 | * | |
120 | * <pre> | |
121 | * MessagingBuilder msgBuilder = ... | |
122 | * msgBuilder | |
123 | * .email() | |
124 | * .sender(SendGridV4Builder.class) | |
125 | * </pre> | |
126 | * | |
127 | * @param parent | |
128 | * the parent builder instance for fluent chaining | |
129 | * @param buildContext | |
130 | * for registering instances and property evaluation | |
131 | */ | |
132 | public SendGridV4Builder(EmailBuilder parent, BuildContext buildContext) { | |
133 | super(SendGridV4Builder.class, parent, buildContext); | |
134 | unitTestingValueBuilder = buildContext.newConfigurationValueBuilder(this, Boolean.class); | |
135 | } | |
136 | ||
137 | /** | |
138 | * @deprecated SendGrid v4 doesn't use username/password anymore. You must | |
139 | * use an {@link #apiKey(String)}. | |
140 | */ | |
141 | @Deprecated | |
142 | @Override | |
143 | public SendGridV4Builder username(String username) { | |
144 | LOG.warn("username and password are no more available with SendGrid v4"); | |
145 |
2
1. username : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::username → SURVIVED 2. username : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::username → NO_COVERAGE |
return this; |
146 | } | |
147 | ||
148 | /** | |
149 | * @deprecated SendGrid v4 doesn't use username/password anymore. You must | |
150 | * use an {@link #apiKey(String)}. | |
151 | */ | |
152 | @Deprecated | |
153 | @Override | |
154 | public ConfigurationValueBuilder<SendGridV4Builder, String> username() { | |
155 | LOG.warn("username and password are no more available with SendGrid v4"); | |
156 |
2
1. username : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::username → NO_COVERAGE 2. username : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::username → KILLED |
return buildContext.newConfigurationValueBuilder(this, String.class); |
157 | } | |
158 | ||
159 | /** | |
160 | * @deprecated SendGrid v4 doesn't use username/password anymore. You must | |
161 | * use an {@link #apiKey(String)}. | |
162 | */ | |
163 | @Deprecated | |
164 | @Override | |
165 | public SendGridV4Builder password(String password) { | |
166 | LOG.warn("username and password are no more available with SendGrid v4"); | |
167 |
2
1. password : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::password → SURVIVED 2. password : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::password → NO_COVERAGE |
return this; |
168 | } | |
169 | ||
170 | /** | |
171 | * @deprecated SendGrid v4 doesn't use username/password anymore. You must | |
172 | * use an {@link #apiKey(String)}. | |
173 | */ | |
174 | @Deprecated | |
175 | @Override | |
176 | public ConfigurationValueBuilder<SendGridV4Builder, String> password() { | |
177 | LOG.warn("username and password are no more available with SendGrid v4"); | |
178 |
2
1. password : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::password → NO_COVERAGE 2. password : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::password → KILLED |
return buildContext.newConfigurationValueBuilder(this, String.class); |
179 | } | |
180 | ||
181 | /** | |
182 | * SendGrid allows to call API for unit tests. Set this to true if you are | |
183 | * unit testing. | |
184 | * | |
185 | * <p> | |
186 | * The value set using this method takes precedence over any property and | |
187 | * default value configured using {@link #unitTesting()}. | |
188 | * | |
189 | * <pre> | |
190 | * .unitTesting(true) | |
191 | * .unitTesting() | |
192 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
193 | * .defaultValue(false) | |
194 | * </pre> | |
195 | * | |
196 | * <pre> | |
197 | * .unitTesting(true) | |
198 | * .unitTesting() | |
199 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
200 | * .defaultValue(false) | |
201 | * </pre> | |
202 | * | |
203 | * In both cases, {@code unitTesting(true)} is used. | |
204 | * | |
205 | * <p> | |
206 | * If this method is called several times, only the last value is used. | |
207 | * | |
208 | * <p> | |
209 | * If {@code null} value is set, it is like not setting a value at all. The | |
210 | * property/default value configuration is applied. | |
211 | * | |
212 | * @param unitTesting | |
213 | * true to use SendGrid in unit testing mode | |
214 | * @return this instance for fluent chaining | |
215 | */ | |
216 | public SendGridV4Builder unitTesting(Boolean unitTesting) { | |
217 |
2
1. unitTesting : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → NO_COVERAGE 2. unitTesting : removed call to fr/sii/ogham/core/builder/configuration/ConfigurationValueBuilderHelper::setValue → SURVIVED |
unitTestingValueBuilder.setValue(unitTesting); |
218 |
2
1. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → NO_COVERAGE 2. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → SURVIVED |
return this; |
219 | } | |
220 | ||
221 | /** | |
222 | * SendGrid allows to call API for unit tests. Set this to true if you are | |
223 | * unit testing. | |
224 | * | |
225 | * <p> | |
226 | * This method is mainly used by {@link Configurer}s to register some | |
227 | * property keys and/or a default value. The aim is to let developer be able | |
228 | * to externalize its configuration (using system properties, configuration | |
229 | * file or anything else). If the developer doesn't configure any value for | |
230 | * the registered properties, the default value is used (if set). | |
231 | * | |
232 | * <pre> | |
233 | * .unitTesting() | |
234 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
235 | * .defaultValue(false) | |
236 | * </pre> | |
237 | * | |
238 | * <p> | |
239 | * Non-null value set using {@link #unitTesting(Boolean)} takes precedence | |
240 | * over property values and default value. | |
241 | * | |
242 | * <pre> | |
243 | * .unitTesting(true) | |
244 | * .unitTesting() | |
245 | * .properties("${custom.property.high-priority}", "${custom.property.low-priority}") | |
246 | * .defaultValue(false) | |
247 | * </pre> | |
248 | * | |
249 | * The value {@code true} is used regardless of the value of the properties | |
250 | * and default value. | |
251 | * | |
252 | * <p> | |
253 | * See {@link ConfigurationValueBuilder} for more information. | |
254 | * | |
255 | * | |
256 | * @return the builder to configure property keys/default value | |
257 | */ | |
258 | public ConfigurationValueBuilder<SendGridV4Builder, Boolean> unitTesting() { | |
259 |
4
1. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → NO_COVERAGE 2. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → KILLED 3. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → KILLED 4. unitTesting : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::unitTesting → KILLED |
return unitTestingValueBuilder; |
260 | } | |
261 | ||
262 | /** | |
263 | * By default, SendGrid uses a {@link Client} instance as an helper to | |
264 | * perform HTTP requests. You may want to use custom client configuration | |
265 | * such as providing custom protocol and port: | |
266 | * | |
267 | * <pre> | |
268 | * .client(new CustomizableUrlClient(false, "http", 8080)) | |
269 | * </pre> | |
270 | * | |
271 | * NOTE: if you provide a custom {@link Client}, the | |
272 | * {@link #unitTesting(Boolean)} or | |
273 | * {@link #httpClient(org.apache.http.impl.client.CloseableHttpClient)} | |
274 | * configurations are not used. You have to handle it manually. | |
275 | * | |
276 | * @param clientHelper | |
277 | * the custom client used to call SendGrid HTTP API | |
278 | * @return this instance for fluent chaining | |
279 | */ | |
280 | public SendGridV4Builder clientHelper(Client clientHelper) { | |
281 | this.clientHelper = clientHelper; | |
282 |
1
1. clientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::clientHelper → NO_COVERAGE |
return this; |
283 | } | |
284 | ||
285 | /** | |
286 | * By default, calling SendGrid HTTP API is done through the default | |
287 | * {@link SendGrid} implementation. If you want to use another client | |
288 | * implementation (creating your custom HTTP API caller for example), you | |
289 | * can implement the {@link SendGridClient} interface and provide it: | |
290 | * | |
291 | * <pre> | |
292 | * .client(new MyCustomHttpApiCaller()) | |
293 | * </pre> | |
294 | * | |
295 | * NOTE: if you provide your custom implementation, any defined properties | |
296 | * and values using {@link #apiKey(String)}, {@link #username(String)} or | |
297 | * {@link #password(String)} won't be used at all. You then have to handle | |
298 | * it by yourself. | |
299 | * | |
300 | * @param client | |
301 | * the custom client used to call SendGrid HTTP API | |
302 | * @return this instance for fluent chaining | |
303 | */ | |
304 | public SendGridV4Builder client(SendGridClient client) { | |
305 | this.client = client; | |
306 |
3
1. client : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::client → NO_COVERAGE 2. client : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::client → SURVIVED 3. client : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::client → KILLED |
return this; |
307 | } | |
308 | ||
309 | /** | |
310 | * By default, calling SendGrid HTTP API is done through the default | |
311 | * {@link SendGrid} implementation that uses default {@link HttpClient} | |
312 | * (calling {@code HttpClientBuilder.create().build()}). If you want to use | |
313 | * another HTTP client implementation, you can extend the | |
314 | * {@link CloseableHttpClient} class and provide it: | |
315 | * | |
316 | * <pre> | |
317 | * .client(new MyCustomHttpClient()) | |
318 | * </pre> | |
319 | * | |
320 | * NOTE: if you provide your custom implementation, any defined properties | |
321 | * and values using {@link #unitTesting(Boolean)} won't be used at all. You | |
322 | * then have to handle it by yourself. | |
323 | * | |
324 | * @param httpClient | |
325 | * the custom implementation of {@link HttpClient} used to call | |
326 | * SendGrid HTTP API. SendGrid requires a | |
327 | * {@link CloseableHttpClient}. | |
328 | * @return this instance for fluent chaining | |
329 | */ | |
330 | @SuppressWarnings("squid:S1185") | |
331 | @Override | |
332 | public SendGridV4Builder httpClient(CloseableHttpClient httpClient) { | |
333 |
1
1. httpClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::httpClient → NO_COVERAGE |
return super.httpClient(httpClient); |
334 | } | |
335 | ||
336 | /** | |
337 | * Ogham will transform general {@link Email} object into | |
338 | * {@link SendGrid}.Email objects. This transformation will fit almost all | |
339 | * use cases but you may need to customize a part of the SendGrid message. | |
340 | * Instead of doing again the same work Ogham does, this builder allows you | |
341 | * to intercept the message to modify it just before sending it: | |
342 | * | |
343 | * <pre> | |
344 | * .sender(SendGridV4Builder.class) | |
345 | * .intercept(new MyCustomInterceptor()) | |
346 | * </pre> | |
347 | * | |
348 | * See {@link SendGridInterceptor} for more information. | |
349 | * | |
350 | * @param interceptor | |
351 | * the custom interceptor used to modify {@link SendGrid}.Email | |
352 | * @return this instance for fluent chaining | |
353 | */ | |
354 | public SendGridV4Builder intercept(SendGridInterceptor interceptor) { | |
355 | this.interceptor = interceptor; | |
356 |
1
1. intercept : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::intercept → NO_COVERAGE |
return this; |
357 | } | |
358 | ||
359 | @Override | |
360 | public SendGridV4Sender build() { | |
361 | String apiKey = apiKeyValueBuilder.getValue(); | |
362 | boolean test = unitTestingValueBuilder.getValue(false); | |
363 | URL url = urlValueBuilder.getValue(); | |
364 | SendGridClient builtClient = buildClient(apiKey, buildClientHelper(clientHelper, httpClient, test, url), url); | |
365 |
4
1. build : negated conditional → NO_COVERAGE 2. build : negated conditional → KILLED 3. build : negated conditional → KILLED 4. build : negated conditional → KILLED |
if (builtClient == null) { |
366 | return null; | |
367 | } | |
368 | LOG.info("Sending email using SendGrid API is registered"); | |
369 |
2
1. build : negated conditional → SURVIVED 2. build : negated conditional → NO_COVERAGE |
if (client == null) { |
370 | LOG.debug("SendGrid account: apiKey={}, test={}", apiKey, test); | |
371 | } else { | |
372 | LOG.debug("SendGrid instance provided so apiKey and unitTesting properties are not used"); | |
373 | } | |
374 |
4
1. build : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::build → NO_COVERAGE 2. build : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::build → KILLED 3. build : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::build → KILLED 4. build : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::build → KILLED |
return buildContext.register(new SendGridV4Sender(builtClient, buildContentHandler(), buildMimetypeProvider(), CompatUtil.getDefaultCompatFactory(), interceptor)); |
375 | } | |
376 | ||
377 | private Client buildClientHelper(Client clientHelper, CloseableHttpClient httpClient, boolean test, URL url) { | |
378 | // custom implementation | |
379 |
3
1. buildClientHelper : negated conditional → SURVIVED 2. buildClientHelper : negated conditional → NO_COVERAGE 3. buildClientHelper : negated conditional → KILLED |
if (clientHelper != null) { |
380 |
1
1. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → NO_COVERAGE |
return clientHelper; |
381 | } | |
382 | // case where custom URL is set. | |
383 | // SendGrid Client doesn't support neither custom port nor custom | |
384 | // protocol | |
385 |
4
1. buildClientHelper : negated conditional → SURVIVED 2. buildClientHelper : negated conditional → NO_COVERAGE 3. buildClientHelper : negated conditional → NO_COVERAGE 4. buildClientHelper : negated conditional → KILLED |
if (url != null && httpClient != null) { |
386 |
1
1. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → NO_COVERAGE |
return buildContext.register(new CustomizableUrlClient(httpClient, url.getProtocol(), url.getPort())); |
387 | } | |
388 |
4
1. buildClientHelper : negated conditional → NO_COVERAGE 2. buildClientHelper : negated conditional → KILLED 3. buildClientHelper : negated conditional → KILLED 4. buildClientHelper : negated conditional → KILLED |
if (url != null) { |
389 |
2
1. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → NO_COVERAGE 2. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → KILLED |
return buildContext.register(new CustomizableUrlClient(test, url.getProtocol(), url.getPort())); |
390 | } | |
391 | // custom http client | |
392 |
2
1. buildClientHelper : negated conditional → NO_COVERAGE 2. buildClientHelper : negated conditional → SURVIVED |
if (httpClient != null) { |
393 |
1
1. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → NO_COVERAGE |
return buildContext.register(new Client(httpClient)); |
394 | } | |
395 | // test client (just to allow http instead of https) | |
396 |
2
1. buildClientHelper : negated conditional → SURVIVED 2. buildClientHelper : negated conditional → NO_COVERAGE |
if (test) { |
397 |
1
1. buildClientHelper : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClientHelper → NO_COVERAGE |
return buildContext.register(new Client(true)); |
398 | } | |
399 | // use default Client implementation created directly by SendGrid | |
400 | return null; | |
401 | } | |
402 | ||
403 | private SendGridClient buildClient(String apiKey, Client client, URL url) { | |
404 |
4
1. buildClient : negated conditional → NO_COVERAGE 2. buildClient : negated conditional → KILLED 3. buildClient : negated conditional → KILLED 4. buildClient : negated conditional → KILLED |
if (this.client != null) { |
405 |
3
1. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → NO_COVERAGE 2. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → KILLED 3. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → KILLED |
return this.client; |
406 | } | |
407 |
4
1. buildClient : negated conditional → NO_COVERAGE 2. buildClient : negated conditional → KILLED 3. buildClient : negated conditional → KILLED 4. buildClient : negated conditional → KILLED |
if (apiKey != null) { |
408 |
4
1. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → NO_COVERAGE 2. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → KILLED 3. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → KILLED 4. buildClient : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildClient → KILLED |
return buildContext.register(new DelegateSendGridClient(buildSendGrid(apiKey, client, url))); |
409 | } | |
410 | return null; | |
411 | } | |
412 | ||
413 | private SendGrid buildSendGrid(String apiKey, Client client, URL url) { | |
414 | SendGrid sendGrid = newSendGrid(apiKey, client); | |
415 |
4
1. buildSendGrid : negated conditional → NO_COVERAGE 2. buildSendGrid : negated conditional → KILLED 3. buildSendGrid : negated conditional → KILLED 4. buildSendGrid : negated conditional → KILLED |
if (url != null) { |
416 |
2
1. buildSendGrid : removed call to com/sendgrid/SendGrid::setHost → NO_COVERAGE 2. buildSendGrid : removed call to com/sendgrid/SendGrid::setHost → TIMED_OUT |
sendGrid.setHost(url.getHost()); |
417 | } | |
418 |
4
1. buildSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildSendGrid → NO_COVERAGE 2. buildSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildSendGrid → KILLED 3. buildSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildSendGrid → KILLED 4. buildSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildSendGrid → KILLED |
return sendGrid; |
419 | } | |
420 | ||
421 | private static SendGrid newSendGrid(String apiKey, Client client) { | |
422 |
3
1. newSendGrid : negated conditional → NO_COVERAGE 2. newSendGrid : negated conditional → SURVIVED 3. newSendGrid : negated conditional → KILLED |
if (client != null) { |
423 |
2
1. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → NO_COVERAGE 2. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → KILLED |
return new SendGrid(apiKey, client); |
424 | } | |
425 |
4
1. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → NO_COVERAGE 2. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → KILLED 3. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → KILLED 4. newSendGrid : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::newSendGrid → KILLED |
return new SendGrid(apiKey); |
426 | } | |
427 | ||
428 | private PriorizedContentHandler buildContentHandler() { | |
429 | MimeTypeProvider mimetypeProvider = buildMimetypeProvider(); | |
430 | PriorizedContentHandler contentHandler = buildContext.register(new PriorizedContentHandler()); | |
431 |
3
1. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → SURVIVED 2. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → NO_COVERAGE 3. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → KILLED |
contentHandler.register(MultiContent.class, buildContext.register(new MultiContentHandler(contentHandler))); |
432 |
2
1. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → NO_COVERAGE 2. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → SURVIVED |
contentHandler.register(ContentWithAttachments.class, buildContext.register(new ContentWithAttachmentsHandler(contentHandler))); |
433 |
3
1. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → NO_COVERAGE 2. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → SURVIVED 3. buildContentHandler : removed call to fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/handler/PriorizedContentHandler::register → KILLED |
contentHandler.register(MayHaveStringContent.class, buildContext.register(new StringContentHandler(mimetypeProvider))); |
434 |
4
1. buildContentHandler : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildContentHandler → NO_COVERAGE 2. buildContentHandler : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildContentHandler → KILLED 3. buildContentHandler : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildContentHandler → KILLED 4. buildContentHandler : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildContentHandler → KILLED |
return contentHandler; |
435 | } | |
436 | ||
437 | private MimeTypeProvider buildMimetypeProvider() { | |
438 |
4
1. buildMimetypeProvider : negated conditional → NO_COVERAGE 2. buildMimetypeProvider : negated conditional → KILLED 3. buildMimetypeProvider : negated conditional → KILLED 4. buildMimetypeProvider : negated conditional → KILLED |
if (mimetypeBuilder == null) { |
439 | return null; | |
440 | } | |
441 |
4
1. buildMimetypeProvider : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildMimetypeProvider → NO_COVERAGE 2. buildMimetypeProvider : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildMimetypeProvider → KILLED 3. buildMimetypeProvider : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildMimetypeProvider → KILLED 4. buildMimetypeProvider : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/builder/sendgrid/SendGridV4Builder::buildMimetypeProvider → KILLED |
return mimetypeBuilder.build(); |
442 | } | |
443 | } | |
Mutations | ||
145 |
1.1 2.2 |
|
156 |
1.1 2.2 |
|
167 |
1.1 2.2 |
|
178 |
1.1 2.2 |
|
217 |
1.1 2.2 |
|
218 |
1.1 2.2 |
|
259 |
1.1 2.2 3.3 4.4 |
|
282 |
1.1 |
|
306 |
1.1 2.2 3.3 |
|
333 |
1.1 |
|
356 |
1.1 |
|
365 |
1.1 2.2 3.3 4.4 |
|
369 |
1.1 2.2 |
|
374 |
1.1 2.2 3.3 4.4 |
|
379 |
1.1 2.2 3.3 |
|
380 |
1.1 |
|
385 |
1.1 2.2 3.3 4.4 |
|
386 |
1.1 |
|
388 |
1.1 2.2 3.3 4.4 |
|
389 |
1.1 2.2 |
|
392 |
1.1 2.2 |
|
393 |
1.1 |
|
396 |
1.1 2.2 |
|
397 |
1.1 |
|
404 |
1.1 2.2 3.3 4.4 |
|
405 |
1.1 2.2 3.3 |
|
407 |
1.1 2.2 3.3 4.4 |
|
408 |
1.1 2.2 3.3 4.4 |
|
415 |
1.1 2.2 3.3 4.4 |
|
416 |
1.1 2.2 |
|
418 |
1.1 2.2 3.3 4.4 |
|
422 |
1.1 2.2 3.3 |
|
423 |
1.1 2.2 |
|
425 |
1.1 2.2 3.3 4.4 |
|
431 |
1.1 2.2 3.3 |
|
432 |
1.1 2.2 |
|
433 |
1.1 2.2 3.3 |
|
434 |
1.1 2.2 3.3 4.4 |
|
438 |
1.1 2.2 3.3 4.4 |
|
441 |
1.1 2.2 3.3 4.4 |