blob: 971a700f59c6cfec2b4ad9df956158bdb3f70e44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
package org.onap.ccsdk.sli.core.sli;
import static org.junit.Assert.*;
import java.util.Date;
import org.junit.Before;
import org.junit.Test;
public class TestMetricLogger {
MetricLogger logger;
@Before
public void setUp() throws Exception {
logger = new MetricLogger();
logger.resetContext();
logger.logRequest("svcInstance1", "svcName", "svcPartner", "targetEntity", "targetServiceName", "targetVirtualEntity", "hello-world");
logger.logResponse("200", "200", "SUCCESS");
}
@Test
public final void testGetBeginTimestamp() {
logger.getBeginTimestamp();
}
@Test
public final void testGetEndTimestamp() {
logger.getEndTimestamp();
}
@Test
public final void testGetRequestID() {
logger.getRequestID();
}
@Test
public final void testGetServiceInstanceID() {
logger.getServiceInstanceID();
}
@Test
public final void testGetServiceName() {
logger.getServiceName();
}
@Test
public final void testGetPartnerName() {
logger.getPartnerName();
}
@Test
public final void testGetTargetEntity() {
logger.getTargetEntity();
}
@Test
public final void testGetTargetServiceName() {
logger.getTargetServiceName();
}
@Test
public final void testGetStatusCode() {
logger.getStatusCode();
}
@Test
public final void testGetResponseCode() {
logger.getResponseCode();
}
@Test
public final void testGetResponseDescription() {
logger.getResponseDescription();
}
@Test
public final void testGetInstanceUUID() {
logger.getInstanceUUID();
}
@Test
public final void testGetCategoryLogLevel() {
logger.getCategoryLogLevel();
}
@Test
public final void testGetSeverity() {
logger.getSeverity();
}
@Test
public final void testGetServerIpAddress() {
logger.getServerIpAddress();
}
@Test
public final void testGetElapsedTime() {
logger.getElapsedTime();
}
@Test
public final void testGetServer() {
logger.getServer();
}
@Test
public final void testGetClientIp() {
logger.getClientIp();
}
@Test
public final void testGetClassName() {
logger.getClassName();
}
@Test
public final void testGetTargetVirtualEntity() {
logger.getTargetVirtualEntity();
}
@Test
public final void testAsIso8601Date() {
logger.asIso8601(new Date());
}
@Test
public final void testAsIso8601Long() {
logger.asIso8601(System.currentTimeMillis());
}
@Test
public void formatString() {
String output = logger.formatString("\n");
assertEquals("",output);
output = logger.formatString("|");
assertEquals("%7C",output);
output = logger.formatString(null);
assertEquals(null,output);
}
}
|