jsonwire

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONResponse

func JSONResponse(w http.ResponseWriter, data Response, code int) (int, error)

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

type ClientFactoryMock struct {
	mock.Mock
}

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

type ClientMock struct {
	mock.Mock
}

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            string         `json:"class,omitempty"`
	Configuration    *Configuration `json:"configuration,omitempty"`
	CapabilitiesList []Capabilities `json:"capabilities,omitempty"` // selenium 3
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL