From 3527f2f68623d21721da8f86db0184c7d1b66d64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Fri, 3 Nov 2023 21:00:57 +0100 Subject: [PATCH] XLS import logic updated, test file normalized --- .../hu/user/mcvodsync/BrightCoveClientIT.java | 86 ++++++++++++-- .../hu/user/mcvodsync/VodXlsProcessorIT.java | 25 +++- ..._Selekt_jogositott_tartalmak_20230906.xlsx | Bin 1779152 -> 0 bytes .../src/test/resources/testdata.xlsx | Bin 0 -> 2521416 bytes .../mc-vod-sync-brightcove.iml | 7 +- .../brightcove/BrightCoveClient.java | 108 +++++++++++++++++- .../scripts/002_create_system_tables.sql | 6 +- .../scripts/003_create_business_tables.sql | 57 ++++++--- .../main/java/hu/user/mcvodsync/db/Asset.java | 30 ++--- .../java/hu/user/mcvodsync/db/AssetId.java | 25 ---- .../java/hu/user/mcvodsync/db/AssetSync.java | 19 ++- .../db/repository/AssetRepository.java | 13 ++- .../db/repository/AssetSyncRepository.java | 3 +- mc-vod-sync/mc-vod-sync-service/pom.xml | 6 + .../service/schedule/TaskSchedules.java | 6 +- .../service/xls/AssetImportService.java | 63 ++++++---- .../mcvodsync/service/xls/AssetMapper.java | 67 +++++++++-- .../service/xls/VodXlsProcessor.java | 82 ++++++++----- 18 files changed, 439 insertions(+), 164 deletions(-) delete mode 100644 mc-vod-sync/mc-vod-sync-app/src/test/resources/AMC_Selekt_jogositott_tartalmak_20230906.xlsx create mode 100644 mc-vod-sync/mc-vod-sync-app/src/test/resources/testdata.xlsx delete mode 100644 mc-vod-sync/mc-vod-sync-db/src/main/java/hu/user/mcvodsync/db/AssetId.java 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 54cc4eb3..4bc34606 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 @@ -1,6 +1,8 @@ package hu.user.mcvodsync; +import com.brightcove.cms.client.model.CreateVideoRequestBodyFields; import com.brightcove.cms.client.model.Playlist; +import com.brightcove.cms.client.model.Video; import hu.user.mcvodsync.brightcove.BrightCoveClient; import lombok.extern.log4j.Log4j2; import org.junit.Test; @@ -14,8 +16,6 @@ import org.springframework.test.context.junit4.SpringRunner; import java.util.List; -import static org.junit.Assert.assertNotNull; - @Log4j2 @RunWith(SpringRunner.class) @ComponentScan("hu.user.mcvodsync") @@ -23,21 +23,15 @@ import static org.junit.Assert.assertNotNull; @ActiveProfiles("dev") @TestPropertySource("classpath:application-dev.yaml") public class BrightCoveClientIT { + @Autowired private BrightCoveClient bcClient; - @Test - public void testOAuth() { - String authToken = bcClient.createToken(); - log.info("Token created {}", authToken); - assertNotNull(authToken); - } @Test public void testGetPlayLists() { - String authToken = bcClient.createToken(); try { - List playLists = bcClient.getPlayLists(authToken, 0, 10); + List playLists = bcClient.getPlayLists(0, 10); playLists.forEach(playList -> { log.info(playList.getName()); @@ -48,4 +42,76 @@ public class BrightCoveClientIT { } } + @Test + public void testGetVideos() { + try { + List