File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
main/java/uk/nhs/adaptors/gp2gp/common/storage
test/java/uk/nhs/adaptors/gp2gp/common/storage Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 33import org .springframework .beans .factory .FactoryBean ;
44
55import lombok .Setter ;
6+ import software .amazon .awssdk .regions .Region ;
67import software .amazon .awssdk .services .s3 .S3Client ;
78
89@ Setter
@@ -16,7 +17,7 @@ public StorageConnector getObject() {
1617 if (storageConnector == null ) {
1718 switch (StorageConnectorOptions .enumOf (configuration .getType ())) {
1819 case S3 :
19- storageConnector = new S3StorageConnector (S3Client .builder ().build (), configuration );
20+ storageConnector = new S3StorageConnector (S3Client .builder ().region ( Region . EU_WEST_2 ). build (), configuration );
2021 break ;
2122 case AZURE :
2223 storageConnector = new AzureStorageConnector ();
Original file line number Diff line number Diff line change 1+ package uk .nhs .adaptors .gp2gp .common .storage ;
2+
3+ import org .junit .jupiter .api .BeforeEach ;
4+ import org .junit .jupiter .api .Test ;
5+ import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
6+
7+ class StorageConnectorFactoryTest {
8+
9+ private StorageConnectorFactory storageConnectorFactory ;
10+
11+ @ BeforeEach
12+ void setUp () {
13+ storageConnectorFactory = new StorageConnectorFactory ();
14+ StorageConnectorConfiguration configuration = new StorageConnectorConfiguration ();
15+ configuration .setType (StorageConnectorOptions .S3 .getStringValue ());
16+ storageConnectorFactory .setConfiguration (configuration );
17+ }
18+
19+ @ Test
20+ void storageConnectorFactoryReturnsS3StorageConnectorTest () {
21+ StorageConnector storageConnector = storageConnectorFactory .getObject ();
22+
23+ assertInstanceOf (S3StorageConnector .class , storageConnector );
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments