Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhuynh27 committed Dec 23, 2021
1 parent 4fdb23d commit 65afe47
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 43 deletions.
5 changes: 2 additions & 3 deletions config/src/test/java/com/keva/config/ArgsParserTest.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package com.keva.config;

import com.keva.config.util.ArgsHolder;
import com.keva.config.util.ArgsParser;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import lombok.var;

class ArgsParserTest {

@Test
void parse() {
String[] args = {
"--p", "123123", "--a", "--b"
};
var parse = ArgsParser.parse(args);
ArgsHolder parse = ArgsParser.parse(args);
assertEquals("true", parse.getFlag("a"));
assertEquals("true", parse.getFlag("b"));
assertEquals("123123", parse.getArgVal("p"));
Expand Down
65 changes: 29 additions & 36 deletions core/src/test/java/dev/keva/core/server/AbstractServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import lombok.var;
import redis.clients.jedis.params.ZAddParams;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -96,7 +95,7 @@ void getSetEmptyString() {
@Test
void del() {
try {
var setAbc = jedis.set("abc", "123");
String setAbc = jedis.set("abc", "123");
val getAbc = jedis.get("abc");
val delAbc = jedis.del("abc");
val getAbcNull = jedis.get("abc");
Expand Down Expand Up @@ -187,7 +186,7 @@ void transactionWatch() {
void getSetExpire() {
try {
val setAbc = jedis.set("abc", "123");
var getAbc = jedis.get("abc");
String getAbc = jedis.get("abc");
val expireAbc = jedis.expire("abc", 1L);

assertEquals("OK", setAbc);
Expand All @@ -208,8 +207,8 @@ void getSetExpire() {
void updateExpire() {
try {
val setAbc = jedis.set("abc", "123");
var getAbc = jedis.get("abc");
var expireAbc = jedis.expire("abc", 1L);
String getAbc = jedis.get("abc");
Long expireAbc = jedis.expire("abc", 1L);

assertEquals("OK", setAbc);
assertEquals("123", getAbc);
Expand Down Expand Up @@ -237,7 +236,7 @@ void updateExpire() {
void getSetExpireAt() {
try {
val setAbc = jedis.set("abc", "123");
var getAbc = jedis.get("abc");
String getAbc = jedis.get("abc");
val oneSecondLaterTime = System.currentTimeMillis() + 1000;
val expireAbc = jedis.expireAt("abc", oneSecondLaterTime);

Expand All @@ -258,8 +257,8 @@ void getSetExpireAt() {
@Test
void setAfterExpireAt() {
try {
var setAbc = jedis.set("abc", "123");
var getAbc = jedis.get("abc");
String setAbc = jedis.set("abc", "123");
String getAbc = jedis.get("abc");
val oneSecondLaterTime = System.currentTimeMillis() + 1000;
val expireAbc = jedis.expireAt("abc", oneSecondLaterTime);

Expand Down Expand Up @@ -313,19 +312,17 @@ void getSetLongKeyString() {
@Timeout(30)
void pubsub() throws ExecutionException, InterruptedException {
CompletableFuture<String> future = new CompletableFuture<>();
new Thread(() -> {
subscriber.subscribe(new JedisPubSub() {
@Override
public void onMessage(String channel, String message) {
future.complete(message);
}

@Override
public void onSubscribe(String channel, int subscribedChannels) {
jedis.publish("test", "Test message");
}
}, "test");
}).start();
new Thread(() -> subscriber.subscribe(new JedisPubSub() {
@Override
public void onMessage(String channel, String message) {
future.complete(message);
}

@Override
public void onSubscribe(String channel, int subscribedChannels) {
jedis.publish("test", "Test message");
}
}, "test")).start();
val message = future.get();
assertEquals("Test message", message);
}
Expand Down Expand Up @@ -832,36 +829,32 @@ void setrange() {

@Test
void zaddWithXXAndNXErrs() {
assertThrows(JedisDataException.class, () -> {
jedis.zadd("zset", 1.0, "val", new ZAddParams().xx().nx());
});
assertThrows(JedisDataException.class, () ->
jedis.zadd("zset", 1.0, "val", new ZAddParams().xx().nx()));
}

@Test
void zaddSingleWithNxAndGtErrs() {
assertThrows(JedisDataException.class, () -> {
jedis.zadd("zset", 1.0, "val", new ZAddParams().gt().nx());
});
assertThrows(JedisDataException.class, () ->
jedis.zadd("zset", 1.0, "val", new ZAddParams().gt().nx()));
}

@Test
void zaddSingleWithNxAndLtErrs() {
assertThrows(JedisDataException.class, () -> {
jedis.zadd("zset", 1.0, "val", new ZAddParams().lt().nx());
});
assertThrows(JedisDataException.class, () ->
jedis.zadd("zset", 1.0, "val", new ZAddParams().lt().nx()));
}

@Test
void zaddSingleWithGtAndLtErrs() {
assertThrows(JedisDataException.class, () -> {
jedis.zadd("zset", 1.0, "val", new ZAddParams().lt().gt());
});
assertThrows(JedisDataException.class, () ->
jedis.zadd("zset", 1.0, "val", new ZAddParams().lt().gt()));
}

@Test
void zaddSingleWithoutOptions() {
try {
var result = jedis.zadd("zset", 1.0, "val");
Long result = jedis.zadd("zset", 1.0, "val");
assertEquals(1, result);

result = jedis.zadd("zset", 1.0, "val");
Expand All @@ -879,7 +872,7 @@ void zaddMultipleWithoutOptions() {
for(int i=0; i<numMembers; ++i) {
members.put(Integer.toString(i), (double) i);
}
var result = jedis.zadd("zset", members);
Long result = jedis.zadd("zset", members);
assertEquals(numMembers, result);

result = jedis.zadd("zset", members);
Expand All @@ -892,7 +885,7 @@ void zaddMultipleWithoutOptions() {
@Test
void zaddCh() {
try {
var result = jedis.zadd("zset", 1.0, "mem", new ZAddParams().ch());
Long result = jedis.zadd("zset", 1.0, "mem", new ZAddParams().ch());
assertEquals(1, result);

result = jedis.zadd("zset", 1.0, "mem", new ZAddParams().ch());
Expand Down
3 changes: 2 additions & 1 deletion docs/src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ module.exports = {
collapsable: false,
children: [
'insight/design',
'insight/benchmark'
'insight/benchmark',
'insight/release-notes',
]
},
'roadmap',
Expand Down
10 changes: 10 additions & 0 deletions docs/src/guide/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,13 @@ public void a() { ... }
// <-- Remove this extra line.
public void b() { ... }
```

## Git flow

Follow the [Git flow](https://git-scm.com/book/en/v2/Git-Branching-and-Merging)

For feature PR (to develop) use squash merge, for release PR (to master) use rebase merge,
commit message merged to master/develop branch should be lowercase first word
(e.g. "fix: some bug").

All pull requests must be passed to the code review and passed all the tests.
3 changes: 3 additions & 0 deletions docs/src/guide/insight/release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release Notes

Visit [Release](https://github.com/keva-dev/keva/releases)
5 changes: 2 additions & 3 deletions docs/src/guide/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

## Todo-list

- Implement various Redis commands
- Implement RDB, AOF persistence mode
- Implement various Redis commands :heavy_check_mark:
- Implement RDB, AOF persistence mode :heavy_check_mark:
- Implement Pub/Sub :heavy_check_mark:
- Implement Transactions :heavy_check_mark:
- Implement Replication ([@axblueblader](https://github.com/axblueblader))
- Implement Keva Proxy ([@haphananhtuan](https://github.com/haphananhtuan))
- Implement Keva Sentinel ([@duongcongtoai](https://github.com/duongcongtoai))
- Implement Keva SQL (TBD)
- Implement Keva security
- Publish dedicated Maven package for `protocol` and `config`
- Create automation for release workflow

0 comments on commit 65afe47

Please sign in to comment.