Skip to content

Commit

Permalink
Merge pull request #13 from GoodforGod/dev
Browse files Browse the repository at this point in the history
[2.3.0]
  • Loading branch information
GoodforGod authored Aug 16, 2021
2 parents b35ffdc + bcd1dee commit 956a9d5
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
java-version: ${{ matrix.java }}

- name: Build
run: ./gradlew classes
run: ./gradlew classes spotlessJavaCheck

- name: Test
run: ./gradlew test jacocoTestReport
Expand Down
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ This project includes integration between Micronaut and ArangoDB.

## Dependency :rocket:

Starting from version *2.0.0* library ships for *Micronaut 2*.

Starting from version *2.1.0* Java 11+ is required (previous version 1.8+ compatible).

Last release for **Micronaut 1** is [version *1.2.1*](https://github.com/GoodforGod/micronaut-arangodb/releases/tag/v1.2.1).

**Gradle**
```groovy
dependencies {
compile 'com.github.goodforgod:micronaut-arangodb:2.2.1'
compile 'com.github.goodforgod:micronaut-arangodb:2.3.0'
}
```

Expand All @@ -27,7 +21,7 @@ dependencies {
<dependency>
<groupId>com.github.goodforgod</groupId>
<artifactId>micronaut-arangodb</artifactId>
<version>2.2.1</version>
<version>2.3.0</version>
</dependency>
```

Expand Down Expand Up @@ -220,7 +214,9 @@ You can explicitly *turn off* health check.
```yaml
arangodb:
health:
enabled: false # default - true
enabled: false # default - true
timeout-in-millis: 5000 # default - 5000
retry: 2 # default - 2
```
#### Cluster Health Check
Expand Down Expand Up @@ -290,7 +286,9 @@ You can turn on Cluster Health Check via configuration:
```yaml
arangodb:
health-cluster:
enabled: true # default - false
enabled: true # default - false
timeout-in-millis: 5000 # default - 5000
retry: 2 # default - 2
```
## Testing
Expand All @@ -301,6 +299,14 @@ For testing purposes it is recommended to use [ArangoDB TestContainer library](h
TestContainers allows you to use integration tests against real database in all docker friendly environments,
check here for [TestContainers](https://www.testcontainers.org/).
## Micronaut Compatability
Starting from version *2.0.0* library ships for *Micronaut 2*.
Starting from version *2.1.0* Java 11+ is required (previous version 1.8+ compatible).
Last release for **Micronaut 1** is [version *1.2.1*](https://github.com/GoodforGod/micronaut-arangodb/releases/tag/v1.2.1).
## License
This project licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
100 changes: 50 additions & 50 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'jacoco'
id 'maven-publish'
id "jacoco"
id "maven-publish"

id 'io.micronaut.library' version '2.0.3'
id 'org.sonarqube' version '3.3'
id 'com.diffplug.spotless' version '5.11.0'
id "io.micronaut.library" version "2.0.3"
id "org.sonarqube" version "3.3"
id "com.diffplug.spotless" version "5.11.0"
}

repositories {
Expand All @@ -20,57 +20,62 @@ targetCompatibility = 11

spotless {
java {
encoding 'UTF-8'
encoding "UTF-8"
removeUnusedImports()
eclipse().configFile "${projectDir}/config/codestyle.xml"
}
}

sonarqube {
properties {
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.organization', 'goodforgod'
property 'sonar.projectKey', 'GoodforGod_micronaut-arangodb'
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "goodforgod"
property "sonar.projectKey", "GoodforGod_micronaut-arangodb"
}
}

micronaut {
version '2.5.11'
version("2.5.12")
processing {
incremental true
module project.name
group project.group
annotations 'io.micronaut.configuration.arango.*'
incremental(true)
module(project.name)
group(project.group)
annotations("io.micronaut.configuration.arango.*")
}
}

dependencies {
annotationProcessor 'io.micronaut:micronaut-inject-java'
compileOnly 'io.micronaut:micronaut-inject-java'
annotationProcessor "io.micronaut:micronaut-inject-java"
compileOnly "io.micronaut:micronaut-inject-java"

api 'com.arangodb:arangodb-java-driver:6.12.3'
api "com.arangodb:arangodb-java-driver:6.12.3"

implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'io.micronaut:micronaut-management'
implementation "org.apache.httpcomponents:httpclient:4.5.13"
implementation "io.micronaut:micronaut-management"

testAnnotationProcessor 'io.micronaut:micronaut-inject-java'
testAnnotationProcessor "io.micronaut:micronaut-inject-java"

testRuntimeOnly 'ch.qos.logback:logback-classic:1.2.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly "ch.qos.logback:logback-classic:1.2.3"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"

testImplementation 'org.testcontainers:junit-jupiter:1.15.3'
testImplementation 'com.github.goodforgod:arangodb-testcontainer:1.3.0'
testImplementation "org.testcontainers:junit-jupiter:1.15.3"
testImplementation "com.github.goodforgod:arangodb-testcontainer:1.3.0"

testImplementation 'io.micronaut.test:micronaut-test-core'
testImplementation 'io.micronaut.test:micronaut-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation "io.micronaut.test:micronaut-test-core"
testImplementation "io.micronaut.test:micronaut-test-junit5"
testImplementation "org.junit.jupiter:junit-jupiter-api"
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
events("passed", "skipped", "failed")
exceptionFormat("full")
}

reports {
html.enabled(false)
junitXml.enabled(false)
}
}

Expand All @@ -80,11 +85,6 @@ tasks.withType(JavaCompile) {
options.fork = true
}

tasks.withType(Test) {
reports.html.enabled = false
reports.junitXml.enabled = false
}

java {
withJavadocJar()
withSourcesJar()
Expand All @@ -96,27 +96,27 @@ publishing {
from components.java

pom {
name = 'Micronaut ArangoDB Configuration'
url = 'https://github.com/GoodforGod/micronaut-arangodb'
description = 'This is integration between Micronaut and ArangoDB.'
name = "Micronaut ArangoDB Configuration"
url = "https://github.com/GoodforGod/micronaut-arangodb"
description = "This is integration between Micronaut and ArangoDB."

license {
name = 'Apache License 2.0'
url = 'https://github.com/GoodforGod/micronaut-arangodb/blob/master/LICENSE'
distribution = 'repo'
name = "Apache License 2.0"
url = "https://github.com/GoodforGod/micronaut-arangodb/blob/master/LICENSE"
distribution = "repo"
}

developer {
id = 'GoodforGod'
name = 'Anton Kurako'
email = 'goodforgod.dev@gmail.com'
url = 'https://github.com/GoodforGod'
id = "GoodforGod"
name = "Anton Kurako"
email = "goodforgod.dev@gmail.com"
url = "https://github.com/GoodforGod"
}

scm {
connection = 'scm:git:git://github.com/GoodforGod/micronaut-arangodb.git'
developerConnection = 'scm:git:ssh://GoodforGod/micronaut-arangodb.git'
url = 'https://github.com/GoodforGod/micronaut-arangodb/tree/master'
connection = "scm:git:git://github.com/GoodforGod/micronaut-arangodb.git"
developerConnection = "scm:git:ssh://GoodforGod/micronaut-arangodb.git"
url = "https://github.com/GoodforGod/micronaut-arangodb/tree/master"
}
}
}
Expand All @@ -126,7 +126,7 @@ publishing {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("OSS_USERNAME")
password System.getenv("OSS_PASSWORD")
Expand All @@ -144,7 +144,7 @@ jacocoTestReport {
}

if (project.hasProperty("signing.keyId")) {
apply plugin: 'signing'
apply plugin: "signing"
signing {
sign publishing.publications.mavenJava
}
Expand All @@ -153,6 +153,6 @@ if (project.hasProperty("signing.keyId")) {
javadoc {
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
options.addBooleanOption("html5", true)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
groupId=com.github.goodforgod
artifactId=micronaut-arangodb
artifactVersion=2.2.1
artifactVersion=2.3.0


##### GRADLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.arangodb.entity.LoadBalancingStrategy;
import com.arangodb.internal.ArangoDefaults;
import io.micronaut.configuration.arango.ssl.ArangoSSLConfiguration;
import io.micronaut.context.annotation.ConfigurationBuilder;
import io.micronaut.context.exceptions.ConfigurationException;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.core.util.StringUtils;
Expand All @@ -25,11 +24,6 @@
*/
public abstract class AbstractArangoConfiguration {

@ConfigurationBuilder("health")
protected EnableConfiguration health = new EnableConfiguration(true);
@ConfigurationBuilder("health-cluster")
protected EnableConfiguration healthCluster = new EnableConfiguration(false);

protected final ArangoSSLConfiguration sslConfiguration;

private String user = ArangoDefaults.DEFAULT_USER;
Expand All @@ -51,7 +45,7 @@ public abstract class AbstractArangoConfiguration {
private boolean createDatabaseAsync = false;
private int createDatabaseTimeoutInMillis = 10000;

public AbstractArangoConfiguration(ArangoSSLConfiguration sslConfiguration) {
protected AbstractArangoConfiguration(ArangoSSLConfiguration sslConfiguration) {
this.sslConfiguration = sslConfiguration;
}

Expand Down Expand Up @@ -309,32 +303,12 @@ public void setLoadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy
this.loadBalancingStrategy = loadBalancingStrategy;
}

/**
* @return health indicator configuration
*/
public EnableConfiguration getHealth() {
return health;
}

/**
* @return cluster health indicator configuration
*/
public EnableConfiguration getHealthCluster() {
return healthCluster;
}

public ArangoSSLConfiguration getSslConfiguration() {
return sslConfiguration;
}

@Override
public String toString() {
return "AbstractArangoConfiguration{" +
"user='" + user + '\'' +
", host='" + host + '\'' +
", port=" + port +
", database='" + database + '\'' +
", createDatabaseIfNotExist=" + createDatabaseIfNotExist +
'}';
return getProperties().toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package io.micronaut.configuration.arango.health;

import io.micronaut.context.exceptions.ConfigurationException;

/**
* @author Anton Kurako (GoodforGod)
* @since 13.08.2021
*/
public abstract class AbstractHealthConfiguration {

private boolean enabled = true;
private long timeoutInMillis = 5000;
private int retry = 2;

public boolean isEnabled() {
return enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public long getTimeoutInMillis() {
return timeoutInMillis;
}

public void setTimeoutInMillis(long timeoutInMillis) {
if (timeoutInMillis < 0)
throw new ConfigurationException("Timeout for health can not be less than 0");
this.timeoutInMillis = timeoutInMillis;
}

public int getRetry() {
return retry;
}

public void setRetry(int retry) {
if (retry < 1)
throw new ConfigurationException("Retry for health can not be less than 1");
this.retry = retry;
}

@Override
public String toString() {
return "[enabled=" + enabled +
", timeoutInMillis=" + timeoutInMillis +
", retry=" + retry + ']';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.micronaut.configuration.arango.health;

import io.micronaut.configuration.arango.ArangoSettings;
import io.micronaut.context.annotation.ConfigurationProperties;
import io.micronaut.context.annotation.Requires;

/**
* @author Anton Kurako (GoodforGod)
* @since 13.08.2021
*/
@Requires(property = ArangoSettings.PREFIX)
@ConfigurationProperties(ArangoSettings.PREFIX + ".health-cluster")
public class ArangoClusterHealthConfiguration extends AbstractHealthConfiguration {

}
Loading

0 comments on commit 956a9d5

Please sign in to comment.