Variable updated in src and test files
[vfc/nfvo/driver/ems.git] / ems / boco / src / test / java / org / onap / vfc / nfvo / emsdriver / collector / CollectMsgReceiverThreadTest.java
1 /*
2  * Copyright 2017 BOCO Corporation.  CMCC Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.vfc.nfvo.emsdriver.collector;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
21 import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
22
23 public class CollectMsgReceiverThreadTest {
24
25     CollectMsgReceiverThread col = null;
26     
27     @Before
28     public void setUp() throws Exception {
29         col = new CollectMsgReceiverThread();
30     }
31
32
33     @Test
34     public void dispose() {
35         new Thread() {
36             public void run() {
37                 try {
38                     Thread.sleep(10);
39                     col.setRun(false);
40                 } catch (InterruptedException e) {
41                     // TODO Auto-generated catch block
42                     e.printStackTrace();
43                 }
44             }
45         }.start();
46         col.setRun(true);
47         col.dispose();
48         col.getTaskService().stopTask();
49         col.getThreadMaxNum();
50         col.setThreadMaxNum(1);
51
52     }
53     
54     @Test
55     public void dispose1() {
56         new Thread() {
57             public void run() {
58                 try {
59                     Thread.sleep(61000);
60                     col.setRun(false);
61                 } catch (InterruptedException e) {
62                     // TODO Auto-generated catch block
63                     e.printStackTrace();
64                 }
65             }
66         }.start();
67         col.setRun(true);
68         col.dispose();
69         col.getTaskService().stopTask();
70         col.getThreadMaxNum();
71         col.setThreadMaxNum(1);
72
73     }
74 }