github.com/cloudreve/Cloudreve/v3@v3.0.0-20240224133659-3edb00a6484c/pkg/mocks/controllermock/c.go (about)

     1  package controllermock
     2  
     3  import (
     4  	"github.com/cloudreve/Cloudreve/v3/pkg/aria2/common"
     5  	"github.com/cloudreve/Cloudreve/v3/pkg/cluster"
     6  	"github.com/cloudreve/Cloudreve/v3/pkg/mq"
     7  	"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
     8  	"github.com/stretchr/testify/mock"
     9  )
    10  
    11  type SlaveControllerMock struct {
    12  	mock.Mock
    13  }
    14  
    15  func (s SlaveControllerMock) HandleHeartBeat(pingReq *serializer.NodePingReq) (serializer.NodePingResp, error) {
    16  	args := s.Called(pingReq)
    17  	return args.Get(0).(serializer.NodePingResp), args.Error(1)
    18  }
    19  
    20  func (s SlaveControllerMock) GetAria2Instance(s2 string) (common.Aria2, error) {
    21  	args := s.Called(s2)
    22  	return args.Get(0).(common.Aria2), args.Error(1)
    23  }
    24  
    25  func (s SlaveControllerMock) SendNotification(s3 string, s2 string, message mq.Message) error {
    26  	args := s.Called(s3, s2, message)
    27  	return args.Error(0)
    28  }
    29  
    30  func (s SlaveControllerMock) SubmitTask(s3 string, i interface{}, s2 string, f func(interface{})) error {
    31  	args := s.Called(s3, i, s2, f)
    32  	return args.Error(0)
    33  }
    34  
    35  func (s SlaveControllerMock) GetMasterInfo(s2 string) (*cluster.MasterInfo, error) {
    36  	args := s.Called(s2)
    37  	return args.Get(0).(*cluster.MasterInfo), args.Error(1)
    38  }
    39  
    40  func (s SlaveControllerMock) GetPolicyOauthToken(s2 string, u uint) (string, error) {
    41  	args := s.Called(s2, u)
    42  	return args.String(0), args.Error(1)
    43  }