@@ -23,7 +23,7 @@ public class LogHeadersPolicyTest extends ApimanPolicyTest {
23
23
* A simple happy flow test to verify the policy does not blow up in our face.
24
24
*/
25
25
@ Test
26
- @ Configuration ("{ \" direction\" : \" both\" }" )
26
+ @ Configuration ("{ \" direction\" : \" both\" , \" logStatusCode \" : true }" )
27
27
public void testLogHeadersWithoutAnyRequestHeaders () throws PolicyFailureError , Throwable {
28
28
PrintStream out = System .out ;
29
29
ByteArrayOutputStream testOutput = new ByteArrayOutputStream ();
@@ -35,11 +35,12 @@ public void testLogHeadersWithoutAnyRequestHeaders() throws PolicyFailureError,
35
35
output = redactDates (output );
36
36
output = normalize (output );
37
37
String expected = "INFO: Logging 0 HTTP Request headers for io.apiman.test.policies.EchoBackEndApi\n " +
38
- "INFO: Logging 4 HTTP Response headers for io.apiman.test.policies.EchoBackEndApi\n " +
39
- "INFO: Key : Content-Length, Value : 167\n " +
40
- "INFO: Key : Content-Type, Value : application/json\n " +
41
- "INFO: Key : Date, Value : XXX\n " +
42
- "INFO: Key : Server, Value : apiman.policy-test\n " +
38
+ "INFO: Status code 200 for io.apiman.test.policies.EchoBackEndApi\n " +
39
+ "INFO: Logging 4 HTTP Response headers for io.apiman.test.policies.EchoBackEndApi\n " +
40
+ "Key : Content-Length, Value : 167\n " +
41
+ "Key : Content-Type, Value : application/json\n " +
42
+ "Key : Date, Value : XXX\n " +
43
+ "Key : Server, Value : apiman.policy-test\n " +
43
44
"" ;
44
45
Assert .assertEquals (expected , output );
45
46
} finally {
@@ -51,7 +52,7 @@ public void testLogHeadersWithoutAnyRequestHeaders() throws PolicyFailureError,
51
52
* A simple happy flow test to verify the policy does not blow up in our face.
52
53
*/
53
54
@ Test
54
- @ Configuration ("{ \" direction\" : \" both\" }" )
55
+ @ Configuration ("{ \" direction\" : \" both\" , \" logStatusCode \" : true }" )
55
56
public void testLogHeadersHappyFlow () throws PolicyFailureError , Throwable {
56
57
PrintStream out = System .out ;
57
58
ByteArrayOutputStream testOutput = new ByteArrayOutputStream ();
@@ -66,12 +67,13 @@ public void testLogHeadersHappyFlow() throws PolicyFailureError, Throwable {
66
67
output = redactDates (output );
67
68
output = normalize (output );
68
69
String expected = "INFO: Logging 1 HTTP Request headers for io.apiman.test.policies.EchoBackEndApi\n " +
69
- "INFO: Key : X-Test-Name, Value : testGet\n " +
70
+ "Key : X-Test-Name, Value : testGet\n " +
71
+ "INFO: Status code 200 for io.apiman.test.policies.EchoBackEndApi\n " +
70
72
"INFO: Logging 4 HTTP Response headers for io.apiman.test.policies.EchoBackEndApi\n " +
71
- "INFO: Key : Content-Length, Value : 199\n " +
72
- "INFO: Key : Content-Type, Value : application/json\n " +
73
- "INFO: Key : Date, Value : XXX\n " +
74
- "INFO: Key : Server, Value : apiman.policy-test\n " +
73
+ "Key : Content-Length, Value : 199\n " +
74
+ "Key : Content-Type, Value : application/json\n " +
75
+ "Key : Date, Value : XXX\n " +
76
+ "Key : Server, Value : apiman.policy-test\n " +
75
77
"" ;
76
78
Assert .assertEquals (expected , output );
77
79
} finally {
@@ -98,7 +100,7 @@ public void testLogHeadersHappyFlowRequestOnly() throws PolicyFailureError, Thro
98
100
output = redactDates (output );
99
101
output = normalize (output );
100
102
String expected = "INFO: Logging 1 HTTP Request headers for io.apiman.test.policies.EchoBackEndApi\n " +
101
- "INFO: Key : X-Test-Name, Value : testGet\n " +
103
+ "Key : X-Test-Name, Value : testGet\n " +
102
104
"" ;
103
105
Assert .assertEquals (expected , output );
104
106
} finally {
@@ -110,7 +112,7 @@ public void testLogHeadersHappyFlowRequestOnly() throws PolicyFailureError, Thro
110
112
* A simple happy flow test to verify the policy does not blow up in our face.
111
113
*/
112
114
@ Test
113
- @ Configuration ("{ \" direction\" : \" response\" }" )
115
+ @ Configuration ("{ \" direction\" : \" response\" , \" logStatusCode \" : true }" )
114
116
public void testLogHeadersHappyFlowResponseOnly () throws PolicyFailureError , Throwable {
115
117
PrintStream out = System .out ;
116
118
ByteArrayOutputStream testOutput = new ByteArrayOutputStream ();
@@ -124,11 +126,12 @@ public void testLogHeadersHappyFlowResponseOnly() throws PolicyFailureError, Thr
124
126
String output = testOutput .toString ("UTF-8" );
125
127
output = redactDates (output );
126
128
output = normalize (output );
127
- String expected = "INFO: Logging 4 HTTP Response headers for io.apiman.test.policies.EchoBackEndApi\n " +
128
- "INFO: Key : Content-Length, Value : 199\n " +
129
- "INFO: Key : Content-Type, Value : application/json\n " +
130
- "INFO: Key : Date, Value : XXX\n " +
131
- "INFO: Key : Server, Value : apiman.policy-test\n " +
129
+ String expected = "INFO: Status code 200 for io.apiman.test.policies.EchoBackEndApi\n " +
130
+ "INFO: Logging 4 HTTP Response headers for io.apiman.test.policies.EchoBackEndApi\n " +
131
+ "Key : Content-Length, Value : 199\n " +
132
+ "Key : Content-Type, Value : application/json\n " +
133
+ "Key : Date, Value : XXX\n " +
134
+ "Key : Server, Value : apiman.policy-test\n " +
132
135
"" ;
133
136
Assert .assertEquals (expected , output );
134
137
} finally {
0 commit comments