Haixu Tang

123 papers A* 19A 6B 8C 1Misc 5Journal 68Unranked 15
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
Tianhao Mao, Dongfang Zhao, Haixu Tang, Xiaofeng Wang, Hang Zhang
2026 J jnl
CoRR
Kristopher W. Reese, Taylor Kulp-McDowall, Michael Majurski, Timothy Blattner, Derek Juba, Peter Bajcsy, Antonio Cardone, Philippe Dessauw, Alden Dima, Anthony J. Kearsley, Melinda Kleczynski, Joel Vasanth, Walid Keyrouz, Chace Ashcraft, Neil Fendley, Ted Staley, Trevor Stout, Josh Carney, Greg Canal, William Redman, Aurora Schmidt, Cameron Hickert, William Paul, Jared Markowitz, Nathan Drenkow, David Shriver, Marissa Connor, Keltin Grimes, Marco Christiani, Hayden Moore, Jordan Widjaja, Kasimir Gabert, Uma Balakrishnan, Satyanadh Gundimada, John Jacobellis, Sandya Lakkur, Vitus Leung, Jon Roose, Casey Battaglino, Farinaz Koushanfar, Greg Fields, Xihe Gu, Yaman Jandali, Xinqiao Zhang, Tara Javidi, Akash Vartak, Tim Oates, Ben Erichson, Michael Mahoney, Rauf Izmailov, Xiangyu Zhang, Guangyu Shen, Siyuan Cheng, Shiqing Ma, Xiaofeng Wang, Haixu Tang, Di Tang, Xiaoyi Chen, Zihao Wang, Rui Zhu, Susmit Jha, Xiao Lin, Manoj Acharya, Weichao Zhou, Feisi Fu, Panagiota Kiourti, Chenyu Wang, Zijian Guo, H. M. Sabbir Ahmad, Wenchao Li, Chao Chen
2025 J jnl
CoRR
Xurui Li, Kaisong Song, Rui Zhu, Pin-Yu Chen, Haixu Tang
2025 J jnl
CoRR
Yongming Fan, Rui Zhu, Zihao Wang, Chenghong Wang, Haixu Tang, Ye Dong, Hyunghoon Cho, Lucila Ohno-Machado
2025 J jnl
Patterns
Xiaoyi Chen, Haixu Tang
2025 J jnl
CoRR
Xinyao Ma, Rui Zhu, Zihao Wang, Jingwei Xiong, Qingyu Chen, Haixu Tang, L. Jean Camp, Lucila Ohno-Machado
2025 J jnl
CoRR
Chen Xiong, Zihao Wang, Rui Zhu, Tsung-Yi Ho, Pin-Yu Chen, Jingwei Xiong, Haixu Tang, Lucila Ohno-Machado
2025 A* conf
EMNLP
Xurui Li, Wanghaijiao, Kaisong Song, Rui Zhu, Haixu Tang
2025 J jnl
CoRR
Rui Zhu, Xiaopu Zhou, Haixu Tang, Stephen W. Scherer, Lucila Ohno-Machado
2025 J jnl
Bioinform.
Xinyu Zhou, Yi Yan, Kevin Hu, Haixu Tang, Yijie Wang, Lu Wang, Chi Zhang, Sha Cao
2025 A* conf
SP
Zihao Wang, Rui Zhu, Zhikun Zhang, Haixu Tang, Xiaofeng Wang
2025 A* conf
USENIX Security Symposium
Zihao Wang, Rui Zhu, Dongruo Zhou, Zhikun Zhang, Xiaofeng Wang, Haixu Tang
2025 J jnl
CoRR
Yingying Sun, Jun A, Zhiwei Liu, Rui Sun, Liujia Qian, Samuel H. Payne, Wout Bittremieux, Markus Ralser, Chen Li, Yi Chen, Zhen Dong, Yasset Pérez-Riverol, Asif Khan, Chris Sander, Ruedi Aebersold, Juan Antonio Vizcaíno, Jonathan R. Krieger, Jianhua Yao, Han Wen, Linfeng Zhang, Yunping Zhu, Yue Xuan, Benjamin Boyang Sun, Liang Qiao, Henning Hermjakob, Haixu Tang, Huanhuan Gao, Yamin Deng, Qing Zhong, Cheng Chang, Nuno Bandeira, Ming Li, Weinan E, Siqi Sun, Yuedong Yang, Gilbert S. Omenn, Yue Zhang, Ping Xu, Yan Fu, Xiaowen Liu, Christopher M. Overall, Yu Wang, Eric W. Deutsch, Luonan Chen, Jürgen Cox, Vadim Demichev, Fuchu He, Jiaxing Huang, Huilin Jin, Chao Liu, Nan Li, Zhongzhi Luan, Jiangning Song, Kaicheng Yu, Wanggen Wan, Tai Wang, Kang Zhang, Le Zhang, Peter A. Bell, Matthias Mann, Bing Zhang, Tiannan Guo
2024 A* conf
USENIX Security Symposium
Zihao Wang, Rui Zhu, Dongruo Zhou, Zhikun Zhang, John Mitchell, Haixu Tang, Xiaofeng Wang
2024 J jnl
CoRR
Zihao Wang, Rui Zhu, Dongruo Zhou, Zhikun Zhang, John Mitchell, Haixu Tang, Xiaofeng Wang
2024 conf
IDS
Zhixin Li, Rui Zhu, Zihao Wang, Jiale Li, Kaiyuan Liu, Yue Qin, Yongming Fan, Mingyu Gu, Zhihui Lu, Jie Wu, Hongfeng Chai, Xiaofeng Wang, Haixu Tang
2024 A* conf
NDSS
Rui Zhu, Di Tang, Siyuan Tang, Zihao Wang, Guanhong Tao, Shiqing Ma, Xiaofeng Wang, Haixu Tang
2024 J jnl
CoRR
Jinhong Yu, Yi Chen, Di Tang, Xiaozhong Liu, Xiaofeng Wang, Chen Wu, Haixu Tang
2024 B conf
RECOMB
Benjamin Giovanni Iovino, Haixu Tang, Yuzhen Ye
2024 A* conf
USENIX Security Symposium
Dandan Xu, Di Tang, Yi Chen, Xiaofeng Wang, Kai Chen, Haixu Tang, Longxing Li
2024 J jnl
Bioinform.
Kaiyuan Liu, Chenghua Tao, Yuzhen Ye, Haixu Tang
2024 A* conf
CCS
Xiaoyi Chen, Siyuan Tang, Rui Zhu, Shijun Yan, Lei Jin, Zihao Wang, Liya Su, Zhikun Zhang, Xiaofeng Wang, Haixu Tang
2023 J jnl
Bioinform.
Yuhui Hong, Sujun Li, Christopher J. Welch, Shane Tichy, Yuzhen Ye, Haixu Tang
2023 J jnl
CoRR
Rui Zhu, Di Tang, Siyuan Tang, Guanhong Tao, Shiqing Ma, Xiaofeng Wang, Haixu Tang
2023 J jnl
CoRR
Xiaotian Zhou, Qian Wang, Xiaofeng Wang, Haixu Tang, Xiaozhong Liu
2023 J jnl
J. Comput. Biol.
Haixu Tang
2023 B ed.
RECOMB
Haixu Tang
2023 A* conf
EMNLP
Xurui Li, Yue Qin, Rui Zhu, Tianqianjin Lin, Yongming Fan, Yangyang Kang, Kaisong Song, Fubang Zhao, Changlong Sun, Haixu Tang, Xiaozhong Liu
2023 A* conf
SP
Rui Zhu, Di Tang, Siyuan Tang, Xiaofeng Wang, Haixu Tang
2023 A* conf
USENIX Security Symposium
Yi Chen, Di Tang, Yepeng Yao, Mingming Zha, Xiaofeng Wang, Xiaozhong Liu, Haixu Tang, Baoxu Liu
2023 J jnl
CoRR
Xiaoyi Chen, Siyuan Tang, Rui Zhu, Shijun Yan, Lei Jin, Zihao Wang, Liya Su, Xiaofeng Wang, Haixu Tang
2022 J jnl
J. Comput. Biol.
Wontack Han, Haixu Tang, Yuzhen Ye
2022 A* conf
USENIX Security Symposium
Yi Chen, Di Tang, Yepeng Yao, Mingming Zha, Xiaofeng Wang, Xiaozhong Liu, Haixu Tang, Dongfang Zhao
2022 J jnl
CoRR
Rui Zhu, Di Tang, Siyuan Tang, Xiaofeng Wang, Haixu Tang
2022 J jnl
J. Am. Medical Informatics Assoc.
Tsung-Ting Kuo, Xiaoqian Jiang, Haixu Tang, Xiaofeng Wang, Arif Ozgun Harmanci, Miran Kim, Kai W. Post, Diyue Bu, Tyler Bath, Jihoon Kim, Weijie Liu, Hongbo Chen, Lucila Ohno-Machado
2022 J jnl
CoRR
Di Tang, Rui Zhu, Xiaofeng Wang, Haixu Tang, Yi Chen
2021 A* conf
SP
Yi Chen, Yepeng Yao, Xiaofeng Wang, Dandan Xu, Chang Yue, Xiaozhong Liu, Kai Chen, Haixu Tang, Baoxu Liu
2021 A* conf
USENIX Security Symposium
Di Tang, Xiaofeng Wang, Haixu Tang, Kehuan Zhang
2021 J jnl
Bioinform.
Diyue Bu, Xiaofeng Wang, Haixu Tang
2021 B conf
CLOUD
Chathura Widanage, Weijie Liu, Jiayu Li, Hongbo Chen, Xiaofeng Wang, Haixu Tang, Judy Fox
2021 J jnl
CoRR
Chathura Widanage, Weijie Liu, Jiayu Li, Hongbo Chen, Xiaofeng Wang, Haixu Tang, Judy Fox
2021 A conf
DSN
Weijie Liu, Wenhao Wang, Hongbo Chen, Xiaofeng Wang, Yaosong Lu, Kai Chen, Xinyu Wang, Qintao Shen, Yi Chen, Haixu Tang
2021 A conf
WACV
Tongxin Wang, Zhengming Ding, Wei Shao, Haixu Tang, Kun Huang
2021 J jnl
CoRR
Weijie Liu, Hongbo Chen, Xiaofeng Wang, Zhi Li, Danfeng Zhang, Wenhao Wang, Haixu Tang
2020 A conf
EuroS&P
Yunhui Long, Lei Wang, Diyue Bu, Vincent Bindschaedler, Xiaofeng Wang, Haixu Tang, Carl A. Gunter, Kai Chen
2020 J jnl
CoRR
Rui Zhu, Bo Lin, Haixu Tang
2020 J jnl
CoRR
Weijie Liu, Wenhao Wang, Xiaofeng Wang, Xiaozhu Meng, Yaosong Lu, Hongbo Chen, Xinyu Wang, Qingtao Shen, Kai Chen, Haixu Tang, Yi Chen, Luyi Xing
2020 conf
ISBRA
Yuan Xie, Yulong Pei, Yun Lu, Haixu Tang, Yuan Zhou
2020 Misc conf
PSB
Gamze Gürsoy, Megan Doerr, John Wilbanks, Jennifer K. Wagner, Haixu Tang, Steven E. Brenner
2020 J jnl
Bioinform.
Yan Song, Haixu Tang, Haoyu Zhang, Qin Zhang
2020 J jnl
Bioinform.
Rui Zhu, Chao Jiang, Xiaofeng Wang, Shuang Wang, Hao Zheng, Haixu Tang
2020 J jnl
CoRR
Tongxin Wang, Zhengming Ding, Wei Shao, Haixu Tang, Kun Huang
2019 J jnl
Quant. Biol.
Wazim Mohammed Ismail, Etienne Nzabarushimana, Haixu Tang
2019 J jnl
CoRR
Di Tang, Xiaofeng Wang, Haixu Tang, Kehuan Zhang
2019 J jnl
IEEE ACM Trans. Comput. Biol. Bioinform.
Erman Ayday, Muhammad Naveed, Haixu Tang
2019 A* conf
NDSS
Inken Hagestedt, Yang Zhang, Mathias Humbert, Pascal Berrang, Haixu Tang, Xiaofeng Wang, Michael Backes
2019 Misc conf
PSB
Gamze Gürsoy, Arif Ozgun Harmanci, Haixu Tang, Erman Ayday, Steven E. Brenner
2019 J jnl
CoRR
Wenhao Wang, Yichen Jiang, Qintao Shen, Weihao Huang, Hao Chen, Shuang Wang, Xiaofeng Wang, Haixu Tang, Kai Chen, Kristin E. Lauter, Dongdai Lin
2018 J jnl
J. Comput. Biol.
Yongan Zhao, Xiaofeng Wang, Haixu Tang
2018 J jnl
Bioinform.
Yen-Yi Lin, Alexander Gawronski, Faraz Hach, Sujun Li, Ibrahim Numanagic, Iman Sarrafi, Swati Mishra, Andrew W. McPherson, Colin C. Collins, Milan Radovich, Haixu Tang, Süleyman Cenk Sahinalp
2018 B conf
RECOMB
Sujun Li, Alex DeCourcy, Haixu Tang
2018 A conf
CIKM
Haoyu Zhang, Qin Zhang, Haixu Tang
2018 J jnl
CoRR
Haoyu Zhang, Qin Zhang, Haixu Tang
2018 J jnl
CoRR
Yunhui Long, Vincent Bindschaedler, Lei Wang, Diyue Bu, Xiaofeng Wang, Haixu Tang, Carl A. Gunter, Kai Chen
2017 conf
BCB
Xuefu Wang, Sujun Li, Wenjing Peng, Yehia Mechref, Haixu Tang
2017 J jnl
J. Am. Medical Informatics Assoc.
Jean Louis Raisaro, Florian Tramèr, Zhanglong Ji, Diyue Bu, Yongan Zhao, W. Knox Carey, David D. Lloyd, Heidi Sofia, Dixie Baker, Paul Flicek, Suyash S. Shringarpure, Carlos D. Bustamante, Shuang Wang, Xiaoqian Jiang, Lucila Ohno-Machado, Haixu Tang, Xiaofeng Wang, Jean-Pierre Hubaux
2017 J jnl
Bioinform.
Zhiqun Xie, Haixu Tang
2017 J jnl
Int. J. Comput. Biol. Drug Des.
Hussein Mohsen, Haixu Tang, Yuzhen Ye
2017 A* conf
CCS
Wenhao Wang, Guoxing Chen, Xiaorui Pan, Yinqian Zhang, Xiaofeng Wang, Vincent Bindschaedler, Haixu Tang, Carl A. Gunter
2017 J jnl
CoRR
Wenhao Wang, Guoxing Chen, Xiaorui Pan, Yinqian Zhang, Xiaofeng Wang, Vincent Bindschaedler, Haixu Tang, Carl A. Gunter
2017 J jnl
BMC Bioinform.
Haixu Tang, Etienne Nzabarushimana
2016 J jnl
PLoS Comput. Biol.
Haixu Tang, Sujun Li, Yuzhen Ye
2016 J jnl
Bioinform.
Hyungro Lee, Minsu Lee, Wazim Mohammed Ismail, Mina Rho, Geoffrey C. Fox, Sangyoon Oh, Haixu Tang
2016 conf
CRI
Sujun Li, Nuno Bandeira, Xiaofeng Wang, Haixu Tang
2016 J jnl
Bioinform.
Yuzhen Ye, Haixu Tang
2015 conf
BCB
Chao Ji, Yong Fuga Li, Earl P. Bellinger, Sujun Li, Randy J. Arnold, Predrag Radivojac, Haixu Tang
2015 J jnl
J. Am. Medical Informatics Assoc.
Yongan Zhao, Xiaofeng Wang, Xiaoqian Jiang, Lucila Ohno-Machado, Haixu Tang
2015 A* conf
CCS
Xiao Shaun Wang, Yan Huang, Yongan Zhao, Haixu Tang, Xiaofeng Wang, Diyue Bu
2015 J jnl
CoRR
Yuzhen Ye, Haixu Tang
2014 J jnl
BMC Medical Informatics Decis. Mak.
Xiaoqian Jiang, Yongan Zhao, Xiaofeng Fang, Bradley A. Malin, Shuang Wang, Lucila Ohno-Machado, Haixu Tang
2014 J jnl
J. Comput. Biol.
Heewook Lee, Ellen Popodi, Patricia L. Foster, Haixu Tang
2014 J jnl
BMC Bioinform.
Wazim Ismail, Yuzhen Ye, Haixu Tang
2014 conf
BIBM
Mingjie Wang, Haixu Tang, Yuzhen Ye
2014 B conf
CCGRID
Yang Ruan, Geoffrey L. House, Saliya Ekanayake, Ursel Schutte, James D. Bever, Haixu Tang, Geoffrey C. Fox
2014 conf
BIBM
Diyue Bu, Haixu Tang
2013 J jnl
Bioinform.
Chuan-Yih Yu, Anoop M. Mayampurath, Yunli Hu, Shiyue Zhou, Yehia Mechref, Haixu Tang
2013 conf
BCB
Sujun Li, Randy J. Arnold, Haixu Tang, Predrag Radivojac
2013 J jnl
PLoS Comput. Biol.
Dazhi Jiao, Yuzhen Ye, Haixu Tang
2012 J jnl
J. Comput. Biol.
Mingjie Wang, Yuzhen Ye, Haixu Tang
2012 conf
BCB
Yang Ruan, Saliya Ekanayake, Mina Rho, Haixu Tang, Seung-Hee Bae, Judy Qiu, Geoffrey C. Fox
2012 J jnl
BMC Bioinform.
Heewook Lee, Ellen Popodi, Patricia L. Foster, Haixu Tang
2012 A* conf
NDSS
Yangyi Chen, Bo Peng, Xiaofeng Wang, Haixu Tang
2012 conf
HISB
Xiaofeng Wang, Haixu Tang
2012 J jnl
Bioinform.
Yongan Zhao, Haixu Tang, Yuzhen Ye
2011 Misc conf
Pacific Symposium on Biocomputing
Neethu Shah, Haixu Tang, Thomas G. Doak, Yuzhen Ye
2011 J jnl
BMC Bioinform.
Seungmook Lee, Min-Seok Kwon, Hyoung-joo Lee, Young-Ki Paik, Haixu Tang, Jae K. Lee, Taesung Park
2011 J jnl
BMC Bioinform.
Yuzhen Ye, Jeong-Hyeon Choi, Haixu Tang
2011 A conf
ESORICS
Xiao-yong Zhou, Bo Peng, Yong Fuga Li, Yangyi Chen, Haixu Tang, Xiaofeng Wang
2009 J jnl
J. Comput. Biol.
Yong Fuga Li, Randy J. Arnold, Yixue Li, Predrag Radivojac, Quanhu Sheng, Haixu Tang
2009 J jnl
J. Bioinform. Comput. Biol.
Yuzhen Ye, Haixu Tang
2009 C conf
CloudCom
Geoffrey C. Fox, Xiaohong Qiu, Scott Beason, Jong Youl Choi, Jaliya Ekanayake, Thilina Gunarathne, Mina Rho, Haixu Tang, Neil Devadasan, Gilbert C. Liu
2009 A* conf
CCS
Rui Wang, Yong Fuga Li, Xiaofeng Wang, Haixu Tang, Xiao-yong Zhou
2009 A* conf
CCS
Rui Wang, Xiaofeng Wang, Zhou Li, Haixu Tang, Michael K. Reiter, Zheng Dong
2008 B conf
RECOMB
Yong Fuga Li, Randy J. Arnold, Yixue Li, Predrag Radivojac, Quanhu Sheng, Haixu Tang
2008 J jnl
Bioinform.
Jeong-Hyeon Choi, Sun Kim, Haixu Tang, Justen Andrews, Don G. Gilbert, John Colbourne
2008 J jnl
Bioinform.
Pedro Alves, Randy J. Arnold, David E. Clemmer, Yixue Li, James P. Reilly, Quanhu Sheng, Haixu Tang, Zhiyin Xun, Rong Zeng, Predrag Radivojac
2007 Misc conf
Pacific Symposium on Biocomputing
Pedro Alves, Randy J. Arnold, Milos V. Novotny, Predrag Radivojac, James P. Reilly, Haixu Tang
2007 ch.
Analysis of Biological Data: A Soft Computing Approach
Haixu Tang, Sun Kim
2007 J jnl
IEEE ACM Trans. Comput. Biol. Bioinform.
Degui Zhi, Uri Keich, Pavel A. Pevzner, Steffen Heber, Haixu Tang
2007 J jnl
Bioinform.
Seung-Hee Bae, Haixu Tang, Jing Wu, Jun Xie, Sun Kim
2006 conf
Systems Biology and Computational Proteomics
Yin Wu, Yehia Mechref, Iveta Klouckova, Milos V. Novotny, Haixu Tang
2006 Misc conf
Pacific Symposium on Biocomputing
Randy J. Arnold, Narmada Jayasankar, Divya Aggarwal, Haixu Tang, Predrag Radivojac
2006 conf
ISMB (Supplement of Bioinformatics)
Haixu Tang, Randy J. Arnold, Pedro Alves, Zhiyin Xun, David E. Clemmer, Milos V. Novotny, James P. Reilly, Predrag Radivojac
2006 conf
VDMB
Rupali Patwardhan, Haixu Tang, Sun Kim, Mehmet M. Dalkilic
2006 J jnl
J. Comput. Biol.
Vineet Bafna, Haixu Tang, Shaojie Zhang
2005 conf
ISMB (Supplement of Bioinformatics)
Haixu Tang, Yehia Mechref, Milos V. Novotny
2005 B conf
RECOMB
Vineet Bafna, Haixu Tang, Shaojie Zhang
2004 J jnl
Bioinform.
Mark Chaisson, Pavel A. Pevzner, Haixu Tang
2004 J jnl
Bioinform.
Qiang Tu, Haixu Tang, Dafu Ding
2002 A conf
ISMB
Steffen Heber, Max A. Alekseyev, Sing-Hoi Sze, Haixu Tang, Pavel A. Pevzner
2001 J jnl
J. Comput. Biol.
Semyon Kruglyak, Haixu Tang
2001 B conf
RECOMB
Pavel A. Pevzner, Haixu Tang, Michael S. Waterman
2001 conf
ISMB (Supplement of Bioinformatics)
Pavel A. Pevzner, Haixu Tang
tests/unit/test_apk_decompile_extractor.py
← Index tests/unit/test_apk_decompile_extractor.py python
"""
Unit tests for DecompileAPK extractor, export data, and ClickHouse schemas.

Tests the main DecompileAPK extractor class following the DecompileBinja test pattern.
All analysis is mocked — no JADX/apktool/Java installation required.
"""
import hashlib
import os
import tempfile
import zipfile

import pytest
from unittest.mock import MagicMock, patch, PropertyMock
from dataclasses import asdict

pytestmark = [pytest.mark.unit, pytest.mark.apk, pytest.mark.decompile]


def _create_fake_apk_file():
    """Create a minimal APK file for testing and return its path."""
    tmpdir = tempfile.mkdtemp()
    apk_path = os.path.join(tmpdir, "test.apk")
    with zipfile.ZipFile(apk_path, "w") as zf:
        zf.writestr("AndroidManifest.xml", b"<manifest/>")
        zf.writestr("classes.dex", b"dex\n035\x00" + b"\x00" * 100)
    return apk_path


# ============================================================================
# DecompileAPK Extractor Tests
# ============================================================================

class TestDecompileAPK:
    """Tests for the DecompileAPK extractor class."""

    def test_tag(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.tag() == "apk_decompiled"
        finally:
            os.unlink(apk_path)

    def test_get_clickhouse_table(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.get_clickhouse_table() is None
        finally:
            os.unlink(apk_path)

    def test_timeout_default(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.APK_DECOMPILE_TIMEOUT == 600
        finally:
            os.unlink(apk_path)

    def test_timeout_from_env(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with patch.dict(os.environ, {"APK_DECOMPILE_TIMEOUT": "900"}):
                ext = DecompileAPK(apk_path, MagicMock())
                assert ext.APK_DECOMPILE_TIMEOUT == 900
        finally:
            os.unlink(apk_path)

    def test_timeout_invalid_env(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with patch.dict(os.environ, {"APK_DECOMPILE_TIMEOUT": "not_a_number"}):
                ext = DecompileAPK(apk_path, MagicMock())
                assert ext.APK_DECOMPILE_TIMEOUT == 600
        finally:
            os.unlink(apk_path)

    def test_calculate_md5(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            result = ext.calculate_md5("test_string")
            assert len(result) == 32
            assert result == hashlib.md5(b"test_string").hexdigest()
        finally:
            os.unlink(apk_path)

    def test_context_manager(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with DecompileAPK(apk_path, MagicMock()) as ext:
                assert ext is not None
        finally:
            os.unlink(apk_path)

    def test_cleanup_run(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            ext.analyzer = MagicMock()
            ext.cleanup_run()
            assert ext.analyzer is None
        finally:
            os.unlink(apk_path)


# ============================================================================
# Export Data Tests
# ============================================================================

class TestPrepareExportData:
    """Tests for DecompileAPK.prepare_export_data() ClickHouse schemas."""

    def _make_extractor_with_results(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        ext = DecompileAPK(apk_path, MagicMock())
        ext.analysis_results = {
            "sha256": "a" * 64,
            "sha1": "b" * 40,
            "md5": "c" * 32,
            "decompiled_content": [
                {
                    "decompiled_method_hash": "d" * 64,
                    "decompiled_method": "public void foo() {}",
                    "decompiled_method_type": "USER",
                    "decompiled_has_string_encryption": False,
                    "decompiled_has_reflection_calls": False,
                    "decompiled_excessive_goto_count": False,
                }
            ],
            "decompiled_refs": [
                {
                    "decompiled_method_hash": "d" * 64,
                    "smali_method_hash": "e" * 64,
                    "decompiled_class_name": "com.example.Foo",
                    "decompiled_method_name": "foo",
                    "decompiled_method_signature": "()V",
                    "decompiled_method_prototype": "void foo()",
                    "functions_caller": ["bar"],
                    "functions_call": ["baz"],
                }
            ],
            "smali_content": [
                {
                    "smali_method_hash": "e" * 64,
                    "smali_method": "invoke-virtual {p0}, Lfoo;->bar()V\nreturn-void",
                    "smali_method_type": "USER",
                    "smali_instructions_count": 10,
                    "smali_register_count": 3,
                    "smali_has_string_encryption": False,
                    "smali_has_reflection_calls": False,
                    "smali_excessive_goto_count": False,
                    "smali_flattened_score": 0.0,
                    "smali_mba_score": 0.0,
                }
            ],
            "smali_refs": [
                {
                    "smali_method_hash": "e" * 64,
                    "decompiled_method_hash": "d" * 64,
                    "smali_class_name": "com.example.Foo",
                    "smali_method_name": "foo",
                    "smali_method_signature": "()V",
                    "ssdeep_smali": None,
                    "tlsh_smali": None,
                }
            ],
            "similarity_metrics": [
                {
                    "smali_method_hash": "e" * 64,
                    "cyclomatic_complexity": 2,
                    "ssdeep_smali": None,
                    "tlsh_smali": None,
                    "ssdeep_smali_normalized": None,
                    "tlsh_smali_normalized": None,
                    "minhash": [],
                }
            ],
            "cfg": [
                {
                    "smali_method_hash": "e" * 64,
                    "cfg_topology_hash": b'\x01' * 16,
                    "block_count": 3,
                    "edge_count": 3,
                    "cfg_instructions_count": 10,
                    "call_count": 1,
                    "cyclomatic_complexity": 2,
                    "loop_count": 0,
                    "max_depth": 2,
                    "max_fan_out": 2,
                    "md_index_topdown": 12345,
                    "md_index_bottomup": 67890,
                    "prime_product_smali": 999,
                    "cfg_feature_tlsh": None,
                    "wl_minhash": [0] * 128,
                    "bb_features": [[5, 1, 0, 1, 1, 0, 0, 2]] * 3,
                    "cfg_adjacency": [0x00000001, 0x00000002],
                }
            ],
            "strings": [
                {
                    "string": "https://evil.example.com/payload",
                    "string_encoding": "UTF8",
                    "string_offset": 0,
                    "string_length": 31,
                    "string_entropy": 3.95,
                }
            ],
            "analysis_errors": [
                {
                    "class_name": "com.example.Foo",
                    "method_name": "bar",
                    "error_location": "jadx",
                    "error_message": "timeout",
                    "error_type": "TimeoutError",
                }
            ],
        }
        return ext, apk_path

    def test_returns_none_when_no_results(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.prepare_export_data("ClickHouseExporter") is None
        finally:
            os.unlink(apk_path)

    def test_multi_table_flag(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            assert export["multi_table"] is True
        finally:
            os.unlink(apk_path)

    def test_all_table_keys_present(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            assert "decompiled_content" in export
            assert "decompiled_refs" in export
            assert "smali_content" in export
            assert "smali_refs" in export
            assert "method_similarity_metrics" in export
            assert "strings_raw" in export
            assert "analysis_errors" in export
        finally:
            os.unlink(apk_path)

    def test_decompiled_content_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            dc = export["decompiled_content"]
            assert dc["table"] == "code_apk_decompiled_methods_content"
            assert len(dc["column_names"]) == 7
            assert len(dc["column_type_names"]) == 7
            assert "decompiled_method_hash" in dc["column_names"]
            assert "decompiled_method" in dc["column_names"]
            assert "analysis_date" in dc["column_names"]
            assert len(dc["data"]) == 1
            assert len(dc["data"][0]) == 7
        finally:
            os.unlink(apk_path)

    def test_decompiled_refs_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            dr = export["decompiled_refs"]
            assert dr["table"] == "code_apk_decompiled_methods_references"
            assert len(dr["column_names"]) == 10
            assert len(dr["column_type_names"]) == 10
            assert "sha256" in dr["column_names"]
            assert "sha1" not in dr["column_names"]
            assert "md5" not in dr["column_names"]
            assert "functions_caller" in dr["column_names"]
            assert "functions_call" in dr["column_names"]
        finally:
            os.unlink(apk_path)

    def test_smali_content_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sc = export["smali_content"]
            assert sc["table"] == "code_apk_smali_methods_content"
            assert len(sc["column_names"]) == 11
            assert len(sc["column_type_names"]) == 11
            assert "smali_instructions_count" in sc["column_names"]
            assert "smali_register_count" in sc["column_names"]
            assert "smali_flattened_score" in sc["column_names"]
            assert "smali_mba_score" in sc["column_names"]
        finally:
            os.unlink(apk_path)

    def test_smali_refs_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sr = export["smali_refs"]
            assert sr["table"] == "code_apk_smali_methods_references"
            assert len(sr["column_names"]) == 7
            assert len(sr["column_type_names"]) == 7
            assert "sha1" not in sr["column_names"]
            assert "md5" not in sr["column_names"]
            assert "ssdeep_smali" not in sr["column_names"]
            assert "tlsh_smali" not in sr["column_names"]
        finally:
            os.unlink(apk_path)

    def test_similarity_metrics_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sm = export["method_similarity_metrics"]
            assert sm["table"] == "code_apk_method_similarity_metrics"
            assert len(sm["column_names"]) == 7
            assert "minhash" in sm["column_names"]
            assert "ssdeep_smali_normalized" in sm["column_names"]
            assert "tlsh_smali_normalized" in sm["column_names"]
            # cyclomatic_complexity moved to cfg table
            assert "cyclomatic_complexity" not in sm["column_names"]
            assert "block_count" not in sm["column_names"]
            assert "loop_count" not in sm["column_names"]
        finally:
            os.unlink(apk_path)

    def test_analysis_errors_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            ae = export["analysis_errors"]
            assert ae["table"] == "code_apk_analysis_errors"
            assert len(ae["column_names"]) == 9
            assert "error_hash" in ae["column_names"]
            assert "status" in ae["column_names"]
        finally:
            os.unlink(apk_path)

    def test_sha256_propagated_to_refs(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            # Check that sha256 from analysis_results appears in ref rows
            dr_row = export["decompiled_refs"]["data"][0]
            assert dr_row[0] == "a" * 64  # sha256
            # sha1 and md5 no longer included in refs
            assert "sha1" not in export["decompiled_refs"]["column_names"]
            assert "md5" not in export["decompiled_refs"]["column_names"]
        finally:
            os.unlink(apk_path)

    def test_empty_tables_not_included(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            ext.analysis_results = {
                "sha256": "a" * 64,
                "sha1": "b" * 40,
                "md5": "c" * 32,
                "decompiled_content": [],
                "decompiled_refs": [],
                "smali_content": [],
                "smali_refs": [],
                "similarity_metrics": [],
                "cfg": [],
                "strings": [],
                "analysis_errors": [],
            }
            export = ext.prepare_export_data("ClickHouseExporter")
            assert export == {"multi_table": True}
        finally:
            os.unlink(apk_path)

    def test_non_clickhouse_exporter_returns_none(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            result = ext.prepare_export_data("ElasticsearchExporter")
            assert result is None
        finally:
            os.unlink(apk_path)


# ============================================================================
# Dataclass Tests
# ============================================================================

class TestAPKCodeAnalysisDataclasses:
    """Tests for the new APK code analysis dataclasses."""

    def test_decompiled_method_content(self):
        from redb.models.dataclasses import APKDecompiledMethodContent
        dc = APKDecompiledMethodContent(
            decompiled_method_hash="a" * 64,
            decompiled_method="public void foo() {}",
            decompiled_method_type="USER",
        )
        assert dc.decompiled_has_string_encryption is False
        assert dc.decompiled_has_reflection_calls is False
        assert dc.decompiled_excessive_goto_count is False

    def test_decompiled_method_content_populated(self):
        from redb.models.dataclasses import APKDecompiledMethodContent
        dc = APKDecompiledMethodContent(
            decompiled_method_hash="a" * 64,
            decompiled_method="public void foo() {}",
            decompiled_method_type="USER",
            decompiled_has_string_encryption=True,
            decompiled_has_reflection_calls=True,
            decompiled_excessive_goto_count=True,
        )
        assert dc.decompiled_has_string_encryption is True
        d = asdict(dc)
        assert d["decompiled_method_hash"] == "a" * 64

    def test_decompiled_method_reference(self):
        from redb.models.dataclasses import APKDecompiledMethodReference
        dr = APKDecompiledMethodReference(
            sha256="a" * 64,
            sha1="b" * 40,
            md5="c" * 32,
            decompiled_method_hash="d" * 64,
        )
        assert dr.functions_caller == []
        assert dr.functions_call == []
        assert dr.smali_method_hash is None

    def test_smali_method_content(self):
        from redb.models.dataclasses import APKSmaliMethodContent
        sc = APKSmaliMethodContent(
            smali_method_hash="e" * 64,
            smali_method="invoke-virtual {p0}, Lfoo;->bar()V",
            smali_method_type="USER",
            smali_instructions_count=5,
            smali_register_count=3,
        )
        assert sc.smali_instructions_count == 5
        assert sc.smali_register_count == 3

    def test_smali_method_reference(self):
        from redb.models.dataclasses import APKSmaliMethodReference
        sr = APKSmaliMethodReference(
            sha256="a" * 64,
            sha1="b" * 40,
            md5="c" * 32,
            smali_method_hash="e" * 64,
        )
        assert sr.decompiled_method_hash is None
        assert sr.ssdeep_smali is None
        assert sr.tlsh_smali is None

    def test_method_similarity_metrics(self):
        from redb.models.dataclasses import APKMethodSimilarityMetrics
        ms = APKMethodSimilarityMetrics(smali_method_hash="e" * 64)
        assert ms.cyclomatic_complexity is None
        assert ms.ssdeep_smali_normalized is None
        assert ms.tlsh_smali_normalized is None
        assert ms.minhash == []

    def test_code_analysis_error(self):
        from redb.models.dataclasses import APKCodeAnalysisError
        err = APKCodeAnalysisError(
            sha256="a" * 64,
            error_location="jadx",
            error_message="timeout",
        )
        assert err.class_name is None
        assert err.method_name is None
        assert err.error_type is None


# ============================================================================
# Tag Enum Tests
# ============================================================================

class TestAPKDecompiledTag:
    """Tests for the APK_DECOMPILED tag enum."""

    def test_tag_exists(self):
        from redb.extractors.enum import Tag
        assert hasattr(Tag, "APK_DECOMPILED")

    def test_tag_value(self):
        from redb.extractors.enum import Tag
        assert Tag.APK_DECOMPILED.value == "apk_decompiled"


# ============================================================================
# Worker Integration Tests
# ============================================================================

class TestAPKWorkerDecompileIntegration:
    """Tests that DecompileAPK is registered in workers.py."""

    def test_module_registered(self):
        """Verify DecompileAPK is discoverable via the extractor registry."""
        from redb.extractor_registry import get_extractor_class
        cls = get_extractor_class("DecompileAPK")
        assert cls is not None, "DecompileAPK not found in extractor registry"
        assert cls.__name__ == "DecompileAPK"

    def test_worker_apk_dispatch_includes_decompile(self):
        import inspect
        import redb.workers as workers
        source = inspect.getsource(workers.process_binary_file)
        assert "DecompileAPK" in source