blob: dfd84f8301297afd4588d10c937cf13cb3eef367 [file] [log] [blame]
Yuxuan 'fishy' Wang4d46c112019-06-07 20:47:18 +08001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20package thrift
21
22import (
23 "testing"
24)
25
26func TestReadWriteHeaderProtocol(t *testing.T) {
Yuxuan 'fishy' Wanga2c44662020-09-21 12:33:26 -070027 t.Run(
28 "default",
29 func(t *testing.T) {
30 ReadWriteProtocolTest(t, NewTHeaderProtocolFactory())
31 },
32 )
33
34 t.Run(
35 "compact",
36 func(t *testing.T) {
Yuxuan 'fishy' Wangc4d1c0d2020-12-16 17:10:48 -080037 ReadWriteProtocolTest(t, NewTHeaderProtocolFactoryConf(&TConfiguration{
38 THeaderProtocolID: THeaderProtocolIDPtrMust(THeaderProtocolCompact),
39 }))
Yuxuan 'fishy' Wanga2c44662020-09-21 12:33:26 -070040 },
41 )
Yuxuan 'fishy' Wangb20f6752024-05-02 16:50:08 -070042
43 t.Run(
44 "binary-zlib",
45 func(t *testing.T) {
46 ReadWriteProtocolTest(t, NewTHeaderProtocolFactoryConf(&TConfiguration{
47 THeaderProtocolID: THeaderProtocolIDPtrMust(THeaderProtocolBinary),
48 THeaderTransforms: []THeaderTransformID{TransformZlib},
49 }))
50 },
51 )
52
53 t.Run(
54 "compact-zlib",
55 func(t *testing.T) {
56 ReadWriteProtocolTest(t, NewTHeaderProtocolFactoryConf(&TConfiguration{
57 THeaderProtocolID: THeaderProtocolIDPtrMust(THeaderProtocolCompact),
58 THeaderTransforms: []THeaderTransformID{TransformZlib},
59 }))
60 },
61 )
Yuxuan 'fishy' Wang4d46c112019-06-07 20:47:18 +080062}