Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 1595dfb

Browse files
authored
s3 as a separate module (#466)
* s3 as a separate module
1 parent 04f56c2 commit 1595dfb

22 files changed

+189
-106
lines changed

asto-core/pom.xml

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,6 @@ SOFTWARE.
111111
<artifactId>resilience4j-retry</artifactId>
112112
<version>1.7.1</version>
113113
</dependency>
114-
<!-- S3 client -->
115-
<dependency>
116-
<groupId>software.amazon.awssdk</groupId>
117-
<artifactId>s3</artifactId>
118-
<version>2.17.165</version>
119-
<exclusions>
120-
<exclusion>
121-
<groupId>com.fasterxml.jackson.core</groupId>
122-
<artifactId>jackson-databind</artifactId>
123-
</exclusion>
124-
<exclusion>
125-
<groupId>com.fasterxml.jackson.dataformat</groupId>
126-
<artifactId>jackson-dataformat-xml</artifactId>
127-
</exclusion>
128-
</exclusions>
129-
</dependency>
130114
<!-- etcd client -->
131115
<dependency>
132116
<groupId>io.etcd</groupId>
@@ -150,49 +134,6 @@ SOFTWARE.
150134
<artifactId>testng</artifactId>
151135
<version>7.3.0</version>
152136
</dependency>
153-
<!-- tests -->
154-
<!-- s3 mocks deps -->
155-
<dependency>
156-
<groupId>com.adobe.testing</groupId>
157-
<artifactId>s3mock</artifactId>
158-
<version>2.4.9</version>
159-
<scope>test</scope>
160-
<exclusions>
161-
<exclusion>
162-
<groupId>com.fasterxml.jackson.dataformat</groupId>
163-
<artifactId>jackson-dataformat-xml</artifactId>
164-
</exclusion>
165-
<exclusion>
166-
<groupId>org.eclipse.jetty</groupId>
167-
<artifactId>jetty-http</artifactId>
168-
</exclusion>
169-
</exclusions>
170-
</dependency>
171-
<dependency>
172-
<groupId>com.adobe.testing</groupId>
173-
<artifactId>s3mock-junit5</artifactId>
174-
<version>2.4.9</version>
175-
<scope>test</scope>
176-
<exclusions>
177-
<exclusion>
178-
<groupId>com.fasterxml.jackson.dataformat</groupId>
179-
<artifactId>jackson-dataformat-xml</artifactId>
180-
</exclusion>
181-
</exclusions>
182-
</dependency>
183-
<dependency>
184-
<groupId>com.fasterxml.jackson.dataformat</groupId>
185-
<artifactId>jackson-dataformat-xml</artifactId>
186-
<version>2.11.4</version>
187-
<scope>test</scope>
188-
</dependency>
189-
<dependency>
190-
<groupId>org.eclipse.jetty</groupId>
191-
<artifactId>jetty-http</artifactId>
192-
<version>9.4.45.v20220203</version>
193-
<scope>test</scope>
194-
</dependency>
195-
<!-- end s3 mocks deps -->
196137
<!-- TestNG compatibility layer with Junit5 -->
197138
<dependency>
198139
<groupId>org.reactivestreams</groupId>

asto-core/src/test/java/com/artipie/asto/factory/StoragesTest.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.artipie.ArtipieException;
99
import com.artipie.asto.etcd.EtcdStorage;
1010
import com.artipie.asto.fs.FileStorage;
11-
import com.artipie.asto.s3.S3Storage;
1211
import com.third.party.factory.first2.TestFirst2StorageFactory;
1312
import java.util.Collections;
1413
import org.hamcrest.MatcherAssert;
@@ -39,35 +38,6 @@ void shouldCreateFileStorage() {
3938
);
4039
}
4140

42-
/**
43-
* Test for S3 storage factory.
44-
*
45-
* @checkstyle MethodNameCheck (3 lines)
46-
*/
47-
@Test
48-
void shouldCreateS3Storage() {
49-
MatcherAssert.assertThat(
50-
new Storages()
51-
.newStorage(
52-
"s3",
53-
Yaml.createYamlMappingBuilder()
54-
.add("region", "us-east-1")
55-
.add("bucket", "aaa")
56-
.add("endpoint", "http://localhost")
57-
.add(
58-
"credentials",
59-
Yaml.createYamlMappingBuilder()
60-
.add("type", "basic")
61-
.add("accessKeyId", "foo")
62-
.add("secretAccessKey", "bar")
63-
.build()
64-
)
65-
.build()
66-
),
67-
new IsInstanceOf(S3Storage.class)
68-
);
69-
}
70-
7141
@Test
7242
void shouldCreateEtcdStorage() {
7343
MatcherAssert.assertThat(
@@ -130,7 +100,7 @@ void shouldScanAdditionalPackageFromEnv() {
130100
"com.third.party.factory.first"
131101
)
132102
).types(),
133-
Matchers.containsInAnyOrder("fs", "s3", "etcd", "test-first")
103+
Matchers.containsInAnyOrder("fs", "etcd", "test-first")
134104
);
135105
}
136106

@@ -143,7 +113,7 @@ void shouldScanSeveralPackagesFromEnv() {
143113
"com.third.party.factory.first;com.third.party.factory.second"
144114
)
145115
).types(),
146-
Matchers.containsInAnyOrder("fs", "s3", "etcd", "test-first", "test-second")
116+
Matchers.containsInAnyOrder("fs", "etcd", "test-first", "test-second")
147117
);
148118
}
149119
}

asto-s3/pom.xml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
The MIT License (MIT)
4+
5+
Copyright (c) 2020-2022 artipie.com
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included
15+
in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.
24+
-->
25+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
26+
<parent>
27+
<artifactId>asto</artifactId>
28+
<groupId>com.artipie</groupId>
29+
<version>1.0-SNAPSHOT</version>
30+
</parent>
31+
<modelVersion>4.0.0</modelVersion>
32+
<artifactId>asto-s3</artifactId>
33+
<dependencies>
34+
<dependency>
35+
<groupId>com.artipie</groupId>
36+
<artifactId>asto-core</artifactId>
37+
<version>1.0-SNAPSHOT</version>
38+
<scope>compile</scope>
39+
</dependency>
40+
<!-- S3 client -->
41+
<dependency>
42+
<groupId>software.amazon.awssdk</groupId>
43+
<artifactId>s3</artifactId>
44+
<version>2.17.165</version>
45+
<exclusions>
46+
<exclusion>
47+
<groupId>com.fasterxml.jackson.core</groupId>
48+
<artifactId>jackson-databind</artifactId>
49+
</exclusion>
50+
<exclusion>
51+
<groupId>com.fasterxml.jackson.dataformat</groupId>
52+
<artifactId>jackson-dataformat-xml</artifactId>
53+
</exclusion>
54+
</exclusions>
55+
</dependency>
56+
<!-- tests -->
57+
<!-- s3 mocks deps -->
58+
<dependency>
59+
<groupId>com.adobe.testing</groupId>
60+
<artifactId>s3mock</artifactId>
61+
<version>2.4.9</version>
62+
<scope>test</scope>
63+
<exclusions>
64+
<exclusion>
65+
<groupId>com.fasterxml.jackson.dataformat</groupId>
66+
<artifactId>jackson-dataformat-xml</artifactId>
67+
</exclusion>
68+
<exclusion>
69+
<groupId>org.eclipse.jetty</groupId>
70+
<artifactId>jetty-http</artifactId>
71+
</exclusion>
72+
</exclusions>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.adobe.testing</groupId>
76+
<artifactId>s3mock-junit5</artifactId>
77+
<version>2.4.9</version>
78+
<scope>test</scope>
79+
<exclusions>
80+
<exclusion>
81+
<groupId>com.fasterxml.jackson.dataformat</groupId>
82+
<artifactId>jackson-dataformat-xml</artifactId>
83+
</exclusion>
84+
</exclusions>
85+
</dependency>
86+
<dependency>
87+
<groupId>com.fasterxml.jackson.dataformat</groupId>
88+
<artifactId>jackson-dataformat-xml</artifactId>
89+
<version>2.11.4</version>
90+
<scope>test</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.eclipse.jetty</groupId>
94+
<artifactId>jetty-http</artifactId>
95+
<version>9.4.45.v20220203</version>
96+
<scope>test</scope>
97+
</dependency>
98+
</dependencies>
99+
</project>

asto-core/src/main/java/com/artipie/asto/s3/Bucket.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/Bucket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* S3 client targeted at specific bucket.
1919
*
20-
* @since 0.15
20+
* @since 0.1
2121
*/
2222
final class Bucket {
2323

asto-core/src/main/java/com/artipie/asto/s3/EstimatedContentCompliment.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/EstimatedContentCompliment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* If end of content has not been reached by reading `limit` of bytes
2626
* then original content is returned.
2727
*
28-
* @since 0.34
28+
* @since 0.1
2929
*/
3030
final class EstimatedContentCompliment {
3131
/**

asto-core/src/main/java/com/artipie/asto/s3/InternalExceptionHandle.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/InternalExceptionHandle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Translate an exception happened inside future.
1717
*
1818
* @param <T> Future result type.
19-
* @since 0.34
19+
* @since 0.1
2020
*/
2121
final class InternalExceptionHandle<T> implements BiFunction<T, Throwable, CompletionStage<T>> {
2222

asto-core/src/main/java/com/artipie/asto/s3/MultipartUpload.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/MultipartUpload.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* Multipart upload of S3 object.
3333
*
34-
* @since 0.15
34+
* @since 0.1
3535
*/
3636
final class MultipartUpload {
3737

asto-core/src/main/java/com/artipie/asto/s3/S3HeadMeta.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/S3HeadMeta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* Metadata from S3 object.
14-
* @since 1.9
14+
* @since 0.1
1515
*/
1616
final class S3HeadMeta implements Meta {
1717

asto-core/src/main/java/com/artipie/asto/s3/S3Storage.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/S3Storage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/**
4040
* Storage that holds data in S3 storage.
4141
*
42-
* @since 0.15
42+
* @since 0.1
4343
* @todo #87:60min Do not await abort to complete if save() failed.
4444
* In case uploading content fails inside {@link S3Storage#save(Key, Content)} method
4545
* we are doing abort() for multipart upload.

asto-core/src/main/java/com/artipie/asto/s3/S3StorageFactory.java renamed to asto-s3/src/main/java/com/artipie/asto/s3/S3StorageFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Factory to create S3 storage.
2020
*
21-
* @since 1.13.0
21+
* @since 0.1
2222
*/
2323
@ArtipieStorageFactory("s3")
2424
public final class S3StorageFactory implements StorageFactory {

0 commit comments

Comments
 (0)