test_class.declarator: ROOT_JSON_FILE = WorkerTestUtils.getPath("JSON_ROOT.json")
test_class.modifier: private static final
test_class.original_string: private static final String ROOT_JSON_FILE = WorkerTestUtils.getPath("JSON_ROOT.json");
test_class.type: String
test_class.var_name: ROOT_JSON_FILE
test_class.declarator: EMPTY_MISSION_BODY_FILE = WorkerTestUtils.getPath("JSON_ROOT_empty_mission_body.json")
test_class.modifier: private static final
test_class.original_string: private static final String EMPTY_MISSION_BODY_FILE = WorkerTestUtils.getPath("JSON_ROOT_empty_mission_body.json");
test_class.type: String
test_class.var_name: EMPTY_MISSION_BODY_FILE
test_class.declarator: EXPECTED_MAP
test_class.modifier: private static final
test_class.original_string: private static final Map<String, String> EXPECTED_MAP;
test_class.type: Map<String, String>
test_class.var_name: EXPECTED_MAP
test_class.file: ingester/src/test/java/com/amazonaws/services/dynamodbv2/json/demo/mars/worker/DynamoDBJSONRootWorkerTest.java
test_class.identifier: DynamoDBJSONRootWorkerTest
test_case.body: @Test
      public void testGetMissionToManifestMap() {
          final URL url = PowerMock.createMock(URL.class);
          PowerMock.mockStatic(JSONUtils.class);
          PowerMock.mockStatic(NetworkUtils.class);
          String manifest = null;
          try {
              manifest = WorkerTestUtils.readFile(ROOT_JSON_FILE);
          } catch (final IOException e1) {
              fail("Could not read file: " + ROOT_JSON_FILE);
          }
          try {
              NetworkUtils.getDataFromURL(url, null, ImageIngester.DEFAULT_CONNECT_TIMEOUT);
              PowerMock.expectLastCall().andReturn(manifest.getBytes());
              PowerMock.replayAll();
              final Map<String, String> missionMap = DynamoDBJSONRootWorker.getMissionToManifestMap(url, ImageIngester.DEFAULT_CONNECT_TIMEOUT);
              assertEquals(EXPECTED_MAP, missionMap);
          } catch (final IOException e) {
              fail(e.getMessage());
          }
  
      }
test_case.class_method_signature: DynamoDBJSONRootWorkerTest.testGetMissionToManifestMap()
test_case.full_signature: @Test public void testGetMissionToManifestMap()
test_case.identifier: testGetMissionToManifestMap
test_case.invocations: createMock mockStatic mockStatic readFile fail getDataFromURL andReturn expectLastCall getBytes replayAll getMissionToManifestMap assertEquals fail getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetMissionToManifestMap()
focal_class.declarator: LOGGER = Logger.getLogger(DynamoDBJSONRootWorker.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(DynamoDBJSONRootWorker.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: IMAGE_RESOURCE_KEY = "image_manifest"
focal_class.modifier: private static final
focal_class.original_string: private static final String IMAGE_RESOURCE_KEY = "image_manifest";
focal_class.type: String
focal_class.var_name: IMAGE_RESOURCE_KEY
focal_class.declarator: rootURL
focal_class.modifier: private final
focal_class.original_string: private final String rootURL;
focal_class.type: String
focal_class.var_name: rootURL
focal_class.declarator: connectTimeout
focal_class.modifier: private final
focal_class.original_string: private final int connectTimeout;
focal_class.type: int
focal_class.var_name: connectTimeout
focal_class.file: ingester/src/main/java/com/amazonaws/services/dynamodbv2/json/demo/mars/worker/DynamoDBJSONRootWorker.java
focal_class.identifier: DynamoDBJSONRootWorker
focal_class.interfaces: implements Callable<Map<String, String>>
focal_class.class_method_signature: DynamoDBJSONRootWorker.getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
focal_class.full_signature: public static Map<String, String> getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
focal_class.identifier: getMissionToManifestMap
focal_class.modifiers: public static
focal_class.parameters: (final URL rootJsonUrl, final int connectTimeout)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
focal_class.class_method_signature: DynamoDBJSONRootWorker.DynamoDBJSONRootWorker(final String rootURL, final int connectTimeout)
focal_class.full_signature: public  DynamoDBJSONRootWorker(final String rootURL, final int connectTimeout)
focal_class.identifier: DynamoDBJSONRootWorker
focal_class.modifiers: public
focal_class.parameters: (final String rootURL, final int connectTimeout)
focal_class.signature:  DynamoDBJSONRootWorker(final String rootURL, final int connectTimeout)
focal_class.class_method_signature: DynamoDBJSONRootWorker.call()
focal_class.full_signature: @Override public Map<String, String> call()
focal_class.identifier: call
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> call()
focal_method.body: public static Map<String, String> getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
          throws IOException {
          final Map<String, String> map = new HashMap<String, String>();
          // Retrieve JSON
          final JsonNode root = JSONParser.getJSONFromURL(rootJsonUrl, connectTimeout);
          final Iterator<Entry<String, JsonNode>> it = root.fields();
          // Top level is array of mission names
          while (it.hasNext()) {
              final Entry<String, JsonNode> pair = it.next();
              final String mission = pair.getKey();
              if (pair.getKey() == null) {
                  // Log error and skip mission
                  LOGGER.warning("Null mission name");
                  continue;
              }
              final JsonNode missionObject = pair.getValue();
              if (missionObject == null) {
                  // Log error and skip mission
                  LOGGER.warning("Null mission object for: " + mission);
                  continue;
              }
              if (!missionObject.has(IMAGE_RESOURCE_KEY)) {
                  // Log error and skip mission
                  LOGGER.warning("Missing mission manifest for " + mission + ": " + missionObject.toString());
                  continue;
              }
              // Image manifest key has URL
              final String manifestValue = missionObject.get(IMAGE_RESOURCE_KEY).asText();
              map.put(mission, manifestValue);
          }
          return map;
      }
focal_method.class_method_signature: DynamoDBJSONRootWorker.getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
focal_method.full_signature: public static Map<String, String> getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)
focal_method.identifier: getMissionToManifestMap
focal_method.invocations: getJSONFromURL fields hasNext next getKey getKey warning getValue warning has warning toString asText get put
focal_method.modifiers: public static
focal_method.parameters: (final URL rootJsonUrl, final int connectTimeout)
focal_method.return: Map<String, String>
focal_method.signature: Map<String, String> getMissionToManifestMap(final URL rootJsonUrl, final int connectTimeout)