git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorvasary.daniel <TFS\vasary.daniel>
Fri, 25 Jun 2021 13:37:45 +0000 (13:37 +0000)
committervasary.daniel <TFS\vasary.daniel>
Fri, 25 Jun 2021 13:37:45 +0000 (13:37 +0000)
server/hu.user.mediacube.executors.tests/settings/application.yaml
server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Support.java
server/user.jobengine.osgi.db/migrations/scripts/037_add_disableproxy_mediafile.sql [new file with mode: 0644]
server/user.mediacube.metadata/build-metadata.launch [new file with mode: 0644]

index 39e7b9522e30be0a219bd7081a9e3c4b3eaea304..93cf8eb7f0d8aa4a116be1a1487b81f681ae62e5 100644 (file)
@@ -35,6 +35,9 @@ services:
       rundowns-collection-name: rundowns\r
       stories-collection-name: stories\r
       folders-collection-name: storyfolders\r
+#      rundowns-collection-name: test-rundowns\r
+#      stories-collection-name: test-stories\r
+#      folders-collection-name: test-storyfolders\r
 jobs:\r
    validate-transfers: false\r
    copy-buffer-size: 32768\r
index 58d2470dff4cd36aa68a8c0c922301dcbd9f8e36..b334efaefe1e1071efd1add169a8c2ecf59212f8 100644 (file)
@@ -12,7 +12,9 @@ import java.nio.file.Paths;
 import java.nio.file.attribute.BasicFileAttributes;\r
 import java.sql.Timestamp;\r
 import java.util.ArrayList;\r
+import java.util.HashSet;\r
 import java.util.List;\r
+import java.util.Set;\r
 \r
 import org.jboss.resteasy.client.jaxrs.ResteasyClient;\r
 import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
@@ -26,12 +28,15 @@ import com.ibm.nosql.json.api.BasicDBObject;
 import com.ibm.nosql.json.api.DB;\r
 import com.ibm.nosql.json.api.DBCollection;\r
 import com.ibm.nosql.json.api.DBCursor;\r
+import com.ibm.nosql.json.api.DBObject;\r
 import com.ibm.nosql.json.api.QueryBuilder;\r
 \r
 import user.commons.ListUtils;\r
 import user.commons.RemoteFile;\r
 import user.commons.StoreUri;\r
 import user.commons.nosql.NoSQLUtils;\r
+import user.commons.octopus.IOctopusAPI;\r
+import user.commons.octopus.OctopusAPI;\r
 import user.commons.remotestore.RemoteStoreProtocol;\r
 import user.jobengine.db.IItemManager;\r
 import user.jobengine.db.Item;\r
@@ -53,23 +58,27 @@ public class Support {
 \r
        @BeforeClass\r
        static public void setUpConnection() throws TSMException {\r
-               //              System.setProperty("jobengine.octopus.rundowns.name", "test_rundowns");\r
-               //              System.setProperty("jobengine.octopus.stories.name", "test_stories");\r
-               //              System.setProperty("jobengine.octopus.storyfolders.name", "test_storyfolders");\r
-               //              System.setProperty("jobengine.octopus.rundowns.name", "rundowns180620");\r
-               //              System.setProperty("jobengine.octopus.stories.name", "stories180620");\r
-               //              System.setProperty("jobengine.octopus.storyfolders.name", "storyfolders180620");\r
-               System.setProperty("jobengine.octopus.rundowns.name", "rundowns181217");\r
-               System.setProperty("jobengine.octopus.stories.name", "stories181217");\r
-               System.setProperty("jobengine.octopus.storyfolders.name", "storyfolders181217");\r
-\r
-               //              System.setProperty("jobengine.nosql.db.url", "jdbc:db2://10.11.1.90:50000/mc:retrieveMessagesFromServerOnGetMessage=true;");\r
-               //              System.setProperty("jobengine.nosql.db.user", "db2admin");\r
-               //              System.setProperty("jobengine.nosql.db.password", "password");\r
-               System.setProperty("nexio.host", "10.10.1.55");\r
-               //              System.setProperty(ItemManager.DBURL, "jdbc:db2://10.228.212.42:50000/mc:retrieveMessagesFromServerOnGetMessage=true;");\r
-               //              System.setProperty(ItemManager.DBUSERNAME, "blobtest");\r
-               //              System.setProperty(ItemManager.DBPASSWORD, "blobtest");\r
+               // System.setProperty("jobengine.octopus.rundowns.name", "test_rundowns");\r
+               // System.setProperty("jobengine.octopus.stories.name", "test_stories");\r
+               // System.setProperty("jobengine.octopus.storyfolders.name",\r
+               // "test_storyfolders");\r
+               // System.setProperty("jobengine.octopus.rundowns.name", "rundowns180620");\r
+               // System.setProperty("jobengine.octopus.stories.name", "stories180620");\r
+               // System.setProperty("jobengine.octopus.storyfolders.name",\r
+               // "storyfolders180620");\r
+//             System.setProperty("jobengine.octopus.rundowns.name", "rundowns181217");\r
+//             System.setProperty("jobengine.octopus.stories.name", "stories181217");\r
+//             System.setProperty("jobengine.octopus.storyfolders.name", "storyfolders181217");\r
+\r
+               // System.setProperty("jobengine.nosql.db.url",\r
+               // "jdbc:db2://10.11.1.90:50000/mc:retrieveMessagesFromServerOnGetMessage=true;");\r
+               // System.setProperty("jobengine.nosql.db.user", "db2admin");\r
+               // System.setProperty("jobengine.nosql.db.password", "password");\r
+//             System.setProperty("nexio.host", "10.10.1.55");\r
+               // System.setProperty(ItemManager.DBURL,\r
+               // "jdbc:db2://10.228.212.42:50000/mc:retrieveMessagesFromServerOnGetMessage=true;");\r
+               // System.setProperty(ItemManager.DBUSERNAME, "blobtest");\r
+               // System.setProperty(ItemManager.DBPASSWORD, "blobtest");\r
                // System.setProperty(ItemManager.DBURL,\r
 \r
                manager = new ItemManager();\r
@@ -101,7 +110,7 @@ public class Support {
                        }\r
                        stream.close();\r
 \r
-                       //check_rd_process(allFiles, allStatus);\r
+                       // check_rd_process(allFiles, allStatus);\r
                } catch (Exception e) {\r
                        System.err.println(e.getMessage());\r
                }\r
@@ -117,7 +126,8 @@ public class Support {
 \r
        private void check_rd_collect_status(Path mediaFilePath, List<String> allFiles) {\r
                File file = mediaFilePath.toFile();\r
-               if (file.isDirectory() || (!file.getName().toUpperCase().endsWith(".JSON") && !file.getName().toUpperCase().endsWith(".KILLDATE")))\r
+               if (file.isDirectory() || (!file.getName().toUpperCase().endsWith(".JSON")\r
+                               && !file.getName().toUpperCase().endsWith(".KILLDATE")))\r
                        return;\r
 \r
                if (file.getName().toUpperCase().endsWith(".KILLDATE")) {\r
@@ -143,7 +153,8 @@ public class Support {
        @Test\r
        public void getJSONFile() throws Exception {\r
                Path filePath = Paths.get("//10.11.1.90/root/mediacube/data/ARCHIVE/14-03379-0092-1_.mov");\r
-               Path json = Paths.get(Paths.get(filePath.getParent().toString(), ".STATUS", filePath.getFileName().toString()) + ".json");\r
+               Path json = Paths.get(\r
+                               Paths.get(filePath.getParent().toString(), ".STATUS", filePath.getFileName().toString()) + ".json");\r
                System.out.println(json);\r
        }\r
 \r
@@ -153,37 +164,43 @@ public class Support {
                assertNotNull(media);\r
        }\r
 \r
-       //      private void check_rd_process(List<String> allFiles, List<String> allStatus) {\r
-       //              File mediaFile = mediaFilePath.toFile();\r
-       //              if (mediaFile.isDirectory() || !mediaFile.getName().toUpperCase().endsWith(".MXF"))\r
-       //                      return;\r
-       //              Path status = Paths.get(mediaFilePath.getParent().toString(), ".STATUS", mediaFile.getName() + ".json");\r
-       //              if (!status.toFile().exists()) {\r
-       //                      System.out.println("Nincs JSON: " + mediaFile.getAbsolutePath());\r
-       //              }\r
+       // private void check_rd_process(List<String> allFiles, List<String> allStatus)\r
+       // {\r
+       // File mediaFile = mediaFilePath.toFile();\r
+       // if (mediaFile.isDirectory() ||\r
+       // !mediaFile.getName().toUpperCase().endsWith(".MXF"))\r
+       // return;\r
+       // Path status = Paths.get(mediaFilePath.getParent().toString(), ".STATUS",\r
+       // mediaFile.getName() + ".json");\r
+       // if (!status.toFile().exists()) {\r
+       // System.out.println("Nincs JSON: " + mediaFile.getAbsolutePath());\r
+       // }\r
        //\r
-       //              if (mediaFile.length() == 0) {\r
-       //                      String houseid = mediaFile.getName().substring(0, mediaFile.getName().lastIndexOf("."));\r
-       //                      final String idToCheck = houseid.substring(0, houseid.lastIndexOf("-"));\r
-       //                      MetadataType metadataType = MetadataTypeDetector.GuessMetadataType(idToCheck);\r
-       //                      if (metadataType == MetadataType.OctopusPlaceholder) {\r
-       //                              String query = String.format("select count(*) from mediafile where houseid like '%s%%'", idToCheck);\r
-       //                              IResultSetConsumer consumer = rs -> {\r
-       //                                      if (rs.getInt(1) == 0) {\r
+       // if (mediaFile.length() == 0) {\r
+       // String houseid = mediaFile.getName().substring(0,\r
+       // mediaFile.getName().lastIndexOf("."));\r
+       // final String idToCheck = houseid.substring(0, houseid.lastIndexOf("-"));\r
+       // MetadataType metadataType =\r
+       // MetadataTypeDetector.GuessMetadataType(idToCheck);\r
+       // if (metadataType == MetadataType.OctopusPlaceholder) {\r
+       // String query = String.format("select count(*) from mediafile where houseid\r
+       // like '%s%%'", idToCheck);\r
+       // IResultSetConsumer consumer = rs -> {\r
+       // if (rs.getInt(1) == 0) {\r
        //\r
-       //                                              File f = check_rd_nonzero_fellow(idToCheck, allFiles);\r
-       //                                              if (f == null)\r
-       //                                                      System.out.println("0 még sincs korábbi: " + mediaFile.getAbsolutePath());\r
+       // File f = check_rd_nonzero_fellow(idToCheck, allFiles);\r
+       // if (f == null)\r
+       // System.out.println("0 még sincs korábbi: " + mediaFile.getAbsolutePath());\r
        //\r
-       //                                      }\r
-       //                                      return false;\r
-       //                              };\r
-       //                              manager.executeQuery(query, consumer, null);\r
-       //                      }\r
+       // }\r
+       // return false;\r
+       // };\r
+       // manager.executeQuery(query, consumer, null);\r
+       // }\r
        //\r
-       //              }\r
+       // }\r
        //\r
-       //      }\r
+       // }\r
 \r
        private void rescue_archive(RescueNEXIOMaterials processor, String clipName, long duration) throws Exception {\r
                /*\r
@@ -194,7 +211,7 @@ public class Support {
                RundownArchive ra = processor.processRundow(clipName, duration);\r
                if (ra != null) {\r
                        System.out.println(ra.getItemTitle());\r
-                       //processor.copy(ra);\r
+                       // processor.copy(ra);\r
                } else\r
                        System.out.println("No rundown for " + clipName);\r
 \r
@@ -210,7 +227,8 @@ public class Support {
                DBCursor cursor = collection.find(queryBuilder.get());\r
                int count = 0;\r
                RescueNEXIOMaterials processor = new RescueNEXIOMaterials();\r
-               processor.set(2098, "administrator", "system", "ftp://10.10.1.100/ARCHIVE/TEST", "mediacube", "Broadca5T", 21, "ARCHIVED", manager);\r
+               processor.set(2098, "administrator", "system", "ftp://10.10.1.100/ARCHIVE/TEST", "mediacube", "Broadca5T", 21,\r
+                               "ARCHIVED", manager);\r
 \r
                List<BasicDBObject> clips = ListUtils.cast(cursor.toArray());\r
                for (BasicDBObject clip : clips) {\r
@@ -232,24 +250,26 @@ public class Support {
 \r
        @Test\r
        public void test_PlanAirExtensions() throws Exception {\r
-               String actual = PlanAirExtensions.getMorpeusXML(manager, "jdbc:sqlserver://10.10.1.45;databaseName=PA_Echo;", "MAM", "Echotv.hu", "M009729A", "ISILON");\r
+               String actual = PlanAirExtensions.getMorpeusXML(manager, "jdbc:sqlserver://10.10.1.45;databaseName=PA_Echo;",\r
+                               "MAM", "Echotv.hu", "M009729A", "ISILON");\r
                assertNotNull(actual);\r
                assertTrue(actual.length() > 0);\r
        }\r
 \r
        @Test\r
        public void test_ProjectCleanupMountedLocationStep() throws Exception {\r
-               //TODO\r
+               // TODO\r
                ProjectCleanupMountedLocationStep sut = new ProjectCleanupMountedLocationStep();\r
                sut.execute("c://_video//projects", null, new JobRuntime());\r
        }\r
 \r
        @Test\r
        public void test_Solr() throws Exception {\r
-               //http://lucene.apache.org/solr/guide/7_5/using-solrj.html#using-solrj\r
+               // http://lucene.apache.org/solr/guide/7_5/using-solrj.html#using-solrj\r
 \r
                final String solrUrl = "http://localhost:8983/solr";\r
-               //return new HttpSolrClient.Builder(solrUrl).withConnectionTimeout(10000).withSocketTimeout(60000).build();\r
+               // return new\r
+               // HttpSolrClient.Builder(solrUrl).withConnectionTimeout(10000).withSocketTimeout(60000).build();\r
 \r
                ResteasyClient client = new ResteasyClientBuilder().build();\r
                ResteasyWebTarget webTarget = client.target("httpp:");\r
@@ -278,7 +298,8 @@ public class Support {
                Item i = manager.createItem("Generic", "Trigger teszt2", "itemdesc2", "itemhouseid2");\r
                Media m = manager.createMedia("Generic", "mediatitle2", "mediadesc2", "mediahouseid2");\r
                i.appendMedia(m);\r
-               MediaFile mf = manager.createMediaFile("filename2", manager.getFileType("High-res"), manager.getSystemStore(false), m);\r
+               MediaFile mf = manager.createMediaFile("filename2", manager.getFileType("High-res"),\r
+                               manager.getSystemStore(false), m);\r
                m.appendMediaFile(mf);\r
                manager.mergeItemStructure(i);\r
 \r
@@ -326,7 +347,8 @@ public class Support {
 \r
        @Test\r
        public void testTSM() throws Exception {\r
-               //System.setProperty("PATH", "c:\\_workspace\\USER\\MediaCube\\server\\user.tsm.client\\apilib\\;%PATH%");\r
+               // System.setProperty("PATH",\r
+               // "c:\\_workspace\\USER\\MediaCube\\server\\user.tsm.client\\apilib\\;%PATH%");\r
                TSMClient c = null;\r
                try {\r
                        final TSMClient client = new TSMClient("JOBENGINE");\r
@@ -346,7 +368,8 @@ public class Support {
                                }\r
 \r
                                if (objects != null && objects.length != 1) {\r
-                                       System.out.println(houseId + " count: " + objects.length + " archived: " + rs.getTimestamp("archived"));\r
+                                       System.out.println(\r
+                                                       houseId + " count: " + objects.length + " archived: " + rs.getTimestamp("archived"));\r
                                } else\r
 \r
                                        System.out.println(houseId);\r
@@ -362,4 +385,55 @@ public class Support {
 \r
        }\r
 \r
+       @Test\r
+       public void test_check_archived_rundownstories() throws Exception {\r
+               OctopusAPI octopus = new OctopusAPI();\r
+               List<DBObject> rundowns = octopus.getRundowns(null);\r
+\r
+               System.out.println("Reading archive");\r
+               Set<String> archived = new HashSet<>();\r
+               String sql = "select mediafilehouseid from vw_items where mediatype ='Hír bejátszó'";\r
+               manager.executeQuery(sql, rs -> {\r
+                       String id = rs.getString(1);\r
+\r
+                       try {\r
+                               if (id.contains("-"))\r
+                                       id = id.substring(0, id.lastIndexOf("-"));\r
+                               else\r
+                                       id = id.substring(0, id.length() - 4);\r
+                       } catch (Exception e) {\r
+                               System.out.println(e.getMessage());\r
+                       }\r
+\r
+                       archived.add(id);\r
+                       // System.out.println(id);\r
+                       return true;\r
+               }, null);\r
+\r
+               System.out.println("Processing rundowns");\r
+               for (DBObject o : rundowns) {\r
+                       BasicDBObject bo = (BasicDBObject) o;\r
+                       System.out.println(bo.getLong(IOctopusAPI.ID) + " | " + bo.getString(IOctopusAPI.SCHEDULED_START) + " | "\r
+                                       + bo.getString(IOctopusAPI.NAME));\r
+                       List<DBObject> stories = octopus.getRundownFullStories(bo.getLong(IOctopusAPI.ID));\r
+                       if (stories == null)\r
+                               continue;\r
+                       for (DBObject s : stories) {\r
+                               BasicDBObject bs = (BasicDBObject) s;\r
+                               List<BasicDBObject> mosObjects = NoSQLUtils.asList(bs, IOctopusAPI.MOS_OBJECTS);\r
+                               if (mosObjects == null)\r
+                                       continue;\r
+                               for (BasicDBObject mos : mosObjects) {\r
+                                       String mosId = mos.getString(IOctopusAPI.OBJ_ID);\r
+                                       if (archived.contains(mosId))\r
+                                               System.out.println(mosId);\r
+                                       else\r
+                                               System.out.println("Missing " + mosId);\r
+                               }\r
+\r
+                       }\r
+               }\r
+\r
+       }\r
+\r
 }\r
diff --git a/server/user.jobengine.osgi.db/migrations/scripts/037_add_disableproxy_mediafile.sql b/server/user.jobengine.osgi.db/migrations/scripts/037_add_disableproxy_mediafile.sql
new file mode 100644 (file)
index 0000000..cf3050a
--- /dev/null
@@ -0,0 +1,18 @@
+-- // Add filesize column to mediafile
+-- Migration SQL that makes the change goes here.
+
+ALTER TABLE MEDIAFILE ADD COLUMN DISABLEPROXY CHARACTER(1) NOT NULL DEFAULT 'N'
+@
+ALTER TABLE MEDIAFILE ADD CONSTRAINT CHK_MEDIAFILE_DISABLEPROXY CHECK (DISABLEPROXY in ('Y', 'N'))
+@
+CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' )
+@
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+ALTER TABLE MEDIAFILE DROP CONSTRAINT CHK_MEDIAFILE_DISABLEPROXY
+@
+ALTER TABLE MEDIAFILE DROP COLUMN DISABLEPROXY
+@
+CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' )
+@
diff --git a/server/user.mediacube.metadata/build-metadata.launch b/server/user.mediacube.metadata/build-metadata.launch
new file mode 100644 (file)
index 0000000..3d3875a
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
+<stringAttribute key="M2_GOALS" value="clean install"/>\r
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
+<booleanAttribute key="M2_OFFLINE" value="false"/>\r
+<stringAttribute key="M2_PROFILES" value=""/>\r
+<listAttribute key="M2_PROPERTIES"/>\r
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>\r
+<booleanAttribute key="M2_SKIP_TESTS" value="true"/>\r
+<intAttribute key="M2_THREADS" value="1"/>\r
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>\r
+<stringAttribute key="M2_USER_SETTINGS" value=""/>\r
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>\r
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">\r
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>\r
+</listAttribute>\r
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/user.mediacube.metadata}"/>\r
+</launchConfiguration>\r