fix
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2020-05-22 01:47:51 +02:00
parent 8bec7d6120
commit 5f42110d75
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
3 changed files with 8 additions and 17 deletions

View File

@ -12,8 +12,8 @@ buildscript {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_1_8
} }
apply plugin: 'kotlin' apply plugin: 'kotlin'
@ -47,7 +47,6 @@ dependencies {
compile 'com.rabbitmq:amqp-client:2.7.1' compile 'com.rabbitmq:amqp-client:2.7.1'
compile 'com.zaxxer:HikariCP:2.7.8' compile 'com.zaxxer:HikariCP:2.7.8'
compile 'com.viartemev:the-white-rabbit:0.0.5' compile 'com.viartemev:the-white-rabbit:0.0.5'
compile 'com.sun.activation:javax.activation:1.2.0'
implementation "org.koin:koin-ktor:$koin_version" implementation "org.koin:koin-ktor:$koin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "io.ktor:ktor-server-netty:$ktor_version" implementation "io.ktor:ktor-server-netty:$ktor_version"
@ -66,7 +65,7 @@ kotlin.experimental.coroutines = 'enable'
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions { kotlinOptions {
jvmTarget = "11" jvmTarget = "1.8"
} }
} }

View File

@ -8,7 +8,7 @@ services:
volumes: volumes:
- "input-ktor-data:/var/lib/postgresql/data" - "input-ktor-data:/var/lib/postgresql/data"
ports: ports:
- "127.0.0.1:54321:5432" - "127.0.0.1:5432:5432"
environment: environment:
POSTGRES_USER: "input-service" POSTGRES_USER: "input-service"
POSTGRES_PASSWORD: "input-service" POSTGRES_PASSWORD: "input-service"
@ -22,7 +22,6 @@ services:
environment: environment:
DB_USER: "input-service" DB_USER: "input-service"
DB_PASSWORD: "input-service" DB_PASSWORD: "input-service"
POSTGRES_DB: "input-service"
DB_URL: "jdbc:postgresql://input-service-postgres:5432/input-service" DB_URL: "jdbc:postgresql://input-service-postgres:5432/input-service"
MQ_HOST: rabbitmq MQ_HOST: rabbitmq
MQ_USERNAME: rabbitmq MQ_USERNAME: rabbitmq
@ -41,7 +40,7 @@ services:
RABBITMQ_DEFAULT_VHOST: "/" RABBITMQ_DEFAULT_VHOST: "/"
ports: ports:
- "127.0.0.1:15672:15672" - "127.0.0.1:15672:15672"
- "127.0.0.1:5672:5672" - "127.0.0.1:5672:5672"
volumes: volumes:
input-ktor-data: input-ktor-data:

View File

@ -6,11 +6,7 @@ import com.kmalbz.api.model.SampleObject
import com.kmalbz.database.service.IInputObjectService import com.kmalbz.database.service.IInputObjectService
import com.rabbitmq.client.BuiltinExchangeType import com.rabbitmq.client.BuiltinExchangeType
import com.rabbitmq.client.ConnectionFactory import com.rabbitmq.client.ConnectionFactory
import com.rabbitmq.client.MessageProperties
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
import com.viartemev.thewhiterabbit.channel.confirmChannel
import com.viartemev.thewhiterabbit.channel.publish
import com.viartemev.thewhiterabbit.publisher.OutboundMessage
import io.ktor.application.call import io.ktor.application.call
import io.ktor.config.HoconApplicationConfig import io.ktor.config.HoconApplicationConfig
import io.ktor.http.HttpStatusCode import io.ktor.http.HttpStatusCode
@ -36,7 +32,6 @@ import java.time.LocalDate
import java.util.* import java.util.*
import javax.activation.MimetypesFileTypeMap import javax.activation.MimetypesFileTypeMap
/** /**
* Input Service * Input Service
* *
@ -79,24 +74,22 @@ class InputServiceServer {
when (part) { when (part) {
is PartData.FormItem -> { is PartData.FormItem -> {
if (part.name == "description") { if (part.name == "description") {
print(part.value)
description = gson.fromJson(part.value, SampleObject::class.java) description = gson.fromJson(part.value, SampleObject::class.java)
} }
} }
is PartData.FileItem -> { is PartData.FileItem -> {
val file = File(System.getProperty( "java.io.tmpdir"), "upload-${System.currentTimeMillis()}") val file = File(System.getProperty( "java.io.tmpdir"), "upload-${System.currentTimeMillis()}")
part.streamProvider().use { input -> file.outputStream().buffered().use { output -> input.copyToSuspend(output) } } part.streamProvider().use { input -> file.outputStream().buffered().use { output -> input.copyToSuspend(output) } }
val fileType = MimetypesFileTypeMap().getContentType(file)
if (fileType != "audio/wave")
call.respond(HttpStatusCode.BadRequest)
soundFile = file soundFile = file
} }
} }
part.dispose() part.dispose()
} }
if (description == null || soundFile == null) if ((description == null) or (soundFile == null)) {
call.respond(HttpStatusCode.ExpectationFailed) call.respond(HttpStatusCode.ExpectationFailed)
return@post
}
val tag = UUID.randomUUID() val tag = UUID.randomUUID()