Xiangdong Jia

87 papers C 2Journal 61Unranked 24
YearRankTypeTitle / Venue / Authors
2026 J jnl
IEEE Signal Process. Lett.
Qianqian Wang, Baiqiang Long, Xinyue Pei, Yuankun Tang, Haoyue Qu, Xiangdong Jia
2026 J jnl
IEEE Trans. Green Commun. Netw.
Yuxin Guo, Xiangdong Jia, Mangang Xie, Yue Li
2025 J jnl
IEEE Wirel. Commun. Lett.
Jun Lan, Xiangdong Jia
2025 J jnl
IEEE Trans. Mob. Comput.
Yue Li, Xiangdong Jia, Xiaoping Ma, Yuxin Guo, Hailong Tian
2025 conf
VTC2025-Fall
Yue Li, Xiangdong Jia, Yuxin Guo
2025 J jnl
IEEE Internet Things J.
Jun Lan, Xiangdong Jia, Zhilong Kou
2025 conf
VTC2025-Fall
Xingyuan Zhang, Xiangdong Jia, Hongli Bao, Jingjing Wu
2025 J jnl
IEEE Trans. Veh. Technol.
Junyan Wang, Xiangdong Jia, Jie Gong, Xu Chen
2025 conf
ICC Workshops
Yue Li, Xiangdong Jia, Jingjing Wu
2025 conf
ICC Workshops
Yuxin Guo, Xiangdong Jia, Yue Li
2024 conf
VTC Fall
Xiangdong Jia, Yue Li, Yuxin Guo
2024 J jnl
IEEE Trans. Wirel. Commun.
Mangang Xie, Xiangdong Jia, Jiaxiang Yin, Qianqian Wang, Meng Zhou
2024 conf
VTC Fall
Xingyuan Zhang, Xiangdong Jia, Heng Chang, Hailong Tian
2024 conf
VTC Spring
Xiangdong Jia, Xiao Ma, Junyan Wang, Xianghua Han
2024 conf
VTC Spring
Yue Li, Xiangdong Jia, Yuxin Guo
2024 conf
VTC Fall
Xiaoping Ma, Xiangdong Jia, Yue Li, Kailai Xue
2024 conf
VTC Fall
Yuxin Guo, Xiangdong Jia, Yue Li
2024 conf
VTC Fall
Xiangdong Jia, Gongziyu Chen, Yangyang Sun
2024 J jnl
Trans. Emerg. Telecommun. Technol.
Yangyang Sun, Xiangdong Jia, Xianghua Han, Mangang Xie, Liang Zhang
2024 J jnl
Comput. Networks
Mangang Xie, Baozhen An, Xiangdong Jia, Meng Zhou, Jintian Lu
2023 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Abdullah Ibn Abbas, Xiangdong Jia, Glenn E. R. Cowan
2023 J jnl
IEEE Trans. Veh. Technol.
Mangang Xie, Jie Gong, Xiangdong Jia, Qianqian Wang, Xiao Ma
2023 J jnl
IEEE Wirel. Commun. Lett.
Zhi Chen, Zhenchao Hao, Junyan Wang, Yuhua Zhao, Qianqian Wang, Xiangdong Jia
2023 conf
ICC
Zhi Chen, Xiangdong Jia, Zhemin Wei, Junyan Wang
2023 J jnl
Int. J. Commun. Syst.
Yuhua Zhao, Xiangdong Jia, Mangang Xie, Zhenchao Hao
2023 J jnl
Int. J. Commun. Syst.
Zhenchao Hao, Xiangdong Jia
2023 J jnl
IEEE Open J. Commun. Soc.
Qianqian Wang, Quansheng Guan, Yuankun Tang, Julian Cheng, Fei Ji, Xiangdong Jia
2023 conf
ICC
Qianqian Wang, Quansheng Guan, Julian Cheng, Xiangdong Jia, Mangang Xie, Yuankun Tang
2023 conf
ICCE-Taiwan
Mangang Xie, Baozhen An, Changhao Song, Qianqian Wang, Meng Zhou, Xiangdong Jia
2022 conf
VTC Spring
Mangang Xie, Qi Cao, Meng Zhou, Xiangdong Jia
2022 conf
VTC Spring
Zhenchao Hao, Xiangdong Jia, Jin Xu
2022 conf
VTC Spring
Junyan Wang, Xiangdong Jia, Zhenchao Hao, Jiaxiang Yin
2022 J jnl
Trans. Emerg. Telecommun. Technol.
Xiangdong Jia, Yixuan Guo, Zhenchao Hao, Shengnan Cao
2022 J jnl
Ad Hoc Networks
Mangang Xie, Xiangdong Jia, Meng Zhou
2022 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Zhemin Wei, Zhenchao Hao, Yuhua Ouyang
2022 J jnl
Trans. Emerg. Telecommun. Technol.
Junyan Wang, Xiangdong Jia, Zhi Chen, Xin Zhang
2021 J jnl
IEEE Trans. Commun.
Mangang Xie, Jie Gong, Xiangdong Jia, Xiao Ma
2021 J jnl
IEEE Wirel. Commun. Lett.
Xiangdong Jia, Shengnan Cao, Mangang Xie
2021 J jnl
IEEE Access
Yongfu Shi, Letian Jing, Xiangdong Jia, Pengshan Ji, Nini Wan
2021 J jnl
Trans. Emerg. Telecommun. Technol.
Xiangdong Jia, Yaping Lv, Yuwan Chen, Letian Jing, Yuhua Ouyang
2021 conf
VTC Fall
Yixuan Guo, Xiangdong Jia, Shengnan Cao
2021 conf
VTC Fall
Shengnan Cao, Xiangdong Jia, Yixuan Guo
2020 conf
WCSP
Yi Lu, Xiangdong Jia, Pengshan Ji, Yaping Lv, Haixia Hu, Peiwen Ye
2020 conf
WCSP
Haixia Hu, Xiangdong Jia, Peiwen Ye, Yaping Lv, Yi Lu
2020 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Xiaorong Yang, Wenjuan Xu
2020 J jnl
IEEE Access
Pengshan Ji, Xiangdong Jia, Yi Lu, Haixia Hu, Yuhua Ouyang
2020 C conf
ISCAS
Christopher Williams, Diaaeldin Abdelrahman, Xiangdong Jia, Abdullah Ibn Abbas, Glenn E. R. Cowan, Odile Liboiron-Ladouceur
2020 J jnl
Comput. Commun.
Pingzhang Gou, Gang Mao, Fen Zhang, Xiangdong Jia
2019 J jnl
IET Commun.
Xiangdong Jia, Wenjuan Xu, Qiaoling Fan, Longxiang Yang
2019 J jnl
IEEE Access
Xiangdong Jia, Qiaoling Fan, Wenjuan Xu, Longxiang Yang
2019 J jnl
Trans. Emerg. Telecommun. Technol.
Xiangdong Jia, Xiaorong Yang, Wenjuan Xu, Longxiang Yang
2019 J jnl
IEEE Access
Xiangdong Jia, Wenjuan Xu, Yuwan Chen, Longxiang Yang
2019 J jnl
J. Comput. Methods Sci. Eng.
Pingzhang Gou, Fengzhen Li, Zhen Li, Xiangdong Jia
2019 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Wenjuan Xu, Mangang Xie, Meng Zhou, Longxiang Yang
2019 J jnl
IEEE Access
Xiangdong Jia, Pengshan Ji, Yuwan Chen
2019 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Christopher Williams, Diaaeldin Abdelrahman, Xiangdong Jia, Abdullah Ibn Abbas, Odile Liboiron-Ladouceur, Glenn E. R. Cowan
2019 conf
VTC Spring
Meng Zhou, Mangang Xie, Yao Zhang, Xiangdong Jia, Longxiang Yang
2018 J jnl
Int. J. Commun. Syst.
Shanshan Ji, Xiangdong Jia, Qiaoling Fan, Mangang Xie, Meng Zhou
2018 J jnl
IET Commun.
Xiangdong Jia, Shanshan Ji, Yuhua Ouyang, Meng Zhou, Longxiang Yang
2017 C conf
ISCAS
Xiangdong Jia, Glenn E. R. Cowan
2017 conf
WCSP
Meng Zhou, Xiangdong Jia, Mangang Xie, Weijie Tan, Weiqiang Tan
2017 J jnl
Int. J. Commun. Syst.
Xiangdong Jia, Mangang Xie, Meng Zhou, Hongbo Zhu, Longxiang Yang
2017 J jnl
IET Commun.
Xiangdong Jia, Meng Zhou, Mangang Xie, Longxiang Yang, Hongbo Zhu
2017 J jnl
Trans. Emerg. Telecommun. Technol.
Xiangdong Jia, Mangang Xie, Longxiang Yang, Hongbo Zhu
2017 J jnl
Trans. Emerg. Telecommun. Technol.
Mangang Xie, Xiangdong Jia, Meng Zhou, Longxiang Yang
2017 J jnl
Trans. Emerg. Telecommun. Technol.
Xiangdong Jia, Meng Zhou, Longxiang Yang, Hongbo Zhu
2016 J jnl
EURASIP J. Wirel. Commun. Netw.
Xiangdong Jia, Meng Zhou, Xiaochao Dang, Longxiang Yang, Hongbo Zhu
2016 J jnl
IEEE Access
Xiangdong Jia, Meng Zhou, Mangang Xie, Longxiang Yang, Hongbo Zhu
2016 J jnl
Wirel. Pers. Commun.
Weisheng Wang, Xiangdong Jia, Longxiang Yang, Hongbo Zhu
2016 J jnl
Int. J. Commun. Syst.
Xiangdong Jia, Pengfei Deng, Longxiang Yang, Hongbo Zhu
2016 conf
WCSP
Mangang Xie, Xiangdong Jia, Meng Zhou, Longxiang Yang
2015 J jnl
IET Commun.
Xiangdong Jia, Pengfei Deng, Dan Wang, Longxiang Yang, Hongbo Zhu
2015 J jnl
EURASIP J. Wirel. Commun. Netw.
Xiangdong Jia, Dan Wang, Xiaochao Dang, Longxiang Yang, Hongbo Zhu
2015 J jnl
IEEE Access
Xiangdong Jia, Pengfei Deng, Longxiang Yang, Hongbo Zhu
2014 J jnl
EURASIP J. Wirel. Commun. Netw.
Xiangdong Jia, Ming Zhou, Xiaochao Dang, Longxiang Yang, Hongbo Zhu
2014 J jnl
IET Commun.
Xiangdong Jia, Longxiang Yang, Hongbo Zhu
2014 J jnl
Int. J. Commun. Syst.
Hui Zhi, Xiangdong Jia, Longxiang Yang, Haiyang Fu
2014 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Longxiang Yang, Hongbo Zhu
2014 J jnl
Int. J. Commun. Syst.
Xiangdong Jia, Hongbo Zhu, Longxiang Yang
2013 J jnl
IET Commun.
Xiangdong Jia, Hongbo Zhu, Longxiang Yang, Haiyang Fu
2013 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Hongbo Zhu, Longxiang Yang, Haiyang Fu
2012 J jnl
IET Wirel. Sens. Syst.
Xiangdong Jia, Longxiang Yang, Shixiang Shao, Shengchen Wu, Hongbo Zhu
2012 J jnl
IEEE Commun. Lett.
Xiangdong Jia, Longxiang Yang
2011 J jnl
Wirel. Pers. Commun.
Xiangdong Jia, Wei Xiao, Haiyang Fu, Junfeng Fan
2011 J jnl
Eur. Trans. Telecommun.
Xiangdong Jia, Longxiang Yang
2011 J jnl
Int. J. Commun. Syst.
Xiangdong Jia, Haiyang Fu, Longxiang Yang, Laiqiang Zhao
2011 J jnl
EURASIP J. Wirel. Commun. Netw.
Xiangdong Jia, Longxiang Yang, Haiyang Fu
tests/integration/test_pe_extractors.py
← Index tests/integration/test_pe_extractors.py python
"""
Integration tests for PE-specific extractors.
"""
import pytest
from unittest.mock import Mock, patch, MagicMock

pytestmark = [pytest.mark.integration, pytest.mark.pe]


# ============================================================================
# PEFeaturesExtractor Tests
# ============================================================================

class TestPEFeaturesExtractor:
    """Tests for PEFeaturesExtractor class."""

    def test_extract_valid_pe(self, pe_binary_path, mock_logger):
        """Test extracting features from valid PE file."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.models.dataclasses import PE

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result is not None
            assert isinstance(result, PE)

    def test_extract_pe_type(self, pe_binary_path, mock_logger):
        """Test PE type detection (DLL, EXE, DRIVER)."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result.type in ["DLL", "EXE", "DRIVER"]

    def test_extract_architecture(self, pe_binary_path, mock_logger):
        """Test architecture detection."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Architecture should be detected
            assert result.architecture is not None

    def test_extract_entry_point(self, pe_binary_path, mock_logger):
        """Test entry point extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Entry point should be a hex string
            assert result.entry_point.startswith("0x")

    def test_extract_compilation_time(self, pe_binary_path, mock_logger):
        """Test compilation time extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Compilation time should be an integer timestamp
            assert isinstance(result.compilation_time, int)
            assert result.compilation_time_utc is not None

    def test_extract_dotnet_detection(self, pe_binary_path, mock_logger):
        """Test .NET detection."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Should be True for the test .NET binary
            assert isinstance(result.is_dotnet, bool)
            assert result.is_dotnet is True  # Test file is .NET

    def test_extract_headers(self, pe_binary_path, mock_logger):
        """Test header extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result.dos_header is not None
            assert result.nt_header is not None
            assert result.file_header is not None
            assert result.optional_header is not None

    def test_extract_counts(self, pe_binary_path, mock_logger):
        """Test section/import/export counts."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert isinstance(result.number_of_sections, int)
            assert isinstance(result.number_of_imports, int)
            assert isinstance(result.number_of_exports, int)
            assert isinstance(result.number_of_resources, int)

    def test_extract_rich_header(self, pe_binary_path, mock_logger):
        """Test Rich header extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Rich header may or may not be present
            # If present, should be JSON string
            if result.rich_header_dump is not None:
                assert isinstance(result.rich_header_dump, str)

    def test_extract_version_info(self, pe_binary_path, mock_logger):
        """Test version info extraction."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEFeaturesExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # Version info may or may not be present
            if result.version_info is not None:
                assert isinstance(result.version_info, list)


# ============================================================================
# PEImportExtractor Tests
# ============================================================================

class TestPEImportExtractor:
    """Tests for PEImportExtractor class."""

    def test_extract_imports(self, pe_binary_path, mock_logger):
        """Test import extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor
        from redb.models.dataclasses import PEImport

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None:
                assert isinstance(result, PEImport)
                assert isinstance(result.pe_imports_total, int)

    def test_extract_import_libraries(self, pe_binary_path, mock_logger):
        """Test import library extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and result.pe_import_libraryName is not None:
                assert isinstance(result.pe_import_libraryName, list)

    def test_extract_import_functions(self, pe_binary_path, mock_logger):
        """Test import function extraction."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and result.pe_import_functions is not None:
                assert isinstance(result.pe_import_functions, list)

    def test_prepare_export_clickhouse(self, pe_binary_path, mock_logger):
        """Test ClickHouse export preparation."""
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEImportExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.prepare_export_data("ClickHouseExporter")

            if result is not None:
                data, column_names, column_type_names = result
                assert 'library_name' in column_names
                assert 'function_name' in column_names


# ============================================================================
# PESectionExtractor Tests
# ============================================================================

class TestPESectionExtractor:
    """Tests for PESectionExtractor class."""

    def test_extract_sections(self, pe_binary_path, mock_logger):
        """Test section extraction."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor
        from redb.models.dataclasses import PESection

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            assert result is not None
            assert isinstance(result, list)
            assert len(result) > 0
            assert isinstance(result[0], PESection)

    def test_section_properties(self, pe_binary_path, mock_logger):
        """Test section property extraction."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and len(result) > 0:
                section = result[0]
                assert section.section_name is not None
                assert section.section_entropy >= 0
                assert section.section_sha256 is not None
                assert section.section_md5 is not None
                assert section.section_size >= 0

    def test_section_entropy_range(self, pe_binary_path, mock_logger):
        """Test that section entropy is in valid range."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None:
                for section in result:
                    assert 0 <= section.section_entropy <= 8

    def test_prepare_export_clickhouse(self, pe_binary_path, mock_logger):
        """Test ClickHouse export preparation."""
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESectionExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.prepare_export_data("ClickHouseExporter")

            if result is not None:
                data, column_names, column_type_names = result
                assert 'section_name' in column_names
                assert 'section_entropy' in column_names
                assert 'section_sha256' in column_names


# ============================================================================
# PEResourceExtractor Tests
# ============================================================================

class TestPEResourceExtractor:
    """Tests for PEResourceExtractor class."""

    def test_extract_resources(self, pe_binary_path, mock_logger):
        """Test resource extraction."""
        from redb.extractors.pe_extractors.pe_resources import PEResourceExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEResourceExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if no resources
            if result is not None:
                assert isinstance(result, list)

    def test_resource_properties(self, pe_binary_path, mock_logger):
        """Test resource property extraction."""
        from redb.extractors.pe_extractors.pe_resources import PEResourceExtractor
        from redb.models.dataclasses import PEResource

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEResourceExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            if result is not None and len(result) > 0:
                resource = result[0]
                assert isinstance(resource, PEResource)
                assert resource.resource_type is not None


# ============================================================================
# PEOverlayExtractor Tests
# ============================================================================

class TestPEOverlayExtractor:
    """Tests for PEOverlayExtractor class."""

    def test_extract_overlay(self, pe_binary_path, mock_logger):
        """Test overlay extraction."""
        from redb.extractors.pe_extractors.pe_overlay import PEOverlayExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEOverlayExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if no overlay
            # If present, should have overlay properties
            if result is not None:
                assert hasattr(result, 'overlay_size')

    def test_has_overlay_check(self, pe_binary_path, mock_logger):
        """Test overlay detection."""
        from redb.extractors.pe_extractors.pe_overlay import PEOverlayExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEOverlayExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            has_overlay = extractor._has_overlay()
            assert isinstance(has_overlay, bool)


# ============================================================================
# PESignatureExtractor Tests
# ============================================================================

class TestPESignatureExtractor:
    """Tests for PESignatureExtractor class."""

    def test_extract_signature(self, pe_binary_path, mock_logger):
        """Test signature extraction."""
        from redb.extractors.pe_extractors.pe_signature import PESignatureExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESignatureExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May be None if not signed
            # Result type depends on implementation

    def test_is_signed_check(self, pe_binary_path, mock_logger):
        """Test signature detection."""
        from redb.extractors.pe_extractors.pe_signature import PESignatureExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PESignatureExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            is_signed = extractor._is_signed()
            assert isinstance(is_signed, bool)


# ============================================================================
# PEDotNetExtractor Tests
# ============================================================================

class TestPEDotNetExtractor:
    """Tests for PEDotNetExtractor class."""

    def test_extract_dotnet(self, pe_binary_path, mock_logger):
        """Test .NET metadata extraction."""
        from redb.extractors.pe_extractors.pe_dotnet import PEDotNetExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEDotNetExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # The test file is a .NET binary
            if extractor._check_dotnet():
                assert result is not None

    def test_check_dotnet(self, pe_binary_path, mock_logger):
        """Test .NET detection."""
        from redb.extractors.pe_extractors.pe_dotnet import PEDotNetExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEDotNetExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            is_dotnet = extractor._check_dotnet()
            assert isinstance(is_dotnet, bool)
            # Test file should be .NET
            assert is_dotnet is True


# ============================================================================
# PEInconsistencyTestsExtractor Tests
# ============================================================================

class TestPEInconsistencyTestsExtractor:
    """Tests for PEInconsistencyTestsExtractor class."""

    def test_extract_inconsistency_tests(self, pe_binary_path, mock_logger):
        """Test inconsistency tests extraction."""
        from redb.extractors.pe_extractors.pe_inconsistency_tests import PEInconstistencyTestsExtractor as PEInconsistencyTestsExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEInconsistencyTestsExtractor(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # extract() returns True if tests were performed, False otherwise
            # The actual test results are stored in extractor.pe_inconsistency_tests
            # and extractor.dotnet_inconsistency_tests
            assert result in (True, False)

            if result:
                # Check that test results were stored
                assert extractor.pe_inconsistency_tests is not None or extractor.dotnet_inconsistency_tests is not None


# ============================================================================
# PEExtraFindings Tests
# ============================================================================

class TestPEExtraFindings:
    """Tests for PEExtraFindings class."""

    def test_extract_extra_findings(self, pe_binary_path, mock_logger):
        """Test extra findings extraction."""
        from redb.extractors.pe_extractors.pe_extra_findings import PEExtraFindings

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            extractor = PEExtraFindings(pe_binary_path, mock_logger)

            if extractor.pe is None:
                pytest.skip("PE parsing failed")

            result = extractor.extract()

            # May return None or list of findings
            if result is not None:
                assert isinstance(result, list)


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

class TestPEExtractorIntegration:
    """Integration tests for PE extractors."""

    def test_all_extractors_same_pe_object(self, pe_binary_path, mock_logger, pe_object):
        """Test that extractors can share the same PE object."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor
        from redb.extractors.pe_extractors.pe_sections import PESectionExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            # Create extractors sharing the same PE object
            features_ext = PEFeaturesExtractor(pe_binary_path, mock_logger, pe=pe_object)
            imports_ext = PEImportExtractor(pe_binary_path, mock_logger, pe=pe_object)
            sections_ext = PESectionExtractor(pe_binary_path, mock_logger, pe=pe_object)

            # All should use the same PE object
            assert features_ext.pe is pe_object
            assert imports_ext.pe is pe_object
            assert sections_ext.pe is pe_object

            # All should extract successfully
            features_result = features_ext.extract()
            imports_result = imports_ext.extract()
            sections_result = sections_ext.extract()

            assert features_result is not None
            # imports and sections may be None if not present

    def test_hash_consistency_across_extractors(self, pe_binary_path, mock_logger):
        """Test that hashes are consistent across all extractors."""
        from redb.extractors.pe_extractors.pe_features import PEFeaturesExtractor
        from redb.extractors.pe_extractors.pe_imports import PEImportExtractor

        with patch('redb.settings.ELASTIC_BINARIES_COLLECTION', 'test'):
            features_ext = PEFeaturesExtractor(pe_binary_path, mock_logger)
            imports_ext = PEImportExtractor(pe_binary_path, mock_logger)

            # Hashes should be the same
            assert features_ext.sha256 == imports_ext.sha256
            assert features_ext.md5 == imports_ext.md5
            assert features_ext.sha1 == imports_ext.sha1