mockserver

package
v2.0.0-2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 7 Imported by: 0

README

go-graylog mockserver

GoDoc GitHub last commit GitHub tag License

Graylog API mockserver for Golang.

See https://github.com/suzuki-shunsuke/go-graylog

Documentation

Overview

Package mockserver provides Graylog API mock server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*logic.Logic `json:"-"`
	// contains filtered or unexported fields
}

Server represents a mock of the Graylog API. Server embeds the Logic, so please see the document about Logic also. https://godoc.org/github.com/suzuki-shunsuke/go-graylog/mockserver/logic

func NewServer

func NewServer(addr string, store store.Store) (*Server, error)

NewServer returns new Server but doesn't start it. The argument `addr` is the port number which the server uses.

server, err := mockserver.NewServer(":8000", nil)

If addr is an empty string, the free port is assigned automatially. The argument `store` is the store which the server uses. If `store` is nil, the default plain store is used and data is not persisted. To start the server, call the Start method.

server.Start()
defer server.Close()

func (*Server) Close

func (ms *Server) Close()

Close shuts down the server and blocks until all outstanding requests on this server have completed.

func (*Server) Endpoint

func (ms *Server) Endpoint() string

Endpoint returns the endpoint url.

server, err := mockserver.NewServer(":8000", nil)
fmt.Println(server.Endpoint()) // http://localhost:8000/api

func (*Server) Start

func (ms *Server) Start()

Start starts a server from NewUnstartedServer.

Directories

Path Synopsis
Run Graylog mock server.
Run Graylog mock server.
cmd
Package handler provides handlers of Graylog API mock server.
Package handler provides handlers of Graylog API mock server.
Package logic provides logic layers of Graylog API mock server.
Package logic provides logic layers of Graylog API mock server.
Package store provides store interface for Graylog API mock server.
Package store provides store interface for Graylog API mock server.
plain
Package plain provides the implementation of store.Store interface.
Package plain provides the implementation of store.Store interface.

Jump to

Keyboard shortcuts

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