Yuxuan 'fishy' Wang | 4d46c11 | 2019-06-07 20:47:18 +0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | package thrift |
| 21 | |
| 22 | import ( |
| 23 | "testing" |
| 24 | ) |
| 25 | |
| 26 | func TestReadWriteHeaderProtocol(t *testing.T) { |
Yuxuan 'fishy' Wang | a2c4466 | 2020-09-21 12:33:26 -0700 | [diff] [blame] | 27 | 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' Wang | c4d1c0d | 2020-12-16 17:10:48 -0800 | [diff] [blame] | 37 | ReadWriteProtocolTest(t, NewTHeaderProtocolFactoryConf(&TConfiguration{ |
| 38 | THeaderProtocolID: THeaderProtocolIDPtrMust(THeaderProtocolCompact), |
| 39 | })) |
Yuxuan 'fishy' Wang | a2c4466 | 2020-09-21 12:33:26 -0700 | [diff] [blame] | 40 | }, |
| 41 | ) |
Yuxuan 'fishy' Wang | b20f675 | 2024-05-02 16:50:08 -0700 | [diff] [blame] | 42 | |
| 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' Wang | 4d46c11 | 2019-06-07 20:47:18 +0800 | [diff] [blame] | 62 | } |