grpcServer unit test cases added 30/128430/3
authorGanesh <ganesh.c@samsung.com>
Mon, 11 Apr 2022 11:16:56 +0000 (16:46 +0530)
committerGanesh <ganesh.c@samsung.com>
Fri, 22 Apr 2022 11:16:29 +0000 (16:46 +0530)
Signed-off-by: Ganesh <ganesh.c@samsung.com>
Change-Id: Ibc7eed90a862ca60c23e993519490b2703f1d7a9
Issue-ID: CLI-443

grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java [new file with mode: 0644]

diff --git a/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java b/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java
new file mode 100644 (file)
index 0000000..f25ffc5
--- /dev/null
@@ -0,0 +1,55 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2022 Samsung Electronics\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.open.infc.grpc.server;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+\r
+import java.io.IOException;\r
+\r
+public class OpenInterfaceGrpcServerTest {\r
+\r
+    private static final String CONF_FILE = "oclip-grpc-server.properties";\r
+    private static final String CONF_SERVER_PORT = "oclip.grpc_server_port";\r
+    private static final String CONF_SERVER_HOST = "oclip.grpc_server_host";\r
+\r
+    @Test\r
+    public void multiInputArgs() throws IOException, InterruptedException{\r
+        String[] args = {"help"};\r
+        OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
+        OpenInterfaceGrpcServer.OpenRemoteCli openRemoteCli = new OpenInterfaceGrpcServer.OpenRemoteCli(args);\r
+        openRemoteCli.setArgs(args);\r
+        Assert.assertEquals("",openRemoteCli.getResult());\r
+    }\r
+\r
+    @Test(expected=NullPointerException.class)\r
+    public void invalidNullInputArgs() throws IOException, InterruptedException{\r
+        OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
+        OpenInterfaceGrpcServer.main(null);\r
+    }\r
+\r
+    @Test(expected=NumberFormatException.class)\r
+    public void invalidInputArgs() throws IOException, InterruptedException{\r
+        String[] args = {"test"};\r
+        OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();\r
+        OpenInterfaceGrpcServer.main(args);\r
+    }\r
+}\r