Skip to content

Commit

Permalink
Add code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanyu committed Sep 23, 2023
1 parent c527a45 commit 47fe605
Show file tree
Hide file tree
Showing 17 changed files with 1,086 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

43 changes: 43 additions & 0 deletions .github/workflows/main_push_and_pull_request_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright 2023 Aiven Oy
#
# 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
#
# http://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.
#

# The workflow to check main after push.
name: Main checks after push and during pull requests
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
build:
strategy:
matrix:
java-version: [ 11, 17 ]
name: Build on ${{ matrix.runs-on }} with jdk ${{ matrix.java-version }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: temurin

- name: Build with Gradle
run: ./gradlew build
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.gradle

build

/.idea
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
{{PROJECT_NAME}}
testcontainers-fake-gcs-server
======================
This is a template repository for creating open source repositories at Aiven.
Testcontainers wrapper for [https://github.com/fsouza/fake-gcs-server]().

Overview
========
Usage
=====

Features
============
1. Add the dependency

Setup
============
```xml
<dependency>
<groupId>io.aiven</groupId>
<artifactId>testcontainers.fakegcsserver</artifactId>
<version>0.1.0</version>
</dependency>
```

2. Use in tests

```java with JUnit 5 and Testcontainers
@Testcontainers
class MyTest {
@Container
private static final FakeGcsServerContainer FAKE_GCS_SERVER_CONTAINER =
new FakeGcsServerContainer();

@Test
void test() {
final Storage storage = StorageOptions.newBuilder()
.setCredentials(NoCredentials.getInstance())
.setHost(FAKE_GCS_SERVER_CONTAINER.url())
.setProjectId("test-project")
.build()
.getService();

storage.create(BucketInfo.of("test-bucket"));
}
}
```

License
============
{{PROJECT_NAME}} is licensed under the Apache license, version 2.0. Full license text is available in the [LICENSE](LICENSE) file.
testcontainers-fake-gcs-server is licensed under the Apache license, version 2.0. Full license text is available in the [LICENSE](LICENSE) file.

Please note that the project explicitly does not require a CLA (Contributor License Agreement) from its contributors.

Expand Down
66 changes: 66 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2023 Aiven Oy
*
* 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
*
* http://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.
*/

plugins {
// https://docs.gradle.org/current/userguide/java_library_plugin.html
id 'java-library'

// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
id 'checkstyle'

// https://docs.gradle.org/current/userguide/distribution_plugin.html
id 'distribution'
}

group = 'io.aiven'

repositories {
mavenCentral()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

withJavadocJar()
withSourcesJar()
}

tasks.named('test') {
useJUnitPlatform()
}

dependencies {
implementation libs.testcontainers

testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.params
testRuntimeOnly libs.junit.jupiter.engine

testImplementation libs.testcontainers.junit.jupiter

testImplementation libs.gcs
testRuntimeOnly libs.slf4j.log4j12
}

distributions {
main {
contents {
from jar
from sourcesJar
}
}
}
Loading

0 comments on commit 47fe605

Please sign in to comment.