-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
060340a
commit a7eca10
Showing
2 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 实用观点下的函数式编程思想 | ||
|
||
## 一. 什么是函数 | ||
|
||
## 二. 什么是Monad | ||
|
||
## 三. 从函数到函子 | ||
|
51 changes: 51 additions & 0 deletions
51
nop-sys/nop-sys-dao/src/test/java/io/nop/sys/dao/seq/TestSysSequenceGenerator.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,51 @@ | ||
package io.nop.sys.dao.seq; | ||
|
||
import io.nop.api.core.annotations.autotest.NopTestConfig; | ||
import io.nop.autotest.junit.JunitBaseTestCase; | ||
import io.nop.dao.DaoConstants; | ||
import io.nop.dao.api.IDaoProvider; | ||
import io.nop.sys.dao.entity.NopSysSequence; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@NopTestConfig(localDb = true, initDatabaseSchema = true) | ||
public class TestSysSequenceGenerator extends JunitBaseTestCase { | ||
static final Logger LOG = LoggerFactory.getLogger(TestSysSequenceGenerator.class); | ||
|
||
@Inject | ||
IDaoProvider daoProvider; | ||
|
||
@Inject | ||
SysSequenceGenerator generator; | ||
|
||
@Test | ||
public void testSequence() { | ||
NopSysSequence seq = new NopSysSequence(); | ||
seq.setNextValue(100L); | ||
seq.setSeqName("test"); | ||
seq.setCacheSize(200); | ||
seq.setSeqType("default"); | ||
seq.setIsUuid(DaoConstants.NO_VALUE); | ||
seq.setStepSize(1); | ||
|
||
daoProvider.daoFor(NopSysSequence.class).saveEntity(seq); | ||
|
||
String value = generator.generateString("test", true); | ||
assertEquals("100", value); | ||
|
||
LOG.info("before-generate"); | ||
value = generator.generateString("test", true); | ||
assertEquals("101", value); | ||
|
||
value = generator.generateString("test", true); | ||
assertEquals("102", value); | ||
LOG.info("after-generate"); | ||
|
||
NopSysSequence entity = daoProvider.daoFor(NopSysSequence.class).getEntityById(seq.orm_id()); | ||
assertEquals(300, entity.getNextValue()); | ||
} | ||
} |