• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   SERVICE_ACCOUNT_CREDS("large_unary with compute engine auth"),
42   JWT_TOKEN_CREDS("JWT-based auth"),
43   OAUTH2_AUTH_TOKEN("raw oauth2 access token auth"),
44   PER_RPC_CREDS("per rpc raw oauth2 access token auth"),
45   CUSTOM_METADATA("unary and full duplex calls with metadata"),
46   STATUS_CODE_AND_MESSAGE("request error code and message"),
47   SPECIAL_STATUS_MESSAGE("special characters in status message"),
48   UNIMPLEMENTED_METHOD("call an unimplemented RPC method"),
49   UNIMPLEMENTED_SERVICE("call an unimplemented RPC service"),
50   CANCEL_AFTER_BEGIN("cancel stream after starting it"),
51   CANCEL_AFTER_FIRST_RESPONSE("cancel on first response"),
52   TIMEOUT_ON_SLEEPING_SERVER("timeout before receiving a response"),
53   VERY_LARGE_REQUEST("very large request");
54 
55   private final String description;
56 
TestCases(String description)57   TestCases(String description) {
58     this.description = description;
59   }
60 
61   /**
62    * Returns a description of the test case.
63    */
description()64   public String description() {
65     return description;
66   }
67 
68   /**
69    * Returns the {@link TestCases} matching the string {@code s}. The
70    * matching is done case insensitive.
71    */
fromString(String s)72   public static TestCases fromString(String s) {
73     Preconditions.checkNotNull(s, "s");
74     return TestCases.valueOf(s.toUpperCase());
75   }
76 }
77