X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=grpc%2Fgrpc-server%2Fsrc%2Ftest%2Fjava%2Forg%2Fopen%2Finfc%2Fgrpc%2Fserver%2FOpenInterfaceGrpcServerTest.java;fp=grpc%2Fgrpc-server%2Fsrc%2Ftest%2Fjava%2Forg%2Fopen%2Finfc%2Fgrpc%2Fserver%2FOpenInterfaceGrpcServerTest.java;h=f25ffc5a1d726ff410a32fe36046a9da86609bb5;hb=84fd604cf98f71e120002f5162abd820783abc77;hp=0000000000000000000000000000000000000000;hpb=3c5930e0d61f3f0b0eec57c20a2b82a6838ad70e;p=cli.git 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); + } +}