aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2022-04-25 04:18:24 +0000
committerGerrit Code Review <gerrit@onap.org>2022-04-25 04:18:24 +0000
commit82af57b3b997c975ac436b9ab2e6ba5b3cf90ea3 (patch)
tree7b89db27ae390ea1952697760ffe108fba594506
parent81beb332e2be22591f9d67d34fdb88a4fbc53c77 (diff)
parent84fd604cf98f71e120002f5162abd820783abc77 (diff)
Merge "grpcServer unit test cases added"
-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);
+ }
+}