-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from jitwxs/dev
1.15-RELEASE
- Loading branch information
Showing
22 changed files
with
370 additions
and
83 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
81 changes: 81 additions & 0 deletions
81
.../java/io/github/jitwxs/easydata/sample/core/mock/primitive/AgronaPrimitiveStructTest.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,81 @@ | ||
package io.github.jitwxs.easydata.sample.core.mock.primitive; | ||
|
||
import io.github.jitwxs.easydata.common.bean.MockConfig; | ||
import io.github.jitwxs.easydata.core.mock.EasyMock; | ||
import io.github.jitwxs.easydata.core.mock.TypeKit; | ||
import org.agrona.collections.Long2LongHashMap; | ||
import org.agrona.collections.Long2ObjectHashMap; | ||
import org.agrona.collections.LongHashSet; | ||
import org.agrona.collections.Object2IntHashMap; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* test primitive data struct support with easymock | ||
* | ||
* this case will use <a href="https://github.com/real-logic/agrona">agrona</a> library | ||
* | ||
* @author jitwxs@foxmail.com | ||
* @since 2023-04-11 0:15 | ||
*/ | ||
public class AgronaPrimitiveStructTest { | ||
@Test | ||
@DisplayName("agrona | key map") | ||
public void testAgronaKMap() { | ||
// initial with TypeKit | ||
final Long2ObjectHashMap<String> map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Long2ObjectHashMap<String>>() { | ||
})); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Long2ObjectHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Long2ObjectHashMap.class)); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("agrona | value map") | ||
public void testAgronaVMap() { | ||
final Supplier<MockConfig> mockConfigSupplier = () -> new MockConfig().registerConstructorSupplier(() -> new Object2IntHashMap(-1)); | ||
|
||
// initial with TypeKit | ||
final Object2IntHashMap<String> map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Object2IntHashMap<String>>() { | ||
}, mockConfigSupplier.get())); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Object2IntHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Object2IntHashMap.class, mockConfigSupplier.get())); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("agrona | key-value map") | ||
public void testAgronaKVMap() { | ||
final Supplier<MockConfig> mockConfigSupplier = () -> new MockConfig().registerConstructorSupplier(() -> new Long2LongHashMap(-1)); | ||
|
||
// initial with TypeKit | ||
final Long2LongHashMap map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Long2LongHashMap>() { | ||
}, mockConfigSupplier.get())); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Long2LongHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Long2LongHashMap.class, mockConfigSupplier.get())); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("agrona | key set") | ||
public void testAgronaKSet() { | ||
// initial with TypeKit | ||
final LongHashSet set = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<LongHashSet>() { | ||
})); | ||
assertFalse(set.isEmpty()); | ||
|
||
// initial with generic | ||
final LongHashSet set1 = assertDoesNotThrow(() -> EasyMock.run(LongHashSet.class)); | ||
assertFalse(set1.isEmpty()); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...ava/io/github/jitwxs/easydata/sample/core/mock/primitive/FastutilPrimitiveStructTest.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,75 @@ | ||
package io.github.jitwxs.easydata.sample.core.mock.primitive; | ||
|
||
import io.github.jitwxs.easydata.core.mock.EasyMock; | ||
import io.github.jitwxs.easydata.core.mock.TypeKit; | ||
import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; | ||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; | ||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; | ||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
/** | ||
* test primitive data struct support with easymock | ||
* | ||
* this case will use <a href="https://github.com/vigna/fastutil">fastutil</a> library | ||
* | ||
* @author jitwxs@foxmail.com | ||
* @since 2023-04-11 0:15 | ||
*/ | ||
public class FastutilPrimitiveStructTest { | ||
@Test | ||
@DisplayName("fastutil | key map") | ||
public void testFastutilaKMap() { | ||
// initial with TypeKit | ||
final Long2ObjectOpenHashMap<String> map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Long2ObjectOpenHashMap<String>>() { | ||
})); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Long2ObjectOpenHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Long2ObjectOpenHashMap.class)); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("fastutil | value map") | ||
public void testFastutilaVMap() { | ||
// initial with TypeKit | ||
final Object2IntOpenHashMap<String> map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Object2IntOpenHashMap<String>>() { | ||
})); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Object2IntOpenHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Object2IntOpenHashMap.class)); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("fastutil | key-value map") | ||
public void testFastutilaKVMap() { | ||
// initial with TypeKit | ||
final Long2LongOpenHashMap map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<Long2LongOpenHashMap>() { | ||
})); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final Long2LongOpenHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(Long2LongOpenHashMap.class)); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
|
||
@Test | ||
@DisplayName("fastutil | key set") | ||
public void testFastutilaKSet() { | ||
// initial with TypeKit | ||
final LongOpenHashSet set = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<LongOpenHashSet>() { | ||
})); | ||
assertFalse(set.isEmpty()); | ||
|
||
// initial with generic | ||
final LongOpenHashSet set1 = assertDoesNotThrow(() -> EasyMock.run(LongOpenHashSet.class)); | ||
assertFalse(set1.isEmpty()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...t/java/io/github/jitwxs/easydata/sample/core/mock/primitive/NettyPrimitiveStructTest.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,33 @@ | ||
package io.github.jitwxs.easydata.sample.core.mock.primitive; | ||
|
||
import io.github.jitwxs.easydata.core.mock.EasyMock; | ||
import io.github.jitwxs.easydata.core.mock.TypeKit; | ||
import io.netty.util.collection.LongObjectHashMap; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
/** | ||
* test primitive data struct support with easymock | ||
* | ||
* this case will use <a href="https://github.com/netty/netty">netty</a> library | ||
* | ||
* @author jitwxs@foxmail.com | ||
* @since 2023-04-11 0:15 | ||
*/ | ||
public class NettyPrimitiveStructTest { | ||
@Test | ||
@DisplayName("netty | key map") | ||
public void testNettyKMap() { | ||
// initial with TypeKit | ||
final LongObjectHashMap<String> map = assertDoesNotThrow(() -> EasyMock.run(new TypeKit<LongObjectHashMap<String>>() { | ||
})); | ||
assertFalse(map.isEmpty()); | ||
|
||
// initial with generic | ||
final LongObjectHashMap map1 = assertDoesNotThrow(() -> EasyMock.run(LongObjectHashMap.class)); | ||
assertFalse(map1.isEmpty()); | ||
} | ||
} |
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
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
Oops, something went wrong.