Skip to content

Commit f4870e6

Browse files
committed
Merge branch 'master' of github.com:ibm-messaging/mq-golang
2 parents 0a39c03 + 71ddee8 commit f4870e6

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

ibmmq/ibmmq_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,33 @@ func TestRoundTo4(t *testing.T) {
289289
}
290290
}
291291
}
292+
293+
func TestNewMQDLHWithNilMQMD(t *testing.T) {
294+
dlh := NewMQDLH(nil)
295+
if dlh == nil {
296+
t.Logf("Expected the MQDLH to not be nil, Got: %v", dlh)
297+
t.Fail()
298+
}
299+
}
300+
301+
func TestNewMQDLHWithMQMD(t *testing.T) {
302+
mqmd := NewMQMD()
303+
mqmd.PutDate = "20060102"
304+
mqmd.PutTime = "150405.00"
305+
306+
dlh := NewMQDLH(mqmd)
307+
if dlh == nil {
308+
t.Logf("Expected the MQDLH to not be nil. Got: %v", dlh)
309+
t.Fail()
310+
}
311+
312+
if dlh.PutDate != mqmd.PutDate {
313+
t.Logf("PutDate is wrong. Expected: %q. Got: %q", mqmd.PutDate, dlh.PutDate)
314+
t.Fail()
315+
}
316+
317+
if dlh.PutTime != mqmd.PutTime {
318+
t.Logf("PutTime is wrong. Expected: %q. Got: %q", mqmd.PutTime, dlh.PutTime)
319+
t.Fail()
320+
}
321+
}

ibmmq/mqiDLH.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ func NewMQDLH(md *MQMD) *MQDLH {
5353
dlh.CodedCharSetId = MQCCSI_UNDEFINED
5454
dlh.PutApplType = 0
5555
dlh.PutApplName = ""
56-
dlh.PutTime = md.PutTime // Copy over the original put timestamp
57-
dlh.PutDate = md.PutDate
5856
dlh.Format = ""
5957
dlh.DestQName = ""
6058
dlh.DestQMgrName = ""
6159

6260
dlh.strucLength = int(MQDLH_CURRENT_LENGTH)
6361

6462
if md != nil {
63+
dlh.PutTime = md.PutTime // Copy over the original put timestamp
64+
dlh.PutDate = md.PutDate
6565
dlh.Encoding = md.Encoding
6666
if md.CodedCharSetId == MQCCSI_DEFAULT {
6767
dlh.CodedCharSetId = MQCCSI_INHERIT

0 commit comments

Comments
 (0)