1 package orchestrationapi
10 configuremgr "configuremgr"
11 mockconfiguremgr "configuremgr/mock"
13 scoringmgr "scoringmgr"
14 mockscoringmgr "scoringmgr/mock"
16 // discoverymgr "discoverymgr"
17 // servicemgr "servicemgr"
19 mockorchestrationapi "orchestrationapi/mock"
22 //jaehoon.hyun , jaehoon.hyun
23 func TestConfigureMgrScoringMgr(t *testing.T){
25 //copy event environment
26 watchDir := "/tmp/foo"
27 src := "../configuremgr/mock/mysum"
30 //mock function linking
31 scoringHandlers := scoringmgr.Init()
32 scoringHandlers.IloadScoringLibrary = mockscoringmgr.LoadScoringAdd
33 scoringHandlers.Ch = make(chan interface{}, 1024)
35 configuremgrObj := configuremgr.Init()
36 configuremgrObj.IDiscoveryMgr.PushConfPath = mockconfiguremgr.PushConfPathDiscoveryDeviceMock
37 configuremgrObj.IScoringMgr.PushLibPath = scoringmgr.PushLibPath
38 configuremgrObj.IScoringMgr.Ch = scoringHandlers.Ch
40 scoringHandlers.Listening()
41 go configuremgrObj.Watch(watchDir)
43 time.Sleep(time.Duration(1) * time.Second)
46 command := fmt.Sprintf("cp -ar %s %s", src, dst)
47 configuremgr.DLog.Println(command)
48 cmd := exec.Command("sh", "-c", command)
49 stdoutStderr, err := cmd.CombinedOutput()
50 configuremgr.DLog.Printf("%s", stdoutStderr)
52 configuremgr.ELog.Fatal(err)
56 time.Sleep(time.Duration(5) * time.Second)
58 configuremgrObj.Done <- true
62 //jaehoon.hyun, damon92-lee
63 func TestConfigureMgrDiscoveryMgr(t *testing.T) {
65 orcheEngine = new(Iorche)
67 orcheEngine.IScoringmgr = scoringmgr.Init()
68 orcheEngine.IConfiguremgr = configuremgr.Init()
70 orcheEngine.IScoringmgr.IloadScoringLibrary = mockscoringmgr.LoadScoringAdd
71 orcheEngine.IScoringmgr.GetScore = mockorchestrationapi.GetScore
72 orcheEngine.IScoringmgr.Ch = make(chan interface{}, 1024)
74 orcheEngine.IConfiguremgr.IDiscoveryMgr.PushConfPath = mockorchestrationapi.PushConfPathDiscoveryDeviceMock
75 orcheEngine.IConfiguremgr.IScoringMgr.PushLibPath = mockorchestrationapi.PushLibPathScoringAppMock
76 orcheEngine.IConfiguremgr.IScoringMgr.Ch = orcheEngine.IScoringmgr.Ch
78 orcheEngine.IDiscoverymgr.GetEndpointDevices = mockorchestrationapi.GetEndpointDevices
79 orcheEngine.IServicemgr.InitServiceMgr = mockorchestrationapi.InitServiceMgr
80 orcheEngine.IServicemgr.ExecuteApp = mockorchestrationapi.ExecuteApp
82 orcheEngine.IScoringmgr.Listening()
84 //TODO : get watch path of attribute in settingpath
85 go orcheEngine.IConfiguremgr.Watch("/tmp/foo")
90 //jaehoon.hyun, chacha
91 func TestScoringMgrServiceMgr(t *testing.T){
93 //I can do that , anyone have a idea, implement please or ask for jaehoon
96 //daemon92-lee, chacha
97 func TestDiscoveryMgrServiceMgr(t *testing.T){
102 //jaehoon.hyun, daemon92-lee, jaehoon.hyun
103 func TestConfigureMgrDiscoveryMgrScoringMgr(t *testing.T){
107 //jaehoon.hyun, daemon92-lee, chacha
108 func TestConfigureMgrDiscoveryMgrServiceMgr(t *testing.T){
113 //jaehoon.hyun, chacha, jaehoon.hyun
114 func TestConfigureMgrServiceMgrScoringMgr(t *testing.T){
118 //jaehoon.hyun, daemon92-lee, chacha, jaehoon.hyun
119 func TestConfigureMgrDiscoveryMgrScoringMgrServiceMgr(t *testing.T){