test_class.declarator: ERROR_RESPONSE = "Test error response"
test_class.modifier: private static final
test_class.original_string: private static final String ERROR_RESPONSE = "Test error response";
test_class.type: String
test_class.var_name: ERROR_RESPONSE
test_class.declarator: mockResponseBodyString = "{\n" +
              "        \"has_next\" : false,\n" +
              "        \"next_offset\" : 0,\n" +
              "        \"limit\" : 2000,\n" +
              "        \"offset\" : 0,\n" +
              "        \"sdb_count_in_result\" : 1,\n" +
              "        \"total_sdbcount\" : 1,\n" +
              "        \"safe_deposit_box_metadata\" : [ {\n" +
              "            \"name\" : \"test sdb\",\n" +
              "            \"path\" : \"test/path/app\",\n" +
              "            \"category\" : \"Applications\",\n" +
              "            \"owner\" : \"Test.Owner\",\n" +
              "            \"description\" : \"test sdb\",\n" +
              "            \"created_ts\" : \"2019-05-13T20:13:56.799Z\",\n" +
              "            \"created_by\" : \"test.user@nike.com\",\n" +
              "            \"last_updated_ts\" : \"2019-05-13T20:13:56.799Z\",\n" +
              "            \"last_updated_by\" : \"arn:aws:iam::111111111111:role/example/role\",\n" +
              "            \"user_group_permissions\" : {  },\n" +
              "            \"iam_role_permissions\" : {\n" +
              "               \"arn:aws:iam::111111111111:role/example/role\" : \"read\"\n" +
              "          },\n" +
              "       \"data\" : null\n" +
              "      }]\n" +
              "}"
test_class.modifier: private static final
test_class.original_string: private static final String mockResponseBodyString = "{\n" +
              "        \"has_next\" : false,\n" +
              "        \"next_offset\" : 0,\n" +
              "        \"limit\" : 2000,\n" +
              "        \"offset\" : 0,\n" +
              "        \"sdb_count_in_result\" : 1,\n" +
              "        \"total_sdbcount\" : 1,\n" +
              "        \"safe_deposit_box_metadata\" : [ {\n" +
              "            \"name\" : \"test sdb\",\n" +
              "            \"path\" : \"test/path/app\",\n" +
              "            \"category\" : \"Applications\",\n" +
              "            \"owner\" : \"Test.Owner\",\n" +
              "            \"description\" : \"test sdb\",\n" +
              "            \"created_ts\" : \"2019-05-13T20:13:56.799Z\",\n" +
              "            \"created_by\" : \"test.user@nike.com\",\n" +
              "            \"last_updated_ts\" : \"2019-05-13T20:13:56.799Z\",\n" +
              "            \"last_updated_by\" : \"arn:aws:iam::111111111111:role/example/role\",\n" +
              "            \"user_group_permissions\" : {  },\n" +
              "            \"iam_role_permissions\" : {\n" +
              "               \"arn:aws:iam::111111111111:role/example/role\" : \"read\"\n" +
              "          },\n" +
              "       \"data\" : null\n" +
              "      }]\n" +
              "}";
test_class.type: String
test_class.var_name: mockResponseBodyString
test_class.declarator: emptyMetadataResponseBodyString = "{  \n" +
              "   \"has_next\":false,\n" +
              "   \"next_offset\":0,\n" +
              "   \"limit\":2000,\n" +
              "   \"offset\":0,\n" +
              "   \"sdb_count_in_result\":1723,\n" +
              "   \"total_sdbcount\":1723,\n" +
              "   \"safe_deposit_box_metadata\":[  \n" +
              "\n" +
              "   ]\n" +
              "}"
test_class.modifier: private static final
test_class.original_string: private static final String emptyMetadataResponseBodyString = "{  \n" +
              "   \"has_next\":false,\n" +
              "   \"next_offset\":0,\n" +
              "   \"limit\":2000,\n" +
              "   \"offset\":0,\n" +
              "   \"sdb_count_in_result\":1723,\n" +
              "   \"total_sdbcount\":1723,\n" +
              "   \"safe_deposit_box_metadata\":[  \n" +
              "\n" +
              "   ]\n" +
              "}";
test_class.type: String
test_class.var_name: emptyMetadataResponseBodyString
test_class.declarator: cerberusMetadataLookup = new CerberusMetadataLookup()
test_class.modifier: private
test_class.original_string: private CerberusMetadataLookup cerberusMetadataLookup = new CerberusMetadataLookup();
test_class.type: CerberusMetadataLookup
test_class.var_name: cerberusMetadataLookup
test_class.file: cerberus-ip-translator-lambda/src/test/java/com.nike.cerberus.lambda.waf/CerberusMetadataLookupTest.java
test_class.identifier: CerberusMetadataLookupTest
test_case.body: @Test(expected = RuntimeException.class)
      public void test_get_metadata_empty_response_body() throws IOException {
          MockWebServer mockWebServer = new MockWebServer();
          mockWebServer.start();
          final String cerberusUrl = "http://localhost:" + mockWebServer.getPort();
  
          mockWebServer.enqueue(new MockResponse().setResponseCode(200));
          ArrayList<Map<String, String>> sdbMetadata = cerberusMetadataLookup.getCerberusMetadata(cerberusUrl);
      }
test_case.class_method_signature: CerberusMetadataLookupTest.test_get_metadata_empty_response_body()
test_case.full_signature: @Test(expected = RuntimeException.class) public void test_get_metadata_empty_response_body()
test_case.identifier: test_get_metadata_empty_response_body
test_case.invocations: start getPort enqueue setResponseCode getCerberusMetadata
test_case.modifiers: @Test(expected = RuntimeException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_get_metadata_empty_response_body()
focal_class.declarator: DEFAULT_TIMEOUT = 60_000
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_TIMEOUT = 60_000;
focal_class.type: int
focal_class.var_name: DEFAULT_TIMEOUT
focal_class.declarator: DEFAULT_TIMEOUT_UNIT = TimeUnit.MILLISECONDS
focal_class.modifier: private static final
focal_class.original_string: private static final TimeUnit DEFAULT_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
focal_class.type: TimeUnit
focal_class.var_name: DEFAULT_TIMEOUT_UNIT
focal_class.declarator: CERBERUS_TOKEN = "X-Cerberus-Token"
focal_class.modifier: private static final
focal_class.original_string: private static final String CERBERUS_TOKEN = "X-Cerberus-Token";
focal_class.type: String
focal_class.var_name: CERBERUS_TOKEN
focal_class.declarator: EMAIL_SYMBOL = "@"
focal_class.modifier: private static final
focal_class.original_string: private static final String EMAIL_SYMBOL = "@";
focal_class.type: String
focal_class.var_name: EMAIL_SYMBOL
focal_class.declarator: logger = Logger.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = Logger.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: TLS_1_2_OR_NEWER = new ConnectionSpec.Builder(MODERN_TLS)
              .tlsVersions(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2)
              .build()
focal_class.modifier: private static final
focal_class.original_string: private static final ConnectionSpec TLS_1_2_OR_NEWER = new ConnectionSpec.Builder(MODERN_TLS)
              .tlsVersions(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2)
              .build();
focal_class.type: ConnectionSpec
focal_class.var_name: TLS_1_2_OR_NEWER
focal_class.file: cerberus-ip-translator-lambda/src/main/java/com.nike.cerberus.lambda.waf/CerberusMetadataLookup.java
focal_class.identifier: CerberusMetadataLookup
focal_class.class_method_signature: CerberusMetadataLookup.createHttpClient()
focal_class.full_signature: private OkHttpClient createHttpClient()
focal_class.identifier: createHttpClient
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: OkHttpClient
focal_class.signature: OkHttpClient createHttpClient()
focal_class.class_method_signature: CerberusMetadataLookup.getCerberusMetadata(String environment)
focal_class.full_signature: public ArrayList<Map<String, String>> getCerberusMetadata(String environment)
focal_class.identifier: getCerberusMetadata
focal_class.modifiers: public
focal_class.parameters: (String environment)
focal_class.return: ArrayList<Map<String, String>>
focal_class.signature: ArrayList<Map<String, String>> getCerberusMetadata(String environment)
focal_class.class_method_signature: CerberusMetadataLookup.searchCerberusMetadata(ArrayList<Map<String, String>> sdbMetadata, String sdbName, String principalName)
focal_class.full_signature: public ArrayList<String> searchCerberusMetadata(ArrayList<Map<String, String>> sdbMetadata, String sdbName, String principalName)
focal_class.identifier: searchCerberusMetadata
focal_class.modifiers: public
focal_class.parameters: (ArrayList<Map<String, String>> sdbMetadata, String sdbName, String principalName)
focal_class.return: ArrayList<String>
focal_class.signature: ArrayList<String> searchCerberusMetadata(ArrayList<Map<String, String>> sdbMetadata, String sdbName, String principalName)
focal_class.class_method_signature: CerberusMetadataLookup.executeRequest(OkHttpClient httpClient, DefaultCerberusCredentialsProviderChain chain,
                                     String cerberusUrl, String offset)
focal_class.full_signature: private HashMap executeRequest(OkHttpClient httpClient, DefaultCerberusCredentialsProviderChain chain,
                                     String cerberusUrl, String offset)
focal_class.identifier: executeRequest
focal_class.modifiers: private
focal_class.parameters: (OkHttpClient httpClient, DefaultCerberusCredentialsProviderChain chain,
                                     String cerberusUrl, String offset)
focal_class.return: HashMap
focal_class.signature: HashMap executeRequest(OkHttpClient httpClient, DefaultCerberusCredentialsProviderChain chain,
                                     String cerberusUrl, String offset)
focal_method.body: public ArrayList<Map<String, String>> getCerberusMetadata(String environment) {
  
          String cerberusUrl = String.format("https://%s.cerberus.nikecloud.com", environment);
          OkHttpClient httpClient = createHttpClient();
          String region = EnvUtils.getRequiredEnv("REGION");
          DefaultCerberusCredentialsProviderChain chain = new DefaultCerberusCredentialsProviderChain(cerberusUrl, region);
  
          ArrayList<Map<String, String>> sdbMetadata = new ArrayList<>();
          String offset = "0";
          Boolean hasNext;
  
          do {
              HashMap result = executeRequest(httpClient, chain, cerberusUrl, offset);
              sdbMetadata.addAll((ArrayList<Map<String, String>>) result.get("safe_deposit_box_metadata"));
  
              offset = result.get("next_offset").toString();
              hasNext = Boolean.valueOf(result.get("has_next").toString());
  
          } while (hasNext);
  
          if (sdbMetadata.isEmpty()) {
              throw new NullPointerException("SDB Metadata is empty");
          }
          return sdbMetadata;
      }
focal_method.class_method_signature: CerberusMetadataLookup.getCerberusMetadata(String environment)
focal_method.full_signature: public ArrayList<Map<String, String>> getCerberusMetadata(String environment)
focal_method.identifier: getCerberusMetadata
focal_method.invocations: format createHttpClient getRequiredEnv executeRequest addAll get toString get valueOf toString get isEmpty
focal_method.modifiers: public
focal_method.parameters: (String environment)
focal_method.return: ArrayList<Map<String, String>>
focal_method.signature: ArrayList<Map<String, String>> getCerberusMetadata(String environment)