forked from raystack/firehose
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add oss storage type in blob sink
- Loading branch information
1 parent
afbbf43
commit 43dfbbc
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/test/java/com/gotocompany/firehose/config/OSSConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.gotocompany.firehose.config; | ||
|
||
import org.aeonbits.owner.ConfigFactory; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class OSSConfigTest { | ||
|
||
@Test | ||
public void shouldLoadOSSConfigWithPrefix() { | ||
OSSConfig config = ConfigFactory.create(OSSConfig.class, new HashMap<String, String>() {{ | ||
put("OSS_TYPE", "SINK_BLOB"); | ||
put("SINK_BLOB_OSS_ENDPOINT", "oss-cn-hangzhou.aliyuncs.com"); | ||
put("SINK_BLOB_OSS_BUCKET_NAME", "test-bucket"); | ||
put("SINK_BLOB_OSS_ACCESS_KEY_ID", "test-key"); | ||
put("SINK_BLOB_OSS_ACCESS_KEY_SECRET", "test-secret"); | ||
put("SINK_BLOB_OSS_DIRECTORY_PREFIX", "test-prefix"); | ||
put("SINK_BLOB_OSS_RETRY_MAX_ATTEMPTS", "5"); | ||
put("SINK_BLOB_OSS_RETRY_INITIAL_DELAY_MS", "2000"); | ||
put("SINK_BLOB_OSS_RETRY_MAX_DELAY_MS", "60000"); | ||
}}); | ||
|
||
assertEquals("oss-cn-hangzhou.aliyuncs.com", config.getOSSEndpoint()); | ||
assertEquals("test-bucket", config.getOSSBucketName()); | ||
assertEquals("test-key", config.getOSSAccessKeyId()); | ||
assertEquals("test-secret", config.getOSSAccessKeySecret()); | ||
assertEquals("test-prefix", config.getOSSDirectoryPrefix()); | ||
assertEquals(Long.valueOf(5), config.getOSSRetryMaxAttempts()); | ||
assertEquals(Long.valueOf(2000), config.getOSSRetryInitialDelayMS()); | ||
assertEquals(Long.valueOf(60000), config.getOSSRetryMaxDelayMS()); | ||
} | ||
|
||
@Test | ||
public void shouldLoadDefaultValues() { | ||
OSSConfig config = ConfigFactory.create(OSSConfig.class, new HashMap<String, String>() {{ | ||
put("OSS_TYPE", "SINK_BLOB"); | ||
put("SINK_BLOB_OSS_ENDPOINT", "oss-cn-hangzhou.aliyuncs.com"); | ||
put("SINK_BLOB_OSS_BUCKET_NAME", "test-bucket"); | ||
put("SINK_BLOB_OSS_ACCESS_KEY_ID", "test-key"); | ||
put("SINK_BLOB_OSS_ACCESS_KEY_SECRET", "test-secret"); | ||
}}); | ||
|
||
assertEquals("", config.getOSSDirectoryPrefix()); | ||
assertEquals(Long.valueOf(10), config.getOSSRetryMaxAttempts()); | ||
assertEquals(Long.valueOf(1000), config.getOSSRetryInitialDelayMS()); | ||
assertEquals(Long.valueOf(30000), config.getOSSRetryMaxDelayMS()); | ||
} | ||
} |