Documentation ¶
Index ¶
- type App
- func (app *App) DispatchEvent(token string, topic string, payload interface{})
- func (app *App) Initialize(routeSpecifiers []RouteSpecifier)
- func (app *App) Logger(module string) *log.Entry
- func (app *App) NewUnitOfWork(readOnly bool) *repository.UnitOfWork
- func (app *App) Start()
- func (app *App) Stop()
- type RouteSpecifier
- type TestApp
- func (testApp *TestApp) CheckResponseCode(t *testing.T, expected, actual int)
- func (testApp *TestApp) ExecuteRequest(req *http.Request) *httptest.ResponseRecorder
- func (testApp *TestApp) GetAdminToken(tenantID string, userID string, scope []string) string
- func (testApp *TestApp) GetToken(tenantID string, userID string, scope []string) string
- func (testApp *TestApp) GetTokenWithExternalID(tenantID string, userID string, externalID string, externalIDType string, ...) string
- func (testApp *TestApp) Initialize()
- func (testApp *TestApp) PrepareEmptyTables()
- func (testApp *TestApp) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Name string Config *config.Config DB *gorm.DB Router *mux.Router // contains filtered or unexported fields }
App structure for tenant microservice
func New ¶
func New(appName string, appConfigOverride map[string]string, appLog *log.Logger, appDB *gorm.DB, appEventDispatcher event.EventDispatcher) *App
New creates a new microApp
func (*App) DispatchEvent ¶
DispatchEvent delegates to eventDispatcher.
func (*App) Initialize ¶
func (app *App) Initialize(routeSpecifiers []RouteSpecifier)
Initialize initializes properties of the app
func (*App) NewUnitOfWork ¶ added in v0.0.2
func (app *App) NewUnitOfWork(readOnly bool) *repository.UnitOfWork
NewUnitOfWork creates new UnitOfWork
type RouteSpecifier ¶
RouteSpecifier should be implemented by the class that sets routes for the API endpoints
type TestApp ¶ added in v0.0.7
type TestApp struct {
// contains filtered or unexported fields
}
TestApp Provides convinience methods for test
func NewTestApp ¶ added in v0.0.7
func NewTestApp(appName string, controllerRouteProvider func(*App) []RouteSpecifier, dbInitializer func(db *gorm.DB), verbose bool) *TestApp
NewTestApp returns new instance of TestApp
func (*TestApp) CheckResponseCode ¶ added in v0.0.7
CheckResponseCode checks if the http response is as expected
func (*TestApp) ExecuteRequest ¶ added in v0.0.7
func (testApp *TestApp) ExecuteRequest(req *http.Request) *httptest.ResponseRecorder
ExecuteRequest executes the http request
func (*TestApp) GetAdminToken ¶ added in v0.0.8
GetAdminToken returns a test token
func (*TestApp) GetTokenWithExternalID ¶ added in v0.0.29
func (testApp *TestApp) GetTokenWithExternalID(tenantID string, userID string, externalID string, externalIDType string, scope []string) string
GetTokenWithExternalID returns a test token with different external IDs for types such as Appliance, Session, User. These external IDs are used with REST api is invoked from another REST API service as opposed to the getting hit from UI by the user.
func (*TestApp) Initialize ¶ added in v0.0.7
func (testApp *TestApp) Initialize()
Initialize prepares the app for testing
func (*TestApp) PrepareEmptyTables ¶ added in v0.0.7
func (testApp *TestApp) PrepareEmptyTables()
PrepareEmptyTables clears all table of data