| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.job.internal; |
| 21 |
|
|
| 22 |
|
import java.io.File; |
| 23 |
|
import java.io.IOException; |
| 24 |
|
import java.util.ArrayList; |
| 25 |
|
import java.util.Arrays; |
| 26 |
|
import java.util.Objects; |
| 27 |
|
|
| 28 |
|
import javax.inject.Provider; |
| 29 |
|
import javax.xml.parsers.ParserConfigurationException; |
| 30 |
|
|
| 31 |
|
import org.junit.Before; |
| 32 |
|
import org.junit.Test; |
| 33 |
|
import org.slf4j.Logger; |
| 34 |
|
import org.xwiki.component.manager.ComponentManager; |
| 35 |
|
import org.xwiki.job.DefaultJobStatus; |
| 36 |
|
import org.xwiki.job.DefaultRequest; |
| 37 |
|
import org.xwiki.job.Request; |
| 38 |
|
import org.xwiki.job.annotation.Serializable; |
| 39 |
|
import org.xwiki.job.event.status.JobStatus; |
| 40 |
|
import org.xwiki.job.test.SerializableStandaloneComponent; |
| 41 |
|
import org.xwiki.job.test.StandaloneComponent; |
| 42 |
|
import org.xwiki.logging.marker.TranslationMarker; |
| 43 |
|
|
| 44 |
|
import static org.junit.Assert.assertEquals; |
| 45 |
|
import static org.junit.Assert.assertNotNull; |
| 46 |
|
import static org.junit.Assert.assertNull; |
| 47 |
|
import static org.junit.Assert.assertSame; |
| 48 |
|
import static org.mockito.Mockito.mock; |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@link |
| 52 |
|
|
| 53 |
|
@version |
| 54 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (140) |
Complexity: 22 |
Complexity Density: 0.19 |
|
| 55 |
|
public class JobStatusSerializerTest |
| 56 |
|
{ |
| 57 |
|
private JobStatusSerializer serializer; |
| 58 |
|
|
| 59 |
|
private File testFile = new File("target/test/status.xml"); |
| 60 |
|
|
| 61 |
|
@Serializable |
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
|
private static class SerializableCrossReferenceObject |
| 63 |
|
{ |
| 64 |
|
public SerializableCrossReferenceObject field; |
| 65 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
1 |
public SerializableCrossReferenceObject()... |
| 67 |
|
{ |
| 68 |
1 |
this.field = this; |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
@Serializable |
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
|
private static class SerializableObjectTest |
| 74 |
|
{ |
| 75 |
|
public Object field; |
| 76 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 77 |
7 |
public SerializableObjectTest(Object field)... |
| 78 |
|
{ |
| 79 |
7 |
this.field = field; |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
@Serializable |
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 84 |
|
private static class CustomSerializableObject |
| 85 |
|
{ |
| 86 |
|
public String field; |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
2 |
public CustomSerializableObject(String field)... |
| 89 |
|
{ |
| 90 |
2 |
this.field = field; |
| 91 |
|
} |
| 92 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 93 |
1 |
@Override... |
| 94 |
|
public boolean equals(Object obj) |
| 95 |
|
{ |
| 96 |
1 |
return Objects.equals(((CustomSerializableObject) obj).field, this.field); |
| 97 |
|
} |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
@Serializable |
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 101 |
|
private static class SerializableCustomObject |
| 102 |
|
{ |
| 103 |
|
public String field; |
| 104 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 105 |
2 |
public SerializableCustomObject(String field)... |
| 106 |
|
{ |
| 107 |
2 |
this.field = field; |
| 108 |
|
} |
| 109 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 110 |
1 |
@Override... |
| 111 |
|
public boolean equals(Object obj) |
| 112 |
|
{ |
| 113 |
1 |
return Objects.equals(((SerializableCustomObject) obj).field, this.field); |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
@Serializable(false) |
| |
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 3 |
Complexity Density: 1 |
|
| 118 |
|
private static class NotSerializableCustomObject |
| 119 |
|
{ |
| 120 |
|
public String field; |
| 121 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 122 |
1 |
public NotSerializableCustomObject(String field)... |
| 123 |
|
{ |
| 124 |
1 |
this.field = field; |
| 125 |
|
} |
| 126 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0 |
@Override... |
| 128 |
|
public boolean equals(Object obj) |
| 129 |
|
{ |
| 130 |
0 |
return Objects.equals(((NotSerializableCustomObject) obj).field, this.field); |
| 131 |
|
} |
| 132 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 133 |
1 |
@Override... |
| 134 |
|
public String toString() |
| 135 |
|
{ |
| 136 |
1 |
return this.field; |
| 137 |
|
} |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
@Serializable |
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
| 141 |
|
private static class SerializableProvider implements Provider<String> |
| 142 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 143 |
0 |
@Override... |
| 144 |
|
public String get() |
| 145 |
|
{ |
| 146 |
0 |
return null; |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
| 150 |
|
private static class SerializableImplementationProvider implements Provider<String>, java.io.Serializable |
| 151 |
|
{ |
| 152 |
|
private static final long serialVersionUID = 1L; |
| 153 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 154 |
0 |
@Override... |
| 155 |
|
public String get() |
| 156 |
|
{ |
| 157 |
0 |
return null; |
| 158 |
|
} |
| 159 |
|
} |
| 160 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 161 |
|
private static class TestException extends Exception |
| 162 |
|
{ |
| 163 |
|
private Object custom; |
| 164 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 165 |
1 |
public TestException(String message, Throwable cause, Object custom)... |
| 166 |
|
{ |
| 167 |
1 |
super(message, cause); |
| 168 |
|
|
| 169 |
1 |
this.custom = custom; |
| 170 |
|
} |
| 171 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 172 |
1 |
public Object getCustom()... |
| 173 |
|
{ |
| 174 |
1 |
return this.custom; |
| 175 |
|
} |
| 176 |
|
} |
| 177 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 178 |
20 |
@Before... |
| 179 |
|
public void before() throws ParserConfigurationException |
| 180 |
|
{ |
| 181 |
20 |
this.serializer = new JobStatusSerializer(); |
| 182 |
|
} |
| 183 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 184 |
20 |
private JobStatus writeread(JobStatus status) throws IOException... |
| 185 |
|
{ |
| 186 |
20 |
this.serializer.write(status, this.testFile); |
| 187 |
|
|
| 188 |
20 |
return this.serializer.read(this.testFile); |
| 189 |
|
} |
| 190 |
|
|
| 191 |
|
|
| 192 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
| 193 |
1 |
@Test... |
| 194 |
|
public void test() throws IOException |
| 195 |
|
{ |
| 196 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 197 |
|
|
| 198 |
1 |
writeread(status); |
| 199 |
|
} |
| 200 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 201 |
1 |
@Test... |
| 202 |
|
public void testLogMessage() throws IOException |
| 203 |
|
{ |
| 204 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 205 |
|
|
| 206 |
1 |
status.getLog().error("error message"); |
| 207 |
|
|
| 208 |
1 |
status = writeread(status); |
| 209 |
|
|
| 210 |
1 |
assertNotNull(status.getLog()); |
| 211 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 212 |
|
} |
| 213 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 214 |
1 |
@Test... |
| 215 |
|
public void testLogMarker() throws IOException |
| 216 |
|
{ |
| 217 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 218 |
|
|
| 219 |
1 |
status.getLog().error(new TranslationMarker("translation.key"), "error message"); |
| 220 |
|
|
| 221 |
1 |
status = writeread(status); |
| 222 |
|
|
| 223 |
1 |
assertNotNull(status.getLog()); |
| 224 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 225 |
1 |
assertEquals(new TranslationMarker("translation.key"), status.getLog().peek().getMarker()); |
| 226 |
|
} |
| 227 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 228 |
1 |
@Test... |
| 229 |
|
public void testLogWithException() throws IOException |
| 230 |
|
{ |
| 231 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 232 |
|
|
| 233 |
1 |
status.getLog().error("error message", new TestException("exception message", new Exception("cause"), "custom")); |
| 234 |
|
|
| 235 |
1 |
status = writeread(status); |
| 236 |
|
|
| 237 |
1 |
assertNotNull(status.getLog()); |
| 238 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 239 |
1 |
assertEquals("exception message", status.getLog().peek().getThrowable().getMessage()); |
| 240 |
1 |
assertEquals("cause", status.getLog().peek().getThrowable().getCause().getMessage()); |
| 241 |
1 |
assertNull("exception message", ((TestException)status.getLog().peek().getThrowable()).getCustom()); |
| 242 |
|
} |
| 243 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 244 |
1 |
@Test... |
| 245 |
|
public void testLogWithArguments() throws IOException |
| 246 |
|
{ |
| 247 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 248 |
|
|
| 249 |
1 |
status.getLog().error("error message", "arg1", "arg2"); |
| 250 |
|
|
| 251 |
1 |
status = writeread(status); |
| 252 |
|
|
| 253 |
1 |
assertNotNull(status.getLog()); |
| 254 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 255 |
1 |
assertEquals("arg1", status.getLog().peek().getArgumentArray()[0]); |
| 256 |
1 |
assertEquals("arg2", status.getLog().peek().getArgumentArray()[1]); |
| 257 |
|
} |
| 258 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 259 |
1 |
@Test... |
| 260 |
|
public void testLogWithNullArguments() throws IOException |
| 261 |
|
{ |
| 262 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 263 |
|
|
| 264 |
1 |
status.getLog().error("error message", "arg1", null, "arg3"); |
| 265 |
|
|
| 266 |
1 |
status = writeread(status); |
| 267 |
|
|
| 268 |
1 |
assertNotNull(status.getLog()); |
| 269 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 270 |
1 |
assertEquals("arg1", status.getLog().peek().getArgumentArray()[0]); |
| 271 |
1 |
assertEquals(null, status.getLog().peek().getArgumentArray()[1]); |
| 272 |
1 |
assertEquals("arg3", status.getLog().peek().getArgumentArray()[2]); |
| 273 |
|
} |
| 274 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 275 |
1 |
@Test... |
| 276 |
|
public void testLogWithComponentArgument() throws IOException |
| 277 |
|
{ |
| 278 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 279 |
|
|
| 280 |
1 |
status.getLog().error("error message", new DefaultJobStatusStore()); |
| 281 |
|
|
| 282 |
1 |
status = writeread(status); |
| 283 |
|
|
| 284 |
1 |
assertNotNull(status.getLog()); |
| 285 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 286 |
1 |
assertEquals(String.class, status.getLog().peek().getArgumentArray()[0].getClass()); |
| 287 |
|
} |
| 288 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 289 |
1 |
@Test... |
| 290 |
|
public void testLogWithStandaloneComponentArgument() throws IOException |
| 291 |
|
{ |
| 292 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 293 |
|
|
| 294 |
1 |
status.getLog().error("error message", new StandaloneComponent()); |
| 295 |
|
|
| 296 |
1 |
status = writeread(status); |
| 297 |
|
|
| 298 |
1 |
assertNotNull(status.getLog()); |
| 299 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 300 |
1 |
assertEquals(String.class, status.getLog().peek().getArgumentArray()[0].getClass()); |
| 301 |
|
} |
| 302 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 303 |
1 |
@Test... |
| 304 |
|
public void testLogWithSerializableStandaloneComponentArgument() throws IOException |
| 305 |
|
{ |
| 306 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 307 |
|
|
| 308 |
1 |
status.getLog().error("error message", new SerializableStandaloneComponent()); |
| 309 |
|
|
| 310 |
1 |
status = writeread(status); |
| 311 |
|
|
| 312 |
1 |
assertNotNull(status.getLog()); |
| 313 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 314 |
1 |
assertEquals(SerializableStandaloneComponent.class, status.getLog().peek().getArgumentArray()[0].getClass()); |
| 315 |
|
} |
| 316 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 317 |
1 |
@Test... |
| 318 |
|
public void testLogWithCrossReference() throws IOException |
| 319 |
|
{ |
| 320 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 321 |
|
|
| 322 |
1 |
status.getLog().error("message", new SerializableCrossReferenceObject()); |
| 323 |
|
|
| 324 |
1 |
status = writeread(status); |
| 325 |
|
|
| 326 |
1 |
assertNotNull(status.getLog()); |
| 327 |
1 |
SerializableCrossReferenceObject obj = |
| 328 |
|
(SerializableCrossReferenceObject) status.getLog().peek().getArgumentArray()[0]; |
| 329 |
1 |
assertSame(obj, obj.field); |
| 330 |
|
} |
| 331 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 332 |
1 |
@Test... |
| 333 |
|
public void testLogWithComponentField() throws IOException |
| 334 |
|
{ |
| 335 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 336 |
|
|
| 337 |
1 |
status.getLog().error("error message", new SerializableObjectTest(new DefaultJobStatusStore())); |
| 338 |
|
|
| 339 |
1 |
status = writeread(status); |
| 340 |
|
|
| 341 |
1 |
assertNotNull(status.getLog()); |
| 342 |
1 |
assertNull(((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field); |
| 343 |
|
} |
| 344 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 345 |
1 |
@Test... |
| 346 |
|
public void testLogWithStandaloneComponentField() throws IOException |
| 347 |
|
{ |
| 348 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 349 |
|
|
| 350 |
1 |
status.getLog().error("error message", new SerializableObjectTest(new StandaloneComponent())); |
| 351 |
|
|
| 352 |
1 |
status = writeread(status); |
| 353 |
|
|
| 354 |
1 |
assertNotNull(status.getLog()); |
| 355 |
1 |
assertNull(((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field); |
| 356 |
|
} |
| 357 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 358 |
1 |
@Test... |
| 359 |
|
public void testLogWithLoggerField() throws IOException |
| 360 |
|
{ |
| 361 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 362 |
|
|
| 363 |
1 |
status.getLog().error("error message", new SerializableObjectTest(mock(Logger.class))); |
| 364 |
|
|
| 365 |
1 |
status = writeread(status); |
| 366 |
|
|
| 367 |
1 |
assertNotNull(status.getLog()); |
| 368 |
1 |
assertNull(((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field); |
| 369 |
|
} |
| 370 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 371 |
1 |
@Test... |
| 372 |
|
public void testLogWithProviderField() throws IOException |
| 373 |
|
{ |
| 374 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 375 |
|
|
| 376 |
1 |
status.getLog().error("error message", new SerializableObjectTest(mock(Provider.class))); |
| 377 |
|
|
| 378 |
1 |
status = writeread(status); |
| 379 |
|
|
| 380 |
1 |
assertNotNull(status.getLog()); |
| 381 |
1 |
assertNull(((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field); |
| 382 |
|
} |
| 383 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 384 |
1 |
@Test... |
| 385 |
|
public void testLogWithComponentManagerField() throws IOException |
| 386 |
|
{ |
| 387 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 388 |
|
|
| 389 |
1 |
status.getLog().error("error message", new SerializableObjectTest(mock(ComponentManager.class))); |
| 390 |
|
|
| 391 |
1 |
status = writeread(status); |
| 392 |
|
|
| 393 |
1 |
assertNotNull(status.getLog()); |
| 394 |
1 |
assertNull(((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field); |
| 395 |
|
} |
| 396 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 397 |
1 |
@Test... |
| 398 |
|
public void testLogWithSerializableProviderField() throws IOException |
| 399 |
|
{ |
| 400 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 401 |
|
|
| 402 |
1 |
status.getLog().error("error message", new SerializableObjectTest(new SerializableProvider())); |
| 403 |
|
|
| 404 |
1 |
status = writeread(status); |
| 405 |
|
|
| 406 |
1 |
assertNotNull(status.getLog()); |
| 407 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 408 |
1 |
assertEquals(SerializableProvider.class, |
| 409 |
|
((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field.getClass()); |
| 410 |
|
} |
| 411 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 412 |
1 |
@Test... |
| 413 |
|
public void testLogWithSerializableImplementationProviderField() throws IOException |
| 414 |
|
{ |
| 415 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 416 |
|
|
| 417 |
1 |
status.getLog().error("error message", new SerializableObjectTest(new SerializableImplementationProvider())); |
| 418 |
|
|
| 419 |
1 |
status = writeread(status); |
| 420 |
|
|
| 421 |
1 |
assertNotNull(status.getLog()); |
| 422 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 423 |
1 |
assertEquals(SerializableImplementationProvider.class, |
| 424 |
|
((SerializableObjectTest) status.getLog().peek().getArgumentArray()[0]).field.getClass()); |
| 425 |
|
} |
| 426 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 427 |
1 |
@Test... |
| 428 |
|
public void testLogWithCustomObjectArgument() throws IOException |
| 429 |
|
{ |
| 430 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 431 |
|
|
| 432 |
1 |
status.getLog().error("error message", new CustomSerializableObject("value")); |
| 433 |
|
|
| 434 |
1 |
status = writeread(status); |
| 435 |
|
|
| 436 |
1 |
assertNotNull(status.getLog()); |
| 437 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 438 |
1 |
assertEquals(new CustomSerializableObject("value"), status.getLog().peek().getArgumentArray()[0]); |
| 439 |
|
} |
| 440 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 441 |
1 |
@Test... |
| 442 |
|
public void testLogWithSerializableCustomObjectArgument() throws IOException |
| 443 |
|
{ |
| 444 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 445 |
|
|
| 446 |
1 |
status.getLog().error("error message", new SerializableCustomObject("value")); |
| 447 |
|
|
| 448 |
1 |
status = writeread(status); |
| 449 |
|
|
| 450 |
1 |
assertNotNull(status.getLog()); |
| 451 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 452 |
1 |
assertEquals(new SerializableCustomObject("value"), status.getLog().peek().getArgumentArray()[0]); |
| 453 |
|
} |
| 454 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 455 |
1 |
@Test... |
| 456 |
|
public void testLogWithNotSerializableCustomObjectArgument() throws IOException |
| 457 |
|
{ |
| 458 |
1 |
JobStatus status = new DefaultJobStatus<Request>(new DefaultRequest(), null, null, null); |
| 459 |
|
|
| 460 |
1 |
status.getLog().error("error message", new NotSerializableCustomObject("value")); |
| 461 |
|
|
| 462 |
1 |
status = writeread(status); |
| 463 |
|
|
| 464 |
1 |
assertNotNull(status.getLog()); |
| 465 |
1 |
assertEquals("error message", status.getLog().peek().getMessage()); |
| 466 |
1 |
assertEquals("value", status.getLog().peek().getArgumentArray()[0]); |
| 467 |
|
} |
| 468 |
|
} |