Page History
...
단순하게 MockServer가 아닌 시뮬레이션이되며 도커에서 작동하기때문에 작동로그(INFO)를 확인할수 있습니다.
로컬기반 유닛테스트
...
S3를 로컬에서 클라우드요소없이 스트림처리 유닛테스트가 가능하며유닛테스트를 할수 있으며
Code Block |
---|
uploadSource .throttle(processCouuntPerSec, Duration.ofSeconds(1)) .runForeach(pair -> { ByteString byteString = pair.first(); long index = pair.second(); String dynamicFileKey = fileKey + index; // fileKey에 인덱스를 추가하여 고유한 파일 이름 생성 Source.single(byteString) .runWith(S3.multipartUpload(bucketName, dynamicFileKey) .withAttributes(S3Attributes.settings(s3Settings)), materializer) .thenAccept(result -> { LocalTime now = LocalTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); String formatedNow = now.format(formatter); System.out.println(formatedNow + " Upload complete: " + result.location()); greetActor.tell("hello", null); }) .exceptionally(throwable -> { System.err.println("Upload failed: " + throwable.getMessage()); return null; }); }, materializer); |
Code Block | ||
---|---|---|
| ||
Try Upload Wait for UploadCompleted 23:33:50 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt11 23:33:50 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt10 23:33:50 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt12 23:33:51 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt13 23:33:52 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt14 23:33:53 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt15 23:33:54 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt16 23:33:55 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt17 23:33:56 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt18 23:33:57 Upload complete: http://my-bucket.s3.localhost.localstack.cloud:4566/example.txt19 Try Download 23:33:57 Downloaded: example.txt19 23:33:57 Downloaded: example.txt10 23:33:57 Downloaded: example.txt17 23:33:57 Downloaded: example.txt11 23:33:57 Downloaded: example.txt12 23:33:57 Downloaded: example.txt14 23:33:57 Downloaded: example.txt16 23:33:57 Downloaded: example.txt18 23:33:57 Downloaded: example.txt15 23:33:57 Downloaded: example.txt13 |
- AkkaStream의 조절기를 활용 업로드의 TPS를 조절하고~ 업로드가 모두완료후 다운로드를 이어서 진행할수 있습니다.
유닛테스트 전체 코드는 다음링크를 통해 확인할수 있으며 ReactiveStream의 기능을 활용하여 S3의 스트림을 다양한 오픈스트림과 연결 시킬수 있으며
...