1 /* 2 * Copyright 2016 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.grpc.testing.integration; 18 19 import com.google.common.base.Preconditions; 20 21 /** 22 * Enum of interop test cases. 23 */ 24 public enum TestCases { 25 EMPTY_UNARY("empty (zero bytes) request and response"), 26 CACHEABLE_UNARY("cacheable unary rpc sent using GET"), 27 LARGE_UNARY("single request and (large) response"), 28 CLIENT_COMPRESSED_UNARY("client compressed unary request"), 29 CLIENT_COMPRESSED_UNARY_NOPROBE( 30 "client compressed unary request (skip initial feature-probing request)"), 31 SERVER_COMPRESSED_UNARY("server compressed unary response"), 32 CLIENT_STREAMING("request streaming with single response"), 33 CLIENT_COMPRESSED_STREAMING("client per-message compression on stream"), 34 CLIENT_COMPRESSED_STREAMING_NOPROBE( 35 "client per-message compression on stream (skip initial feature-probing request)"), 36 SERVER_STREAMING("single request with response streaming"), 37 SERVER_COMPRESSED_STREAMING("server per-message compression on stream"), 38 PING_PONG("full-duplex ping-pong streaming"), 39 EMPTY_STREAM("A stream that has zero-messages in both directions"), 40 COMPUTE_ENGINE_CREDS("large_unary with service_account auth"), 41 COMPUTE_ENGINE_CHANNEL_CREDENTIALS("large unary with compute engine channel builder"), 42 SERVICE_ACCOUNT_CREDS("large_unary with compute engine auth"), 43 JWT_TOKEN_CREDS("JWT-based auth"), 44 OAUTH2_AUTH_TOKEN("raw oauth2 access token auth"), 45 PER_RPC_CREDS("per rpc raw oauth2 access token auth"), 46 GOOGLE_DEFAULT_CREDENTIALS( 47 "google default credentials, i.e. GoogleManagedChannel based auth"), 48 CUSTOM_METADATA("unary and full duplex calls with metadata"), 49 STATUS_CODE_AND_MESSAGE("request error code and message"), 50 SPECIAL_STATUS_MESSAGE("special characters in status message"), 51 UNIMPLEMENTED_METHOD("call an unimplemented RPC method"), 52 UNIMPLEMENTED_SERVICE("call an unimplemented RPC service"), 53 CANCEL_AFTER_BEGIN("cancel stream after starting it"), 54 CANCEL_AFTER_FIRST_RESPONSE("cancel on first response"), 55 TIMEOUT_ON_SLEEPING_SERVER("timeout before receiving a response"), 56 VERY_LARGE_REQUEST("very large request"), 57 PICK_FIRST_UNARY("all requests are sent to one server despite multiple servers are resolved"), 58 RPC_SOAK("sends 'soak_iterations' large_unary rpcs in a loop, each on the same channel"), 59 CHANNEL_SOAK("sends 'soak_iterations' large_unary rpcs in a loop, each on a new channel"), 60 ORCA_PER_RPC("report backend metrics per query"), 61 ORCA_OOB("report backend metrics out-of-band"); 62 63 private final String description; 64 TestCases(String description)65 TestCases(String description) { 66 this.description = description; 67 } 68 69 /** 70 * Returns a description of the test case. 71 */ description()72 public String description() { 73 return description; 74 } 75 76 /** 77 * Returns the {@link TestCases} matching the string {@code s}. The 78 * matching is done case insensitive. 79 */ fromString(String s)80 public static TestCases fromString(String s) { 81 Preconditions.checkNotNull(s, "s"); 82 return TestCases.valueOf(s.toUpperCase()); 83 } 84 } 85