Java Code Examples for org.apache.rocketmq.common.UtilAll#deleteFile()

The following examples show how to use org.apache.rocketmq.common.UtilAll#deleteFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConsumeQueueExtTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testTruncateByMinOffset() {
    ConsumeQueueExt consumeQueueExt = genExt();

    putSth(consumeQueueExt, false, true, unitCount * 2);

    try {
        // truncate first one file.
        long address = consumeQueueExt.decorate((long) (cqExtFileSize * 1.5));

        long expectMinAddress = consumeQueueExt.decorate(cqExtFileSize);

        consumeQueueExt.truncateByMinAddress(address);

        long minAddress = consumeQueueExt.getMinAddress();

        assertThat(expectMinAddress).isEqualTo(minAddress);
    } finally {
        consumeQueueExt.destroy();
        UtilAll.deleteFile(new File(storePath));
    }
}
 
Example 2
Source File: DefaultMessageStoreCleanFilesTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@After
public void destroy() {
    messageStore.shutdown();
    messageStore.destroy();

    MessageStoreConfig messageStoreConfig = messageStore.getMessageStoreConfig();
    File file = new File(messageStoreConfig.getStorePathRootDir());
    UtilAll.deleteFile(file);
}
 
Example 3
Source File: ConsumeQueueExtTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testGet() {
    ConsumeQueueExt consumeQueueExt = genExt();

    putSth(consumeQueueExt, false, false, unitCount);

    try {
        // from start.
        long addr = consumeQueueExt.decorate(0);

        ConsumeQueueExt.CqExtUnit unit = new ConsumeQueueExt.CqExtUnit();
        while (true) {
            boolean ret = consumeQueueExt.get(addr, unit);

            if (!ret) {
                break;
            }

            assertThat(unit.getSize()).isGreaterThanOrEqualTo(ConsumeQueueExt.CqExtUnit.MIN_EXT_UNIT_SIZE);

            addr += unit.getSize();
        }
    } finally {
        consumeQueueExt.destroy();
        UtilAll.deleteFile(new File(storePath));
    }
}
 
Example 4
Source File: ConsumeQueueExtTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testPut() {
    ConsumeQueueExt consumeQueueExt = genExt();

    try {
        putSth(consumeQueueExt, true, false, unitCount);
    } finally {
        consumeQueueExt.destroy();
        UtilAll.deleteFile(new File(storePath));
    }
}
 
Example 5
Source File: MappedFileQueueTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/unit_test_store");
    UtilAll.deleteFile(file);
}
 
Example 6
Source File: ClientLoggerTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void cleanFiles() {
    UtilAll.deleteFile(new File(LOG_DIR));
}
 
Example 7
Source File: MappedFileTest.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/unit_test_store");
    UtilAll.deleteFile(file);
}
 
Example 8
Source File: BrokerControllerTest.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(new MessageStoreConfig().getStorePathRootDir()));
}
 
Example 9
Source File: StoreCheckpointTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/checkpoint_test");
    UtilAll.deleteFile(file);
}
 
Example 10
Source File: IntegrationTestBase.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public static void deleteFile(File file) {
    if (!file.exists()) {
        return;
    }
    UtilAll.deleteFile(file);
}
 
Example 11
Source File: AppendCallbackTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(System.getProperty("user.home") + File.separator + "unitteststore"));
}
 
Example 12
Source File: ConsumeQueueExtTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(storePath));
}
 
Example 13
Source File: MappedFileQueueTest.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/unit_test_store");
    UtilAll.deleteFile(file);
}
 
Example 14
Source File: DefaultMessageStoreShutDownTest.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    messageStore.destroy();
    File file = new File(messageStore.getMessageStoreConfig().getStorePathRootDir());
    UtilAll.deleteFile(file);
}
 
Example 15
Source File: MappedFileQueueTest.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/unit_test_store");
    UtilAll.deleteFile(file);
}
 
Example 16
Source File: BrokerControllerTest.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(new MessageStoreConfig().getStorePathRootDir()));
}
 
Example 17
Source File: AppendCallbackTest.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(System.getProperty("user.home") + File.separator + "unitteststore"));
}
 
Example 18
Source File: ConsumeQueueExtTest.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    UtilAll.deleteFile(new File(storePath));
}
 
Example 19
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@After
public void destroy() {
    master.shutdown();
    master.destroy();
    UtilAll.deleteFile(new File(storePath));
}
 
Example 20
Source File: MappedFileTest.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
@After
public void destory() {
    File file = new File("target/unit_test_store");
    UtilAll.deleteFile(file);
}