|
| 1 | +// Copyright 2021 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +// This schema uses some non-idiomatic style for field names because it's |
| 16 | +// designed to parse an existing JSON file used by the Android and iOS |
| 17 | +// implementations of Realtime Database. |
| 18 | + |
| 19 | +namespace firebase.database.internal.test_data; |
| 20 | + |
| 21 | +// Order of these enum values matters. It must match the order of the EventType |
| 22 | +// enum in `database/src/desktop/view/event_type.h` |
| 23 | +enum EventType : uint8 { |
| 24 | + child_removed, |
| 25 | + child_added, |
| 26 | + child_moved, |
| 27 | + child_changed, |
| 28 | + value, |
| 29 | +} |
| 30 | + |
| 31 | +enum StepType : uint8 { |
| 32 | + ackUserWrite, |
| 33 | + listen, |
| 34 | + serverMerge, |
| 35 | + serverUpdate, |
| 36 | + set, |
| 37 | + suppressWarning, |
| 38 | + unlisten, |
| 39 | + update, |
| 40 | +} |
| 41 | + |
| 42 | +table Event { |
| 43 | + path: string; |
| 44 | + type: EventType; |
| 45 | + name: string; |
| 46 | + prevName: string; |
| 47 | + data: [uint8] (flexbuffer); |
| 48 | +} |
| 49 | + |
| 50 | +table Bound { |
| 51 | + index: [uint8] (flexbuffer); |
| 52 | + name: string; |
| 53 | +} |
| 54 | + |
| 55 | +table QueryParams { |
| 56 | + tag: int32; |
| 57 | + limitToFirst: int32; |
| 58 | + limitToLast: int32; |
| 59 | + orderByKey: bool; |
| 60 | + orderByPriority: bool; |
| 61 | + startAt: Bound; |
| 62 | + endAt: Bound; |
| 63 | + equalTo: Bound; |
| 64 | + orderBy: string; |
| 65 | +} |
| 66 | + |
| 67 | +table Step { |
| 68 | + // A comment that may be printed during the test, describing what the action |
| 69 | + // that the current step is performing. |
| 70 | + comment: string; |
| 71 | + |
| 72 | + type: StepType; |
| 73 | + path: string; |
| 74 | + tag: int64; |
| 75 | + params: QueryParams; |
| 76 | + data: [uint8] (flexbuffer); |
| 77 | + events: [Event]; |
| 78 | + |
| 79 | + visible: bool = true; |
| 80 | + callbackId: int32; |
| 81 | + writeId: int32; |
| 82 | + revert: bool; |
| 83 | +} |
| 84 | + |
| 85 | +table TestCase { |
| 86 | + // A comment that may be printed during the test, describing what the what is |
| 87 | + // being tested. |
| 88 | + comment: string; |
| 89 | + |
| 90 | + // The name of the test. |
| 91 | + name: string; |
| 92 | + |
| 93 | + // The series of steps in this test, including what actions to take and what |
| 94 | + // events are expected to be raised at each step. |
| 95 | + steps: [Step]; |
| 96 | +} |
| 97 | + |
| 98 | +table TestSuite { |
| 99 | + test_cases: [TestCase]; |
| 100 | +} |
| 101 | + |
| 102 | +root_type TestSuite; |
0 commit comments