Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Log is sending debugging information to the test logger (t.Log(), t.Logf()) Log Logger // SendEventsFromAPI will send all the events automatically on the event bus when // adding, updating, deleting items, things, channels, etc. from the REST API. // The default is off meaning the events are to be sent from the unit test SendEventsFromAPI bool // Version of the openHAB API: valid values are V2 or V3 Version Version }
Config is the configuration object for the mock openhab Server
type Logger ¶
type Logger interface { Log(args ...interface{}) Logf(format string, args ...interface{}) }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a mock openHAB instance to use in tests.
func (*Server) Close ¶
func (s *Server) Close()
Close the mock openHAB server. The call will also close any long running request to the event bus API. The method can safely be called multiple times.
func (*Server) RawEvent ¶
RawEvent sends a raw JSON string event to the event bus. Example of a raw event:
{"topic":"smarthome/items/LocalWeatherAndForecast_Current_Cloudiness/state","payload":"{\"type\":\"Quantity\",\"value\":\"20 %\"}","type":"ItemStateEvent"}
A topic parameter is needed for subscriber topic filtering, and to avoid decoding the event string unnecessarily.
func (*Server) RemoveItem ¶
RemoveItem removes an existing item. It doesn't return an error if the item doesn't exist.
Click to show internal directories.
Click to hide internal directories.