Skip to content

Commit

Permalink
spring update
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichsralf committed Jun 26, 2021
1 parent 0e63f58 commit 3be2715
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 50 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Build your own S3 Server and keep your data safe!
### Installation:
The Ladon S3 Server is built using Java 8-13 and Maven
```bash
mvn package && java -jar ladon-s3-server-boot/target/ladon-s3-server-boot-2.1.1.jar
mvn package && java -jar ladon-s3-server-boot/target/ladon-s3-server-boot-2.1.2.jar
```
Or run Docker:
```bash
mvn package && docker run -i --network=host mindconsulting/ladon:2.1.1
mvn package && docker run -i --network=host mindconsulting/ladon:2.1.2
```
### Customize:
The core functions of S3 are mapped to a class called S3Repository.
Expand Down Expand Up @@ -43,7 +43,7 @@ Supported so far is only access via REST API, no ACL, no policies, no torrent ..

To see what you can build with it have a look at [Ladon Data Center Edition](https://github.com/mindmill/ladon-data-center-edition) where you can see a full Ladon application.
### License
Copyright (C) 2019 Mind Consulting
Copyright (C) 2021 Mind Consulting

Free for private use, easy commercial licensing available [here](https://elopage.com/s/mind/ladon-s3-server/payment?locale=en)

Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mvn package && java -jar target/s3-server-{version}.jar


### License
Copyright (C) 2018 Mind Consulting
Copyright (C) 2021 Mind Consulting

Free for private use, easy commercial licensing available

Expand Down
4 changes: 2 additions & 2 deletions ladon-s3-server-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-boot</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<packaging>jar</packaging>

<name>s3-server-boot</name>
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import com.amazonaws.services.s3.S3ClientOptions;
import com.amazonaws.services.s3.model.*;
import org.apache.tomcat.util.http.fileupload.util.Streams;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand All @@ -25,21 +26,22 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;


/**
* Example Integration Test
*
* @author Ralf Ulrich
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = S3ServerApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class FSStorageTests {

private ExecutorService service;

@Before
@BeforeEach
public void setUp() {
service = Executors.newFixedThreadPool(3);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,31 @@
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.tomcat.util.http.fileupload.util.Streams;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Example Integration Test
*
* @author Ralf Ulrich
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = S3ServerApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class S3ServerApplicationTests {

@Before
@BeforeEach
public void setUp() {
AmazonS3Client client = getClient();
client.createBucket("test");
Expand Down Expand Up @@ -131,7 +129,7 @@ public void testPutObjectNoMd5NoLength() throws IOException {
}

@Test
@Ignore
@Disabled
public void testPutBigObjectAndVerifyGet() throws IOException {
final long TEST_LENGTH = 1024 * 1024 * 1024 * 6L; // 6 GB

Expand Down Expand Up @@ -171,7 +169,7 @@ public int read() throws IOException {
}

@Test
public void testCopyObject() throws IOException {
public void testCopyObject() {
AmazonS3Client client = getClient();
Bucket b = client.createBucket(UUID.randomUUID().toString());
ObjectMetadata meta = new ObjectMetadata();
Expand All @@ -180,27 +178,31 @@ public void testCopyObject() throws IOException {

}

@Test(expected = AmazonS3Exception.class)
public void testPutObjectWrongMd5() throws IOException {
AmazonS3Client client = getClient();
Bucket b = client.createBucket(UUID.randomUUID().toString());
String md5 = Base64.encodeBase64String(DigestUtils.md5("test1"));
ObjectMetadata meta = new ObjectMetadata();
meta.setContentMD5(md5);
client.putObject(b.getName(), "test.txt", new ByteArrayInputStream("test".getBytes()), meta);
@Test
public void testPutObjectWrongMd5() {
Assertions.assertThrows(AmazonS3Exception.class, () -> {
AmazonS3Client client = getClient();
Bucket b = client.createBucket(UUID.randomUUID().toString());
String md5 = Base64.encodeBase64String(DigestUtils.md5("test1"));
ObjectMetadata meta = new ObjectMetadata();
meta.setContentMD5(md5);
client.putObject(b.getName(), "test.txt", new ByteArrayInputStream("test".getBytes()), meta);
});

}

@Test(expected = AmazonClientException.class)
@Test
public void testPutObjectWrongLengthRightMd5() throws IOException {
AmazonS3Client client = getClient();
Bucket b = client.createBucket(UUID.randomUUID().toString());
String md5 = Base64.encodeBase64String(DigestUtils.md5("test"));
ObjectMetadata meta = new ObjectMetadata();
meta.setContentMD5(md5);
meta.setContentLength(5);
client.putObject(b.getName(), "test.txt", new ByteArrayInputStream("test".getBytes()), meta);

Assertions.assertThrows(AmazonClientException.class, () -> {
AmazonS3Client client = getClient();
Bucket b = client.createBucket(UUID.randomUUID().toString());
String md5 = Base64.encodeBase64String(DigestUtils.md5("test"));
ObjectMetadata meta = new ObjectMetadata();
meta.setContentMD5(md5);
meta.setContentLength(5);
client.putObject(b.getName(), "test.txt", new ByteArrayInputStream("test".getBytes()), meta);

});
}

@Test
Expand Down Expand Up @@ -266,7 +268,7 @@ public void testDelimiter() {
String bucket = UUID.randomUUID().toString();
client.createBucket(bucket);
List<S3ObjectSummary> objectSummaries = client.listObjects(new ListObjectsRequest(bucket, null, null, null, null)).getObjectSummaries();
assertEquals(0, objectSummaries.size());
assertEquals(0, objectSummaries.size());

ObjectMetadata meta = new ObjectMetadata();
client.putObject(bucket, "one/one.txt", new ByteArrayInputStream("test".getBytes()), meta);
Expand All @@ -278,9 +280,9 @@ public void testDelimiter() {


ObjectListing ol = client.listObjects(new ListObjectsRequest(bucket, null, null, "/", null));
assertEquals(0,ol.getObjectSummaries().size());
assertEquals(0, ol.getObjectSummaries().size());
System.out.println(ol.getCommonPrefixes());
assertEquals(3,ol.getCommonPrefixes().size());
assertEquals(3, ol.getCommonPrefixes().size());

}

Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-fs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ s3server.fsrepo.root=${user.home}/.s3server
```

# License
Copyright (C) 2018 Mind Consulting
Copyright (C) 2021 Mind Consulting

Free for private use, easy commercial licensing available

Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-fs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-fs</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-osgi-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-osgi-starter</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Core Library containing the S3Servlet and S3Repository Interface


### License
Copyright (C) 2018 Mind Consulting
Copyright (C) 2021 Mind Consulting

Free for private use, easy commercial licensing available

Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>s3-server</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<packaging>pom</packaging>

<name>s3-server-boot</name>
Expand Down

0 comments on commit 3be2715

Please sign in to comment.