mockscoringmgr "scoringmgr/mock"
// discoverymgr "discoverymgr"
- // servicemgr "servicemgr"
+ servicemgr "servicemgr"
)
//user scenario
execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
- time.Sleep(time.Duration(5) * time.Second)
-
-
- orcheMock.IScoringmgr.RemoveLib("/tmp/foo/mysum/libmysum.so")
+ time.Sleep(time.Duration(3) * time.Second)
+ //resource release
+ orcheMock.IScoringmgr.RemoveLib("mysum")
orcheMock.IConfiguremgr.Done <- true
}
//jaehoon.hyun, chacha
func TestRequestServiceFunctionServiceMgr(t *testing.T){
- //make orche
- // orcheMock := new(Orche)
+ orcheMock := Init("")
- // orcheMock.IScoringmgr = scoringmgr.Init()
- // orcheMock.IConfiguremgr = configuremgr.Init()
+ orcheMock.IScoringmgr = scoringmgr.Init()
+ orcheMock.IConfiguremgr = configuremgr.Init()
- // orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringAddInterface
- // orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
- // orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
+ orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringAddInterface
+ orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
+ orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
- // orcheMock.IConfiguremgr.IDiscoveryMgr.PushConfPath = pushConfPathDiscoveryDeviceMock
- // orcheMock.IConfiguremgr.IScoringMgr.PushLibPath = scoringmgr.PushLibPath
- // orcheMock.IConfiguremgr.IScoringMgr.Ch = orcheMock.IScoringmgr.Ch
+ orcheMock.IConfiguremgr.IDiscoveryMgr.PushConfPath = pushConfPathDiscoveryDeviceMock
+ orcheMock.IConfiguremgr.IScoringMgr.PushLibPath = scoringmgr.PushLibPath
+ orcheMock.IConfiguremgr.IScoringMgr.Ch = orcheMock.IScoringmgr.Ch
- // orcheMock.IDiscoverymgr.GetEndpointDevices = getEndpointDevicesMock
- // orcheMock.IServicemgr.ExecuteApp = executeAppMock
+ orcheMock.IDiscoverymgr.GetEndpointDevices = getEndpointDevicesMock
+ orcheMock.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
- // //scoringmgr init
- // orcheMock.IScoringmgr.Listening()
+ //scoringmgr init
+ orcheMock.IScoringmgr.Listening()
- // //configuremgr init
- // go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+ //configuremgr init
+ go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+
+ //servicemgr init
+ servicemgr.InitServiceMap()
+
+
+ //init scenario
+ execCommand("rm -rf /tmp/foo/mysum")
+ time.Sleep(time.Duration(1) * time.Second)
+
+ //user scenario
+ execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
+ time.Sleep(time.Duration(3) * time.Second)
+ RequestService("mysum", "ls", []string{"-al"})
- // //servicemgr init
- // servicemgr.InitServiceMap()
- // //user scenario
- // RequestService("mysum", "ls", []string{"-al"})
+ //resource release
+ time.Sleep(time.Duration(1) * time.Second)
+ orcheMock.IScoringmgr.RemoveLib("mysum")
+ orcheMock.IConfiguremgr.Done <- true
+ for {}
}
//daemon92-lee, chacha
}
func getEndpointDevicesMock(serviceName string) []string {
+ DLog.Printf("getEndpointDevicesMock serviceName: %s\n", serviceName)
return []string{"localhost", "localhost"}
}