1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
33
33
import org .springframework .messaging .support .MessageHeaderAccessor ;
34
34
import org .springframework .util .AlternativeJdkIdGenerator ;
35
35
import org .springframework .util .LinkedMultiValueMap ;
36
+ import org .springframework .util .MimeType ;
36
37
import org .springframework .util .MimeTypeUtils ;
37
38
import org .springframework .util .MultiValueMap ;
38
39
@@ -48,9 +49,9 @@ public class StompHeaderAccessorTests {
48
49
49
50
private static final Charset UTF_8 = Charset .forName ("UTF-8" );
50
51
52
+
51
53
@ Test
52
54
public void createWithCommand () {
53
-
54
55
StompHeaderAccessor accessor = StompHeaderAccessor .create (StompCommand .CONNECTED );
55
56
assertEquals (StompCommand .CONNECTED , accessor .getCommand ());
56
57
@@ -60,7 +61,6 @@ public void createWithCommand() {
60
61
61
62
@ Test
62
63
public void createWithSubscribeNativeHeaders () {
63
-
64
64
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
65
65
extHeaders .add (StompHeaderAccessor .STOMP_ID_HEADER , "s1" );
66
66
extHeaders .add (StompHeaderAccessor .STOMP_DESTINATION_HEADER , "/d" );
@@ -75,7 +75,6 @@ public void createWithSubscribeNativeHeaders() {
75
75
76
76
@ Test
77
77
public void createWithUnubscribeNativeHeaders () {
78
-
79
78
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
80
79
extHeaders .add (StompHeaderAccessor .STOMP_ID_HEADER , "s1" );
81
80
@@ -88,7 +87,6 @@ public void createWithUnubscribeNativeHeaders() {
88
87
89
88
@ Test
90
89
public void createWithMessageFrameNativeHeaders () {
91
-
92
90
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
93
91
extHeaders .add (StompHeaderAccessor .DESTINATION_HEADER , "/d" );
94
92
extHeaders .add (StompHeaderAccessor .STOMP_SUBSCRIPTION_HEADER , "s1" );
@@ -103,7 +101,6 @@ public void createWithMessageFrameNativeHeaders() {
103
101
104
102
@ Test
105
103
public void createWithConnectNativeHeaders () {
106
-
107
104
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
108
105
extHeaders .add (StompHeaderAccessor .STOMP_LOGIN_HEADER , "joe" );
109
106
extHeaders .add (StompHeaderAccessor .STOMP_PASSCODE_HEADER , "joe123" );
@@ -124,7 +121,6 @@ public void createWithConnectNativeHeaders() {
124
121
125
122
@ Test
126
123
public void toNativeHeadersSubscribe () {
127
-
128
124
StompHeaderAccessor headers = StompHeaderAccessor .create (StompCommand .SUBSCRIBE );
129
125
headers .setSubscriptionId ("s1" );
130
126
headers .setDestination ("/d" );
@@ -138,7 +134,6 @@ public void toNativeHeadersSubscribe() {
138
134
139
135
@ Test
140
136
public void toNativeHeadersUnsubscribe () {
141
-
142
137
StompHeaderAccessor headers = StompHeaderAccessor .create (StompCommand .UNSUBSCRIBE );
143
138
headers .setSubscriptionId ("s1" );
144
139
@@ -150,7 +145,6 @@ public void toNativeHeadersUnsubscribe() {
150
145
151
146
@ Test
152
147
public void toNativeHeadersMessageFrame () {
153
-
154
148
StompHeaderAccessor headers = StompHeaderAccessor .create (StompCommand .MESSAGE );
155
149
headers .setSubscriptionId ("s1" );
156
150
headers .setDestination ("/d" );
@@ -168,9 +162,8 @@ public void toNativeHeadersMessageFrame() {
168
162
169
163
@ Test
170
164
public void toNativeHeadersContentType () {
171
-
172
165
SimpMessageHeaderAccessor simpHeaderAccessor = SimpMessageHeaderAccessor .create ();
173
- simpHeaderAccessor .setContentType (MimeTypeUtils . APPLICATION_ATOM_XML );
166
+ simpHeaderAccessor .setContentType (MimeType . valueOf ( "application/atom+xml" ) );
174
167
Message <byte []> message = MessageBuilder .createMessage (new byte [0 ], simpHeaderAccessor .getMessageHeaders ());
175
168
176
169
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor .wrap (message );
@@ -181,7 +174,6 @@ public void toNativeHeadersContentType() {
181
174
182
175
@ Test
183
176
public void encodeConnectWithLoginAndPasscode () throws UnsupportedEncodingException {
184
-
185
177
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
186
178
extHeaders .add (StompHeaderAccessor .STOMP_LOGIN_HEADER , "joe" );
187
179
extHeaders .add (StompHeaderAccessor .STOMP_PASSCODE_HEADER , "joe123" );
@@ -195,7 +187,6 @@ public void encodeConnectWithLoginAndPasscode() throws UnsupportedEncodingExcept
195
187
196
188
@ Test
197
189
public void modifyCustomNativeHeader () {
198
-
199
190
MultiValueMap <String , String > extHeaders = new LinkedMultiValueMap <>();
200
191
extHeaders .add (StompHeaderAccessor .STOMP_ID_HEADER , "s1" );
201
192
extHeaders .add (StompHeaderAccessor .STOMP_DESTINATION_HEADER , "/d" );
0 commit comments