Mock Aerospike Java Client

Mock Aerospike Java Client - Allows for mocking & unit testing

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

com.github.srini156
Идентификатор

Идентификатор

mock-aerospike-java
Последняя версия

Последняя версия

0.0.6
Дата

Дата

Тип

Тип

jar
Описание

Описание

Mock Aerospike Java Client
Mock Aerospike Java Client - Allows for mocking & unit testing
Ссылка на сайт

Ссылка на сайт

https://github.com/srini156/mock-aersopike
Система контроля версий

Система контроля версий

https://github.com/srini156/mock-aersopike

Скачать mock-aerospike-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.srini156/mock-aerospike-java/ -->
<dependency>
    <groupId>com.github.srini156</groupId>
    <artifactId>mock-aerospike-java</artifactId>
    <version>0.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.srini156/mock-aerospike-java/
implementation 'com.github.srini156:mock-aerospike-java:0.0.6'
// https://jarcasting.com/artifacts/com.github.srini156/mock-aerospike-java/
implementation ("com.github.srini156:mock-aerospike-java:0.0.6")
'com.github.srini156:mock-aerospike-java:jar:0.0.6'
<dependency org="com.github.srini156" name="mock-aerospike-java" rev="0.0.6">
  <artifact name="mock-aerospike-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.srini156', module='mock-aerospike-java', version='0.0.6')
)
libraryDependencies += "com.github.srini156" % "mock-aerospike-java" % "0.0.6"
[com.github.srini156/mock-aerospike-java "0.0.6"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.aerospike : aerospike-client jar 4.4.9
org.testng : testng jar 7.1.0

Модули Проекта

Данный проект не имеет модулей.

mock-aerospike

Just use MockAerospikeClient implementation for the interface IAerospikeClient in your unit tests.

Goals

  • Lightweight & Embedded
  • Easy to use (implements the same interface)
  • Reduce effort in unit testing
  • Allow extensibility

Issues with IAerospikeClient

Currently, Aerospike provides for IAerospikeClient (in Java) with sole intention of making AerospikeClient testable. However, there are few issues pointed out - https://github.com/aerospike/aerospike-client-java/issues/34

  • Don't mock what you don't own (Mocking IAerospikeClient, then mocking Record).

Better approach to testing is to create MockAerospikeClient which implements IAerospikeClient, thus avoiding mocking RecordSet and Record itself.

Implementation

MockAerospikeClient implements IAerospikeClient (version - 4.4.9)
Currently, MockAerospikeClient supports the following methods:

  • put
  • get
  • delete
  • exists
  • getHeader

MockAerospikeClient internally uses a HashMap to store Record corresponding to a Key

Setup

  • Maven
  • Java 1.8 or greater

Usage

  • pom.xml
    Add the following dependency to your pom.xml
<dependency>
  <groupId>com.github.srini156</groupId>
  <artifactId>mock-aerospike-java</artifactId>
  <version>0.0.4</version>
</dependency>
  • Code
  MockAerospikeClient client = new MockAerospikeClient();
  //Put entry into Aerospike
  client.put(null, new Key("namespace", "set", "key"), new Bin[] { new Bin("bin1", "value1") });
  //Fetch entry from Aerospike
  client.get(null, new Key("namespace","set","key"));

Contributions

It is currently alpha and WIP. Contributions are welcome, please raise a pull request.

Версии библиотеки

Версия
0.0.6
0.0.5
0.0.4
0.0.2
0.0.1