Skip to content

Commit b46a7ed

Browse files
Test session and links details
1 parent 5b845a6 commit b46a7ed

File tree

2 files changed

+76
-16
lines changed

2 files changed

+76
-16
lines changed

selenium/test/connections/amqp10/sessions-for-monitoring-user.js

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
4949
'id': "selenium-connection-id",
5050
'container_id': "selenium-container-id"
5151
})
52-
connection.open_receiver('examples')
53-
connection.open_sender('examples')
54-
52+
connection.open_receiver({
53+
source: 'examples',
54+
target: 'receiver-target',
55+
name: 'receiver-link'
56+
})
57+
connection.open_sender({
58+
target: 'examples',
59+
source: 'sender-source',
60+
name: 'sender-link'
61+
})
5562
await connectionEstablishedPromise
5663
await overview.clickOnConnectionsTab()
5764
await connectionsPage.isLoaded()
@@ -64,21 +71,38 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
6471

6572

6673
it('can list session information', async function () {
67-
let a = await connectionPage.list_sessions()
68-
console.log(a.length + " sessions")
69-
for(var i = 0; i < a.length; i++) {
70-
console.log(a[i].length + " columns " + a[i])
71-
for(var z = 0; z < a[i].length; z++) {
72-
console.log(a[i][z]);
73-
}
74-
}
74+
let sessions = await connectionPage.getSessions()
75+
assert.equal(1, sessions.sessions.length)
76+
let session = connectionPage.getSessionInfo(sessions.sessions, 0)
77+
console.log("session: " + JSON.stringify(session))
78+
assert.equal(0, session.channelNumber)
79+
assert.equal(1, session.nextIncomingId)
80+
assert.equal(0, session.outgoingUnsettledDeliveries)
7581
})
7682

7783
it('can list link information', async function () {
78-
// names
79-
// target and source information
80-
// unconfirmed messages
81-
// flow control
84+
let sessions = await connectionPage.getSessions()
85+
assert.equal(1, sessions.incoming_links.length)
86+
assert.equal(1, sessions.outgoing_links.length)
87+
88+
let incomingLink = connectionPage.getIncomingLinkInfo(sessions.incoming_links, 0)
89+
console.log("incomingLink: " + JSON.stringify(incomingLink))
90+
assert.equal(1, incomingLink.handle)
91+
assert.equal("sender-link", incomingLink.name)
92+
assert.equal("examples", incomingLink.targetAddress)
93+
assert.equal("mixed", incomingLink.sndSettleMode)
94+
assert.equal("0", incomingLink.unconfirmedMessages)
95+
96+
let outgoingLink = connectionPage.getOutgoingLinkInfo(sessions.outgoing_links, 0)
97+
console.log("outgoingLink: " + JSON.stringify(outgoingLink))
98+
assert.equal(0, outgoingLink.handle)
99+
assert.equal("receiver-link", outgoingLink.name)
100+
assert.equal("examples", outgoingLink.sourceAddress)
101+
assert.equal("examples", outgoingLink.queueName)
102+
103+
assert.equal(false, outgoingLink.sendSettled)
104+
assert.equal("unlimited", outgoingLink.maxMessageSize)
105+
82106
})
83107

84108
after(async function () {

selenium/test/pageobjects/ConnectionPage.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,48 @@ module.exports = class ConnectionPage extends BasePage {
1818
async getName() {
1919
return this.getText(CONNECTION_NAME)
2020
}
21-
async list_sessions() {
21+
async getSessions() {
2222
await this.waitForDisplayed(SESSIONS_SECTION)
2323
return {
2424
sessions : await this.getTable(SESSIONS_TABLE, 100, "session"),
2525
incoming_links : await this.getTable(INCOMING_LINKS_TABLE, 100, "link"),
2626
outgoing_links : await this.getTable(OUTCOMING_LINKS_TABLE, 100, "link")
2727
}
28+
}
29+
getSessionInfo(sessions, index) {
30+
return {
31+
channelNumber: sessions[index][0],
32+
handleMax: sessions[index][1],
33+
nextIncomingId: sessions[index][2],
34+
incomingWindow: sessions[index][3],
35+
nextOutgoingId: sessions[index][4],
36+
remoteIncomingWindow: sessions[index][5],
37+
remoteOutgoingWindow: sessions[index][6],
38+
outgoingUnsettledDeliveries: sessions[index][7]
39+
}
40+
}
41+
getIncomingLinkInfo(links, index) {
42+
return {
43+
handle: links[index][0],
44+
name: links[index][1],
45+
targetAddress: links[index][2],
46+
sndSettleMode: links[index][3],
47+
maxMessageSize: links[index][4],
48+
deliveryCount: links[index][5],
49+
linkCredit: links[index][6],
50+
unconfirmedMessages: links[index][7]
51+
}
2852
}
53+
getOutgoingLinkInfo(links, index) {
54+
return {
55+
handle: links[index][0],
56+
name: links[index][1],
57+
sourceAddress: links[index][2],
58+
queueName: links[index][3],
59+
sendSettled: links[index][4] == "&#9679;" ? true : false,
60+
maxMessageSize: links[index][5],
61+
deliveryCount: links[index][6],
62+
linkCredit: links[index][7]
63+
}
64+
}
2965
}

0 commit comments

Comments
 (0)