public FlatFileStore(MessageStoreConfig storeConfig, MetadataStore metadataStore, MessageStoreExecutor executor) {
        this.storeConfig = storeConfig;
        this.metadataStore = metadataStore;
        this.executor = executor;
        this.flatFileFactory = new FlatFileFactory(metadataStore, storeConfig);
        this.flatFileConcurrentMap = new ConcurrentHashMap<>();
    }
@Test
    public void flatFileStoreTest() {
        // Empty recover
        MessageStoreExecutor executor = new MessageStoreExecutor();
        FlatFileStore fileStore = new FlatFileStore(storeConfig, metadataStore, executor);
        Assert.assertTrue(fileStore.load());

        Assert.assertEquals(storeConfig, fileStore.getStoreConfig());
        Assert.assertEquals(metadataStore, fileStore.getMetadataStore());
        Assert.assertNotNull(fileStore.getFlatFileFactory());

        for (int i = 0; i < 4; i++) {
            MessageQueue mq = new MessageQueue("flatFileStoreTest", storeConfig.getBrokerName(), i);
            FlatMessageFile flatFile = fileStore.computeIfAbsent(mq);
            FlatMessageFile flatFileGet = fileStore.getFlatFile(mq);
            Assert.assertEquals(flatFile, flatFileGet);
        }
        Assert.assertEquals(4, fileStore.deepCopyFlatFileToList().size());
        fileStore.shutdown();

        fileStore = new FlatFileStore(storeConfig, metadataStore, executor);
        Assert.assertTrue(fileStore.load());
        Assert.assertEquals(4, fileStore.deepCopyFlatFileToList().size());

        for (int i = 1; i < 3; i++) {
            MessageQueue mq = new MessageQueue("flatFileStoreTest", storeConfig.getBrokerName(), i);
            fileStore.destroyFile(mq);
        }
        Assert.assertEquals(2, fileStore.deepCopyFlatFileToList().size());
        fileStore.shutdown();

        FlatFileStore fileStoreSpy = Mockito.spy(fileStore);
        Mockito.when(fileStoreSpy.recoverAsync(any())).thenReturn(CompletableFuture.supplyAsync(() -> {
            throw new TieredStoreException(TieredStoreErrorCode.ILLEGAL_PARAM, "Test");
        }));
        Assert.assertFalse(fileStoreSpy.load());

        Mockito.reset(fileStoreSpy);
        fileStore.load();
        Assert.assertEquals(2, fileStore.deepCopyFlatFileToList().size());
        fileStore.destroy();
        Assert.assertEquals(0, fileStore.deepCopyFlatFileToList().size());
    }