github.com/wph95/goofys@v0.24.1-0.20200907140828-7bc615e8492e/internal/backend_test.go (about) 1 // Copyright 2020 Ka-Hing Cheung 2 // Copyright 2020 Databricks 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 package internal 17 18 type TestBackend struct { 19 StorageBackend 20 err error 21 } 22 23 func (s *TestBackend) HeadBlob(param *HeadBlobInput) (*HeadBlobOutput, error) { 24 if s.err != nil { 25 return nil, s.err 26 } 27 return s.StorageBackend.HeadBlob(param) 28 } 29 30 func (s *TestBackend) ListBlobs(param *ListBlobsInput) (*ListBlobsOutput, error) { 31 if s.err != nil { 32 return nil, s.err 33 } 34 return s.StorageBackend.ListBlobs(param) 35 } 36 37 func (s *TestBackend) DeleteBlob(param *DeleteBlobInput) (*DeleteBlobOutput, error) { 38 if s.err != nil { 39 return nil, s.err 40 } 41 return s.StorageBackend.DeleteBlob(param) 42 } 43 44 func (s *TestBackend) DeleteBlobs(param *DeleteBlobsInput) (*DeleteBlobsOutput, error) { 45 if s.err != nil { 46 return nil, s.err 47 } 48 return s.StorageBackend.DeleteBlobs(param) 49 } 50 51 func (s *TestBackend) RenameBlob(param *RenameBlobInput) (*RenameBlobOutput, error) { 52 if s.err != nil { 53 return nil, s.err 54 } 55 return s.StorageBackend.RenameBlob(param) 56 } 57 58 func (s *TestBackend) CopyBlob(param *CopyBlobInput) (*CopyBlobOutput, error) { 59 if s.err != nil { 60 return nil, s.err 61 } 62 return s.StorageBackend.CopyBlob(param) 63 } 64 65 func (s *TestBackend) GetBlob(param *GetBlobInput) (*GetBlobOutput, error) { 66 if s.err != nil { 67 return nil, s.err 68 } 69 return s.StorageBackend.GetBlob(param) 70 } 71 72 func (s *TestBackend) PutBlob(param *PutBlobInput) (*PutBlobOutput, error) { 73 if s.err != nil { 74 return nil, s.err 75 } 76 return s.StorageBackend.PutBlob(param) 77 } 78 79 func (s *TestBackend) MultipartBlobBegin(param *MultipartBlobBeginInput) (*MultipartBlobCommitInput, error) { 80 if s.err != nil { 81 return nil, s.err 82 } 83 return s.StorageBackend.MultipartBlobBegin(param) 84 } 85 86 func (s *TestBackend) MultipartBlobAdd(param *MultipartBlobAddInput) (*MultipartBlobAddOutput, error) { 87 if s.err != nil { 88 return nil, s.err 89 } 90 return s.StorageBackend.MultipartBlobAdd(param) 91 } 92 93 func (s *TestBackend) MultipartBlobAbort(param *MultipartBlobCommitInput) (*MultipartBlobAbortOutput, error) { 94 if s.err != nil { 95 return nil, s.err 96 } 97 return s.StorageBackend.MultipartBlobAbort(param) 98 } 99 100 func (s *TestBackend) MultipartBlobCommit(param *MultipartBlobCommitInput) (*MultipartBlobCommitOutput, error) { 101 if s.err != nil { 102 return nil, s.err 103 } 104 return s.StorageBackend.MultipartBlobCommit(param) 105 } 106 107 func (s *TestBackend) MultipartExpire(param *MultipartExpireInput) (*MultipartExpireOutput, error) { 108 if s.err != nil { 109 return nil, s.err 110 } 111 return s.StorageBackend.MultipartExpire(param) 112 }