aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGanesh <ganesh.c@samsung.com>2022-04-11 16:46:56 +0530
committerGanesh <ganesh.c@samsung.com>2022-04-22 16:46:29 +0530
commit84fd604cf98f71e120002f5162abd820783abc77 (patch)
treecc488d562cb398ec13c9c8e66af51cb0476adc4a
parent3c5930e0d61f3f0b0eec57c20a2b82a6838ad70e (diff)
grpcServer unit test cases added
Signed-off-by: Ganesh <ganesh.c@samsung.com> Change-Id: Ibc7eed90a862ca60c23e993519490b2703f1d7a9 Issue-ID: CLI-443
-rw-r--r--grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java55
1 files changed, 55 insertions, 0 deletions
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
index 00000000..f25ffc5a
--- /dev/null
+++ b/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2022 Samsung Electronics
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.open.infc.grpc.server;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class OpenInterfaceGrpcServerTest {
+
+ private static final String CONF_FILE = "oclip-grpc-server.properties";
+ private static final String CONF_SERVER_PORT = "oclip.grpc_server_port";
+ private static final String CONF_SERVER_HOST = "oclip.grpc_server_host";
+
+ @Test
+ public void multiInputArgs() throws IOException, InterruptedException{
+ String[] args = {"help"};
+ OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();
+ OpenInterfaceGrpcServer.OpenRemoteCli openRemoteCli = new OpenInterfaceGrpcServer.OpenRemoteCli(args);
+ openRemoteCli.setArgs(args);
+ Assert.assertEquals("",openRemoteCli.getResult());
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void invalidNullInputArgs() throws IOException, InterruptedException{
+ OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();
+ OpenInterfaceGrpcServer.main(null);
+ }
+
+ @Test(expected=NumberFormatException.class)
+ public void invalidInputArgs() throws IOException, InterruptedException{
+ String[] args = {"test"};
+ OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer();
+ OpenInterfaceGrpcServer.main(args);
+ }
+}