Documentation ¶
Index ¶
- func GenerateKey(path string) (string, error)
- func GetDefaultConfigMap() map[string]interface{}
- func Handler(resp *Response) func(http.ResponseWriter, *http.Request)
- func InitDatabaseFromEnv()
- func NewAdminserver(config map[string]interface{}) (*httptest.Server, error)
- func NewCapacityHandle() (func(http.ResponseWriter, *http.Request), error)
- func NewRegistryCtl(config map[string]interface{}) (*httptest.Server, error)
- func NewServer(mappings ...*RequestHandlerMapping) *httptest.Server
- type FakePolicyManager
- func (f *FakePolicyManager) CreatePolicy(policy models.ReplicationPolicy) (int64, error)
- func (f *FakePolicyManager) GetPolicies(query models.QueryParameter) (*models.ReplicationPolicyQueryResult, error)
- func (f *FakePolicyManager) GetPolicy(id int64) (models.ReplicationPolicy, error)
- func (f *FakePolicyManager) RemovePolicy(int64) error
- func (f *FakePolicyManager) UpdatePolicy(models.ReplicationPolicy) error
- type FakeReplicatoinController
- type FakeWatchItemDAO
- type GCResult
- type RequestHandlerMapping
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultConfigMap ¶
func GetDefaultConfigMap() map[string]interface{}
GetDefaultConfigMap returns the defailt config map for easier modification.
func Handler ¶
func Handler(resp *Response) func(http.ResponseWriter, *http.Request)
Handler returns a handler function which handle requst according to the response provided
func InitDatabaseFromEnv ¶
func InitDatabaseFromEnv()
InitDatabaseFromEnv is used to initialize database for testing
func NewAdminserver ¶
NewAdminserver returns a mock admin server
func NewCapacityHandle ¶
func NewCapacityHandle() (func(http.ResponseWriter, *http.Request), error)
NewCapacityHandle ...
func NewRegistryCtl ¶
NewRegistryCtl returns a mock registry server
func NewServer ¶
func NewServer(mappings ...*RequestHandlerMapping) *httptest.Server
NewServer creates a HTTP server for unit test
Types ¶
type FakePolicyManager ¶
type FakePolicyManager struct { }
func (*FakePolicyManager) CreatePolicy ¶
func (f *FakePolicyManager) CreatePolicy(policy models.ReplicationPolicy) (int64, error)
func (*FakePolicyManager) GetPolicies ¶
func (f *FakePolicyManager) GetPolicies(query models.QueryParameter) (*models.ReplicationPolicyQueryResult, error)
func (*FakePolicyManager) GetPolicy ¶
func (f *FakePolicyManager) GetPolicy(id int64) (models.ReplicationPolicy, error)
func (*FakePolicyManager) RemovePolicy ¶
func (f *FakePolicyManager) RemovePolicy(int64) error
func (*FakePolicyManager) UpdatePolicy ¶
func (f *FakePolicyManager) UpdatePolicy(models.ReplicationPolicy) error
type FakeReplicatoinController ¶
type FakeReplicatoinController struct {
FakePolicyManager
}
func (*FakeReplicatoinController) Init ¶
func (f *FakeReplicatoinController) Init() error
type FakeWatchItemDAO ¶
type FakeWatchItemDAO struct {
// contains filtered or unexported fields
}
FakeWatchItemDAO is the fake implement for the dao.WatchItemDAO
func (*FakeWatchItemDAO) Add ¶
func (f *FakeWatchItemDAO) Add(item *models.WatchItem) (int64, error)
Add ...
func (*FakeWatchItemDAO) DeleteByPolicyID ¶
func (f *FakeWatchItemDAO) DeleteByPolicyID(policyID int64) error
DeleteByPolicyID : delete the WatchItem specified by policy ID
type GCResult ¶
type GCResult struct { Status bool `json:"status"` Msg string `json:"msg"` StartTime time.Time `json:"starttime"` EndTime time.Time `json:"endtime"` }
GCResult ...
type RequestHandlerMapping ¶
type RequestHandlerMapping struct { // Method is the method the request used Method string // Pattern is the pattern the request must match Pattern string // Handler is the handler which handles the request Handler func(http.ResponseWriter, *http.Request) }
RequestHandlerMapping is a mapping between request and its handler
func (*RequestHandlerMapping) ServeHTTP ¶
func (rhm *RequestHandlerMapping) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP ...
Click to show internal directories.
Click to hide internal directories.