"strings"
"sync/atomic"
"syscall"
+ "testing"
"time"
"github.com/spf13/viper"
)
+// For testing purpose go version 1.13 ->
+var _ = func() bool {
+ testing.Init()
+ return true
+}()
+
type ReadyCB func(interface{})
type ShutdownCB func()
// XApp is an application instance
Rmr *RMRClient
Sdl *SDLClient
+ SdlStorage *SDLStorage
Rnib *RNIBClient
Resource *Router
Metric *Metrics
)
func IsReady() bool {
- return Rmr != nil && Rmr.IsReady() && Sdl != nil && Sdl.IsReady()
+ return Rmr != nil && Rmr.IsReady() && SdlStorage != nil && SdlStorage.IsReady()
}
func SetReadyCB(cb ReadyCB, params interface{}) {
Config = Configurator{}
Metric = NewMetrics(viper.GetString("metrics.url"), viper.GetString("metrics.namespace"), Resource.router)
Subscription = NewSubscriber(viper.GetString("controls.subscription.host"), viper.GetInt("controls.subscription.timeout"))
+ SdlStorage = NewSdlStorage()
Sdl = NewSDLClient(viper.GetString("controls.db.namespace"))
- Rnib = NewRNIBClient()
+ Rnib = GetNewRnibClient(SdlStorage.db)
Util = NewUtils()
InstallSignalHandler()
Logger.Info(fmt.Sprintf("Xapp started, listening on: %s", host))
if sdlcheck {
- Sdl.TestConnection()
+ SdlStorage.TestConnection(viper.GetString("controls.db.namespace"))
}
go registerXapp()