Unverified Commit fb686f24 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

remove data path settings

parent fd1785c1
Pipeline #15096 passed with stages
in 13 minutes and 19 seconds
...@@ -26,12 +26,6 @@ spec: ...@@ -26,12 +26,6 @@ spec:
env: env:
- name: JOB_ID - name: JOB_ID
value: media-converter value: media-converter
- name: AUDIO_SINK_DIR
value: /data
- name: IMAGE_SINK_DIR
value: /data
- name: VIDEO_SINK_DIR
value: /data
- name: AUDIO_SNIPPET_DURATION - name: AUDIO_SNIPPET_DURATION
value: "30" value: "30"
- name: INTERNAL_BASE_URL - name: INTERNAL_BASE_URL
......
app: app:
audioSinkDir: ${AUDIO_SINK_DIR:?system}
imageSinkDir: ${IMAGE_SINK_DIR:?system}
videoSinkDir: ${VIDEO_SINK_DIR:?system}
audioSnippetDuration: ${AUDIO_SNIPPET_DURATION:?system} audioSnippetDuration: ${AUDIO_SNIPPET_DURATION:?system}
internalBaseUrl: ${INTERNAL_BASE_URL:?system} internalBaseUrl: ${INTERNAL_BASE_URL:?system}
externalBaseUrl: ${EXTERNAL_BASE_URL:?system} externalBaseUrl: ${EXTERNAL_BASE_URL:?system}
......
...@@ -31,9 +31,6 @@ import scala.collection.JavaConverters._ ...@@ -31,9 +31,6 @@ import scala.collection.JavaConverters._
object App extends scala.App with Logging { object App extends scala.App with Logging {
val settings = new SettingsLoader(List( val settings = new SettingsLoader(List(
"audioSinkDir",
"imageSinkDir",
"videoSinkDir",
"audioSnippetDuration", "audioSnippetDuration",
"internalBaseUrl", "internalBaseUrl",
"externalBaseUrl", "externalBaseUrl",
...@@ -47,9 +44,6 @@ object App extends scala.App with Logging { ...@@ -47,9 +44,6 @@ object App extends scala.App with Logging {
false) false)
val consumer = new KafkaConsumer[String, String](settings.getKafkaConsumerSettings) val consumer = new KafkaConsumer[String, String](settings.getKafkaConsumerSettings)
val fileHandler = new DisseminationCopyHandler( val fileHandler = new DisseminationCopyHandler(
settings.getAppSettings.getProperty("audioSinkDir"),
settings.getAppSettings.getProperty("imageSinkDir"),
settings.getAppSettings.getProperty("videoSinkDir"),
settings.getAppSettings.getProperty("audioSnippetDuration").toInt) settings.getAppSettings.getProperty("audioSnippetDuration").toInt)
val fCWrapper = FedoraClientWrapper( val fCWrapper = FedoraClientWrapper(
settings.getAppSettings.getProperty("internalBaseUrl"), settings.getAppSettings.getProperty("internalBaseUrl"),
......
...@@ -28,12 +28,8 @@ import scala.util.{Failure, Success, Try} ...@@ -28,12 +28,8 @@ import scala.util.{Failure, Success, Try}
/** /**
* Manages dissemination copies of media files * Manages dissemination copies of media files
*
* @param audioDestPath Path to folder containing audio dissemination copies
* @param imageDestPath Path to folder containing image dissemination copies
* @param videoDestPath Path to folder containing video dissemination copies
*/ */
class DisseminationCopyHandler(audioDestPath: String, imageDestPath: String, videoDestPath: String, audioSnippetDuration: Int) { class DisseminationCopyHandler(audioSnippetDuration: Int) {
private def writeData(data: ByteArrayOutputStream, destFile: Path): Try[Path] = { private def writeData(data: ByteArrayOutputStream, destFile: Path): Try[Path] = {
Try(new FileOutputStream(destFile.toFile)) match { Try(new FileOutputStream(destFile.toFile)) match {
......
...@@ -25,7 +25,7 @@ object FileUtils { ...@@ -25,7 +25,7 @@ object FileUtils {
import models.Conversions._ import models.Conversions._
val rootPath = "/media" val rootPath = "/data"
def createVideoFile(id: String, mimeType: MimeType): String = def createVideoFile(id: String, mimeType: MimeType): String =
s"$rootPath/$id.${getFileTypeExtension(mimeType).get}" s"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
package ch.memobase package ch.memobase
import java.io.{ByteArrayOutputStream, File, FileInputStream} import java.io.{ByteArrayOutputStream, File, FileInputStream}
import java.nio.file.{Files, Path, Paths} import java.nio.file.{Files, Paths}
import ch.memobase.TestUtilities._
import ch.memobase.models.{JpegFile, MimeType, Mp3File, VideoMpeg4File} import ch.memobase.models.{JpegFile, MimeType, Mp3File, VideoMpeg4File}
import org.scalatest.funsuite.AnyFunSuite import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.{Assertion, BeforeAndAfter} import org.scalatest.{Assertion, BeforeAndAfter}
import TestUtilities._
import scala.util.Try import scala.util.Try
...@@ -34,7 +34,7 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter { ...@@ -34,7 +34,7 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
private def fixture = { private def fixture = {
new { new {
val resPath = "src/test/resources" val resPath = "src/test/resources"
val fileHandler = new DisseminationCopyHandler(resPath, resPath, resPath, 30) val fileHandler = new DisseminationCopyHandler(30)
} }
} }
...@@ -67,12 +67,12 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter { ...@@ -67,12 +67,12 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
} }
private def testAudioCopy(pathToTmpDir: String, private def testAudioCopy(pathToTmpDir: String,
sourceFileName: String, sourceFileName: String,
destFileName: String, destFileName: String,
fileType: MimeType, fileType: MimeType,
isSnippet: Boolean, isSnippet: Boolean,
copyFun: (ByteArrayOutputStream, String, MimeType, Boolean) copyFun: (ByteArrayOutputStream, String, MimeType, Boolean)
=> Try[Boolean]): Assertion = { => Try[Boolean]): Assertion = {
val file = Paths.get(pathToTmpDir, sourceFileName).toFile val file = Paths.get(pathToTmpDir, sourceFileName).toFile
val data = new ByteArrayOutputStream(file.length().toInt) val data = new ByteArrayOutputStream(file.length().toInt)
val buffer = new Array[Byte](1024) val buffer = new Array[Byte](1024)
......
...@@ -28,7 +28,6 @@ import org.scalamock.scalatest.MockFactory ...@@ -28,7 +28,6 @@ import org.scalamock.scalatest.MockFactory
import org.scalatest.funsuite.AnyFunSuite import org.scalatest.funsuite.AnyFunSuite
import scala.io.Source import scala.io.Source
import scala.util.Success
class RecordProcessorTest extends AnyFunSuite with MockFactory { class RecordProcessorTest extends AnyFunSuite with MockFactory {
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
package ch.memobase package ch.memobase
import org.scalatest.Assertion
import scala.language.postfixOps import scala.language.postfixOps
object TestUtilities { object TestUtilities {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment