-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12786 from rabbitmq/replace-java-amqp10-client-wi…
…th-javascript Selenium suites: replace Java AMQP 1.0 client with a JavaScript one
- Loading branch information
Showing
8 changed files
with
120 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
96 changes: 0 additions & 96 deletions
96
selenium/amqp10-roundtriptest/src/main/java/com/rabbitmq/amqp1_0/RoundTripTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
var container = require('rhea') // https://github.com/amqp/rhea | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
function getAmqpConnectionOptions() { | ||
return { | ||
'host': process.env.RABBITMQ_HOSTNAME || 'rabbitmq', | ||
'port': process.env.RABBITMQ_AMQP_PORT || 5672, | ||
'username' : process.env.RABBITMQ_AMQP_USERNAME || 'guest', | ||
'password' : process.env.RABBITMQ_AMQP_PASSWORD || 'guest', | ||
'id': "selenium-connection-id", | ||
'container_id': "selenium-container-id" | ||
} | ||
} | ||
function getAmqpsConnectionOptions() { | ||
let options = getAmqpConnectionOptions() | ||
let useMtls = process.env.AMQP_USE_MTLS || false | ||
if (useMtls) { | ||
options['enable_sasl_external'] = true | ||
} | ||
options['transport'] = 'tls' | ||
let certsLocation = getEnv("RABBITMQ_CERTS"); | ||
options['key'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_key.pem')) | ||
options['cert'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_certificate.pem')) | ||
options['ca'] = fs.readFileSync(path.resolve(certsLocation,'ca_rabbitmq_certificate.pem')) | ||
} | ||
function getConnectionOptions() { | ||
switch(process.env.RABBITMQ_AMQP_SCHEME || 'amqp'){ | ||
case 'amqp': | ||
return getAmqpConnectionOptions() | ||
case 'amqps': | ||
return getAmqpsConnectionOptions() | ||
} | ||
} | ||
module.exports = { | ||
|
||
open: () => { | ||
let promise = new Promise((resolve, reject) => { | ||
container.on('connection_open', function(context) { | ||
resolve() | ||
}) | ||
}) | ||
let connection = container.connect(getConnectionOptions()) | ||
let receiver = connection.open_receiver({ | ||
source: 'examples', | ||
target: 'receiver-target', | ||
name: 'receiver-link' | ||
}) | ||
let sender = connection.open_sender({ | ||
target: 'examples', | ||
source: 'sender-source', | ||
name: 'sender-link' | ||
}) | ||
return { | ||
'connection': connection, | ||
'promise' : promise, | ||
'receiver' : receiver, | ||
'sender' : sender | ||
} | ||
}, | ||
close: (connection) => { | ||
if (connection != null) { | ||
connection.close() | ||
} | ||
}, | ||
once: (event, callback) => { | ||
container.once(event, callback) | ||
}, | ||
on: (event, callback) => { | ||
container.on(event, callback) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.