Skip to content

Commit f1d59e4

Browse files
authored
[DE-485] Documentation v7 (#488)
* upd javadoc link * v7_java.md * dev-README.md * v7_java-reference-serialization.md * v7_detailed_changes.md * v7_detailed_changes.md * upd tutorial * configuration properties * changed protocol configuration method name in ArangoDB.Builder * v7_java-reference-setup.md * serde annotations * v7_detailed_changes.md * fluent JacksonSerde configure * generic RawData * renamed ReplicationFactor.getValue() to get()
1 parent baad63c commit f1d59e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+724
-247
lines changed

ChangeLog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ Any usage of the current Java driver API related to it is therefore discouraged.
761761
- added `ArangoDBVersion#getLicense()`
762762
- added `ArangoDB#getRole()`
763763
- added `ArangoDBException#getException()`
764-
- added protocol switch (`ArangoDB.Builder#useProtocol(Protocol)`)
764+
- added protocol switch (`ArangoDB.Builder#protocol(Protocol)`)
765765
- `Protocol#VST` = VeclocyStream (default)
766766
- `Protocol#HTTP_JSON` = JSON over HTTP
767767
- `Protocol#HTTP_VPACK` = VelocyPack over HTTP

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ The official [ArangoDB](https://www.arangodb.com/) Java Driver.
1313
- [Examples](driver/src/test/java/com/arangodb/example)
1414
- [Tutorial](https://www.arangodb.com/docs/stable/drivers/java-tutorial.html)
1515
- [Documentation](https://www.arangodb.com/docs/stable/drivers/java.html)
16-
- [JavaDoc](http://arangodb.github.io/arangodb-java-driver/)
16+
- [JavaDoc](https://www.javadoc.io/doc/com.arangodb/arangodb-java-driver/latest/index.html)

core/src/main/java/com/arangodb/ArangoDB.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public interface ArangoDB extends ArangoSerdeAccessor {
320320
*/
321321
class Builder extends InternalArangoDBBuilder<Builder> {
322322

323-
public Builder useProtocol(final Protocol protocol) {
323+
public Builder protocol(final Protocol protocol) {
324324
config.setProtocol(protocol);
325325
return this;
326326
}

core/src/main/java/com/arangodb/entity/ReplicationFactor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ static SatelliteReplicationFactor ofSatellite() {
3333
}
3434

3535
@JsonValue
36-
Object getValue();
36+
Object get();
3737

3838
enum SatelliteReplicationFactor implements ReplicationFactor {
3939
INSTANCE;
4040

4141
@Override
42-
public String getValue() {
42+
public String get() {
4343
return "satellite";
4444
}
4545
}
@@ -53,7 +53,7 @@ public NumericReplicationFactor(Integer value) {
5353
}
5454

5555
@Override
56-
public Integer getValue() {
56+
public Integer get() {
5757
return value;
5858
}
5959
}

core/src/main/java/com/arangodb/internal/InternalArangoDBBuilder.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ public T verifyHost(final Boolean verifyHost) {
153153
/**
154154
* Sets the chunk size when {@link Protocol#VST} is used.
155155
*
156-
* @param chunksize size of a chunk in bytes
156+
* @param chunkSize size of a chunk in bytes
157157
* @return {@link ArangoDB.Builder}
158158
*/
159159
@SuppressWarnings("unchecked")
160-
public T chunksize(final Integer chunksize) {
161-
config.setChunkSize(chunksize);
160+
public T chunkSize(final Integer chunkSize) {
161+
config.setChunkSize(chunkSize);
162162
return (T) this;
163163
}
164164

@@ -211,15 +211,15 @@ public T keepAliveInterval(final Integer keepAliveInterval) {
211211
}
212212

213213
/**
214-
* Whether or not the driver should acquire a list of available coordinators in an ArangoDB cluster or a single
214+
* Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single
215215
* server with active failover. In case of Active-Failover deployment set to {@code true} to enable automatic
216216
* master discovery.
217217
*
218218
* <p>
219219
* The host list will be used for failover and load balancing.
220220
* </p>
221221
*
222-
* @param acquireHostList whether or not automatically acquire a list of available hosts (default: false)
222+
* @param acquireHostList whether automatically acquire a list of available hosts (default: false)
223223
* @return {@link ArangoDB.Builder}
224224
*/
225225
@SuppressWarnings("unchecked")

core/src/main/java/com/arangodb/internal/serde/InternalSerializers.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public final class InternalSerializers {
2323
static final JsonSerializer<RawJson> RAW_JSON_SERIALIZER = new JsonSerializer<RawJson>() {
2424
@Override
2525
public void serialize(RawJson value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
26-
gen.writeTree(SerdeUtils.INSTANCE.parseJson(value.getValue()));
26+
gen.writeTree(SerdeUtils.INSTANCE.parseJson(value.get()));
2727
}
2828
};
2929
static final JsonSerializer<RawBytes> RAW_BYTES_SERIALIZER = new JsonSerializer<RawBytes>() {
3030
@Override
3131
public void serialize(RawBytes value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
3232
// TODO: find a way to append raw bytes directly
3333
// see https://github.com/FasterXML/jackson-dataformats-binary/issues/331
34-
try (JsonParser parser = gen.getCodec().getFactory().createParser(value.getValue())) {
34+
try (JsonParser parser = gen.getCodec().getFactory().createParser(value.get())) {
3535
gen.writeTree(parser.readValueAsTree());
3636
}
3737
}

core/src/main/java/com/arangodb/util/RawBytes.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
2020
* {@code RawBytes}.
2121
*/
22-
public final class RawBytes implements RawData {
22+
public final class RawBytes implements RawData<byte[]> {
2323
private final byte[] value;
2424

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

33-
public byte[] getValue() {
33+
@Override
34+
public byte[] get() {
3435
return value;
3536
}
3637

@@ -39,11 +40,11 @@ public boolean equals(Object o) {
3940
if (this == o) return true;
4041
if (o == null || getClass() != o.getClass()) return false;
4142
RawBytes rawBytes = (RawBytes) o;
42-
return Arrays.equals(getValue(), rawBytes.getValue());
43+
return Arrays.equals(get(), rawBytes.get());
4344
}
4445

4546
@Override
4647
public int hashCode() {
47-
return Arrays.hashCode(getValue());
48+
return Arrays.hashCode(get());
4849
}
4950
}

core/src/main/java/com/arangodb/util/RawData.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* - {@link RawBytes}
66
* - {@link RawJson}
77
*/
8-
public interface RawData {
8+
public interface RawData<T> {
99
static RawJson of(final String value) {
1010
return RawJson.of(value);
1111
}
@@ -14,4 +14,5 @@ static RawBytes of(final byte[] value) {
1414
return RawBytes.of(value);
1515
}
1616

17+
T get();
1718
}

core/src/main/java/com/arangodb/util/RawJson.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
1414
* {@code RawJson}.
1515
*/
16-
public final class RawJson implements RawData {
16+
public final class RawJson implements RawData<String> {
1717
private final String value;
1818

1919
private RawJson(final String value) {
@@ -24,7 +24,8 @@ public static RawJson of(final String value) {
2424
return new RawJson(value);
2525
}
2626

27-
public String getValue() {
27+
@Override
28+
public String get() {
2829
return value;
2930
}
3031

@@ -33,11 +34,11 @@ public boolean equals(Object o) {
3334
if (this == o) return true;
3435
if (o == null || getClass() != o.getClass()) return false;
3536
RawJson rawJson = (RawJson) o;
36-
return Objects.equals(getValue(), rawJson.getValue());
37+
return Objects.equals(get(), rawJson.get());
3738
}
3839

3940
@Override
4041
public int hashCode() {
41-
return Objects.hash(getValue());
42+
return Objects.hash(get());
4243
}
4344
}

dev-README.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# dev-README
2+
3+
4+
## Start DB
5+
Single:
6+
```
7+
./docker/start_db.sh
8+
```
9+
Cluster:
10+
```
11+
STARTER_MODE=cluster ./docker/start_db.sh
12+
```
13+
Active Failover:
14+
```
15+
STARTER_MODE=activefailover ./docker/start_db.sh
16+
```
17+
18+
19+
## GH Actions
20+
Check results [here](https://github.com/arangodb/arangodb-java-driver/actions).
21+
22+
23+
## SonarCloud
24+
Check results [here](https://sonarcloud.io/project/overview?id=arangodb_arangodb-java-driver).
25+
26+
27+
## check dependencies updates
28+
```shell
29+
mvn versions:display-dependency-updates
30+
mvn versions:display-plugin-updates
31+
```
32+
33+
34+
## Code Analysis
35+
Analyze (Spotbugs and JaCoCo):
36+
```
37+
mvn prepare-package -Pstatic-code-analysis
38+
```
39+
Report: [link](driver/target/site/jacoco/index.html)
40+
41+
42+
## update native image reflection configuration
43+
44+
To generate reflection configuration run [NativeImageHelper](./driver/src/test/java/helper/NativeImageHelper.java) and
45+
copy the generated json to
46+
[reflect-config.json](./driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/reflect-config.json).
47+
48+
49+
## test
50+
```shell
51+
mvn test
52+
```
53+
54+
55+
## test native
56+
```shell
57+
mvn --no-transfer-progress install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
58+
cd driver
59+
mvn -Pnative test
60+
```
61+
62+
63+
## test native shaded
64+
```shell
65+
mvn --no-transfer-progress install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
66+
cd integration-tests
67+
mvn -Pnative test
68+
```
69+
70+
71+
## test ssl
72+
```shell
73+
mvn test -Dsurefire.failIfNoSpecifiedTests=false -Dtest=com.arangodb.ArangoSslTest -DSslTest=true
74+
```
75+
76+
77+
## integration tests
78+
```shell
79+
mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
80+
cd integration-tests
81+
mvn -Pinternal-serde test
82+
mvn -Pjackson-serde test
83+
mvn -Pjsonb-serde test
84+
mvn -Pplain test
85+
```
86+
87+
88+
## resilience tests
89+
```shell
90+
mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
91+
cd resilience-tests
92+
mvn test
93+
```

0 commit comments

Comments
 (0)