f25ffc5a1d726ff410a32fe36046a9da86609bb5
[cli.git] / grpc / grpc-server / src / test / java / org / open / infc / grpc / server / OpenInterfaceGrpcServerTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP : APPC\r
4  * ================================================================================\r
5  * Copyright (C) 2022 Samsung Electronics\r
6  * =============================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.open.infc.grpc.server;\r
22 \r
23 import org.junit.Assert;\r
24 import org.junit.Test;\r
25 \r
26 import java.io.IOException;\r
27 \r
28 public class OpenInterfaceGrpcServerTest {\r
29 \r
30     private static final String CONF_FILE = "oclip-grpc-server.properties";\r
31     private static final String CONF_SERVER_PORT = "oclip.grpc_server_port";\r
32     private static final String CONF_SERVER_HOST = "oclip.grpc_server_host";\r
33 \r
34     @Test\r
35     public void multiInputArgs() throws IOException, InterruptedException{\r
36         String[] args = {"help"};\r
37         OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
38         OpenInterfaceGrpcServer.OpenRemoteCli openRemoteCli = new OpenInterfaceGrpcServer.OpenRemoteCli(args);\r
39         openRemoteCli.setArgs(args);\r
40         Assert.assertEquals("",openRemoteCli.getResult());\r
41     }\r
42 \r
43     @Test(expected=NullPointerException.class)\r
44     public void invalidNullInputArgs() throws IOException, InterruptedException{\r
45         OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
46         OpenInterfaceGrpcServer.main(null);\r
47     }\r
48 \r
49     @Test(expected=NumberFormatException.class)\r
50     public void invalidInputArgs() throws IOException, InterruptedException{\r
51         String[] args = {"test"};\r
52         OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
53         OpenInterfaceGrpcServer.main(args);\r
54     }\r
55 }\r