diff --git a/.build.yml b/.build.yml index 1ae8f0f..e646082 100644 --- a/.build.yml +++ b/.build.yml @@ -1,22 +1,15 @@ name: aerospike-client-rest -dependency: - - url: git@github.com:citrusleaf/aerospike-client-java - dir: client/java - ref: master container: - base: - - docker.qe.aerospike.com/build/aerospike-client-java:openjdk-8 + - docker.qe.aerospike.com/build/aerospike-client-rest:openjdk-8 build: - name: build script: - - cd client/java - - mvn install - - cd ../.. - - export aerospikeUseLocal=1 - - ./gradlew bootwar + - source ~/.bashrc + - make package artifact: - - build/libs/*.war + - ./target/*.tgz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..539550e --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ + +VERSION=$(shell grep appVersion gradle.properties | cut -d '=' -f 2) +ARCHIVEDIR=as-rest-client-$(VERSION) +ARCHIVENAME=$(ARCHIVEDIR).tgz + +.PHONY: package +package: clean war validatedocs + mkdir $(ARCHIVEDIR) + mkdir target + cp build/libs/*.war $(ARCHIVEDIR) + cp docs/swagger.json $(ARCHIVEDIR) + tar -czvf target/$(ARCHIVENAME) $(ARCHIVEDIR) + +.PHONY: war +war: + ./gradlew bootWar + +.PHONY: clean +clean: + echo $(VERSION) + rm -rf $(ARCHIVEDIR) + rm -f $(ARCHIVENAME) + rm -rf target/ + ./gradlew clean + +.PHONY: validatedocs +validatedocs: + ls -lat /root/.nvm/versions/node/v10.15.3/bin/swagger-tools + env + swagger-tools validate docs/swagger.json + swagger-cli validate docs/swagger.json \ No newline at end of file diff --git a/README.md b/README.md index 93fbf8e..9d99359 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # aerospike-client-rest -The Aerospike Rest client provides a server which translates Restful API requests into messages to an Aerospike Cluster. +The Aerospike REST client provides a server which translates Restful API requests into messages to an Aerospike Cluster. It can be used as a bridge between applications written in languages without an existing Aerospike Client library, or as a pluggable component in a pre-existing architecture. ## Installation -For instructions on installing the Rest Client from a `.war` file see [Installation and Configuration](./docs/installation-and-config.md) . +For instructions on installing the REST Client from a `.war` file see [Installation and Configuration](./docs/installation-and-config.md) . ## Building @@ -32,12 +32,12 @@ See [Installation and Configuration](./docs/installation-and-config.md) for conf ### Formats -The Aerospike Rest client allows communication utilizing `JSON` and `MessagePack` formats. For more information about how to specify the format, and recommended usages of each, see [Data Formats](./docs/data-formats.md) +The Aerospike REST client allows communication utilizing `JSON` and `MessagePack` formats. For more information about how to specify the format, and recommended usages of each, see [Data Formats](./docs/data-formats.md) ### Interactive UI and Swagger Specification -After installing and starting the Rest client, you can try out the API using an interactive frontend powered by Swagger UI. The interactive documentation is located at: `http://:8080/swagger-ui.html` +After installing and starting the REST client, you can try out the API using an interactive frontend powered by Swagger UI. The interactive documentation is located at: `http://:8080/swagger-ui.html` The Swagger `.JSON` specification of the API is available at: `http://:8080/v2/api-docs` . -So if the Rest Client is running on localhost these URLs would be `http://localhost:8080/swagger-ui.html` and `http://localhost:8080/v2/api-docs`. \ No newline at end of file +So if the REST Client is running on localhost these URLs would be `http://localhost:8080/swagger-ui.html` and `http://localhost:8080/v2/api-docs`. diff --git a/build.gradle b/build.gradle index f4a0c72..ba2a28c 100644 --- a/build.gradle +++ b/build.gradle @@ -35,11 +35,10 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' group = 'com.aerospike' -version = '1.0.1' sourceCompatibility = 1.8 bootWar { - archiveName "as-rest-client##${version}.war" + archiveName "${warBaseName}##${appVersion}.war" } test { testLogging { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..9df04ef --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +appVersion=1.0.1 +warBaseName=as-rest-client diff --git a/src/main/java/com/aerospike/restclient/service/AerospikeOperateServiceV1.java b/src/main/java/com/aerospike/restclient/service/AerospikeOperateServiceV1.java index 4d4931a..47bb055 100644 --- a/src/main/java/com/aerospike/restclient/service/AerospikeOperateServiceV1.java +++ b/src/main/java/com/aerospike/restclient/service/AerospikeOperateServiceV1.java @@ -25,12 +25,14 @@ import com.aerospike.client.Key; import com.aerospike.client.Operation; +import com.aerospike.client.Record; import com.aerospike.client.policy.WritePolicy; import com.aerospike.restclient.domain.RestClientOperation; import com.aerospike.restclient.domain.RestClientRecord; import com.aerospike.restclient.handlers.OperateHandler; import com.aerospike.restclient.util.AerospikeAPIConstants.RecordKeyType; import com.aerospike.restclient.util.KeyBuilder; +import com.aerospike.restclient.util.RestClientErrors; import com.aerospike.restclient.util.converters.OperationsConverter; @Service @@ -49,8 +51,11 @@ public RestClientRecord operate(String namespace, String set, String key, List> opList = new ArrayList>(); + Map opMap = new HashMap(); + Map opValues = new HashMap(); + opMap.put(OPERATION_FIELD, AerospikeAPIConstants.OPERATION_GET); + opMap.put(OPERATION_VALUES_FIELD, opValues); + + opList.add(opMap); + String jsString = objectMapper.writeValueAsString(opList); + ASTestUtils.performOperationAndExpect(mockMVC, fakeEndpoint, jsString, status().isNotFound()); + } }