test_class.file: kb-importer/src/test/java/org/eclipse/steady/kb/util/MetadataTest.java
test_class.identifier: MetadataTest
test_case.body: @Test
    public void testGetCommitMetadata() throws JsonSyntaxException, IOException {
      ClassLoader classLoader = getClass().getClassLoader();
      String path = classLoader.getResource("commitDir1").getPath();
      Commit commit = Metadata.getCommitMetadata(path);
      assertEquals("master", commit.getBranch());
      assertEquals("b2b8f4adc557e4ef1ee2fe5e0ab46866c06ec55b", commit.getCommitId());
      assertEquals("1447974481000", commit.getTimestamp());
      assertEquals("https://github.com/apache/commons-collections", commit.getRepoUrl());
      assertEquals(path, commit.getDirectory());
    }
test_case.class_method_signature: MetadataTest.testGetCommitMetadata()
test_case.full_signature: @Test public void testGetCommitMetadata()
test_case.identifier: testGetCommitMetadata
test_case.invocations: getClassLoader getClass getPath getResource getCommitMetadata assertEquals getBranch assertEquals getCommitId assertEquals getTimestamp assertEquals getRepoUrl assertEquals getDirectory
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetCommitMetadata()
focal_class.declarator: META_PROPERTIES_FILE = "metadata.json"
focal_class.modifier: private static final
focal_class.original_string: private static final String META_PROPERTIES_FILE = "metadata.json";
focal_class.type: String
focal_class.var_name: META_PROPERTIES_FILE
focal_class.declarator: log = org.apache.logging.log4j.LogManager.getLogger()
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: kb-importer/src/main/java/org/eclipse/steady/kb/util/Metadata.java
focal_class.identifier: Metadata
focal_class.class_method_signature: Metadata.getCommitMetadata(String commitDir)
focal_class.full_signature: public static Commit getCommitMetadata(String commitDir)
focal_class.identifier: getCommitMetadata
focal_class.modifiers: public static
focal_class.parameters: (String commitDir)
focal_class.return: Commit
focal_class.signature: Commit getCommitMetadata(String commitDir)
focal_class.class_method_signature: Metadata.getVulnerabilityMetadata(String rootDir)
focal_class.full_signature: public static Vulnerability getVulnerabilityMetadata(String rootDir)
focal_class.identifier: getVulnerabilityMetadata
focal_class.modifiers: public static
focal_class.parameters: (String rootDir)
focal_class.return: Vulnerability
focal_class.signature: Vulnerability getVulnerabilityMetadata(String rootDir)
focal_method.body: public static Commit getCommitMetadata(String commitDir) throws JsonSyntaxException, IOException {
      String filePath = commitDir + File.separator + META_PROPERTIES_FILE;
      if (!FileUtil.isAccessibleFile(filePath)) {
        log.error(
            "The commit folder {} or the meta file is missing {} in commit folder",
            commitDir,
            filePath);
        return null;
      }
  
      Gson gson = new Gson();
      Commit metadata = null;
      metadata = gson.fromJson(FileUtil.readFile(filePath), Commit.class);
      metadata.setDirectory(commitDir);
      return metadata;
    }
focal_method.class_method_signature: Metadata.getCommitMetadata(String commitDir)
focal_method.full_signature: public static Commit getCommitMetadata(String commitDir)
focal_method.identifier: getCommitMetadata
focal_method.invocations: isAccessibleFile error fromJson readFile setDirectory
focal_method.modifiers: public static
focal_method.parameters: (String commitDir)
focal_method.return: Commit
focal_method.signature: Commit getCommitMetadata(String commitDir)