diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bf80868..071f3b3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,12 @@ jobs: with: distribution: 'adopt-hotspot' java-version: '11' - cache: 'maven' + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: 7.4.1 - name: Test Default - run: mvn clean verify - - name: Test Ancient Jackson - run: mvn -Dversion.jackson=2.6.7 -pl !fahrschein-typeresolver,!fahrschein-example,!fahrschein-e2e-test clean verify - - name: Test Oldest Jackson (with full feature support) - run: mvn -Dversion.jackson=2.8.0 clean verify + run: gradle build + - name: Test oldest supported library versions + run: gradle build -Pjackson.version=2.8.0 -Pspring.version=4.3.0.RELEASE -Pokhttp.version=3.3.0 -Papachehttp.version=4.3 + - name: Test with latest library (micro) updates + run: gradle build -Pjackson.version=2.13.+ -Pspring.version=5.3.+ -Pokhttp.version=4.9.+ -Papachehttp.version=4.5.+ diff --git a/.github/workflows/cve-scan.yml b/.github/workflows/cve-scan.yml new file mode 100644 index 00000000..ab601ea7 --- /dev/null +++ b/.github/workflows/cve-scan.yml @@ -0,0 +1,18 @@ +name: CVE scan +on: + schedule: + - cron: "0 0 * * *" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt-hotspot' + java-version: '11' + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: 7.4.1 + arguments: dependencyCheckAggregate diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index b035a8e4..61a89e95 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -2,25 +2,25 @@ name: Publish package to the Maven Central Repository and GitHub Packages on: release: types: [created] + jobs: publish: runs-on: ubuntu-latest steps: - name: Check out Git repository uses: actions/checkout@v2 - - - name: Set up Java for publishing to Maven Central Repository + - name: Set up Java uses: actions/setup-java@v2 with: java-version: '11' distribution: 'adopt' - - - name: Release Maven package - uses: samuelmeuli/action-maven-publish@v1 + - name: Publish package + uses: gradle/gradle-build-action@v2 with: - gpg_private_key: ${{ secrets.GPG_KEY }} - gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} - nexus_username: ${{ secrets.OSSRH_USERNAME }} - nexus_password: ${{ secrets.OSSRH_TOKEN }} - maven_profiles: release - maven_args: -DskipITs=true \ No newline at end of file + gradle-version: 7.4.1 + arguments: publish -Prelease + env: + NEXUS_USERNAME: ${{ secrets.OSSRH_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + GPG_KEY: ${{ secrets.GPG_KEY }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.gitignore b/.gitignore index edbf220e..5bd2db44 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ target/ .settings/ .vscode bin/ + +#gradle +.gradle/ +build/ diff --git a/README.md b/README.md index 2e1f7f50..0092d4aa 100644 --- a/README.md +++ b/README.md @@ -209,8 +209,8 @@ final CloseableHttpClient httpClient = HttpClients.custom() .disableAutomaticRetries() .setDefaultRequestConfig(config) .disableRedirectHandling() - .setMaxConnTotal(8) - .setMaxConnPerRoute(2) + .setMaxConnTotal(20) + .setMaxConnPerRoute(20) .build(); final RequestFactory requestFactory = new HttpComponentsRequestFactory(httpClient, ContentEncoding.GZIP); @@ -245,6 +245,21 @@ final NakadiClient nakadiClient = NakadiClient.builder(NAKADI_URI, requestFactor **Note:** The implementations from the Spring framework don't handle closing of streams as expected. They will try to consume remaining data, which will usually time out when nakadi does not receive a commit. +**Note:** Regarding sizing and reuse of HTTP client connection pools, make sure to have a connection pool +size bigger than the number of subscriptions you're making, because subscriptions use long-polling to +retrieve events, each effectively blocking one connection. + +## Dependency compatibility + +Although Fahrschein is using fixed dependency versions, it is integration-tested against the following dependency matrix. We will inform in the release notes in case we bump the compatibility baseline. + +| Dependency | Baseline | Latest | +| ---- | ---- | +| Jackson | 2.8.0 | 2.13.+ | +| Spring Core | 4.3.0.RELEASE | 5.3.+ | +| okHttp | 3.3.0 | 4.9.+ | +| Apache HttpClient | 4.3 | 4.5.+ | + ## Content-Compression Fahrschein handles content compression transparently to the API consumer, and mostly independently of the actual HTTP @@ -284,21 +299,63 @@ If you have questions, concerns, bug reports, etc, please file an issue in this ## Local development -For local development, Fahrschein requires: +Fahrschein is a gradle-based project. For local development, Fahrschein requires: -* A local installation of JDK8 -* Any recent version of Maven +* A local installation of JDK11 * A local Docker installation for running integration tests -When developing, make sure to run unit and integration tests with `mvn verify`. +When developing, make sure to run unit and integration tests with `./gradlew test`. + +### Understanding the build + +We use Gradle [convention plugins](https://docs.gradle.org/current/samples/sample_convention_plugins.html) to share common build logic across multiple subprojects. These are [fahrschein.java-conventions.gradle](./buildSrc/src/main/groovy/fahrschein.java-conventions.gradle) for common java properties, and [fahrschein.maven-publishing-conventions.gradle](./buildSrc/src/main/groovy/fahrschein.maven-publishing-conventions.gradle) for subprojects that are released as maven artefacts. + +### Bumping dependency versions + +Most dependencies are defined on a per-subproject level, only the versions for the most-used shared dependencies are controlled centrally, in the [gradle.properties](./gradle.properties) file. This also allows you testing your build with a different version by specifying the property on the command-line. + +```sh +./gradlew test -Pjackson.version=2.9.0 +``` + +The [integration tests](.github/workflows/ci.yaml) include running the build with our supported baseline dependency as well as the latest micro release of Jackson, Apache HttpClient and Spring. Please update the section in the README when bumping dependency baselines, and add this to the release notes. + +### End-to-End tests The `fahrschein-e2e-test` module has end-to-end tests using `docker-compose`. If you wish to leave the Docker containers running between tests, you can also bring up docker-compose manually using its [docker-compose.yaml](fahrschein-e2e-test/src/test/resources/docker-compose.yaml), before running the tests. In either case, you will need the port `8080` to be available for Nakadi to run. ```sh docker-compose -f fahrschein-e2e-test/src/test/resources/docker-compose.yaml up -d -mvn verify -DCOMPOSE_PROVIDED +./gradlew :fahrschein-e2e:test -Pe2e.composeProvided +``` + +If you want to skip end-to-end tests completely, run +```sh +./gradlew test -Pe2e.skip +``` + +### CVE scanning + +The project integrates CVE scanning to check for vulnerable dependencies. In case of build failure, this can be caused by a high-risk vulnerability in a dependency being identified. You can run the reporting locally: + +``` +./gradlew dependencyCheckAggregate +open build/reports/dependency-check-report.html ``` +### Releasing + +Fahrschein uses Github Workflows to [build](.github/workflows/ci.yaml) and [publish releases](.github/workflows/maven-publish.yaml). This happens automatically whenever a new release is created in Github. After creating a release, please bump the `project.version` property in [gradle.properties](./gradle.properties). + +If needed, you can preview the signed release artifacts in your local maven repository. + +```sh +env "GPG_KEY=$(cat ~/.gnupg/private-key.pgp)" \ +"GPG_PASSPHRASE=$(read -s password ; echo $password)" \ +./gradlew publishToMavenLocal +``` + + ## Getting involved diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..e0a62eda --- /dev/null +++ b/build.gradle @@ -0,0 +1,14 @@ +plugins { + id 'eclipse' + id 'idea' + id 'com.github.ben-manes.versions' version '0.42.0' + id 'org.owasp.dependencycheck' version '7.1.0.1' +} + + +// CVE vulnerability scanning +// run: ./gradlew dependencyCheckAggregate + +dependencyCheck { + failBuildOnCVSS = '9' +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..4fa76d06 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + gradlePluginPortal() +} diff --git a/buildSrc/src/main/groovy/fahrschein.java-conventions.gradle b/buildSrc/src/main/groovy/fahrschein.java-conventions.gradle new file mode 100644 index 00000000..dd7e1342 --- /dev/null +++ b/buildSrc/src/main/groovy/fahrschein.java-conventions.gradle @@ -0,0 +1,63 @@ +plugins { + id 'java-library' + id 'jacoco' + id 'org.owasp.dependencycheck' +} + +repositories { + mavenCentral() +} + +group = 'org.zalando' +version = project.property('project.version') + (project.hasProperty('release') ? '' : '-SNAPSHOT') + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << '-parameters' + options.compilerArgs << '-Xlint:all' + options.encoding = 'UTF-8' + options.release = 8 +} + +dependencies { + implementation("org.slf4j:slf4j-api:${property('slf4j.version')}") { + because "we want slf4j-api to be available everywhere" + } + testRuntimeOnly("org.slf4j:slf4j-simple:${property('slf4j.version')}") { + because "we want the slf4j-simple logger implementation available at test runtime" + } + testImplementation("org.mockito:mockito-core:${property('mockito.version')}") { + because "we want mockito to be used in tests" + } + testImplementation("junit:junit:${property('junit.version')}") { + because "we want a common version JUnit across all projects" + } + testImplementation('org.hamcrest:hamcrest:2.2') { + because "we want to have hamcrest available for all testing" + } + compileOnly('com.google.code.findbugs:jsr305:2.0.1') { + because "we want to have annotations like @Deprecated available at compilation time" + } +} + +configurations.all { + resolutionStrategy.dependencySubstitution { + substitute(platform(module('commons-logging:commons-logging'))). + using module("org.slf4j:jcl-over-slf4j:${property('slf4j.version')}") + substitute(platform(module('org.hamcrest:hamcrest-core'))). + using module("org.hamcrest:hamcrest:2.2") + } +} + +test { + finalizedBy jacocoTestReport // report is always generated after tests run +} +jacocoTestReport { + dependsOn test // tests are required to run before generating the report +} + diff --git a/buildSrc/src/main/groovy/fahrschein.maven-publishing-conventions.gradle b/buildSrc/src/main/groovy/fahrschein.maven-publishing-conventions.gradle new file mode 100644 index 00000000..3b09dbd2 --- /dev/null +++ b/buildSrc/src/main/groovy/fahrschein.maven-publishing-conventions.gradle @@ -0,0 +1,85 @@ +plugins { + id 'maven-publish' + id 'signing' +} + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications { + maven(MavenPublication) { + from(components.java) + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } + pom { + url = 'https://github.com/zalando-nakadi/fahrschein' + inceptionYear = '2006' + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + name = 'Othon Crelier' + email = 'othon.crelier@zalando.de' + organization = 'Zalando SE' + organizationUrl = 'https://tech.zalando.com/' + } + developer { + name = 'Malte Pickhan' + email = 'malte.pickhan@zalando.de' + organization = 'Zalando Payments GmbH' + organizationUrl = 'https://tech.zalando.com/' + } + developer { + name = 'Oliver Trosien' + email = 'oliver.trosien@zalando.de' + organization = 'Zalando SE' + organizationUrl = 'https://tech.zalando.com/' + } + } + scm { + connection = 'scm:git:git@github.com:zalando-nakadi/fahrschein.git' + developerConnection = 'scm:git:git@github.com:zalando-nakadi/fahrschein.git' + url = 'https://github.com/zalando-nakadi/fahrschein' + } + } + repositories { + maven { + def snapshotsRepo = 'https://oss.sonatype.org/content/repositories/snapshots/' + def releasesRepo ='https://oss.sonatype.org/service/local/staging/deploy/maven2/' + url = version.endsWith('SNAPSHOT') ? snapshotsRepo : releasesRepo + credentials { + username = System.getenv("NEXUS_USERNAME") + password = System.getenv("NEXUS_PASSWORD") + } + } + } + } + } +} + + +signing { + def signingKey = System.getenv("GPG_KEY") + def signingPassword = System.getenv("GPG_PASSPHRASE") + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.maven +} + +javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} diff --git a/docs/RELEASING.md b/docs/RELEASING.md deleted file mode 100644 index 94387827..00000000 --- a/docs/RELEASING.md +++ /dev/null @@ -1,18 +0,0 @@ -# Releasing a new version of Fahrschein - -Fahrschein is released as maven artifacts in the `org.zalando` organisation. Follow these steps to create and publish a new maven release using the prepared Github workflows: - -* Create a branch and bump the version in `pom.xml` to the release version: - -`NEW_VERSION=0.22.0; mvn scm:check-local-modification versions:set -DnewVersion=$NEW_VERSION scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Release $NEW_VERSION"` - -* Create and merge the PR. - -* Create a [new release in Github](https://github.com/zalando-nakadi/fahrschein/releases/new) and tag the latest master with the release version. - -* Wait for the Github workflow to succeed, as this should publish the release artifacts to `oss.sonatype.org`. - -* Create and merge another PR bumping the version string back to `-SNAPSHOT`. - -`NEW_VERSION=0.23.0-SNAPSHOT; mvn scm:check-local-modification versions:set -DnewVersion=$NEW_VERSION scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Start development of $NEW_VERSION"` - diff --git a/fahrschein-e2e-test/build.gradle b/fahrschein-e2e-test/build.gradle new file mode 100644 index 00000000..e446692a --- /dev/null +++ b/fahrschein-e2e-test/build.gradle @@ -0,0 +1,30 @@ +plugins { + id 'fahrschein.java-conventions' +} + +dependencies { + testImplementation project(':fahrschein') + testImplementation project(':fahrschein-http-simple') + testImplementation project(':fahrschein-http-apache') + testImplementation project(':fahrschein-http-spring') + testImplementation project(':fahrschein-http-jdk11') + testImplementation "com.squareup.okhttp3:okhttp:${property('okhttp.version')}" + testImplementation "com.squareup.okhttp3:logging-interceptor:${property('okhttp.version')}" + testImplementation "org.testcontainers:testcontainers:1.17.2" + testImplementation "com.fasterxml.jackson.core:jackson-core:${property('jackson.version')}" + testImplementation "com.fasterxml.jackson.core:jackson-annotations:${property('jackson.version')}" + testImplementation "com.fasterxml.jackson.core:jackson-databind:${property('jackson.version')}" + testImplementation "com.fasterxml.jackson.module:jackson-module-parameter-names:${property('jackson.version')}" + testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${property('jackson.version')}" + testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${property('jackson.version')}" +} + +test { + onlyIf { ! project.hasProperty('e2e.skip') } + maxParallelForks = 1 + systemProperty "COMPOSE_PROVIDED", project.hasProperty("e2e.composeProvided") ? "true" : "false" +} + +tasks.withType(JavaCompile).configureEach { + options.release = 11 +} diff --git a/fahrschein-e2e-test/pom.xml b/fahrschein-e2e-test/pom.xml deleted file mode 100644 index 3d112631..00000000 --- a/fahrschein-e2e-test/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - - - - - org.zalando - 0.22.0-SNAPSHOT - fahrschein-parent - ../pom.xml - - fahrschein-e2e-test - - Fahrschein End-to-End Tests - - - - org.zalando - fahrschein - ${project.version} - test - - - org.zalando - fahrschein-http-simple - ${project.version} - test - - - org.zalando - fahrschein-http-apache - ${project.version} - test - - - org.zalando - fahrschein-http-spring - ${project.version} - test - - - org.zalando - fahrschein-http-jdk11 - ${project.version} - test - - - com.squareup.okhttp3 - okhttp - 4.9.3 - test - - - com.squareup.okhttp3 - logging-interceptor - 4.9.3 - test - - - org.springframework - spring-web - ${version.spring} - test - - - org.springframework - spring-aop - - - org.springframework - spring-context - - - commons-logging - commons-logging - - - - - org.slf4j - slf4j-simple - ${version.slf4j} - test - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - test - - - junit - junit - ${version.junit} - test - - - org.testcontainers - testcontainers - ${version.testcontainers} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - diff --git a/fahrschein-e2e-test/src/test/java/org/zalando/fahrschein/e2e/NakadiTestWithDockerCompose.java b/fahrschein-e2e-test/src/test/java/org/zalando/fahrschein/e2e/NakadiTestWithDockerCompose.java index b35b3db3..bb2a74e3 100644 --- a/fahrschein-e2e-test/src/test/java/org/zalando/fahrschein/e2e/NakadiTestWithDockerCompose.java +++ b/fahrschein-e2e-test/src/test/java/org/zalando/fahrschein/e2e/NakadiTestWithDockerCompose.java @@ -29,7 +29,7 @@ public abstract class NakadiTestWithDockerCompose { - private static final boolean COMPOSE_PROVIDED = System.getProperty("COMPOSE_PROVIDED") != null; + private static final boolean COMPOSE_PROVIDED = Boolean.parseBoolean(System.getProperty("COMPOSE_PROVIDED")); private static final Logger LOG = LoggerFactory.getLogger("docker-compose"); private static final Consumer LOG_CONSUMER = new Slf4jLogConsumer(LOG); diff --git a/fahrschein-example/build.gradle b/fahrschein-example/build.gradle new file mode 100644 index 00000000..d4483e6c --- /dev/null +++ b/fahrschein-example/build.gradle @@ -0,0 +1,24 @@ +plugins { + id 'fahrschein.java-conventions' +} + +dependencies { + implementation project(':fahrschein') + implementation project(':fahrschein-http-simple') + implementation project(':fahrschein-http-apache') + implementation project(':fahrschein-http-spring') + implementation project(':fahrschein-inmemory') + implementation project(':fahrschein-typeresolver') + implementation "com.squareup.okhttp3:okhttp:${property('okhttp.version')}" + implementation "org.apache.httpcomponents:httpclient:${property("apachehttp.version")}" + implementation "org.springframework:spring-web:${property('spring.version')}" + implementation 'org.zalando:jackson-datatype-money:0.6.0' + implementation "com.fasterxml.jackson.core:jackson-core:${property('jackson.version')}" + implementation "com.fasterxml.jackson.core:jackson-annotations:${property('jackson.version')}" + implementation "com.fasterxml.jackson.core:jackson-databind:${property('jackson.version')}" + implementation "com.fasterxml.jackson.module:jackson-module-parameter-names:${property('jackson.version')}" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${property('jackson.version')}" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${property('jackson.version')}" +} + +description = 'Fahrschein Example' diff --git a/fahrschein-example/pom.xml b/fahrschein-example/pom.xml deleted file mode 100644 index e89135e9..00000000 --- a/fahrschein-example/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-example - - Fahrschein Example - - - - - maven-surefire-plugin - - false - - - - - - - - org.zalando - fahrschein - ${project.version} - - - org.zalando - fahrschein-http-simple - ${project.version} - - - org.zalando - fahrschein-http-apache - ${project.version} - - - org.zalando - fahrschein-http-spring - ${project.version} - - - com.squareup.okhttp3 - okhttp - 4.9.3 - - - org.zalando - fahrschein-inmemory - ${project.version} - - - org.zalando - fahrschein-typeresolver - ${project.version} - - - org.springframework - spring-web - ${version.spring} - - - org.springframework - spring-aop - - - org.springframework - spring-context - - - commons-logging - commons-logging - - - - - org.zalando - jackson-datatype-money - 0.6.0 - - - - org.slf4j - slf4j-api - ${version.slf4j} - - - org.slf4j - slf4j-simple - ${version.slf4j} - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - - - - diff --git a/fahrschein-example/src/main/java/org/zalando/fahrschein/example/Main.java b/fahrschein-example/src/main/java/org/zalando/fahrschein/example/Main.java index 2d6f8c7f..a6123c11 100644 --- a/fahrschein-example/src/main/java/org/zalando/fahrschein/example/Main.java +++ b/fahrschein-example/src/main/java/org/zalando/fahrschein/example/Main.java @@ -12,14 +12,16 @@ import okhttp3.CertificatePinner; import okhttp3.ConnectionPool; import okhttp3.OkHttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.config.ConnectionConfig; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; -import org.zalando.fahrschein.*; +import org.zalando.fahrschein.EqualJitterBackoffStrategy; +import org.zalando.fahrschein.EventProcessingException; +import org.zalando.fahrschein.Listener; +import org.zalando.fahrschein.NakadiClient; +import org.zalando.fahrschein.ZignAccessTokenProvider; import org.zalando.fahrschein.domain.Cursor; import org.zalando.fahrschein.domain.Partition; import org.zalando.fahrschein.domain.Subscription; @@ -169,26 +171,8 @@ private static void subscriptionListen(ObjectMapper objectMapper, Listener listener) throws IOException { - final RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(60000) - .setConnectTimeout(2000) - .setConnectionRequestTimeout(8000) - .setContentCompressionEnabled(false) - .build(); - - final ConnectionConfig connectionConfig = ConnectionConfig.custom() - .setBufferSize(512) - .build(); - final CloseableHttpClient httpClient = HttpClients.custom() - .setDefaultRequestConfig(requestConfig) - .setDefaultConnectionConfig(connectionConfig) - .setConnectionTimeToLive(30, TimeUnit.SECONDS) - .disableAutomaticRetries() - .disableRedirectHandling() - .setMaxConnTotal(8) - .setMaxConnPerRoute(2) - .build(); + final CloseableHttpClient httpClient = HttpClients.createDefault(); final RequestFactory requestFactory = new HttpComponentsRequestFactory(httpClient, ContentEncoding.IDENTITY); diff --git a/fahrschein-http-apache/build.gradle b/fahrschein-http-apache/build.gradle new file mode 100644 index 00000000..5f014abe --- /dev/null +++ b/fahrschein-http-apache/build.gradle @@ -0,0 +1,12 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein-http-api') + api "org.apache.httpcomponents:httpclient:${property('apachehttp.version')}" + testImplementation(testFixtures(project(':fahrschein-http-test-support'))) +} + +publishing.publications.maven.pom.description = 'Fahrschein HTTP Client using Apache HttpComponents' diff --git a/fahrschein-http-apache/pom.xml b/fahrschein-http-apache/pom.xml deleted file mode 100644 index f55f1977..00000000 --- a/fahrschein-http-apache/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - - fahrschein-http-apache - Fahrschein HTTP Client using Apache HttpComponents - - - - org.zalando - fahrschein-http-api - ${project.version} - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - commons-logging - commons-logging - - - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - - - org.slf4j - slf4j-simple - ${version.slf4j} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - junit - junit - ${version.junit} - test - - - org.zalando - fahrschein-http-test-support - ${project.version} - test - - - - diff --git a/fahrschein-http-api/build.gradle b/fahrschein-http-api/build.gradle new file mode 100644 index 00000000..66edfb91 --- /dev/null +++ b/fahrschein-http-api/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + implementation "com.github.luben:zstd-jni:1.5.2-2" +} + +publishing.publications.maven.pom.description = 'Fahrschein HTTP API' diff --git a/fahrschein-http-api/pom.xml b/fahrschein-http-api/pom.xml deleted file mode 100644 index 021eb44c..00000000 --- a/fahrschein-http-api/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - - fahrschein-http-api - Fahrschein HTTP API - - - - com.github.luben - zstd-jni - 1.5.2-2 - - - com.google.code.findbugs - jsr305 - 2.0.1 - provided - - - junit - junit - ${version.junit} - test - - - - diff --git a/fahrschein-http-jdk11/build.gradle b/fahrschein-http-jdk11/build.gradle new file mode 100644 index 00000000..725d1cd6 --- /dev/null +++ b/fahrschein-http-jdk11/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein-http-api') + testImplementation(testFixtures(project(':fahrschein-http-test-support'))) +} + +tasks.withType(JavaCompile).configureEach { + options.release = 11 +} + +publishing.publications.maven.pom.description = "Fahrschein HTTP Client using JDK11's HttpClient" diff --git a/fahrschein-http-jdk11/pom.xml b/fahrschein-http-jdk11/pom.xml deleted file mode 100644 index 6e74a67c..00000000 --- a/fahrschein-http-jdk11/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - - - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - - fahrschein-http-jdk11 - Fahrschein HTTP Client using JDK11's HttpClient - - - - org.zalando - fahrschein-http-api - ${project.version} - - - junit - junit - ${version.junit} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - org.zalando - fahrschein-http-test-support - ${project.version} - test - - - diff --git a/fahrschein-http-simple/build.gradle b/fahrschein-http-simple/build.gradle new file mode 100644 index 00000000..3d0720eb --- /dev/null +++ b/fahrschein-http-simple/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein-http-api') + testImplementation(testFixtures(project(':fahrschein-http-test-support'))) +} + +publishing.publications.maven.pom.description = 'Fahrschein HTTP Client using HttpURLConnection' diff --git a/fahrschein-http-simple/pom.xml b/fahrschein-http-simple/pom.xml deleted file mode 100644 index 535657e4..00000000 --- a/fahrschein-http-simple/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - - fahrschein-http-simple - Fahrschein HTTP Client using HttpURLConnection - - - - org.zalando - fahrschein-http-api - ${project.version} - - - org.zalando - fahrschein-http-test-support - ${project.version} - test - - - junit - junit - ${version.junit} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - diff --git a/fahrschein-http-spring/build.gradle b/fahrschein-http-spring/build.gradle new file mode 100644 index 00000000..73523a1b --- /dev/null +++ b/fahrschein-http-spring/build.gradle @@ -0,0 +1,13 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein-http-api') + api "org.springframework:spring-web:${property('spring.version')}" + testImplementation "com.squareup.okhttp3:okhttp:${property('okhttp.version')}" + testImplementation(testFixtures(project(':fahrschein-http-test-support'))) +} + +publishing.publications.maven.pom.description = 'Fahrschein HTTP Client using Spring Adapter' diff --git a/fahrschein-http-spring/pom.xml b/fahrschein-http-spring/pom.xml deleted file mode 100644 index 3c1a4636..00000000 --- a/fahrschein-http-spring/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - - fahrschein-http-spring - Fahrschein HTTP Spring Adapter - - - - org.zalando - fahrschein-http-api - ${project.version} - - - org.springframework - spring-web - ${version.spring} - - - org.springframework - spring-aop - - - org.springframework - spring-context - - - commons-logging - commons-logging - - - - - com.google.code.findbugs - jsr305 - 2.0.1 - provided - - - junit - junit - ${version.junit} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - com.squareup.okhttp3 - okhttp - 4.9.3 - test - - - org.zalando - fahrschein-http-test-support - ${project.version} - test - - - - diff --git a/fahrschein-http-test-support/build.gradle b/fahrschein-http-test-support/build.gradle new file mode 100644 index 00000000..23613962 --- /dev/null +++ b/fahrschein-http-test-support/build.gradle @@ -0,0 +1,12 @@ +plugins { + id 'fahrschein.java-conventions' + id "java-test-fixtures" +} + +dependencies { + testFixturesApi project(':fahrschein-http-api') + testFixturesImplementation "com.github.luben:zstd-jni:1.5.2-2" + testFixturesImplementation "org.mockito:mockito-core:${property('mockito.version')}" + testFixturesImplementation "junit:junit:${property('junit.version')}" + +} diff --git a/fahrschein-http-test-support/pom.xml b/fahrschein-http-test-support/pom.xml deleted file mode 100644 index 288d8df2..00000000 --- a/fahrschein-http-test-support/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-http-test-support - - Fahrschein HTTP Client Test Support - - - - - maven-surefire-plugin - - true - - - - - - - org.zalando - fahrschein-http-api - ${project.version} - provided - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - - - - - junit - junit - ${version.junit} - - - org.mockito - mockito-core - ${version.mockito} - compile - - - - diff --git a/fahrschein-http-test-support/src/main/java/org/zalando/fahrschein/http/test/AbstractRequestFactoryTest.java b/fahrschein-http-test-support/src/testFixtures/java/org/zalando/fahrschein/http/test/AbstractRequestFactoryTest.java similarity index 100% rename from fahrschein-http-test-support/src/main/java/org/zalando/fahrschein/http/test/AbstractRequestFactoryTest.java rename to fahrschein-http-test-support/src/testFixtures/java/org/zalando/fahrschein/http/test/AbstractRequestFactoryTest.java diff --git a/fahrschein-inmemory/build.gradle b/fahrschein-inmemory/build.gradle new file mode 100644 index 00000000..50d501fd --- /dev/null +++ b/fahrschein-inmemory/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein') + testImplementation(testFixtures(project(':fahrschein-test-support'))) +} + +publishing.publications.maven.pom.description = 'Fahrschein In-Memory Cursor Management' diff --git a/fahrschein-inmemory/pom.xml b/fahrschein-inmemory/pom.xml deleted file mode 100644 index 2e35f8ce..00000000 --- a/fahrschein-inmemory/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-inmemory - - Fahrschein In-Memory Cursor Management - - - - org.zalando - fahrschein - ${project.version} - - - org.zalando - fahrschein-test-support - ${project.version} - test - - - - - junit - junit - ${version.junit} - test - - - - diff --git a/fahrschein-metrics-dropwizard/build.gradle b/fahrschein-metrics-dropwizard/build.gradle new file mode 100644 index 00000000..c6d558fb --- /dev/null +++ b/fahrschein-metrics-dropwizard/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein') + api 'io.dropwizard.metrics:metrics-core:3.1.2' +} + +publishing.publications.maven.pom.description = 'Fahrschein Metrics using Dropwizard' diff --git a/fahrschein-metrics-dropwizard/pom.xml b/fahrschein-metrics-dropwizard/pom.xml deleted file mode 100644 index 59fbbc2b..00000000 --- a/fahrschein-metrics-dropwizard/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-metrics-dropwizard - - Fahrschein Metrics using Dropwizard - - - - - maven-surefire-plugin - - - false - - - - - - - - org.zalando - fahrschein - ${project.version} - - - - io.dropwizard.metrics - metrics-core - 3.1.2 - - - - diff --git a/fahrschein-test-support/build.gradle b/fahrschein-test-support/build.gradle new file mode 100644 index 00000000..212e17c6 --- /dev/null +++ b/fahrschein-test-support/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'fahrschein.java-conventions' + id "java-test-fixtures" +} + +dependencies { + testFixturesApi project(':fahrschein') + testFixturesImplementation "junit:junit:${property('junit.version')}" + testFixturesImplementation "org.springframework:spring-tx:${property('spring.version')}" +} diff --git a/fahrschein-test-support/pom.xml b/fahrschein-test-support/pom.xml deleted file mode 100644 index b8ac4372..00000000 --- a/fahrschein-test-support/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-test-support - - Fahrschein Test Support - - - - - maven-surefire-plugin - - true - - - - - - - org.zalando - fahrschein - ${project.version} - - - org.springframework - spring-tx - ${version.spring} - - - commons-logging - commons-logging - - - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - - - - - junit - junit - ${version.junit} - - - org.mockito - mockito-core - ${version.mockito} - compile - - - - diff --git a/fahrschein-test-support/src/main/java/org/zalando/fahrschein/test/AbstractCursorManagerTest.java b/fahrschein-test-support/src/testFixtures/java/org/zalando/fahrschein/test/AbstractCursorManagerTest.java similarity index 100% rename from fahrschein-test-support/src/main/java/org/zalando/fahrschein/test/AbstractCursorManagerTest.java rename to fahrschein-test-support/src/testFixtures/java/org/zalando/fahrschein/test/AbstractCursorManagerTest.java diff --git a/fahrschein-test-support/src/main/java/org/zalando/fahrschein/test/AbstractPartitionManagerTest.java b/fahrschein-test-support/src/testFixtures/java/org/zalando/fahrschein/test/AbstractPartitionManagerTest.java similarity index 100% rename from fahrschein-test-support/src/main/java/org/zalando/fahrschein/test/AbstractPartitionManagerTest.java rename to fahrschein-test-support/src/testFixtures/java/org/zalando/fahrschein/test/AbstractPartitionManagerTest.java diff --git a/fahrschein-typeresolver/build.gradle b/fahrschein-typeresolver/build.gradle new file mode 100644 index 00000000..a7b74301 --- /dev/null +++ b/fahrschein-typeresolver/build.gradle @@ -0,0 +1,13 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein') + api "com.fasterxml.jackson.core:jackson-core:${property('jackson.version')}" + api "com.fasterxml.jackson.core:jackson-annotations:${property('jackson.version')}" + api "com.fasterxml.jackson.core:jackson-databind:${property('jackson.version')}" +} + +publishing.publications.maven.pom.description = 'Fahrschein Type Resolver' diff --git a/fahrschein-typeresolver/pom.xml b/fahrschein-typeresolver/pom.xml deleted file mode 100644 index a6acc9c8..00000000 --- a/fahrschein-typeresolver/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein-typeresolver - - Fahrschein Type Resolver - - - - org.zalando - fahrschein - ${project.version} - - - org.slf4j - slf4j-api - ${version.slf4j} - - - - - com.google.code.findbugs - jsr305 - 2.0.1 - provided - - - - - com.fasterxml.jackson.core - jackson-core - ${version.jackson} - - - com.fasterxml.jackson.core - jackson-annotations - ${version.jackson} - - - com.fasterxml.jackson.core - jackson-databind - ${version.jackson} - - - - - junit - junit - ${version.junit} - test - - - - - org.slf4j - slf4j-simple - ${version.slf4j} - test - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - test - - - - diff --git a/fahrschein/build.gradle b/fahrschein/build.gradle new file mode 100644 index 00000000..085db325 --- /dev/null +++ b/fahrschein/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'fahrschein.java-conventions' + id 'fahrschein.maven-publishing-conventions' +} + +dependencies { + api project(':fahrschein-http-api') + api project(':fahrschein-http-simple') + api "com.fasterxml.jackson.core:jackson-databind:${property('jackson.version')}" + implementation "com.fasterxml.jackson.module:jackson-module-parameter-names:${property('jackson.version')}" + implementation "com.fasterxml.jackson.core:jackson-core:${property('jackson.version')}" + implementation "com.fasterxml.jackson.core:jackson-annotations:${property('jackson.version')}" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${property('jackson.version')}" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${property('jackson.version')}" + testImplementation ('com.jayway.jsonpath:json-path:2.2.0') { + exclude group: "org.ow2.asm", module: "asm" + } + testImplementation 'org.hobsoft.hamcrest:hamcrest-compose:0.3.0' + testImplementation 'com.google.code.findbugs:jsr305:2.0.1' +} + +publishing.publications.maven.pom.description = 'A Java client for the Nakadi event bus' diff --git a/fahrschein/pom.xml b/fahrschein/pom.xml deleted file mode 100644 index e29108aa..00000000 --- a/fahrschein/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - 4.0.0 - - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - ../pom.xml - - fahrschein - - Fahrschein - - - - org.zalando - fahrschein-http-simple - ${project.version} - - - org.zalando - fahrschein-http-api - ${project.version} - - - org.slf4j - slf4j-api - ${version.slf4j} - - - - - com.google.code.findbugs - jsr305 - 2.0.1 - provided - - - - - com.fasterxml.jackson.core - jackson-core - ${version.jackson} - - - com.fasterxml.jackson.core - jackson-annotations - ${version.jackson} - - - com.fasterxml.jackson.core - jackson-databind - ${version.jackson} - - - com.fasterxml.jackson.module - jackson-module-parameter-names - ${version.jackson} - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - ${version.jackson} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${version.jackson} - - - - - junit - junit - ${version.junit} - test - - - org.mockito - mockito-core - ${version.mockito} - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.hobsoft.hamcrest - hamcrest-compose - 0.3.0 - test - - - com.jayway.jsonpath - json-path - 2.2.0 - test - - - net.minidev - json-smart - - - - - - - org.slf4j - slf4j-simple - ${version.slf4j} - test - - - org.slf4j - jcl-over-slf4j - ${version.slf4j} - test - - - - diff --git a/fahrschein/src/main/java/org/zalando/fahrschein/ManagedCursorManager.java b/fahrschein/src/main/java/org/zalando/fahrschein/ManagedCursorManager.java index 34612d88..40bfda8c 100644 --- a/fahrschein/src/main/java/org/zalando/fahrschein/ManagedCursorManager.java +++ b/fahrschein/src/main/java/org/zalando/fahrschein/ManagedCursorManager.java @@ -61,7 +61,7 @@ void setStreamId(String streamId) { static final class CursorWrapper { private final List items; - @JsonCreator + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) CursorWrapper(@JsonProperty("items") List items) { this.items = items; } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..8da37629 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,13 @@ +## project version +project.version=0.22.0 + +## dependency versions +jackson.version=2.13.1 +slf4j.version=1.7.25 +spring.version=5.3.18 +mockito.version=4.3.1 +junit.version=4.13.1 +testContainersV=1.16.2 +okhttp.version=4.9.3 +apachehttp.version=4.5.13 + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..41d9927a Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..5b6fb15e --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionSha256Sum=e5444a57cda4a95f90b0c9446a9e1b47d3d7f69057765bfb54bd4f482542d548 diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..1b6c7873 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 21e3af87..00000000 --- a/pom.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - 4.0.0 - - org.zalando - fahrschein-parent - 0.22.0-SNAPSHOT - pom - - Fahrschein Parent - A java client for the nakadi event bus - https://github.com/zalando-nakadi/fahrschein - - - Zalando SE - - - 2016 - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - Othon Crelier - othon.crelier@zalando.de - Zalando SE - https://tech.zalando.com/ - - - Malte Pickhan - malte.pickhan@zalando.de - Zalando Payments GmbH - https://tech.zalando.com/ - - - Oliver Trosien - oliver.trosien@zalando.de - Zalando SE - https://tech.zalando.com/ - - - - - https://github.com/zalando-nakadi/fahrschein - scm:git:git@github.com:zalando-nakadi/fahrschein.git - scm:git:git@github.com:zalando-nakadi/fahrschein.git - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - 1.8 - 1.8 - 6.5.2 - UTF-8 - UTF-8 - true - - 2.13.1 - 5.3.18 - 1.7.25 - 4.3.1 - 4.13.1 - 1.16.2 - - - - fahrschein - fahrschein-inmemory - fahrschein-metrics-dropwizard - fahrschein-example - fahrschein-http-test-support - fahrschein-test-support - fahrschein-typeresolver - fahrschein-http-api - fahrschein-http-simple - fahrschein-http-jdk11 - fahrschein-http-apache - fahrschein-http-spring - fahrschein-e2e-test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - - -parameters - -Xlint:all - -proc:none - - true - true - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - - org.codehaus.mojo - versions-maven-plugin - 2.2 - - false - - - - maven-scm-plugin - 1.9.4 - - false - ${project.version} - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.apache.maven.surefire - surefire-junit47 - 2.19.1 - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - - prepare-agent - - prepare-agent - - - - report - - report - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - -Xdoclint:none - - - - - - - owasp-dependency-check - - - - org.owasp - dependency-check-maven - ${maven.dependency-check.version} - - - - check - - - - - - - - - release - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - - - diff --git a/release.sh b/release.sh deleted file mode 100755 index 1b7d9f9f..00000000 --- a/release.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEFAULT_VERSION=1.0-SNAPSHOT -RELEASE_VERSION=${1?"Usage $0 release-version [next-version]"} -NEXT_VERSION=${2-$DEFAULT_VERSION} - -# release -mvn scm:check-local-modification versions:set -DnewVersion=$RELEASE_VERSION scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Release $RELEASE_VERSION" - -mvn -Prelease clean scm:tag deploy - -# next development version -mvn versions:set -DnewVersion=$NEXT_VERSION scm:add -Dincludes="**/pom.xml" scm:checkin -Dmessage="Develop $NEXT_VERSION" diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..c39f59a2 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,14 @@ +rootProject.name = 'fahrschein-parent' +include(':fahrschein-example') +include(':fahrschein-test-support') +include(':fahrschein-http-test-support') +include(':fahrschein-typeresolver') +include(':fahrschein-http-simple') +include(':fahrschein-inmemory') +include(':fahrschein-metrics-dropwizard') +include(':fahrschein-http-jdk11') +include(':fahrschein-http-spring') +include(':fahrschein-http-api') +include(':fahrschein-e2e-test') +include(':fahrschein-http-apache') +include(':fahrschein')