Skip to content

[DE-50] tests refactoring #425

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 50 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
68826a5
native-maven-plugin
rashtao Jan 28, 2022
5970d4a
fixed mounting docker data
rashtao Jan 31, 2022
0ddd849
replaced hamcrest with assertJ
rashtao Jan 31, 2022
c023ab4
migrated ArangoDBTest
rashtao Jan 31, 2022
b4ea6b8
Merge branch 'master' into test/native_tests
rashtao Mar 21, 2022
54be743
deps upd
rashtao Mar 21, 2022
925a922
ArangoDatabaseTest
rashtao Mar 21, 2022
0c0c694
fixed native ArangoDatabaseTest
rashtao Mar 22, 2022
5cd91e9
fixed ArangoDatabaseTest
rashtao Mar 22, 2022
3414be8
test utils refactoring
rashtao Mar 22, 2022
b19ac5a
ArangoCollectionTest
rashtao Mar 22, 2022
ce7606c
ArangoCollectionTest
rashtao Mar 22, 2022
10a04c1
fixed native ArangoCollectionTest
rashtao Mar 22, 2022
28de554
fixed native ArangoCollectionTest
rashtao Mar 22, 2022
297a30d
ArangoEdgeCollectionTest
rashtao Mar 22, 2022
b854b48
ArangoCursorTest
rashtao Mar 23, 2022
5df3e37
ArangoDocumentUtilTest
rashtao Mar 23, 2022
3b78ebc
ArangoGraphTest
rashtao Mar 23, 2022
f1413e1
ArangoRouteTest
rashtao Mar 23, 2022
594a885
ArangoSearchTest
rashtao Mar 23, 2022
39eeaaa
fixed ArangoSearch native deserialization
rashtao Mar 23, 2022
87fd125
ArangoSslTest
rashtao Mar 23, 2022
f5d0aa9
ArangoVertexCollectionTest
rashtao Mar 23, 2022
7483867
ArangoViewTest
rashtao Mar 23, 2022
01e8e0a
BaseDocumentTest
rashtao Mar 23, 2022
f095d19
ConcurrencyTests
rashtao Mar 23, 2022
5cdf902
fixed ConcurrencyTests
rashtao Mar 23, 2022
9b175f4
DocumentTest
rashtao Mar 23, 2022
4abb22d
JwtAuthTest
rashtao Mar 24, 2022
35095e8
StreamTransactionConflictsTest
rashtao Mar 24, 2022
456b504
StreamTransactionGraphTest
rashtao Mar 24, 2022
dd4b7ed
StreamTransactionTest
rashtao Mar 24, 2022
f9fb4e1
cleanup BaseTest.java
rashtao Mar 24, 2022
af52270
SslExampleTest
rashtao Mar 25, 2022
17e6c0d
examples
rashtao Mar 25, 2022
69f5977
internal tests
rashtao Mar 25, 2022
ac45a59
mapping
rashtao Mar 25, 2022
6e6002b
serde
rashtao Mar 25, 2022
47f0542
util
rashtao Mar 25, 2022
6efea3c
fixed native annotations tests
rashtao Mar 25, 2022
64397d8
fixed native vpack tests
rashtao Mar 25, 2022
2255c0c
async tests
rashtao Mar 29, 2022
089a83b
native async tests
rashtao Mar 29, 2022
4815364
fixed async tests
rashtao Mar 29, 2022
784b741
fixed async tests
rashtao Mar 30, 2022
2368c79
native tests CI
rashtao Mar 30, 2022
5de9eb9
native tests CI
rashtao Mar 30, 2022
3789b2c
native tests CI
rashtao Mar 30, 2022
d447c22
native tests CI
rashtao Mar 30, 2022
826960a
deps upd
rashtao Mar 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 2 additions & 40 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,18 @@ jobs:
with:
java-version: ${{matrix.java-version}}
distribution: 'adopt'
cache: maven
- name: Start Database
run: ./docker/start_db.sh
env:
ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }}
STARTER_MODE: ${{matrix.topology}}
DOCKER_IMAGE: ${{matrix.docker-img}}
DATABASE_EXTENDED_NAMES: ${{matrix.db-ext-names}}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Info
run: mvn -version
- name: Test
run: mvn --no-transfer-progress test -DargLine="-Duser.language=${{matrix.user-language}}"
- name: Collect docker logs on failure
if: ${{ cancelled() || failure() }}
uses: jwalton/gh-docker-logs@v1
with:
dest: './logs'
- name: Tar logs
if: ${{ cancelled() || failure() }}
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: ${{ cancelled() || failure() }}
uses: actions/upload-artifact@master
with:
name: logs-${{github.job}}.tgz
path: ./logs.tgz

# test encodeURIComponent() and normalize('NFC') comparing to Javascript behavior
test-graalvm:
Expand Down Expand Up @@ -128,19 +109,14 @@ jobs:
with:
java-version: ${{matrix.java-version}}
distribution: 'adopt'
cache: maven
- name: Start Database
run: ./docker/start_db.sh
env:
ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }}
STARTER_MODE: ${{matrix.topology}}
DOCKER_IMAGE: ${{matrix.docker-img}}
DATABASE_EXTENDED_NAMES: ${{matrix.db-ext-names}}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set JWT
run: |
ENDPOINT=$(./docker/find_active_endpoint.sh)
Expand All @@ -152,17 +128,3 @@ jobs:
run: mvn -version
- name: Test
run: mvn --no-transfer-progress test -DargLine="-Duser.language=${{matrix.user-language}}"
- name: Collect docker logs on failure
if: ${{ cancelled() || failure() }}
uses: jwalton/gh-docker-logs@v1
with:
dest: './logs'
- name: Tar logs
if: ${{ cancelled() || failure() }}
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: ${{ cancelled() || failure() }}
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz
43 changes: 43 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Native Tests

on:
workflow_dispatch:
push:
tags: [ v** ]

jobs:
test-native:
timeout-minutes: 20
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
docker-img:
- docker.io/arangodb/enterprise:3.9.0
topology:
- cluster
db-ext-names:
- false
java-version:
- 11

steps:
- uses: actions/checkout@v2
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{matrix.java-version}}
github-token: ${{ secrets.GITHUB_TOKEN }}
components: 'native-image'
- name: Start Database
run: ./docker/start_db.sh
env:
ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }}
STARTER_MODE: ${{matrix.topology}}
DOCKER_IMAGE: ${{matrix.docker-img}}
DATABASE_EXTENDED_NAMES: ${{matrix.db-ext-names}}
- name: Info
run: mvn -version
- name: Test Native
run: mvn -Pnative --no-transfer-progress test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/docker/jwtSecret

/docker/data
/test-results-native/
13 changes: 13 additions & 0 deletions dev-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
## native image reflection configuration

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


## test native

```shell
mvn -Pnative test
```

## test ssl

```shell
mvn test -Dtest=com.arangodb.ArangoSslTest -DSslTest=true
```
52 changes: 41 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,40 @@
<doclint>none</doclint>
</properties>
</profile>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.11</version>
<extensions>true</extensions>
<executions>
<execution>
<id>test-native</id>
<goals>
<goal>generateTestResourceConfig</goal>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<skip>false</skip>
<buildArgs>
<buildArg>--no-fallback</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
Expand Down Expand Up @@ -145,7 +179,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*Test.java</include>
Expand Down Expand Up @@ -214,13 +248,14 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.22.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -232,7 +267,7 @@
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>21.2.0</version>
<version>22.0.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -286,11 +321,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/arangodb/entity/EdgeDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public EdgeDefinition satellites(final String... satellites) {
return this;
}

private static class Options {
public static class Options {
private Collection<String> satellites;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package com.arangodb.entity.arangosearch;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

Expand All @@ -30,7 +32,7 @@
@Deprecated
public class AnalyzerEntity {

private Set<AnalyzerFeature> features;
private Collection<AnalyzerFeature> features;
private AnalyzerType type;
private String name;
private Map<String, Object> properties;
Expand All @@ -39,7 +41,7 @@ public AnalyzerEntity() {
}

public Set<AnalyzerFeature> getFeatures() {
return features;
return features != null ? new HashSet<>(features) : null;
}

public void setFeatures(Set<AnalyzerFeature> features) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
*/
public class ConsolidationPolicy {

private final ConsolidationType type;
private ConsolidationType type;
private Double threshold;
private Long segmentThreshold;

private ConsolidationPolicy(final ConsolidationType type) {
super();
this.type = type;
public ConsolidationPolicy() {
}

public static ConsolidationPolicy of(final ConsolidationType type) {
return new ConsolidationPolicy(type);
return new ConsolidationPolicy().type(type);
}

public ConsolidationPolicy type(final ConsolidationType type) {
this.type = type;
return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.arangodb.entity.arangosearch.AnalyzerFeature;
import com.arangodb.entity.arangosearch.AnalyzerType;

import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

Expand All @@ -34,7 +36,7 @@
public abstract class SearchAnalyzer implements Entity {
private String name;
private AnalyzerType type;
private Set<AnalyzerFeature> features;
private Collection<AnalyzerFeature> features;

/**
* @return The Analyzer name.
Expand Down Expand Up @@ -62,7 +64,7 @@ public void setType(AnalyzerType type) {
* @return The set of features to set on the Analyzer generated fields.
*/
public Set<AnalyzerFeature> getFeatures() {
return features;
return features != null ? new HashSet<>(features) : null;
}

public void setFeatures(Set<AnalyzerFeature> features) {
Expand All @@ -73,10 +75,10 @@ public void setFeatures(Set<AnalyzerFeature> features) {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SearchAnalyzer analyzer = (SearchAnalyzer) o;
return Objects.equals(name, analyzer.name) &&
type == analyzer.type &&
Objects.equals(features, analyzer.features);
SearchAnalyzer that = (SearchAnalyzer) o;
return Objects.equals(getName(), that.getName())
&& getType() == that.getType()
&& Objects.equals(getFeatures(), that.getFeatures());
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/model/AqlQueryExplainOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private Options getOptions() {
return options;
}

private static class Options {
public static class Options {
private Optimizer optimizer;
private Integer maxNumberOfPlans;
private Boolean allPlans;
Expand All @@ -127,7 +127,7 @@ protected Optimizer getOptimizer() {
}
}

private static class Optimizer {
public static class Optimizer {
private Collection<String> rules;
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/arangodb/model/AqlQueryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private Options getOptions() {
return options;
}

private static class Options implements Serializable {
public static class Options implements Serializable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -446,7 +446,7 @@ protected Collection<String> getShardIds() {

}

private static class Optimizer {
public static class Optimizer {
private Collection<String> rules;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public VertexCollectionCreateOptions satellites(final String... satellites) {
return this;
}

private static class Options {
public static class Options {
private Collection<String> satellites;
}

Expand Down
Loading