Skip to content

Commit 7a6215b

Browse files
Feature/con 163 test (#23)
* CON-163: Added test for CON-163 * CON-209: Added unit test for CON-209 Co-authored-by: Sam Raeburn <sam@rti.com>
1 parent d9f82be commit 7a6215b

3 files changed

Lines changed: 92 additions & 2 deletions

File tree

test/nodejs/test_rticonnextdds_connector.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,50 @@ describe('Connector Tests', function () {
4848
const connector = new rti.Connector(participantProfile, xmlProfile)
4949
expect(connector).to.exist
5050
expect(connector).to.be.instanceOf(rti.Connector)
51+
connector.close()
5152
})
5253

53-
it('Multiple Connector objects can be instantiated', function () {
54+
it('Multiple Connector objects can be instantiated', () => {
5455
const participantProfile = 'MyParticipantLibrary::Zero'
5556
const xmlProfile = path.join(__dirname, '/../xml/TestConnector.xml')
5657
const connectors = []
57-
for (var i = 0; i < 5; i++) {
58+
for (var i = 0; i < 3; i++) {
5859
connectors.push(new rti.Connector(participantProfile, xmlProfile))
5960
}
6061
connectors.forEach((connector) => {
6162
expect(connector).to.exist
6263
expect(connector).to.be.instanceOf(rti.Connector)
64+
connector.close()
6365
})
6466
})
6567

68+
// Test for CON-163
69+
it('Multiple Connector obejcts can be instantiated without participant QoS', () => {
70+
const participantProfile = 'MyParticipantLibrary::MyParticipant'
71+
const xmlProfile = path.join(__dirname, '/../xml/TestConnector3.xml')
72+
const connectors = []
73+
for (var i = 0; i < 2; i++) {
74+
connectors.push(new rti.Connector(participantProfile, xmlProfile))
75+
}
76+
connectors.forEach((connector) => {
77+
expect(connector).to.exist
78+
expect(connector).to.be.instanceOf(rti.Connector)
79+
connector.close()
80+
})
81+
})
82+
83+
it('Load two XML files using the url group syntax', function () {
84+
const xmlProfile1 = path.join(__dirname, '/../xml/TestConnector.xml')
85+
const xmlProfile2 = path.join(__dirname, '/../xml/TestConnector2.xml')
86+
const fullXmlPath = xmlProfile1 + ';' + xmlProfile2
87+
const connector = new rti.Connector('MyParticipantLibrary2::MyParticipant2', fullXmlPath)
88+
expect(connector).to.exist
89+
expect(connector).to.be.instanceOf(rti.Connector)
90+
const output = connector.getOutput('MyPublisher2::MySquareWriter2')
91+
expect(output).to.exist
92+
connector.close()
93+
})
94+
6695
describe('Connector callback test', function () {
6796
let connector
6897

test/xml/TestConnector2.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
(c) 2005-2019 Copyright, Real-Time Innovations. All rights reserved.
4+
No duplications, whole or partial, manual or electronic, may be made
5+
without express written permission. Any such copies, or revisions thereof,
6+
must display this notice unaltered.
7+
This code contains trade secrets of Real-Time Innovations, Inc.
8+
-->
9+
10+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_dds_profiles.xsd"
12+
version="6.0.0">
13+
14+
<!-- Participant library -->
15+
<domain_participant_library name="MyParticipantLibrary2">
16+
<domain_participant name="MyParticipant2" domain_ref="MyDomainLibrary::MyDomain">
17+
<publisher name="MyPublisher2">
18+
<data_writer name="MySquareWriter2" topic_ref="Square" />
19+
</publisher>
20+
</domain_participant>
21+
</domain_participant_library>
22+
</dds>

test/xml/TestConnector3.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
(c) 2005-2020 Copyright, Real-Time Innovations. All rights reserved.
4+
No duplications, whole or partial, manual or electronic, may be made
5+
without express written permission. Any such copies, or revisions thereof,
6+
must display this notice unaltered.
7+
This code contains trade secrets of Real-Time Innovations, Inc.
8+
-->
9+
10+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_dds_profiles.xsd"
12+
version="6.0.0">
13+
<!-- types -->
14+
<types>
15+
<struct name="SimpleType">
16+
<member name="first" type="long"/>
17+
</struct>
18+
</types>
19+
20+
<!-- Domain Library -->
21+
<domain_library name="MyDomainLibrary">
22+
<domain name="MyDomain" domain_id="0">
23+
<register_type name="SimpleType" type_ref="SimpleType" />
24+
<topic name="Simple" register_type_ref="SimpleType"/>
25+
</domain>
26+
</domain_library>
27+
28+
<!-- Participant library -->
29+
<domain_participant_library name="MyParticipantLibrary">
30+
<domain_participant name="MyParticipant" domain_ref="MyDomainLibrary::MyDomain">
31+
<publisher name="MyPublisher">
32+
<data_writer name="MyWriter" topic_ref="Simple" />
33+
</publisher>
34+
<subscriber name="MySubscriber">
35+
<data_reader name="MyReader" topic_ref="Simple" />
36+
</subscriber>
37+
</domain_participant>
38+
</domain_participant_library>
39+
</dds>

0 commit comments

Comments
 (0)