Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/projectnessie/nessie-apprunner


https://github.com/projectnessie/nessie-apprunner

gradle java maven nessie test

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# Nessie Apprunner plugins for Maven and Gradle

[![Build Status](https://github.com/projectnessie/nessie-apprunner/actions/workflows/ci.yml/badge.svg)](https://github.com/projectnessie/nessie-apprunner/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/org.projectnessie.nessie-runner/nessie-runner-maven-plugin)](https://search.maven.org/artifact/org.projectnessie.nessie-runner/nessie-runner-maven-plugin)

See https://github.com/projectnessie/nessie

See https://projectnessie.org

## Usage

The _Nessie Apprunner plugins_ are available for [Maven](#maven) and [Gradle](#Gradle). A
rudimentary integration test is shown below.

### Java integration tests

```java
import org.projectnessie.client.api.NessieApiV2;
import org.projectnessie.client.http.HttpClientBuilder;
import org.projectnessie.model.Branch;

public class ITWorksWithNessie {
static URI NESSIE_SERVER_URI =
String.format(
"%s/api/v2",
requireNonNull(
System.getProperty("quarkus.http.test-url"),
"Required system property quarkus.http.test-url is not set"));

static NessieApiV2 nessieApi;

@BeforeAll
static void setupNessieClient() {
nessieApi = HttpClientBuilder.builder()
.fromSystemProperties()
.withUri(NESSIE_SERVER_URI)
.build(NessieApiV2.class);
}

@AfterAll
static void closeNessieClient() {
nessieApiV1.close();
}

@Test
public void pingNessie() {
Branch defaultBranch = nessieApiV1.getDefaultBranch();
// do some more stuff
}
}
```

### Gradle

#### Kotlin DSL

`build.gradle.kts`
```kotlin
plugins {
java
id("org.projectnessie") version "0.29.0"
}

dependencies {
// your dependencies

// specify the GAV of the Nessie Quarkus server runnable (uber-jar)
nessieQuarkusServer("org.projectnessie:nessie-quarkus:0.49.0:runner")
}

nessieQuarkusApp {
// Ensure that the `test` task has a Nessie Server available.
includeTask(tasks.named("test"))
// Note: prefer setting up separate `integrationTest` tasks, see https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html

// These system properties will be available in your integration tests and will contain the
// port and full URL of the Nessie Quarkus server's HTTP server.
// httpListenPortProperty.set("quarkus.http.port") // quarkus.http.port is the default
// httpListenUrlProperty.set("quarkus.http.test-url") // quarkus.http.test-url is the default
}
```

#### Groovy DSL

`build.gradle`
```groovy
plugins {
id 'java'
id 'org.projectnessie' version "0.29.0"
}

dependencies {
// your dependencies

// specify the GAV of the Nessie Quarkus server runnable (uber-jar)
nessieQuarkusServer "org.projectnessie:nessie-quarkus:0.49.0:runner"
}

nessieQuarkusApp {
// Ensure that the `test` task has a Nessie Server available.
includeTask(tasks.named("test"))
// Note: prefer setting up separate `integrationTest` tasks, see https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html

// These system properties will be available in your integration tests and will contain the
// port and full URL of the Nessie Quarkus server's HTTP server.
// httpListenPortProperty.set("quarkus.http.port") // quarkus.http.port is the default
// httpListenUrlProperty.set("quarkus.http.test-url") // quarkus.http.test-url is the default
}
```

### Maven

The `org.projectnessie.nessie-runner:nessie-runner-maven-plugin` Maven plugin can be used together with the
standard `maven-failsafe-plugin`

(POM snippet)

```xml


0.49.0




org.projectnessie
nessie-client
${nessie.version}




org.apache.maven.plugins
maven-failsafe-plugin


org.projectnessie.nessie-runner
nessie-runner-maven-plugin
0.29.0


org.projectnessie:nessie-quarkus:jar:runner:${nessie.version}


bar



world



quarkus.http.port

quarkus.http.test-url




start
pre-integration-test
start



stop
post-integration-test
stop




```

## Build requirements

* Java 11

## Build instructions

```basb
./mvnw clean install
(cd gradle-plugin ; ./gradlew build)
```