orchestration_api_test.go : enhancement 39/203239/1
authorjaehoon.hyun <jaehoon.hyun@samsung.com>
Thu, 11 Apr 2019 04:19:59 +0000 (13:19 +0900)
committerjaehoon.hyun <jaehoon.hyun@samsung.com>
Thu, 11 Apr 2019 04:19:59 +0000 (13:19 +0900)
Change-Id: Ia996c66a2913ec349444f0ba4f8eece294d8aff9

src/orchestrationapi/orchestration_api_test.go

index 18a8eea496935412820fc51ed9b3c64894a84296..42892a9f3e958f575bf4467aac6fa228b59b301c 100755 (executable)
  *******************************************************************************/
 package orchestrationapi
 
-//$
-
 import (
-       "discoverymgr"
        "fmt"
        "log"
        "os/exec"
@@ -28,18 +25,133 @@ import (
 
        configuremgr "configuremgr"
        confdescription "configuremgr/description"
-
        // mockconfiguremgr "configuremgr/mock"
+       scoringmgr       "scoringmgr"
+       mockscoringmgr   "scoringmgr/mock"
+       discoverymgr     "discoverymgr"
+       securemgr        "securemgr"
+       servicemgr       "servicemgr"
+)
+
+//jaehoon.hyun , jaehoon.hyun
+func TestConfigureMgrScoringMgrAlreadyScoring2Library(t *testing.T) {
 
-       scoringmgr "scoringmgr"
-       mockscoringmgr "scoringmgr/mock"
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring2/", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
-       // discoverymgr     "discoverymgr"
-       servicemgr "servicemgr"
-)
+       //make orche
+       orcheMock := Init("")
+
+       //create modules
+       orcheMock.IScoringmgr = scoringmgr.Init()
+       orcheMock.IConfiguremgr = configuremgr.Init()
+
+       //scoringmgr interface
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
+       orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
+       orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
+       //configuremgr interface
+       orcheMock.IConfiguremgr.IDiscoveryMgr.PushConfPath = PushConfPathDiscoveryDeviceMock
+       orcheMock.IConfiguremgr.IScoringMgr.PushLibPath = scoringmgr.PushLibPath
+       orcheMock.IConfiguremgr.IScoringMgr.Ch = orcheMock.IScoringmgr.Ch
+
+       //discoverymgr interface
+       orcheMock.IDiscoverymgr.GetEndpointDevices = GetEndpointDevicesMock
+
+       //servicemgr interface
+       orcheMock.IServicemgr.ExecuteApp = ExecuteAppMock
+
+       //start scoringmgr
+       orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
+
+       //start configuremgr
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
+
+       //user scenario
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
+       time.Sleep(time.Duration(300) * time.Millisecond)
+
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       //release configuremgr
+       orcheMock.IConfiguremgr.Done <- true
+
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+}
+
+//jaehoon.hyun, chacha, jaehoon.hyun
+func TestConfigureMgrServiceMgrScoringMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       orcheMock := Init("")
+
+       orcheMock.IScoringmgr = scoringmgr.Init()
+       orcheMock.IConfiguremgr = configuremgr.Init()
+
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
+       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.IDiscoverymgr.GetEndpointDevices = GetEndpointDevicesMock
+       orcheMock.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
+
+       //servicemgr init
+       servicemgr.Init()
+
+       // securemgr init
+       securemgr.Init("../securemgr/test/key.txt")
+
+       //scoringmgr init
+       orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
+
+       //configuremgr init
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
+
+       //user scenario
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
+       RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(3) * time.Second)
+
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
+
+       //release configuremgr
+       orcheMock.IConfiguremgr.Done <- true
+
+       time.Sleep(time.Duration(100) * time.Millisecond)
+}
 
 //jaehoon.hyun , jaehoon.hyun
 func TestConfigureMgrScoringMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
        //make orche
        orcheMock := Init("")
@@ -49,9 +161,9 @@ func TestConfigureMgrScoringMgr(t *testing.T) {
        orcheMock.IConfiguremgr = configuremgr.Init()
 
        //scoringmgr interface
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
        //configuremgr interface
@@ -70,26 +182,86 @@ func TestConfigureMgrScoringMgr(t *testing.T) {
        orcheMock.IScoringmgr.IStartResourceService()
 
        //start configuremgr
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
+
+       //user scenario
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
+       time.Sleep(time.Duration(3) * time.Second)
+
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       //release configuremgr
+       orcheMock.IConfiguremgr.Done <- true
 
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
+}
+
+//jaehoon.hyun , jaehoon.hyun
+func TestConfigureMgrScoringMgrMyscoring2(t *testing.T) {
        //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       //make orche
+       orcheMock := Init("")
+
+       //create modules
+       orcheMock.IScoringmgr = scoringmgr.Init()
+       orcheMock.IConfiguremgr = configuremgr.Init()
+
+       //scoringmgr interface
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
+       orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
+       orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
+       //configuremgr interface
+       orcheMock.IConfiguremgr.IDiscoveryMgr.PushConfPath = PushConfPathDiscoveryDeviceMock
+       orcheMock.IConfiguremgr.IScoringMgr.PushLibPath = scoringmgr.PushLibPath
+       orcheMock.IConfiguremgr.IScoringMgr.Ch = orcheMock.IScoringmgr.Ch
+
+       //discoverymgr interface
+       orcheMock.IDiscoverymgr.GetEndpointDevices = GetEndpointDevicesMock
+
+       //servicemgr interface
+       orcheMock.IServicemgr.ExecuteApp = ExecuteAppMock
+
+       //start scoringmgr
+       orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
+
+       //start configuremgr
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -arR %s %s", "./mock/mysum/", "/tmp/foo"))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring2/", listeningDir))
        time.Sleep(time.Duration(3) * time.Second)
 
        //release scoringmgr
        orcheMock.IScoringmgr.IStopResourceService()
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       orcheMock.IScoringmgr.RemoveAll()
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
        //release configuremgr
        orcheMock.IConfiguremgr.Done <- true
 
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
 }
 
 func TestConfigureMgrScoringMgrMyScoringLib(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
        //make orche
        orcheMock := new(Orche)
@@ -121,34 +293,40 @@ func TestConfigureMgrScoringMgrMyScoringLib(t *testing.T) {
        orcheMock.IScoringmgr.IStartResourceService()
 
        //start configuremgr
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
-
-       //init scenario
-       execCommand("rm -rf /tmp/foo/myscoring")
-       time.Sleep(time.Duration(1) * time.Second)
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -arR %s %s", "./mock/myscoring/", "/tmp/foo"))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
        time.Sleep(time.Duration(3) * time.Second)
 
        //release scoringmgr
        orcheMock.IScoringmgr.IStopResourceService()
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       orcheMock.IScoringmgr.RemoveAll()
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
        //release configuremgr
        orcheMock.IConfiguremgr.Done <- true
+
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
 }
 
 //jaehoon.hyun, damon92-lee
 func TestConfigureMgrDiscoveryMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
        orcheMock := Init("")
 
        orcheMock.IScoringmgr = scoringmgr.Init()
        orcheMock.IConfiguremgr = configuremgr.Init()
 
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -159,41 +337,52 @@ func TestConfigureMgrDiscoveryMgr(t *testing.T) {
        orcheMock.IDiscoverymgr.GetEndpointDevices = discoverymgr.GetDeviceListWithService
        orcheMock.IServicemgr.ExecuteApp = ExecuteAppMock
 
+       //discoverymgr init
        discoverymgr.InitDiscovery()
 
        //scoringmgr init
        orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
 
        //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
-
-       //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
        time.Sleep(time.Duration(3) * time.Second)
        RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(3) * time.Second)
+
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       //release configure
        orcheMock.IConfiguremgr.Done <- true
+
+       //release discoverymgr
        discoverymgr.ExitChan <- 1
+
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
 }
 
 //jaehoon.hyun, chacha
 func TestRequestServiceFunctionServiceMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
        orcheMock := Init("")
 
        orcheMock.IScoringmgr = scoringmgr.Init()
        orcheMock.IConfiguremgr = configuremgr.Init()
 
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -206,27 +395,29 @@ func TestRequestServiceFunctionServiceMgr(t *testing.T) {
 
        //scoringmgr init
        orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
 
        //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //servicemgr init
        servicemgr.Init()
 
-       //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"))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
        time.Sleep(time.Duration(3) * time.Second)
        RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(3) * time.Second)
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
+
+       //release configuremgr
        orcheMock.IConfiguremgr.Done <- true
 
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
 }
 
 //daemon92-lee, chacha
@@ -236,14 +427,20 @@ func testDiscoveryMgrServiceMgr(t *testing.T) {
 
 //jaehoon.hyun, daemon92-lee, jaehoon.hyun
 func TestConfigureMgrDiscoveryMgrScoringMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
        orcheMock := Init("")
 
        orcheMock.IScoringmgr = scoringmgr.Init()
        orcheMock.IConfiguremgr = configuremgr.Init()
 
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = scoringmgr.GetScore
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -256,38 +453,53 @@ func TestConfigureMgrDiscoveryMgrScoringMgr(t *testing.T) {
 
        //scoringmgr init
        orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
 
-       //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+       //discoverymgr init
+       discoverymgr.InitDiscovery()
 
-       //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       //securemgr init
+       securemgr.Init("../securemgr/test/key.txt")
 
-       discoverymgr.InitDiscovery()
+       //configuremgr init
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -ar %s %s", "../scoringmgr/mock/mysum/", "/tmp/foo"))
-       time.Sleep(time.Duration(3) * time.Second)
+       execCommand(fmt.Sprintf("cp -ar %s %s", "../scoringmgr/mock/myscoring/", listeningDir))
+       time.Sleep(time.Duration(300) * time.Millisecond)
        RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
+
+       //release configuremgr
        orcheMock.IConfiguremgr.Done <- true
+
+       //release discoverymgr
        discoverymgr.ExitChan <- 1
+
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
 }
 
 //jaehoon.hyun, daemon92-lee, chacha
 func TestConfigureMgrDiscoveryMgrServiceMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
        orcheMock := Init("")
 
        orcheMock.IScoringmgr = scoringmgr.Init()
        orcheMock.IConfiguremgr = configuremgr.Init()
 
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = mockscoringmgr.GetScoreRandom100Mock
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -298,85 +510,56 @@ func TestConfigureMgrDiscoveryMgrServiceMgr(t *testing.T) {
        orcheMock.IDiscoverymgr.GetEndpointDevices = discoverymgr.GetDeviceListWithService
        orcheMock.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
 
+       //discoverymgr init
        discoverymgr.InitDiscovery()
+
+       //servicemgr init
        servicemgr.Init()
 
        //scoringmgr init
        orcheMock.IScoringmgr.Listening()
-
-       //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       orcheMock.IScoringmgr.IStartResourceService()
 
        //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
        time.Sleep(time.Duration(3) * time.Second)
        RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
-       orcheMock.IConfiguremgr.Done <- true
-       discoverymgr.ExitChan <- 1
-
-}
-
-//jaehoon.hyun, chacha, jaehoon.hyun
-func TestConfigureMgrServiceMgrScoringMgr(t *testing.T) {
-       orcheMock := Init("")
-
-       orcheMock.IScoringmgr = scoringmgr.Init()
-       orcheMock.IConfiguremgr = configuremgr.Init()
-
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
-       orcheMock.IScoringmgr.IGetScore = scoringmgr.GetScore
-       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.IDiscoverymgr.GetEndpointDevices = GetEndpointDevicesMock
-       orcheMock.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
-
-       //scoringmgr init
-       orcheMock.IScoringmgr.Listening()
-
-       //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStopResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
 
-       //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       //release configuremgr
+       orcheMock.IConfiguremgr.Done <- true
 
-       servicemgr.Init()
+       //release discoverymgr
+       discoverymgr.ExitChan <- 1
 
-       //user scenario
-       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
-       time.Sleep(time.Duration(3) * time.Second)
-       RequestService("ls", []string{"-al"})
+       //waiting resource thread stop
+       time.Sleep(time.Duration(100) * time.Millisecond)
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
-       orcheMock.IConfiguremgr.Done <- true
 }
 
 //jaehoon.hyun, daemon92-lee, chacha, jaehoon.hyun
 func TestConfigureMgrDiscoveryMgrScoringMgrServiceMgr(t *testing.T) {
+       //init scenario
+       listeningDir := "/tmp/foo"
+       execCommand(fmt.Sprintf("rm -rf %s", listeningDir))
+       execCommand(fmt.Sprintf("mkdir -p %s", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
        orcheMock := Init("")
 
        orcheMock.IScoringmgr = scoringmgr.Init()
        orcheMock.IConfiguremgr = configuremgr.Init()
 
-       orcheMock.IScoringmgr.IRunningScore = mockscoringmgr.LoadScoringInterfaceAdd
-       orcheMock.IScoringmgr.IStartResourceService = mockscoringmgr.StartResourceServiceAdd
-       orcheMock.IScoringmgr.IStopResourceService = mockscoringmgr.StopResourceServiceAdd
+       orcheMock.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheMock.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheMock.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheMock.IScoringmgr.IGetScore = scoringmgr.GetScore
        orcheMock.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -387,30 +570,39 @@ func TestConfigureMgrDiscoveryMgrScoringMgrServiceMgr(t *testing.T) {
        orcheMock.IDiscoverymgr.GetEndpointDevices = discoverymgr.GetDeviceListWithService
        orcheMock.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
 
+       //discoverymgr init
+       discoverymgr.InitDiscovery()
+
+       //servicemgr init
+       servicemgr.Init()
+
        //scoringmgr init
        orcheMock.IScoringmgr.Listening()
+       orcheMock.IScoringmgr.IStartResourceService()
 
-       //configuremgr init
-       go orcheMock.IConfiguremgr.Watch("/tmp/foo")
-
-       //init scenario
-       execCommand("rm -rf /tmp/foo/mysum")
-       time.Sleep(time.Duration(1) * time.Second)
+       //securemgr init
+       securemgr.Init("../securemgr/test/key.txt")
 
-       discoverymgr.InitDiscovery()
-       servicemgr.Init()
+       //configuremgr init
+       go orcheMock.IConfiguremgr.Watch(listeningDir)
 
        //user scenario
-       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/mysum/", "/tmp/foo"))
-       time.Sleep(time.Duration(3) * time.Second)
+       execCommand(fmt.Sprintf("cp -ar %s %s", "./mock/myscoring/", listeningDir))
+       time.Sleep(time.Duration(100) * time.Millisecond)
        RequestService("ls", []string{"-al"})
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       //release scoringmgr
+       orcheMock.IScoringmgr.IStartResourceService()
+       orcheMock.IScoringmgr.RemoveAll()
 
-       //resource release
-       time.Sleep(time.Duration(1) * time.Second)
-       orcheMock.IScoringmgr.RemoveLib("ls")
+       //release configuremgr
        orcheMock.IConfiguremgr.Done <- true
+
+       //release discoverymgr
        discoverymgr.ExitChan <- 1
 
+       time.Sleep(time.Duration(100) * time.Millisecond)
 }
 
 func PushConfPathDiscoveryDeviceMock(doc *confdescription.Doc) (err error) {