2 // Copyright © 2011-2019 Guy M. Allard
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
24 Test Send Basic, one message.
26 func TestSendBasic(t
*testing
.T
) {
27 for _
, sp
:= range Protocols() {
30 ch
= headersProtocol(ch
, sp
)
31 conn
, e
= Connect(n
, ch
)
33 t
.Fatalf("TestSendBasic CONNECT expected no error, got [%v]\n", e
)
37 d
:= tdest("/queue/send.basiconn.01." + sp
)
38 sh
:= Headers
{HK_DESTINATION
, d
}
41 t
.Fatalf("TestSendBasic Expected nil error, got [%v]\n", e
)
44 e
= conn
.Send(empty_headers
, ms
)
46 t
.Fatalf("TestSendBasic Expected error, got [nil]\n")
49 t
.Fatalf("TestSendBasic Expected [%v], got [%v]\n", EREQDSTSND
, e
)
51 checkReceived(t
, conn
, false)
52 e
= conn
.Disconnect(empty_headers
)
53 checkDisconnectError(t
, e
)
59 Test Send Multiple, multiple messages, 5 to be exact.
61 func TestSendMultiple(t
*testing
.T
) {
62 for _
, sp
:= range Protocols() {
65 ch
= headersProtocol(ch
, sp
)
66 conn
, e
= Connect(n
, ch
)
68 t
.Fatalf("TestSendMultiple CONNECT expected no error, got [%v]\n", e
)
71 smd
:= multi_send_data
{conn
: conn
,
72 dest
: tdest("/queue/sendmultiple.01." + sp
+ "."),
73 mpref
: "sendmultiple.01.message.prefix ",
77 t
.Fatalf("TestSendMultiple Expected nil error, got [%v]\n", e
)
80 checkReceived(t
, conn
, false)
81 e
= conn
.Disconnect(empty_headers
)
82 checkDisconnectError(t
, e
)