Debian Codegraph @

api/v0/detector/zoo/mock/conn.go

raw symbols SCIP
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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package mock
20
21 import (
22 "github.com/samuel/go-zookeeper/zk"
23 "github.com/stretchr/testify/mock"
24 )
25
26 // Impersontates a zk.Connection
27 // It implements interface Connector
28 type Connector struct {
29 mock.Mock
30 }
31
32 func NewConnector() *Connector {
33 return new(Connector)
34 }
35
36 func (conn *Connector) Close() {
37 conn.Called()
38 }
39
40 func (conn *Connector) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error) {
41 args := conn.Called(path)
42 var (
43 arg0 []string
44 arg1 *zk.Stat
45 arg2 <-chan zk.Event
46 )
47 if args.Get(0) != nil {
48 arg0 = args.Get(0).([]string)
49 }
50 if args.Get(1) != nil {
51 arg1 = args.Get(1).(*zk.Stat)
52 }
53 if args.Get(2) != nil {
54 arg2 = args.Get(2).(<-chan zk.Event)
55 }
56 return arg0, arg1, arg2, args.Error(3)
57 }
58
59 func (conn *Connector) Children(path string) ([]string, *zk.Stat, error) {
60 args := conn.Called(path)
61 return args.Get(0).([]string),
62 args.Get(1).(*zk.Stat),
63 args.Error(2)
64 }
65
66 func (conn *Connector) Get(path string) ([]byte, *zk.Stat, error) {
67 args := conn.Called(path)
68 return args.Get(0).([]byte),
69 args.Get(1).(*zk.Stat),
70 args.Error(2)
71 }