forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove map file strict capacity constraint, see elastic#7581
tests for capacity chage and page and queue level remove dead STRICT_CAPACITY and remove unused @param comment
- Loading branch information
1 parent
653cd34
commit 02bd423
Showing
4 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
logstash-core/src/test/java/org/logstash/ackedqueue/io/MmapPageIOTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.logstash.ackedqueue.io; | ||
|
||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.logstash.ackedqueue.io.MmapPageIO; | ||
import org.logstash.ackedqueue.io.PageIO; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
|
||
public class MmapPageIOTest { | ||
@Rule | ||
public final TemporaryFolder temporaryFolder = new TemporaryFolder(); | ||
|
||
private String dir; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
dir = temporaryFolder.newFolder().getPath(); | ||
} | ||
|
||
@Test | ||
public void adjustToExistingCapacity() throws IOException { | ||
final int ORIGINAL_CAPACITY = 1024; | ||
final int NEW_CAPACITY = 2048; | ||
final int PAGE_NUM = 0; | ||
|
||
try (PageIO io1 = new MmapPageIO(PAGE_NUM, ORIGINAL_CAPACITY, dir)) { | ||
io1.create(); | ||
} | ||
|
||
try (PageIO io2 = new MmapPageIO(PAGE_NUM, NEW_CAPACITY, dir)) { | ||
io2.open(0, PAGE_NUM); | ||
assertThat(io2.getCapacity(), is(equalTo(ORIGINAL_CAPACITY))); | ||
} | ||
} | ||
} |