init code
[vfc/nfvo/wfengine.git] / wso2 / common-util / src / test / java / org / openo / baseservice / bus / util / TestRegisterService.java
1 /*
2  * Copyright 2016 Huawei 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.openo.baseservice.bus.util;
17
18 import java.io.File;
19 import java.io.FileInputStream;
20 import java.io.IOException;
21
22 import javax.ws.rs.core.Response;
23
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.openo.baseservice.util.impl.SystemEnvVariablesDefImpl;
28
29 import junit.framework.Assert;
30 import mockit.Mock;
31 import mockit.MockUp;
32
33 public class TestRegisterService {
34     @Before
35     public void setUp() throws Exception {
36     }
37
38     @After
39     public void tearDown() throws Exception {
40         
41     }
42     
43     @Test
44     public void testregisterServce() throws IOException {
45         
46         File file = new File("");
47         Response res = null;
48         
49         final String path = file.getAbsolutePath();
50         
51         new MockUp<SystemEnvVariablesDefImpl>() {
52             @Mock
53             public String getAppRoot() {
54                 return path;
55             }
56         };
57         
58         try {
59             res = RegisterService.registerService(path, true);
60         } catch(Exception e) {
61             Assert.assertNotNull(e);
62         }
63         
64     }
65 }
66