1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package uk.co.gidley.jmxmonitor.monitoring; |
18 |
|
|
19 |
|
import ch.qos.logback.classic.spi.ILoggingEvent; |
20 |
|
import org.testng.annotations.Test; |
21 |
|
import uk.co.gidley.jmxmonitor.uk.co.gidley.testAppender.TestAppender; |
22 |
|
|
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import static org.hamcrest.Matchers.equalTo; |
26 |
|
import static org.hamcrest.MatcherAssert.assertThat; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
31 |
|
public class SimpleMBeanTest extends BaseMonitoringTest { |
32 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
1
PASS
|
|
33 |
1
|
@Test... |
34 |
|
public void testMemoryMonitoring() { |
35 |
|
|
36 |
1
|
List<ILoggingEvent> events = TestAppender.getEvents(); |
37 |
|
|
38 |
1
|
boolean heapUsedFound = false; |
39 |
1
|
for (ILoggingEvent event : events) { |
40 |
1
|
if (event.getFormattedMessage().startsWith("Heap Used")) { |
41 |
1
|
heapUsedFound = true; |
42 |
|
} |
43 |
|
} |
44 |
1
|
assertThat(heapUsedFound, equalTo(true)); |
45 |
|
} |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
1
|
@Override... |
48 |
|
public String getConfiguration() { |
49 |
1
|
return "src/test/resources/monitoring/simpleMBeanConfiguration.properties"; |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
1
|
@Override... |
53 |
|
public int waitForEvents() { |
54 |
1
|
return 1; |
55 |
|
} |
56 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
57 |
1
|
@Override... |
58 |
|
public void registerTestMBeans() { |
59 |
|
|
60 |
|
} |
61 |
|
} |