-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
24 changed files
with
253 additions
and
55 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
cassdio-core/src/main/java/kr/hakdang/cassdio/common/BaseException.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
cassdio-core/src/main/java/kr/hakdang/cassdio/common/error/BaseException.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,38 @@ | ||
package kr.hakdang.cassdio.common.error; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Getter | ||
public abstract class BaseException extends RuntimeException { | ||
|
||
private final ErrorCode errorCode; | ||
private final List<String> reasons; | ||
|
||
protected BaseException(String message, ErrorCode errorCode) { | ||
super(message); | ||
this.errorCode = errorCode; | ||
this.reasons = Collections.emptyList(); | ||
} | ||
|
||
protected BaseException(String message, ErrorCode errorCode, Throwable cause) { | ||
super(message, cause); | ||
this.errorCode = errorCode; | ||
this.reasons = Collections.emptyList(); | ||
} | ||
|
||
protected BaseException(String message, ErrorCode errorCode, List<String> reasons) { | ||
super(message); | ||
this.errorCode = errorCode; | ||
this.reasons = reasons; | ||
} | ||
|
||
protected BaseException(String message, ErrorCode errorCode, Throwable cause, List<String> reasons) { | ||
super(message, cause); | ||
this.errorCode = errorCode; | ||
this.reasons = reasons; | ||
} | ||
|
||
} |
5 changes: 4 additions & 1 deletion
5
.../kr/hakdang/cassdio/common/ErrorCode.java → ...kdang/cassdio/common/error/ErrorCode.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
2 changes: 1 addition & 1 deletion
2
...java/kr/hakdang/cassdio/common/Jsons.java → ...r/hakdang/cassdio/common/utils/Jsons.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
23 changes: 23 additions & 0 deletions
23
cassdio-core/src/main/java/kr/hakdang/cassdio/core/domain/cluster/ClusterException.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,23 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster; | ||
|
||
import kr.hakdang.cassdio.common.error.BaseException; | ||
import kr.hakdang.cassdio.common.error.ErrorCode; | ||
|
||
/** | ||
* ClusterException | ||
* | ||
* @author Seungho Kang ([email protected]) | ||
* @version 1.0.0 | ||
* @since 2024. 07. 07. | ||
*/ | ||
public class ClusterException { | ||
|
||
public static class ClusterNodeNotFoundException extends BaseException { | ||
|
||
protected ClusterNodeNotFoundException(String message) { | ||
super(message, ErrorCode.E404_NOT_FOUND_CLUSTER_NODE); | ||
} | ||
|
||
} | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
...io-core/src/main/java/kr/hakdang/cassdio/core/domain/cluster/info/ClusterInfoManager.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
2 changes: 1 addition & 1 deletion
2
...o-core/src/main/java/kr/hakdang/cassdio/core/domain/cluster/info/ClusterInfoProvider.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
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
23 changes: 23 additions & 0 deletions
23
...c/main/java/kr/hakdang/cassdio/core/domain/cluster/keyspace/ClusterKeyspaceException.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,23 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster.keyspace; | ||
|
||
import kr.hakdang.cassdio.common.error.BaseException; | ||
import kr.hakdang.cassdio.common.error.ErrorCode; | ||
|
||
/** | ||
* ClusterKeyspaceException | ||
* | ||
* @author Seungho Kang ([email protected]) | ||
* @version 1.0.0 | ||
* @since 2024. 07. 07. | ||
*/ | ||
public class ClusterKeyspaceException { | ||
|
||
public static class ClusterKeyspaceNotFoundException extends BaseException { | ||
|
||
public ClusterKeyspaceNotFoundException(String message) { | ||
super(message, ErrorCode.E404_NOT_FOUND_KEYSPACE); | ||
} | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/kr/hakdang/cassdio/core/domain/cluster/keyspace/table/ClusterTableException.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,22 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster.keyspace.table; | ||
|
||
import kr.hakdang.cassdio.common.error.BaseException; | ||
import kr.hakdang.cassdio.common.error.ErrorCode; | ||
|
||
/** | ||
* ClusterTableException | ||
* | ||
* @author Seungho Kang ([email protected]) | ||
* @version 1.0.0 | ||
* @since 2024. 07. 07. | ||
*/ | ||
public class ClusterTableException { | ||
|
||
public static class CLusterTableNotFoundException extends BaseException { | ||
|
||
protected CLusterTableNotFoundException(String message) { | ||
super(message, ErrorCode.E404_NOT_FOUND_CLUSTER_NODE); | ||
} | ||
} | ||
|
||
} |
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
8 changes: 0 additions & 8 deletions
8
...ava/kr/hakdang/cassdio/core/domain/cluster/keyspace/table/ClusterTablePureSelectArgs.java
This file was deleted.
Oops, something went wrong.
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
61 changes: 61 additions & 0 deletions
61
...e/src/test/java/kr/hakdang/cassdio/core/domain/cluster/ClusterQueryCommanderArgsTest.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,61 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
/** | ||
* ClusterQueryCommanderArgsTest | ||
* | ||
* @author Seungho Kang ([email protected]) | ||
* @version 1.0.0 | ||
* @since 2024. 07. 07. | ||
*/ | ||
class ClusterQueryCommanderArgsTest { | ||
|
||
@Test | ||
void default_pageSize_is_50() { | ||
// given | ||
ClusterQueryCommanderArgs args = ClusterQueryCommanderArgs.builder().build(); | ||
|
||
// when | ||
int sut = args.getPageSize(); | ||
|
||
// then | ||
assertThat(sut).isEqualTo(50); | ||
} | ||
|
||
@Test | ||
void when_pageSize_is_over_500_throw_exception() { | ||
// when & then | ||
assertThatThrownBy(() -> | ||
ClusterQueryCommanderArgs.builder() | ||
.pageSize(501) | ||
.build() | ||
).isInstanceOf(RuntimeException.class); | ||
} | ||
|
||
@Test | ||
void default_timeout_is_3s() { | ||
// given | ||
ClusterQueryCommanderArgs args = ClusterQueryCommanderArgs.builder().build(); | ||
|
||
// when | ||
int sut = args.getTimeoutSeconds(); | ||
|
||
// then | ||
assertThat(sut).isEqualTo(3); | ||
} | ||
|
||
@Test | ||
void when_timeout_is_over_1m_throw_exception() { | ||
// when & then | ||
assertThatThrownBy(() -> | ||
ClusterQueryCommanderArgs.builder() | ||
.timeoutSeconds(61) | ||
.build() | ||
).isInstanceOf(RuntimeException.class); | ||
} | ||
|
||
} |
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.