Skip to content

[DE-485] Documentation v7 #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 17, 2023
Merged
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ Any usage of the current Java driver API related to it is therefore discouraged.
- added `ArangoDBVersion#getLicense()`
- added `ArangoDB#getRole()`
- added `ArangoDBException#getException()`
- added protocol switch (`ArangoDB.Builder#useProtocol(Protocol)`)
- added protocol switch (`ArangoDB.Builder#protocol(Protocol)`)
- `Protocol#VST` = VeclocyStream (default)
- `Protocol#HTTP_JSON` = JSON over HTTP
- `Protocol#HTTP_VPACK` = VelocyPack over HTTP
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ The official [ArangoDB](https://www.arangodb.com/) Java Driver.
- [Examples](driver/src/test/java/com/arangodb/example)
- [Tutorial](https://www.arangodb.com/docs/stable/drivers/java-tutorial.html)
- [Documentation](https://www.arangodb.com/docs/stable/drivers/java.html)
- [JavaDoc](http://arangodb.github.io/arangodb-java-driver/)
- [JavaDoc](https://www.javadoc.io/doc/com.arangodb/arangodb-java-driver/latest/index.html)
2 changes: 1 addition & 1 deletion core/src/main/java/com/arangodb/ArangoDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public interface ArangoDB extends ArangoSerdeAccessor {
*/
class Builder extends InternalArangoDBBuilder<Builder> {

public Builder useProtocol(final Protocol protocol) {
public Builder protocol(final Protocol protocol) {
config.setProtocol(protocol);
return this;
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/com/arangodb/entity/ReplicationFactor.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ static SatelliteReplicationFactor ofSatellite() {
}

@JsonValue
Object getValue();
Object get();

enum SatelliteReplicationFactor implements ReplicationFactor {
INSTANCE;

@Override
public String getValue() {
public String get() {
return "satellite";
}
}
Expand All @@ -53,7 +53,7 @@ public NumericReplicationFactor(Integer value) {
}

@Override
public Integer getValue() {
public Integer get() {
return value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ public T verifyHost(final Boolean verifyHost) {
/**
* Sets the chunk size when {@link Protocol#VST} is used.
*
* @param chunksize size of a chunk in bytes
* @param chunkSize size of a chunk in bytes
* @return {@link ArangoDB.Builder}
*/
@SuppressWarnings("unchecked")
public T chunksize(final Integer chunksize) {
config.setChunkSize(chunksize);
public T chunkSize(final Integer chunkSize) {
config.setChunkSize(chunkSize);
return (T) this;
}

Expand Down Expand Up @@ -211,15 +211,15 @@ public T keepAliveInterval(final Integer keepAliveInterval) {
}

/**
* Whether or not the driver should acquire a list of available coordinators in an ArangoDB cluster or a single
* Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single
* server with active failover. In case of Active-Failover deployment set to {@code true} to enable automatic
* master discovery.
*
* <p>
* The host list will be used for failover and load balancing.
* </p>
*
* @param acquireHostList whether or not automatically acquire a list of available hosts (default: false)
* @param acquireHostList whether automatically acquire a list of available hosts (default: false)
* @return {@link ArangoDB.Builder}
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public final class InternalSerializers {
static final JsonSerializer<RawJson> RAW_JSON_SERIALIZER = new JsonSerializer<RawJson>() {
@Override
public void serialize(RawJson value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeTree(SerdeUtils.INSTANCE.parseJson(value.getValue()));
gen.writeTree(SerdeUtils.INSTANCE.parseJson(value.get()));
}
};
static final JsonSerializer<RawBytes> RAW_BYTES_SERIALIZER = new JsonSerializer<RawBytes>() {
@Override
public void serialize(RawBytes value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// TODO: find a way to append raw bytes directly
// see https://github.com/FasterXML/jackson-dataformats-binary/issues/331
try (JsonParser parser = gen.getCodec().getFactory().createParser(value.getValue())) {
try (JsonParser parser = gen.getCodec().getFactory().createParser(value.get())) {
gen.writeTree(parser.readValueAsTree());
}
}
Expand Down
9 changes: 5 additions & 4 deletions core/src/main/java/com/arangodb/util/RawBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
* {@code RawBytes}.
*/
public final class RawBytes implements RawData {
public final class RawBytes implements RawData<byte[]> {
private final byte[] value;

private RawBytes(final byte[] value) {
Expand All @@ -30,7 +30,8 @@ public static RawBytes of(final byte[] value) {
return new RawBytes(value);
}

public byte[] getValue() {
@Override
public byte[] get() {
return value;
}

Expand All @@ -39,11 +40,11 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RawBytes rawBytes = (RawBytes) o;
return Arrays.equals(getValue(), rawBytes.getValue());
return Arrays.equals(get(), rawBytes.get());
}

@Override
public int hashCode() {
return Arrays.hashCode(getValue());
return Arrays.hashCode(get());
}
}
3 changes: 2 additions & 1 deletion core/src/main/java/com/arangodb/util/RawData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* - {@link RawBytes}
* - {@link RawJson}
*/
public interface RawData {
public interface RawData<T> {
static RawJson of(final String value) {
return RawJson.of(value);
}
Expand All @@ -14,4 +14,5 @@ static RawBytes of(final byte[] value) {
return RawBytes.of(value);
}

T get();
}
9 changes: 5 additions & 4 deletions core/src/main/java/com/arangodb/util/RawJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
* {@code RawJson}.
*/
public final class RawJson implements RawData {
public final class RawJson implements RawData<String> {
private final String value;

private RawJson(final String value) {
Expand All @@ -24,7 +24,8 @@ public static RawJson of(final String value) {
return new RawJson(value);
}

public String getValue() {
@Override
public String get() {
return value;
}

Expand All @@ -33,11 +34,11 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RawJson rawJson = (RawJson) o;
return Objects.equals(getValue(), rawJson.getValue());
return Objects.equals(get(), rawJson.get());
}

@Override
public int hashCode() {
return Objects.hash(getValue());
return Objects.hash(get());
}
}
93 changes: 93 additions & 0 deletions dev-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# dev-README


## Start DB
Single:
```
./docker/start_db.sh
```
Cluster:
```
STARTER_MODE=cluster ./docker/start_db.sh
```
Active Failover:
```
STARTER_MODE=activefailover ./docker/start_db.sh
```


## GH Actions
Check results [here](https://github.com/arangodb/arangodb-java-driver/actions).


## SonarCloud
Check results [here](https://sonarcloud.io/project/overview?id=arangodb_arangodb-java-driver).


## check dependencies updates
```shell
mvn versions:display-dependency-updates
mvn versions:display-plugin-updates
```


## Code Analysis
Analyze (Spotbugs and JaCoCo):
```
mvn prepare-package -Pstatic-code-analysis
```
Report: [link](driver/target/site/jacoco/index.html)


## update native image reflection configuration

To generate reflection configuration run [NativeImageHelper](./driver/src/test/java/helper/NativeImageHelper.java) and
copy the generated json to
[reflect-config.json](./driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/reflect-config.json).


## test
```shell
mvn test
```


## test native
```shell
mvn --no-transfer-progress install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
cd driver
mvn -Pnative test
```


## test native shaded
```shell
mvn --no-transfer-progress install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
cd integration-tests
mvn -Pnative test
```


## test ssl
```shell
mvn test -Dsurefire.failIfNoSpecifiedTests=false -Dtest=com.arangodb.ArangoSslTest -DSslTest=true
```


## integration tests
```shell
mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
cd integration-tests
mvn -Pinternal-serde test
mvn -Pjackson-serde test
mvn -Pjsonb-serde test
mvn -Pplain test
```


## resilience tests
```shell
mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
cd resilience-tests
mvn test
```
Loading