test_class.declarator: INPUT_FILE = new File("src/test/resource/resfilter/globalizejs/input.json")
test_class.modifier: private static final
test_class.original_string: private static final File INPUT_FILE = new File("src/test/resource/resfilter/globalizejs/input.json");
test_class.type: File
test_class.var_name: INPUT_FILE
test_class.declarator: EXPECTED_WRITE_FILE = new File("src/test/resource/resfilter/globalizejs/write-output.json")
test_class.modifier: private static final
test_class.original_string: private static final File EXPECTED_WRITE_FILE = new File("src/test/resource/resfilter/globalizejs/write-output.json");
test_class.type: File
test_class.var_name: EXPECTED_WRITE_FILE
test_class.declarator: EXPECTED_INPUT_RES_LIST
test_class.modifier: private static final
test_class.original_string: private static final Collection<ResourceString> EXPECTED_INPUT_RES_LIST;
test_class.type: Collection<ResourceString>
test_class.var_name: EXPECTED_INPUT_RES_LIST
test_class.declarator: LONG_TEXT_STRING = 
          "This is a really long sentence which " +
          "is supposed to be joined together with " +
          "a space between each string, " +
          "or at least that is what the documentation says."
test_class.modifier: private static final
test_class.original_string: private static final String LONG_TEXT_STRING = 
          "This is a really long sentence which " +
          "is supposed to be joined together with " +
          "a space between each string, " +
          "or at least that is what the documentation says.";
test_class.type: String
test_class.var_name: LONG_TEXT_STRING
test_class.declarator: LONG_TEXT_STRING_DE =
          "Dies ist ein wirklich langer Satz, " +
          "der zusammen mit einem Leerzeichen zwischen jedem String verbunden sein soll, " +
          "oder zumindest das ist, was die Dokumentation sagt."
test_class.modifier: private static final
test_class.original_string: private static final String LONG_TEXT_STRING_DE =
          "Dies ist ein wirklich langer Satz, " +
          "der zusammen mit einem Leerzeichen zwischen jedem String verbunden sein soll, " +
          "oder zumindest das ist, was die Dokumentation sagt.";
test_class.type: String
test_class.var_name: LONG_TEXT_STRING_DE
test_class.declarator: WRITE_BUNDLE
test_class.modifier: private static
test_class.original_string: private static LanguageBundle WRITE_BUNDLE;
test_class.type: LanguageBundle
test_class.var_name: WRITE_BUNDLE
test_class.declarator: res = new GlobalizeJsResource()
test_class.modifier: private static final
test_class.original_string: private static final GlobalizeJsResource res = new GlobalizeJsResource();
test_class.type: GlobalizeJsResource
test_class.var_name: res
test_class.file: gp-res-filter/src/test/java/com/ibm/g11n/pipeline/resfilter/impl/GlobalizeJsResourceTest.java
test_class.identifier: GlobalizeJsResourceTest
test_case.body: @Test
      public void testParse() throws IOException, ResourceFilterException {
          assertTrue("The input test file <" + INPUT_FILE + "> does not exist.", INPUT_FILE.exists());
  
          try (InputStream is = new FileInputStream(INPUT_FILE)) {
              LanguageBundle bundle = res.parse(is, null);
              List<ResourceString> resStrList = new ArrayList<>(bundle.getResourceStrings());
              Collections.sort(resStrList, new ResourceStringComparator());
              assertEquals("ResourceStrings did not match.", EXPECTED_INPUT_RES_LIST, resStrList);
          }
      }
test_case.class_method_signature: GlobalizeJsResourceTest.testParse()
test_case.full_signature: @Test public void testParse()
test_case.identifier: testParse
test_case.invocations: assertTrue exists parse getResourceStrings sort assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testParse()
focal_class.file: gp-res-filter/src/main/java/com/ibm/g11n/pipeline/resfilter/impl/GlobalizeJsResource.java
focal_class.identifier: GlobalizeJsResource
focal_class.class_method_signature: GlobalizeJsResource.parse(InputStream inStream, FilterOptions options)
focal_class.full_signature: @Override public LanguageBundle parse(InputStream inStream, FilterOptions options)
focal_class.identifier: parse
focal_class.modifiers: @Override public
focal_class.parameters: (InputStream inStream, FilterOptions options)
focal_class.return: LanguageBundle
focal_class.signature: LanguageBundle parse(InputStream inStream, FilterOptions options)
focal_class.class_method_signature: GlobalizeJsResource.addBundleStrings(JsonObject obj, String keyPrefix, LanguageBundleBuilder bb, int sequenceNum)
focal_class.full_signature: @Override protected int addBundleStrings(JsonObject obj, String keyPrefix, LanguageBundleBuilder bb, int sequenceNum)
focal_class.identifier: addBundleStrings
focal_class.modifiers: @Override protected
focal_class.parameters: (JsonObject obj, String keyPrefix, LanguageBundleBuilder bb, int sequenceNum)
focal_class.return: int
focal_class.signature: int addBundleStrings(JsonObject obj, String keyPrefix, LanguageBundleBuilder bb, int sequenceNum)
focal_class.superclass: extends JsonResource
focal_method.body: @Override
      public LanguageBundle parse(InputStream inStream, FilterOptions options)
              throws IOException, ResourceFilterException {
          LanguageBundleBuilder bb = new LanguageBundleBuilder(false);    // TODO: can we use auto sequence# mode?
          try (InputStreamReader reader = new InputStreamReader(new BomInputStream(inStream), StandardCharsets.UTF_8)) {
              JsonElement root = new JsonParser().parse(reader);
              if (!root.isJsonObject()) {
                  throw new IllegalResourceFormatException("The root JSON element is not a JSON object.");
              }
              JsonObject root_obj = root.getAsJsonObject();
              Set<Map.Entry<String, JsonElement>> root_elements = root_obj.entrySet();
              if (root_elements.size() != 1) {
                  throw new IllegalResourceFormatException(
                          "Only one top level language tag element is allowed per file.");
              }
              Map.Entry<String, JsonElement> top_level = root_elements.iterator().next();
              String language = top_level.getKey();
              // We just hang on to the language tag as part of the bundle.
              // When doing an import, we can validate that the language tag matches what they
              // say they are importing.
              bb.embeddedLanguageCode(language);
              JsonElement language_obj = top_level.getValue();
              if (!language_obj.isJsonObject()) {
                  throw new IllegalResourceFormatException("The top level language element is not a JSON object.");
              }
              addBundleStrings(language_obj.getAsJsonObject(), "", bb, 0);
          } catch (JsonParseException e) {
              throw new IllegalResourceFormatException("Failed to parse the specified JSON contents.", e);
          }
          return bb.build();
      }
focal_method.class_method_signature: GlobalizeJsResource.parse(InputStream inStream, FilterOptions options)
focal_method.full_signature: @Override public LanguageBundle parse(InputStream inStream, FilterOptions options)
focal_method.identifier: parse
focal_method.invocations: parse isJsonObject getAsJsonObject entrySet size next iterator getKey embeddedLanguageCode getValue isJsonObject addBundleStrings getAsJsonObject build
focal_method.modifiers: @Override public
focal_method.parameters: (InputStream inStream, FilterOptions options)
focal_method.return: LanguageBundle
focal_method.signature: LanguageBundle parse(InputStream inStream, FilterOptions options)