Documentation
¶
Index ¶
- func JSONResponse(w http.ResponseWriter, data Response, code int) (int, error)
- type APIProxy
- type Capabilities
- type ClientFactoryInterface
- type ClientFactoryMock
- type ClientInterface
- type ClientMock
- type Configuration
- type Message
- type NewSession
- type Register
- type Response
- type ResponseStatus
- type Sessions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIProxy ¶
type APIProxy struct { ID string `json:"id"` Request interface{} `json:"request"` //todo: пока не ясно зачем он нужен Msg string `json:"msg"` Success bool `json:"success"` }
APIProxy - message structure for node check.
type Capabilities ¶
type Capabilities map[string]interface{}
Capabilities - structure of supported capabilities.
type ClientFactoryInterface ¶
type ClientFactoryInterface interface {
Create(address string) ClientInterface
}
ClientFactoryInterface - is an abstract http-client factory for node implementations.
type ClientFactoryMock ¶
ClientFactoryMock - mock of factory of client.
func (*ClientFactoryMock) Create ¶
func (cf *ClientFactoryMock) Create(address string) ClientInterface
Create - mock of create session.
type ClientInterface ¶
type ClientInterface interface { Health() (*Message, error) Sessions() (*Sessions, error) CloseSession(sessionID string) (*Message, error) Address() string }
ClientInterface - is an abstract http-client for node implementations.
type ClientMock ¶
ClientMock - mock of client.
func (*ClientMock) Address ¶
func (c *ClientMock) Address() string
Address - mock of get node address.
func (*ClientMock) CloseSession ¶
func (c *ClientMock) CloseSession(sessionID string) (*Message, error)
CloseSession - mock of close session.
func (*ClientMock) Health ¶
func (c *ClientMock) Health() (*Message, error)
Health - mock of healthcheck.
func (*ClientMock) Sessions ¶
func (c *ClientMock) Sessions() (*Sessions, error)
Sessions - mock of sessions list.
type Configuration ¶
type Configuration struct { ID string `json:"id,omitempty"` Proxy string `json:"proxy,omitempty"` Role string `json:"role,omitempty"` Hub string `json:"hub,omitempty"` Port int `json:"port,omitempty"` RemoteHost string `json:"remoteHost,omitempty"` Host string `json:"host,omitempty"` MaxSession int `json:"maxSession,omitempty"` HubHost string `json:"hubHost,omitempty"` RegisterCycle int `json:"registerCycle,omitempty"` HubPort int `json:"hubPort,omitempty"` URL string `json:"url,omitempty"` Register bool `json:"register,omitempty"` CapabilitiesList []Capabilities `json:"capabilities,omitempty"` // selenium 2 }
Configuration - structure of node configuration.
type Message ¶
type Message struct { SessionID string `json:"sessionId"` Status int `json:"status"` Value interface{} `json:"value"` }
Message - common protocol message structure.
type NewSession ¶
type NewSession struct { Message Value struct { SessionID string `json:"sessionId"` } `json:"value"` }
NewSession - message structure for the creation of a new session
type Register ¶
type Register struct { Class json.RawMessage `json:"class,omitempty"` Configuration *Configuration `json:"configuration,omitempty"` CapabilitiesList []Capabilities `json:"capabilities,omitempty"` // selenium 3 Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` }
Register - message structure for registration new node.
type Response ¶
type Response struct { SessionID *string `json:"sessionId"` Status ResponseStatus `json:"status"` Value json.RawMessage `json:"value"` }
func NewResponse ¶
func NewResponse(sessionID *string, status ResponseStatus, value json.RawMessage) *Response
type ResponseStatus ¶
type ResponseStatus int
const ( ResponseStatusSuccess ResponseStatus = 0 ResponseStatusUnknownErr ResponseStatus = 13 )
type Sessions ¶
type Sessions struct { Message Value []struct { ID string `json:"id"` Capabilities json.RawMessage `json:"capabilities"` } `json:"value"` }
Sessions - message structure for sessions list.
Source Files
¶
- interfaces.go
- jsonwire.go
- mocks.go
- response.go