From: Vásáry Dániel Date: Wed, 15 Nov 2023 19:49:05 +0000 (+0100) Subject: BC export, first look X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=556e4609732cabc11c8e383b67a5ab1385c5acc1;p=mediacube.git BC export, first look --- diff --git a/mc-vod-sync/QUESTIONS.md b/mc-vod-sync/QUESTIONS.md index 2bff3a6c..196c36f8 100644 --- a/mc-vod-sync/QUESTIONS.md +++ b/mc-vod-sync/QUESTIONS.md @@ -1,3 +1,6 @@ +* A custom fields API kellhet? Ott be lehet állítani a custom filed-re pl. azt, hogy kötelező e, így amíg nincs értéke + addig a videó nem aktív. Ennek használata nélkül is létrehozható video? +* * A sunset kezelése is kell, tehát jöhet adat későbbi sunset-el? * A sunset és sunrise formátuma legyen egyforma (mindegy melyik) minden sorra! * Mik a kötelező mezők? Most: playlist, sunset, sunrise, title diff --git a/mc-vod-sync/mc-vod-sync-app/src/main/java/hu/user/mcvodsync/VodSyncEntry.java b/mc-vod-sync/mc-vod-sync-app/src/main/java/hu/user/mcvodsync/VodSyncEntry.java index cbabc15b..065235dd 100644 --- a/mc-vod-sync/mc-vod-sync-app/src/main/java/hu/user/mcvodsync/VodSyncEntry.java +++ b/mc-vod-sync/mc-vod-sync-app/src/main/java/hu/user/mcvodsync/VodSyncEntry.java @@ -8,9 +8,7 @@ package hu.user.mcvodsync; import lombok.extern.log4j.Log4j2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import org.springframework.context.ApplicationContext; import org.springframework.core.SpringVersion; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableScheduling; @@ -23,19 +21,9 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; @EnableScheduling public class VodSyncEntry extends SpringBootServletInitializer { - public static void main(String[] args) { -// AnsiConsole.systemInstall(); -// System.out.println( ansi().eraseScreen()); log.info("Spring version: {}", SpringVersion.getVersion()); - ApplicationContext applicationContext = SpringApplication.run(VodSyncEntry.class, args); -// AnsiConsole.systemUninstall(); - } - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - logger.info("Starting configure"); - return builder.sources(VodSyncEntry.class); + SpringApplication.run(VodSyncEntry.class, args); } } diff --git a/mc-vod-sync/mc-vod-sync-app/src/main/resources/application-dev.yaml b/mc-vod-sync/mc-vod-sync-app/src/main/resources/application-dev.yaml index e37ada87..167d87e6 100644 --- a/mc-vod-sync/mc-vod-sync-app/src/main/resources/application-dev.yaml +++ b/mc-vod-sync/mc-vod-sync-app/src/main/resources/application-dev.yaml @@ -24,6 +24,13 @@ spring: retrieveMessagesFromServerOnGetMessage: true username: db2admin password: password + mail: + host: mx.in.useribm.hu +# port: 587 +# spring.mail.username= +# spring.mail.password= +# spring.mail.properties.mail.smtp.auth=true +# spring.mail.properties.mail.smtp.starttls.enable=true camunda.bpm: generic-properties.properties: telemetry-reporter-activate: false diff --git a/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/AssetMapperIT.java b/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/AssetMapperIT.java new file mode 100644 index 00000000..44c4c855 --- /dev/null +++ b/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/AssetMapperIT.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) $today.year-$today.month-24. + * By elGekko + */ + +package hu.user.mcvodsync; + +import com.brightcove.cms.client.model.Video; +import hu.user.mcvodsync.db.Asset; +import hu.user.mcvodsync.service.export.VideoMapper; +import lombok.extern.log4j.Log4j2; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.assertEquals; + + +@Log4j2 +@RunWith(SpringRunner.class) +@ComponentScan("hu.user.lis") +@SpringBootTest +@ActiveProfiles("dev") +public class AssetMapperIT { + @Autowired + private VideoMapper videoMapper; + + @Test + public void mapAssetToVideoTest() { + Asset asset = Asset.builder() + .progLocalTitle("progLocalTitle") + .catalogId("catalogId") + .hubInfo("hubInfo") + .build(); + Video video = videoMapper.toVideo(asset); + + assertEquals(asset.getCatalogId(), video.getReferenceId()); + assertEquals(asset.getProgLocalTitle(), video.getName()); + assertEquals(asset.getHubInfo(), video.getCustomFields().get(VideoMapper.NOTES)); + } + + @Test + public void mapVideoToAssetTest() { + Video video = new Video(); + video.setReferenceId("setReferenceId"); + video.setName("name"); + video.putCustomFieldsItem(VideoMapper.NOTES, "notes"); + Asset asset = videoMapper.toAsset(video); + + assertEquals(video.getReferenceId(), asset.getCatalogId()); + assertEquals(video.getName(), asset.getProgLocalTitle()); + assertEquals(video.getCustomFields().get(VideoMapper.NOTES), asset.getHubInfo()); + } +} diff --git a/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/BrightCoveClientIT.java b/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/BrightCoveClientIT.java index 4bc34606..54f58743 100644 --- a/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/BrightCoveClientIT.java +++ b/mc-vod-sync/mc-vod-sync-app/src/test/java/hu/user/mcvodsync/BrightCoveClientIT.java @@ -2,8 +2,11 @@ package hu.user.mcvodsync; import com.brightcove.cms.client.model.CreateVideoRequestBodyFields; import com.brightcove.cms.client.model.Playlist; +import com.brightcove.cms.client.model.PlaylistInputFields; import com.brightcove.cms.client.model.Video; +import com.google.common.collect.ImmutableMap; import hu.user.mcvodsync.brightcove.BrightCoveClient; +import hu.user.mcvodsync.brightcove.PagedSearch; import lombok.extern.log4j.Log4j2; import org.junit.Test; import org.junit.runner.RunWith; @@ -13,8 +16,13 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; @Log4j2 @RunWith(SpringRunner.class) @@ -28,14 +36,61 @@ public class BrightCoveClientIT { private BrightCoveClient bcClient; + private List getVideos() { + List ids = new ArrayList<>(); + PagedSearch