-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
885 additions
and
955 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,31 +1,30 @@ | ||
# This file is not designed to be used a lone, but | ||
# As an addition to './docker-compose.yml' ex: 'docker-compose -f ./docker-compose.yml -f ./docker-compose.deploy.yml up -d' | ||
version: "3" | ||
networks: | ||
hilfling-network: # Used for internal networking | ||
# # This file is not designed to be used a lone, but | ||
# # As an addition to './docker-compose.yml' ex: 'docker-compose -f ./docker-compose.yml -f ./docker-compose.deploy.yml up -d' | ||
# version: "3" | ||
# networks: | ||
# hilfling-network: # Used for internal networking | ||
|
||
services: | ||
run-tests: | ||
container_name: run-tests | ||
image: maven:3.6.3-jdk-11-slim | ||
working_dir: /hilfling | ||
entrypoint: mvn test | ||
# run commands as user instead of root to avoid privilage trouble | ||
user: "${UID}:${GID}" | ||
volumes: | ||
- ./:/hilfling | ||
depends_on: | ||
- postgres | ||
- fg-blob-storage | ||
expose: | ||
- 8080 | ||
networks: | ||
- hilfling-network | ||
environment: | ||
AZURE_STORAGE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://fg-blob-storage:10000/devstoreaccount1;QueueEndpoint=http://fg-blob-storage:10001/devstoreaccount1;TableEndpoint=http://fg-blob-storage:10002/devstoreaccount1;" | ||
DATABASE_USERNAME: $DATABASE_USERNAME | ||
DATABASE_PASSWORD: $DATABASE_PASSWORD | ||
DATABASE_URL: "jdbc:postgresql://postgres:5432/hilflingdb" #"jdbc:postgresql://postgres:5432/hilflingdb?createDatabaseIfNotExist=true" | ||
# services: | ||
# run-tests: | ||
# container_name: run-tests | ||
# image: maven:3.6.3-jdk-11-slim | ||
# working_dir: /hilfling | ||
# entrypoint: mvn test | ||
# # run commands as user instead of root to avoid privilage trouble | ||
# user: "${UID}:${GID}" | ||
# volumes: | ||
# - ./:/hilfling | ||
# depends_on: | ||
# - postgres | ||
# expose: | ||
# - 8080 | ||
# networks: | ||
# - hilfling-network | ||
# environment: | ||
# AZURE_STORAGE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://fg-blob-storage:10000/devstoreaccount1;QueueEndpoint=http://fg-blob-storage:10001/devstoreaccount1;TableEndpoint=http://fg-blob-storage:10002/devstoreaccount1;" | ||
# DATABASE_USERNAME: $DATABASE_USERNAME | ||
# DATABASE_PASSWORD: $DATABASE_PASSWORD | ||
# DATABASE_URL: "jdbc:postgresql://postgres:5432/hilflingdb" #"jdbc:postgresql://postgres:5432/hilflingdb?createDatabaseIfNotExist=true" | ||
|
||
labels: | ||
- traefik.enable=false | ||
# labels: | ||
# - traefik.enable=false |
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
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
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
42 changes: 21 additions & 21 deletions
42
src/main/kotlin/no/fg/hilflingbackend/blobStorage/AzureBlobStorage.kt
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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
package no.fg.hilflingbackend.blobStorage | ||
// package no.fg.hilflingbackend.blobStorage | ||
|
||
import com.azure.storage.blob.BlobServiceClient | ||
import com.azure.storage.blob.BlobServiceClientBuilder | ||
import no.fg.hilflingbackend.value_object.ImageFileName | ||
import org.springframework.stereotype.Repository | ||
import org.springframework.web.multipart.MultipartFile | ||
// import com.azure.storage.blob.BlobServiceClient | ||
// import com.azure.storage.blob.BlobServiceClientBuilder | ||
// import no.fg.hilflingbackend.value_object.ImageFileName | ||
// import org.springframework.stereotype.Repository | ||
// import org.springframework.web.multipart.MultipartFile | ||
|
||
@Repository | ||
class AzureBlobStorage(val azureStorageConfiguration: AzureStorageConfiguration) : IAzureBlobStorage { | ||
// @Repository | ||
// class AzureBlobStorage(val azureStorageConfiguration: AzureStorageConfiguration) : IAzureBlobStorage { | ||
|
||
val blobServiceClient: BlobServiceClient = BlobServiceClientBuilder() | ||
.connectionString(azureStorageConfiguration.azureStorageConnectionString) | ||
.buildClient() | ||
// val blobServiceClient: BlobServiceClient = BlobServiceClientBuilder() | ||
// .connectionString(azureStorageConfiguration.azureStorageConnectionString) | ||
// .buildClient() | ||
|
||
override fun saveFile(multipartFile: MultipartFile, blobContainerName: String, fileName: ImageFileName): String { | ||
// Have to get a blob container client | ||
val blobContainerClient = this.blobServiceClient.getBlobContainerClient(blobContainerName) | ||
// Create blob client | ||
val blobClient = blobContainerClient.getBlobClient(fileName.filename) | ||
// Upload file | ||
blobClient.upload(multipartFile.inputStream, multipartFile.size) | ||
// override fun saveFile(multipartFile: MultipartFile, blobContainerName: String, fileName: ImageFileName): String { | ||
// // Have to get a blob container client | ||
// val blobContainerClient = this.blobServiceClient.getBlobContainerClient(blobContainerName) | ||
// // Create blob client | ||
// val blobClient = blobContainerClient.getBlobClient(fileName.filename) | ||
// // Upload file | ||
// blobClient.upload(multipartFile.inputStream, multipartFile.size) | ||
|
||
return blobClient.blobUrl | ||
} | ||
} | ||
// return blobClient.blobUrl | ||
// } | ||
// } |
16 changes: 8 additions & 8 deletions
16
src/main/kotlin/no/fg/hilflingbackend/blobStorage/AzureStorageConfiguration.kt
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package no.fg.hilflingbackend.blobStorage | ||
// package no.fg.hilflingbackend.blobStorage | ||
|
||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Configuration | ||
// import org.springframework.beans.factory.annotation.Value | ||
// import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
data class AzureStorageConfiguration( | ||
@Value("\${spring.azure.storage.blob-storage.connection-string}") | ||
val azureStorageConnectionString: String | ||
) | ||
// @Configuration | ||
// data class AzureStorageConfiguration( | ||
// @Value("\${spring.azure.storage.blob-storage.connection-string}") | ||
// val azureStorageConnectionString: String | ||
// ) |
12 changes: 6 additions & 6 deletions
12
src/main/kotlin/no/fg/hilflingbackend/blobStorage/IAzureBlobStorage.kt
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package no.fg.hilflingbackend.blobStorage | ||
// package no.fg.hilflingbackend.blobStorage | ||
|
||
import no.fg.hilflingbackend.value_object.ImageFileName | ||
import org.springframework.web.multipart.MultipartFile | ||
// import no.fg.hilflingbackend.value_object.ImageFileName | ||
// import org.springframework.web.multipart.MultipartFile | ||
|
||
interface IAzureBlobStorage { | ||
fun saveFile(file: MultipartFile, blobContainerName: String = "alle", fileName: ImageFileName): String | ||
} | ||
// interface IAzureBlobStorage { | ||
// fun saveFile(file: MultipartFile, blobContainerName: String = "alle", fileName: ImageFileName): String | ||
// } |
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
42 changes: 21 additions & 21 deletions
42
src/test/kotlin/no/fg/hilflingbackend/HilflingApplicationTests.kt
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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
package no.fg.hilflingbackend | ||
// package no.fg.hilflingbackend | ||
|
||
import org.junit.jupiter.api.AfterAll | ||
import org.junit.jupiter.api.BeforeAll | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.TestInstance | ||
import org.springframework.boot.test.context.SpringBootTest | ||
// import org.junit.jupiter.api.AfterAll | ||
// import org.junit.jupiter.api.BeforeAll | ||
// import org.junit.jupiter.api.Test | ||
// import org.junit.jupiter.api.TestInstance | ||
// import org.springframework.boot.test.context.SpringBootTest | ||
|
||
@SpringBootTest | ||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
class HilflingApplicationTests { | ||
// @SpringBootTest | ||
// @TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
// class HilflingApplicationTests { | ||
|
||
@BeforeAll | ||
fun setup() { | ||
print(">> Setup") | ||
} | ||
// @BeforeAll | ||
// fun setup() { | ||
// print(">> Setup") | ||
// } | ||
|
||
@Test | ||
fun contextLoads() { | ||
} | ||
// @Test | ||
// fun contextLoads() { | ||
// } | ||
|
||
@AfterAll | ||
fun teardown() { | ||
println(">> Teardown") | ||
} | ||
} | ||
// @AfterAll | ||
// fun teardown() { | ||
// println(">> Teardown") | ||
// } | ||
// } |
20 changes: 10 additions & 10 deletions
20
src/test/kotlin/no/fg/hilflingbackend/controller/HealthControllerSpec.kt
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package no.fg.hilflingbackend.controller | ||
// package no.fg.hilflingbackend.controller | ||
|
||
import org.spekframework.spek2.Spek | ||
import org.spekframework.spek2.style.specification.describe | ||
import kotlin.test.assertEquals | ||
// import org.spekframework.spek2.Spek | ||
// import org.spekframework.spek2.style.specification.describe | ||
// import kotlin.test.assertEquals | ||
|
||
class HealthControllerSpec : Spek({ | ||
describe("GET /health") { | ||
val healthController: HealthController = HealthController() | ||
// class HealthControllerSpec : Spek({ | ||
// describe("GET /health") { | ||
// val healthController: HealthController = HealthController() | ||
|
||
assertEquals("OK!", healthController.getHealth()) | ||
} | ||
}) | ||
// assertEquals("OK!", healthController.getHealth()) | ||
// } | ||
// }) |
Oops, something went wrong.