blob: 1881ecb82076bb04785b9792d034923e19dc82f1 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<testSuite xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:test="plc4x-protocol-test"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
xmlns:tpkt="http://plc4x.apache.org/tpkt"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
suiteName="plc4x-tpkt"
description="Testsuite for the TPKT protocol"
defaultRoundTrip="true">
<tdml:defineSchema name="tkptSchema" elementFormDefault="unqualified">
<!-- Import the Schema -->
<xs:import namespace="http://plc4x.apache.org/tpkt"
schemaLocation="tpkt-protocol.dfdl.xsd"/>
<!-- Import the format settings -->
<dfdl:format ref="tpkt:tpktFormat"/>
<!-- Define the root element name and type -->
<xs:element name="tpktMessage" type="tpkt:TpktMessageType"/>
</tdml:defineSchema>
<!--
In this test-case the data should be parsable to a valid result.
It's a TPKT package containing a COTP connection-response payload.
-->
<tdml:parserTestCase name="tpktPacketContainingCotpConnectResponse"
root="tpktMessage"
model="tkptSchema"
description="Simple TKPT packet which contains a COTP Connection-Response as payload.">
<!-- Define the input -->
<tdml:document>
<tdml:documentPart type="byte">0300001611D00001000200C00109C1020100C2020102</tdml:documentPart>
</tdml:document>
<!-- Define the expected output -->
<tdml:infoset>
<tdml:dfdlInfoset>
<!-- Referencing what we defined as root element in the defineSchema section -->
<test:tpktMessage>
<magicByte>3</magicByte>
<reserved>0</reserved>
<length>22</length>
<userData>11D00001000200C00109C1020100C2020102</userData>
</test:tpktMessage>
</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
<!--
In this test-case the packet doesn't start with the required magic byte 0x03.
-->
<tdml:parserTestCase name="invalidMagicByte">
<tdml:document>
<tdml:documentPart type="byte">0400001611D00001000200C00109C1020100C2020102</tdml:documentPart>
</tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
<!--
In this test-case the payload of the packet doesn't match the
length provided in the packet header (Too short)
-->
<tdml:parserTestCase name="tooShortPayload">
<tdml:document>
<tdml:documentPart type="byte">0300001611D00001000200C00109C102010</tdml:documentPart>
</tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
<!--
In this test-case the payload of the packet doesn't match the
length provided in the packet header (Too long)
-->
<tdml:parserTestCase name="tooLongPayload">
ยด <tdml:document>
<tdml:documentPart type="byte">0300001611D00001000200C00109C1020100C20201021234567890</tdml:documentPart>
</tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
</testSuite>