test_class.declarator: compressionFileDao
test_class.modifier: private
test_class.original_string: private CompressionFileDao compressionFileDao;
test_class.type: CompressionFileDao
test_class.var_name: compressionFileDao
test_class.declarator: compressionImpl = "Zlib"
test_class.modifier: private
test_class.original_string: private String compressionImpl = "Zlib";
test_class.type: String
test_class.var_name: compressionImpl
test_class.declarator: originalPos = new ArrayList<>()
test_class.modifier: private
test_class.original_string: private List<Long> originalPos = new ArrayList<>();
test_class.type: List<Long>
test_class.var_name: originalPos
test_class.declarator: compressedPos = new ArrayList<>()
test_class.modifier: private
test_class.original_string: private List<Long> compressedPos = new ArrayList<>();
test_class.type: List<Long>
test_class.var_name: compressedPos
test_class.file: smart-metastore/src/test/java/org/smartdata/metastore/dao/TestCompressionFileDao.java
test_class.identifier: TestCompressionFileDao
test_class.superclass: extends TestDaoUtil
test_case.body: @Test
    public void testInsertUpdate() throws Exception {
      CompressionFileState compressionInfo = new CompressionFileState(
          "/test", 131072, compressionImpl, originalPos.toArray(new Long[0]),
          compressedPos.toArray(new Long[0]));
  
      //insert test
      compressionFileDao.insertUpdate(compressionInfo);
      Assert.assertTrue(compressionFileDao.getInfoByPath("/test").
          getOriginalPos()[0].equals(9000L));
  
      //update test
      compressionInfo.setOriginalLength(1000);
      compressionInfo.setCompressedLength(100);
      compressionFileDao.insertUpdate(compressionInfo);
      CompressionFileState newCompressionInfo = compressionFileDao.getInfoByPath("/test");
      Assert.assertEquals(compressionInfo.getOriginalLength(),
          newCompressionInfo.getOriginalLength());
      Assert.assertEquals(compressionInfo.getCompressedLength(),
          newCompressionInfo.getCompressedLength());
    }
test_case.class_method_signature: TestCompressionFileDao.testInsertUpdate()
test_case.full_signature: @Test public void testInsertUpdate()
test_case.identifier: testInsertUpdate
test_case.invocations: toArray toArray insertUpdate assertTrue equals getOriginalPos getInfoByPath setOriginalLength setCompressedLength insertUpdate getInfoByPath assertEquals getOriginalLength getOriginalLength assertEquals getCompressedLength getCompressedLength
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInsertUpdate()
focal_class.declarator: TABLE_NAME = "compression_file"
focal_class.modifier: private static final
focal_class.original_string: private static final String TABLE_NAME = "compression_file";
focal_class.type: String
focal_class.var_name: TABLE_NAME
focal_class.declarator: dataSource
focal_class.modifier: private
focal_class.original_string: private DataSource dataSource;
focal_class.type: DataSource
focal_class.var_name: dataSource
focal_class.file: smart-metastore/src/main/java/org/smartdata/metastore/dao/CompressionFileDao.java
focal_class.identifier: CompressionFileDao
focal_class.class_method_signature: CompressionFileDao.setDataSource(DataSource dataSource)
focal_class.full_signature: public void setDataSource(DataSource dataSource)
focal_class.identifier: setDataSource
focal_class.modifiers: public
focal_class.parameters: (DataSource dataSource)
focal_class.return: void
focal_class.signature: void setDataSource(DataSource dataSource)
focal_class.class_method_signature: CompressionFileDao.CompressionFileDao(DataSource dataSource)
focal_class.full_signature: public  CompressionFileDao(DataSource dataSource)
focal_class.identifier: CompressionFileDao
focal_class.modifiers: public
focal_class.parameters: (DataSource dataSource)
focal_class.signature:  CompressionFileDao(DataSource dataSource)
focal_class.class_method_signature: CompressionFileDao.insert(CompressionFileState compressionInfo)
focal_class.full_signature: public void insert(CompressionFileState compressionInfo)
focal_class.identifier: insert
focal_class.modifiers: public
focal_class.parameters: (CompressionFileState compressionInfo)
focal_class.return: void
focal_class.signature: void insert(CompressionFileState compressionInfo)
focal_class.class_method_signature: CompressionFileDao.insertUpdate(CompressionFileState compressionInfo)
focal_class.full_signature: public void insertUpdate(CompressionFileState compressionInfo)
focal_class.identifier: insertUpdate
focal_class.modifiers: public
focal_class.parameters: (CompressionFileState compressionInfo)
focal_class.return: void
focal_class.signature: void insertUpdate(CompressionFileState compressionInfo)
focal_class.class_method_signature: CompressionFileDao.deleteByPath(String filePath)
focal_class.full_signature: public void deleteByPath(String filePath)
focal_class.identifier: deleteByPath
focal_class.modifiers: public
focal_class.parameters: (String filePath)
focal_class.return: void
focal_class.signature: void deleteByPath(String filePath)
focal_class.class_method_signature: CompressionFileDao.deleteAll()
focal_class.full_signature: public void deleteAll()
focal_class.identifier: deleteAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void deleteAll()
focal_class.class_method_signature: CompressionFileDao.getAll()
focal_class.full_signature: public List<CompressionFileState> getAll()
focal_class.identifier: getAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<CompressionFileState>
focal_class.signature: List<CompressionFileState> getAll()
focal_class.class_method_signature: CompressionFileDao.getInfoByPath(String filePath)
focal_class.full_signature: public CompressionFileState getInfoByPath(String filePath)
focal_class.identifier: getInfoByPath
focal_class.modifiers: public
focal_class.parameters: (String filePath)
focal_class.return: CompressionFileState
focal_class.signature: CompressionFileState getInfoByPath(String filePath)
focal_class.class_method_signature: CompressionFileDao.toMap(CompressionFileState compressionInfo)
focal_class.full_signature: private Map<String, Object> toMap(CompressionFileState compressionInfo)
focal_class.identifier: toMap
focal_class.modifiers: private
focal_class.parameters: (CompressionFileState compressionInfo)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> toMap(CompressionFileState compressionInfo)
focal_method.body: public void insertUpdate(CompressionFileState compressionInfo) {
      JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
      Gson gson = new Gson();
      String sql = "REPLACE INTO " + TABLE_NAME
          + "(path, buffer_size, compression_impl, "
          + "original_length, compressed_length, originalPos, compressedPos)"
          + " VALUES(?,?,?,?,?,?,?);";
      jdbcTemplate.update(sql, compressionInfo.getPath(),
          compressionInfo.getBufferSize(),
          compressionInfo.getCompressionImpl(),
          compressionInfo.getOriginalLength(),
          compressionInfo.getCompressedLength(),
          gson.toJson(compressionInfo.getOriginalPos()),
          gson.toJson(compressionInfo.getCompressedPos()));
    }
focal_method.class_method_signature: CompressionFileDao.insertUpdate(CompressionFileState compressionInfo)
focal_method.full_signature: public void insertUpdate(CompressionFileState compressionInfo)
focal_method.identifier: insertUpdate
focal_method.invocations: update getPath getBufferSize getCompressionImpl getOriginalLength getCompressedLength toJson getOriginalPos toJson getCompressedPos
focal_method.modifiers: public
focal_method.parameters: (CompressionFileState compressionInfo)
focal_method.return: void
focal_method.signature: void insertUpdate(CompressionFileState compressionInfo)