Skip to content
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

migrate to maven #245

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 0 additions & 12 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

26 changes: 10 additions & 16 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,22 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu' # temurin don't provide jdk8 anymore
cache: maven
# cache Gradle package to speed up future runs after a successful run.
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ matrix.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ matrix.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# gradle build process include test phase.
- name: Build with Gradle
run: ./gradlew build
- name: Run the Maven verify phase
run: mvn --batch-mode verify -"DskipITs" -"Dgpg.skip" # double-quotes: workaround for powershell
- run: mkdir staging && cp target/*.jar staging
# store the built packages as part of the workflow run.
# Allow us to download these artifacts and import to project to help local test.
# with matrix, Each job overwrites what was previously uploaded, but it's fine for us.
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: Package
path: build/libs
name: jar-collection-${{ matrix.os }}-${{ matrix.java-version }}
path: staging
retention-days: 7
196 changes: 98 additions & 98 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ Add a construction method of QingStor.java

- Modify the http response header key to lower case

Now some http response headers have become lowercase, were uppercase before("X-QS-Encryption-Customer-Algorithm" --> "x-qs-encryption-customer-algorithm"). To fix this issue, http headers in SDK are case insensitive.
Now some http response headers have become lowercase, were uppercase before("X-QS-Encryption-Customer-Algorithm" --> "x-qs-encryption-customer-algorithm"). To fix this issue, http headers in SDK are case insensitive.

## [v2.2.12] - 2018-09-05

### Added

- Add has_more in response element

If you are a private cloud user, please ensure that the version number of your server is greater than 20180801 (inclusive).
If you are a private cloud user, please ensure that the version number of your server is greater than 20180801 (inclusive).

## [v2.2.11] - 2018-08-09

Expand Down Expand Up @@ -255,38 +255,38 @@ Add a construction method of QingStor.java

- Modify UploadManager and UploadManagerCallback

- We make **interface UploadManagerCallback** become a **abstract class**
- We make **interface UploadManagerCallback** become a **abstract class**

Not all of users need sign with server.
We make methods "String onSignature(String strToSign)" and "String onAccessKey()" do not auto override.
To support java 1.6 as well, default method in interface does not work.
Not all of users need sign with server.
We make methods "String onSignature(String strToSign)" and "String onAccessKey()" do not auto override.
To support java 1.6 as well, default method in interface does not work.

In summary, interface UploadManagerCallback is a abstract class now.
In summary, interface UploadManagerCallback is a abstract class now.

- A correct time method added in UploadManagerCallback.
- A method to correct time added in UploadManager when sign.
- A correct time method added in UploadManagerCallback.
- A method to correct time added in UploadManager when sign.

- Modify examples

Modify examples about how to correct the time of your device.
Modify examples about how to correct the time of your device.

If the local time of users' clients are not synchronized with the network time,
may occur a signture error.
If the local time of users' clients are not synchronized with the network time,
may occur a signture error.

Now you can correct the time of your device by below codes.
Now you can correct the time of your device by below codes.

```java
requestHandler.getBuilder().setHeader(QSConstant.HEADER_PARAM_KEY_DATE, gmtTime);
requestHandler.send();
```
```java
requestHandler.getBuilder().setHeader(QSConstant.HEADER_PARAM_KEY_DATE, gmtTime);
requestHandler.send();
```

See examples for more info.
See examples for more info.

[Sign With Server - English Version](docs/example/sign_with_server.md)
[Sign With Server - Chinese Version](docs/example/sign_with_server_zh.md)
[Sign With Server - English Version](docs/example/sign_with_server.md)
[Sign With Server - Chinese Version](docs/example/sign_with_server_zh.md)

[UploadManager - English Version](docs/example/AutoUpload.md)
[UploadManager - Chinese Version](docs/example/AutoUpload_zh.md)
[UploadManager - English Version](docs/example/AutoUpload.md)
[UploadManager - Chinese Version](docs/example/AutoUpload_zh.md)

## [v2.2.6] - 2018-04-17

Expand All @@ -296,12 +296,12 @@ Add a construction method of QingStor.java
- Add requestHandlers in ImageProgressClient
- Modify examples

We fixed a lot of mistakes in examples.
And add an example about how to do a image progress.
Visit below links to get examples.
We fixed a lot of mistakes in examples.
And add an example about how to do a image progress.
Visit below links to get examples.

[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)
[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)

## [v2.2.5] - 2018-01-25

Expand All @@ -320,10 +320,10 @@ Visit below links to get examples.

- Add upload manager to auto upload which will keep the position last uploaded.

Visit below links to get examples.
Visit below links to get examples.

[English Version](docs/example/AutoUpload.md)
[Chinese Version](docs/example/AutoUpload_zh.md)
[English Version](docs/example/AutoUpload.md)
[Chinese Version](docs/example/AutoUpload_zh.md)

## [v2.2.4] - 2018-01-13

Expand All @@ -340,10 +340,10 @@ Visit below links to know more.

- Add some examples.

You can see the new examples here:
You can see the new examples here:

[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)
[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)

## [v2.2.3] - 2018-01-05

Expand All @@ -357,10 +357,10 @@ Visit below links to know more.

- Add some examples.

You can see the examples here:
You can see the examples here:

[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)
[English Version](docs/examples.md)
[Chinese Version](docs/guide_zh.md)

## [v2.2.2] - 2017-12-21

Expand All @@ -370,71 +370,71 @@ Visit below links to know more.

- Fixed twice encode when set responseContentDisposition.

Now you can set responseContentDisposition like this:
Now you can set responseContentDisposition like this:

```java
Bucket.GetObjectInput inputs = new Bucket.GetObjectInput();
String fileName = "测试图片(测试).jpg";
String urlName = URLEncoder.encode(fileName, "utf-8");
//do not add blanks int the key "attachment;filename="
inputs.setResponseContentDisposition("attachment;filename=" + urlName);
RequestHandler handle = bucket.GetObjectBySignatureUrlRequest("测试图片(测试).jpg", inputs, System.currentTimeMillis() + 10000);
String tempUrl = handle.getExpiresRequestUrl();
```
```java
Bucket.GetObjectInput inputs = new Bucket.GetObjectInput();
String fileName = "测试图片(测试).jpg";
String urlName = URLEncoder.encode(fileName, "utf-8");
//do not add blanks int the key "attachment;filename="
inputs.setResponseContentDisposition("attachment;filename=" + urlName);
RequestHandler handle = bucket.GetObjectBySignatureUrlRequest("测试图片(测试).jpg", inputs, System.currentTimeMillis() + 10000);
String tempUrl = handle.getExpiresRequestUrl();
```

### Added

- Add config to change url style.

Available url style:
One is the default, when requestUrlStyle != QSConstant#PATH_STYLE}
You may see the url like this(QSConstant#VIRTUAL_HOST_STYLE):
https://bucket-name.zone-id.qingstor.com/object-name
Otherwise you may see the url like this(QSConstant#PATH_STYLE):
https://zone-id.qingstor.com/bucket-name/object-name
Available url style:
One is the default, when requestUrlStyle != QSConstant#PATH_STYLE}
You may see the url like this(QSConstant#VIRTUAL_HOST_STYLE):
https://bucket-name.zone-id.qingstor.com/object-name
Otherwise you may see the url like this(QSConstant#PATH_STYLE):
https://zone-id.qingstor.com/bucket-name/object-name

- Now you can add configs in EvnContext to change url style.
In java:
- Now you can add configs in EvnContext to change url style.
In java:

```java
EvnContext evn = EvnContext.loadFromFile("config_stor.yaml");
Bucket bucket = new Bucket(evn, zoneId, bucketName);
```
```java
EvnContext evn = EvnContext.loadFromFile("config_stor.yaml");
Bucket bucket = new Bucket(evn, zoneId, bucketName);
```

About file config_stor.yaml you can add configs below:
About file config_stor.yaml you can add configs below:

```yaml
# QingStor services configuration
```yaml
# QingStor services configuration

access_key_id: "ACCESS_KEY_ID"
secret_access_key: "SECRET_ACCESS_KEY"
access_key_id: "ACCESS_KEY_ID"
secret_access_key: "SECRET_ACCESS_KEY"

host: "qingstor.com"
port: "443"
protocol: "https"
connection_retries: 3
# uri: '/iaas'
host: "qingstor.com"
port: "443"
protocol: "https"
connection_retries: 3
# uri: '/iaas'

# Valid log levels are "debug", "info", "warn", "error", and "fatal".
log_level: "warn"
# Valid log levels are "debug", "info", "warn", "error", and "fatal".
log_level: "warn"

# Valid request url styles are "virtual_host_style"(default) and "path_style"
request_url_style: "path_style"
```
# Valid request url styles are "virtual_host_style"(default) and "path_style"
request_url_style: "path_style"
```

Attention: if some of the configs you do not use, please add a "#" at the first of the line.
Like this: `# port: '443'`
Attention: if some of the configs you do not use, please add a "#" at the first of the line.
Like this: `# port: '443'`

- Or set request url style with EvnContext.
- Or set request url style with EvnContext.

```java
EvnContext evn = new EvnContext("ACCESS_KEY_ID_EXAMPLE", "SECRET_ACCESS_KEY_EXAMPLE");
//Valid request url styles' params are QSConstant.PATH_STYLE and QSConstant.VIRTUAL_HOST_STYLE
evn.setRequestUrlStyle(QSConstant.PATH_STYLE);
String zoneName = "pek3a";
String bucketName = "testBucketName";
Bucket bucket = new Bucket(evn, zoneKey, bucketName);
```
```java
EvnContext evn = new EvnContext("ACCESS_KEY_ID_EXAMPLE", "SECRET_ACCESS_KEY_EXAMPLE");
//Valid request url styles' params are QSConstant.PATH_STYLE and QSConstant.VIRTUAL_HOST_STYLE
evn.setRequestUrlStyle(QSConstant.PATH_STYLE);
String zoneName = "pek3a";
String bucketName = "testBucketName";
Bucket bucket = new Bucket(evn, zoneKey, bucketName);
```

## [v2.2.1] - 2017-11-07

Expand Down Expand Up @@ -545,17 +545,17 @@ Visit below links to know more.
### Added

- QingStor SDK for the JAVA programming language.
[v2.2.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.2.0...2.2.1
[v2.2.0]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.10...2.2.0
[v2.1.10]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.9...2.1.10
[v2.1.9]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.8...2.1.9
[v2.1.8]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.7...2.1.8
[v2.1.7]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.6...2.1.7
[v2.1.6]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.5...2.1.6
[v2.1.5]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.4...2.1.5
[v2.1.4]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.3...2.1.4
[v2.1.3]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.2...2.1.3
[v2.1.2]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.1...2.1.2
[v2.1.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.0...2.1.1
[v2.1.0]: https://github.com/yunify/qingstor-sdk-java/compare/2.0.1...2.1.0
[v2.0.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.0.0...2.0.1
[v2.2.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.2.0...2.2.1
[v2.2.0]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.10...2.2.0
[v2.1.10]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.9...2.1.10
[v2.1.9]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.8...2.1.9
[v2.1.8]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.7...2.1.8
[v2.1.7]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.6...2.1.7
[v2.1.6]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.5...2.1.6
[v2.1.5]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.4...2.1.5
[v2.1.4]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.3...2.1.4
[v2.1.3]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.2...2.1.3
[v2.1.2]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.1...2.1.2
[v2.1.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.1.0...2.1.1
[v2.1.0]: https://github.com/yunify/qingstor-sdk-java/compare/2.0.1...2.1.0
[v2.0.1]: https://github.com/yunify/qingstor-sdk-java/compare/2.0.0...2.0.1
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ all: update generate unit build

test:
@echo "run service test"
./gradlew cucumber
mvn integration-test
@echo "ok"

generate:
Expand All @@ -22,7 +22,7 @@ generate:
snips \
-f=./specs/qingstor/2016-01-06/swagger/api_v2.0.json -t=./template -o=./src/main/java/com/qingstor/sdk/service
rm ./src/main/java/com/qingstor/sdk/service/Object.java
./gradlew spotlessApply
mvn spotless:apply
@echo "ok"

update:
Expand All @@ -31,10 +31,10 @@ update:

unit:
@echo "run unit test"
./gradlew test
mvn test
@echo "ok"

build:
@echo "run build jar(jar, source, javadoc)"
./gradlew build
mvn package -Prelease
@echo "ok"
Loading
Loading