test_class.declarator: file
test_class.modifier: private
test_class.original_string: private File file;
test_class.type: File
test_class.var_name: file
test_class.file: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/dumpprocessors/ToFileDumpProcessorTest.java
test_class.identifier: ToFileDumpProcessorTest
test_case.body: @Test
      public void toFileDump() throws Exception {
          String igHome = U.defaultWorkDirectory();
  
          System.out.println("IGNITE_HOME:" + igHome);
  
          SharedPageLockTracker pageLockTracker = new SharedPageLockTracker();
  
          pageLockTracker.onBeforeReadLock(1, 2, 3);
          pageLockTracker.onReadLock(1, 2, 3, 4);
  
          SharedPageLockTrackerDump pageLockDump = pageLockTracker.dump();
  
          Assert.assertNotNull(pageLockDump);
  
          String expDumpStr = ToStringDumpHelper.toStringDump(pageLockDump);
  
          String filePath = ToFileDumpProcessor.toFileDump(pageLockDump, file = new File(igHome), "test");
  
          System.out.println("Dump saved:" + filePath);
  
          boolean found = false;
  
          for (File file : file.listFiles()) {
              if (file.getAbsolutePath().equals(filePath)) {
                  found = true;
  
                  break;
              }
          }
  
          Assert.assertTrue(found);
  
          String actDumpStr;
  
          try (FileChannel ch = FileChannel.open(get(filePath), StandardOpenOption.READ)) {
              long size = ch.size();
  
              ByteBuffer buf = ByteBuffer.allocate((int)size);
  
              while (buf.position() != buf.capacity())
                  ch.read(buf);
  
              actDumpStr = new String(buf.array());
          }
  
          Assert.assertEquals(expDumpStr, actDumpStr);
      }
test_case.class_method_signature: ToFileDumpProcessorTest.toFileDump()
test_case.full_signature: @Test public void toFileDump()
test_case.identifier: toFileDump
test_case.invocations: defaultWorkDirectory println onBeforeReadLock onReadLock dump assertNotNull toStringDump toFileDump println listFiles equals getAbsolutePath assertTrue open get size allocate position capacity read array assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void toFileDump()
focal_class.declarator: DATE_FMT = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_SSS")
focal_class.modifier: public static final
focal_class.original_string: public static final SimpleDateFormat DATE_FMT = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_SSS");
focal_class.type: SimpleDateFormat
focal_class.var_name: DATE_FMT
focal_class.declarator: PREFIX_NAME = "page_lock_dump_"
focal_class.modifier: public static final
focal_class.original_string: public static final String PREFIX_NAME = "page_lock_dump_";
focal_class.type: String
focal_class.var_name: PREFIX_NAME
focal_class.file: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/dumpprocessors/ToFileDumpProcessor.java
focal_class.identifier: ToFileDumpProcessor
focal_class.class_method_signature: ToFileDumpProcessor.toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_class.full_signature: public static String toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_class.identifier: toFileDump
focal_class.modifiers: public static
focal_class.parameters: (SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_class.return: String
focal_class.signature: String toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_class.class_method_signature: ToFileDumpProcessor.saveToFile(String dump, File file)
focal_class.full_signature: private static String saveToFile(String dump, File file)
focal_class.identifier: saveToFile
focal_class.modifiers: private static
focal_class.parameters: (String dump, File file)
focal_class.return: String
focal_class.signature: String saveToFile(String dump, File file)
focal_method.body: public static String toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name) throws IgniteCheckedException {
          try {
              if (!dir.exists())
                  dir.mkdirs();
  
              File file = new File(dir, PREFIX_NAME + name + "_" + DATE_FMT.format(new Date(pageLockDump.time)));
  
              return saveToFile(ToStringDumpHelper.toStringDump(pageLockDump), file);
          }
          catch (IOException e) {
              throw new IgniteCheckedException(e);
          }
      }
focal_method.class_method_signature: ToFileDumpProcessor.toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_method.full_signature: public static String toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_method.identifier: toFileDump
focal_method.invocations: exists mkdirs format saveToFile toStringDump
focal_method.modifiers: public static
focal_method.parameters: (SharedPageLockTrackerDump pageLockDump, File dir, String name)
focal_method.return: String
focal_method.signature: String toFileDump(SharedPageLockTrackerDump pageLockDump, File dir, String name)