{"joblist":[\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
+ "name" : "Multiparam",\r
+ "template": "test-multiparam.xml",\r
+ "cronexpression": "0 0 0/1 1/1 * ? *",\r
+ "parameters": [ \r
+ {"name": "p1", "value": 1, "type": "java.lang.Long"},\r
+ {"name": "p2", "value": "x", "type": "java.lang.String"}\r
+ ]\r
+ },\r
+ {\r
+ "active": false,\r
+ "executeimmediate": false,\r
+ "name" : "Visszarögzített anyagok utólagos archiválása",\r
+ "template": "archive-recording.xml",\r
+ "cronexpression": "0 0 0/1 1/1 * ? *",\r
+ "parameters": [ \r
+ {"name": "sourcePath", "value": "\\\\10.10.254.74\\temp_isilon\\NEXIO", "type": "java.lang.String"},\r
+ {"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"},\r
+ {"name": "nexioUserName", "value": "administrator", "type": "java.lang.String"},\r
+ {"name": "nexioPassword", "value": "system", "type": "java.lang.String"}\r
+ ]\r
+ },\r
+ {\r
+ "active": false,\r
+ "executeimmediate": false,\r
"name" : "Híranyag statisztika importálása",\r
"template": "import-statistics.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "daysBeforeNow", "value": 1, "type": "java.lang.Integer"}\r
},\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "MORPHEUS 'missing materials' importálása",\r
"template": "import-morpheus-missing-materials.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "csvFilePath", "value": "/mnt/MORPHEUS", "type": "java.lang.String"},\r
},\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "Egy archiválás",\r
"template": "archive-ondemand.xml",\r
- "executeimmediate": true,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "sourcePath", "value": "/mnt/ISILON/ARCHIVE/ONE", "type": "java.lang.String"},\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "NEXIO visszarögzített anyagok másolása az ISILON/ARCHIVE mappába",\r
"template": "copyforarchive-nexio-recordings.xml",\r
- "executeimmediate": true,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"},\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "TRAFFIC anyagok visszatöltése",\r
"template": "retrieve-traffic-missing-materials.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [\r
{"name": "dbUrl", "value": "jdbc:sqlserver://10.10.1.45\\sql16;databaseName=PA_Echo;", "type": "java.lang.String"},\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "MORPHEUS anyagok visszatöltése",\r
"template": "retrieve-morpheus-missing-materials.xml",\r
- "executeimmediate": true,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [\r
{"name": "sourcePath", "value": "/mnt/MORPHEUS", "type": "java.lang.String"},\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "OCTOPUS adatok szinkronizálása",\r
"template": "sync-octopus.xml",\r
- "executeimmediate": true,\r
"cronexpression": "0/20 * * * * ?",\r
"parameters": [\r
{"name": "includeArchived", "value": false, "type": "java.lang.Boolean"}\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "OCTOPUS adatok szinkronizálása archivált tükrökkel együtt",\r
"template": "sync-octopus.xml",\r
- "executeimmediate": true,\r
"cronexpression": "0/30 * * * * ?",\r
"parameters": [\r
{"name": "includeArchived", "value": true, "type": "java.lang.Boolean"}\r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "Párhuzamosított teszt folyamat",\r
"template": "fake-concurrent.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0/10 * * ? * *",\r
"parameters": [ {"name": "itemID", "value": 1, "type": "java.lang.Long"} ]\r
},\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "Teszt folyamat",\r
"template": "fake-noparams.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 40 22 * * ?",\r
"parameters": [ {"name": "itemID", "value": 1, "type": "java.lang.Long"} ]\r
}\r
{"joblist":[\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "Híranyag statisztika importálása",\r
"template": "import-statistics.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "daysBeforeNow", "value": 1, "type": "java.lang.Integer"}\r
},\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "MORPHEUS 'missing materials' importálása",\r
"template": "import-morpheus-missing-materials.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "csvFilePath", "value": "/mnt/MORPHEUS", "type": "java.lang.String"},\r
]\r
},\r
{\r
- "active": true,\r
- "executeimmediate": true,\r
+ "active": false,\r
+ "executeimmediate": false,\r
"name" : "OCTOPUS adatok szinkronizálása",\r
"template": "sync-octopus.xml",\r
"cronexpression": "0/30 * * * * ?",\r
]\r
}, \r
{\r
- "active": true,\r
+ "active": false,\r
"executeimmediate": false,\r
"name" : "Archiválás az ISILON/ARCHIVE mappából",\r
"template": "archive-ondemand.xml",\r
]\r
},\r
{\r
- "active": true,\r
+ "active": false,\r
"executeimmediate": false,\r
- "name" : "NEXIO anyagok másolása az ISILON/ARCHIVE mappába",\r
+ "name" : "NEXIO bejátszók másolása az ISILON/ARCHIVE mappába",\r
"template": "copyforarchive-nexio-materials.xml",\r
"cronexpression": "0 0 10 * * ?",\r
"parameters": [ \r
}, \r
{\r
"active": false,\r
+ "executeimmediate": false,\r
+ "name" : "NEXIO visszarögzített anyagok másolása az ISILON/ARCHIVE mappába",\r
+ "template": "copyforarchive-nexio-recordings.xml",\r
+ "cronexpression": "0 0 0/1 1/1 * ? *",\r
+ "parameters": [ \r
+ {"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"},\r
+ {"name": "nexioUserName", "value": "administrator", "type": "java.lang.String"},\r
+ {"name": "nexioPassword", "value": "system", "type": "java.lang.String"},\r
+ {"name": "archiveFtp", "value": "ftp://10.10.1.100/ARCHIVE", "type": "java.lang.String"},\r
+ {"name": "archiveUserName", "value": "mediacube", "type": "java.lang.String"},\r
+ {"name": "archivePassword", "value": "Broadca5T", "type": "java.lang.String"},\r
+ {"name": "filterAgencies", "value": "schedule-rec", "type": "java.lang.String"},\r
+ {"name": "limit", "value": 10, "type": "java.lang.Integer"},\r
+ {"name": "nexioKillDateDays", "value": 7, "type": "java.lang.Integer"},\r
+ {"name": "nexioAgency", "value": "ARCHIVED", "type": "java.lang.String"}\r
+ ]\r
+ }, \r
+ {\r
+ "active": false,\r
"executeimmediate": false,\r
"name" : "Lejárt ISISLON/ARCHIVE anyagok törlése",\r
"template": "delete-materials.xml",\r
}, \r
{\r
"active": false,\r
- "executeimmediate": true,\r
+ "executeimmediate": false,\r
"name" : "Lejárt ISISLON/ARCHIVE_TEMP anyagok törlése",\r
"template": "delete-materials.xml",\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
]\r
}, \r
{\r
- "active": true,\r
+ "active": false,\r
"executeimmediate": false,\r
"name" : "Lejárt NEXIO anyagok törlése",\r
"template": "delete-nexio-materials.xml",\r
}, \r
{\r
"active": false,\r
- "executeimmediate": true,\r
+ "executeimmediate": false,\r
"name" : "TRAFFIC anyagok visszatöltése",\r
"template": "retrieve-traffic-missing-materials.xml",\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
}, \r
{\r
"active": false,\r
- "executeimmediate": true,\r
+ "executeimmediate": false,\r
"name" : "MORPHEUS anyagok visszatöltése",\r
"template": "retrieve-morpheus-missing-materials.xml",\r
"cronexpression": "0 0 0/1 1/1 * ? *",\r
},\r
{\r
"active": false,\r
+ "executeimmediate": false,\r
"name" : "Teszt fork-párhuzamosított folyamat",\r
"template": "fake-noparams.xml",\r
- "executeimmediate": false,\r
"cronexpression": "0 40 22 * * ?",\r
"parameters": [ {"name": "itemID", "value": 1, "type": "java.lang.Long"} ]\r
}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate name="Anyag archiválása" multiInstance="true">\r
+ <declarations>\r
+ <parameters>\r
+ <parameter name="sourcePath" type="java.lang.String"/>\r
+ <parameter name="nexioPort" type="java.lang.Integer"/>\r
+ <parameter name="nexioUserName" type="java.lang.String"/>\r
+ <parameter name="nexioPassword" type="java.lang.String"/>\r
+ </parameters>\r
+ <variables>\r
+ <variable name="archiveItem" type="user.jobengine.server.steps.ArchiveItem" />\r
+ <variable name="targetFileName" type="java.lang.String" />\r
+ </variables>\r
+ </declarations>\r
+ <commands>\r
+ <calljobstep type="user.jobengine.server.steps.RecordingsArchiveItemBuilderStep" weight="1">\r
+ <inputs>\r
+ <input>\r
+ <parameter name="sourcePath" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="archiveItem" />\r
+ </output>\r
+ <output>\r
+ <variable name="targetFileName" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep>\r
+ <calljobstep type="user.jobengine.server.steps.UploadRecordingToNexioStep" weight="2">\r
+ <inputs>\r
+ <input>\r
+ <variable name="archiveItem" />\r
+ </input>\r
+ <input>\r
+ <variable name="targetFileName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioPort" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioUserName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioPassword" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="archiveItem" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep>\r
+ </commands>\r
+</jobtemplate>
\ No newline at end of file
<parameter name="processedFolder" type="java.lang.String" />\r
<parameter name="targetPath" type="java.lang.String" />\r
</parameters>\r
+ <variables>\r
+ <variable name="xxx" type="java.lang.String" />\r
+ </variables>\r
</declarations>\r
<commands>\r
<calljobstep type="user.jobengine.server.steps.ImportMORPHEUSMissingMaterialsStep" weight="1">\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate multiInstance="true">\r
+<declarations>\r
+ <parameters>\r
+ <parameter name="p1" type="java.lang.Long"/>\r
+ <parameter name="p2" type="java.lang.String"/>\r
+ </parameters>\r
+ <variables>\r
+ <variable name="v1" type="java.lang.Long"/>\r
+ <variable name="v2" type="java.lang.String"/>\r
+ </variables>\r
+</declarations>\r
+<commands>\r
+ <calljobstep type="user.jobengine.server.steps.MultiParamStep">\r
+ <inputs>\r
+ <input>\r
+ <parameter name="p1" />\r
+ </input>\r
+ <input>\r
+ <parameter name="p2" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="v1" />\r
+ </output>\r
+ <output>\r
+ <variable name="v2" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep>\r
+ <calljobstep type="user.jobengine.server.steps.MultiParamStep">\r
+ <inputs>\r
+ <input>\r
+ <variable name="v1" />\r
+ </input>\r
+ <input>\r
+ <variable name="v2" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep>\r
+</commands>\r
+</jobtemplate>
\ No newline at end of file
private static final String MXFEXT = ".MXF";\r
private static final String NEXIOCLIPS = "nexioclips";\r
private static final String LONGNAMEID = "longnameid";\r
- private static final String ID = "id";\r
private static final String EXTAGENCY = "extagency";\r
private static final String RECORDDATE = "recorddate";\r
private static final SimpleDateFormat startTimeformat = new SimpleDateFormat(STARTTIME_FORMAT);\r
\r
private RundownArchive processRundow(DBObject r, String clipName, long duration) throws Exception {\r
BasicDBObject rundown = (BasicDBObject) r;\r
- long rundownID = rundown.getLong(ID);\r
+ long rundownID = rundown.getLong(IOctopusAPI.ID);\r
logger.info("Processing rundown {} {}", rundownID, rundown.getString(IOctopusAPI.NAME));\r
\r
List<DBObject> stories = octopusAPI.getRundownFullStories(rundownID);\r
import java.nio.file.Files;\r
import java.nio.file.Path;\r
import java.nio.file.Paths;\r
+import java.nio.file.attribute.FileAttribute;\r
+import java.nio.file.attribute.PosixFilePermission;\r
+import java.nio.file.attribute.PosixFilePermissions;\r
import java.util.Date;\r
+import java.util.Set;\r
\r
-import org.apache.commons.lang.StringUtils;\r
import org.apache.logging.log4j.LogManager;\r
import org.apache.logging.log4j.Logger;\r
\r
import user.jobengine.db.Item;\r
import user.jobengine.db.ItemManager;\r
-import user.jobengine.db.ItemType;\r
import user.jobengine.db.Media;\r
import user.jobengine.server.IJobEngine;\r
import user.jobengine.server.IJobRuntime;\r
* @author robi\r
*/\r
public class MetadataTransformStep extends JobStep {\r
- private static final String CONFLICT = "CONFLICT";\r
+ private static final String CONFLICT = ".CONFLICT";\r
private static final Logger logger = LogManager.getLogger();\r
private static final String ITEM_MANAGER_IS_NULL = "ItemManager is null";\r
public static final String DEFAULT_MEDIATYPE = "Generic";\r
try {\r
Path sourcePath = Paths.get(archiveItem.getMediaFile());\r
Path parent = sourcePath.getParent();\r
- EscortFiles.ensureUNCFolder(parent.toString(), CONFLICT);\r
- Files.move(sourcePath, Paths.get(parent.toString(), sourceFileName + (new Date()).getTime()));\r
+ Path conflictPath = Paths.get(parent.toString(), CONFLICT);\r
+ File folder = conflictPath.toFile();\r
+ if (!folder.exists() || !folder.isDirectory()) {\r
+ Set<PosixFilePermission> perms = PosixFilePermissions.fromString("rwxrwxrwx");\r
+ FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);\r
+ try {\r
+ Files.createDirectories(conflictPath, attr);\r
+ } catch (Exception e) {\r
+ try {\r
+ Files.createDirectory(conflictPath);\r
+ } catch (Exception e1) {\r
+ logger.catching(e);\r
+ throw e;\r
+ }\r
+ }\r
+ }\r
+\r
+ Files.move(sourcePath, Paths.get(conflictPath.toString(), sourceFileName + (new Date()).getTime()));\r
} catch (Exception e1) {\r
logger.catching(e1);\r
logger.error(getMarker(), "Hiba az állomány {} mappába másolásakor. A rendszer üzenete: {}", CONFLICT, e1.getMessage());\r
mediaCubeItem = itemManager.createItem(DEFAULT_MEDIATYPE, archiveItem.getItemTitle(), archiveItem.getItemDescription(),\r
archiveItem.getItemHouseId());\r
\r
- String mediaType = archiveItem.getMediaType();\r
- if (StringUtils.isBlank(mediaType)) {\r
- mediaCubeMedia = itemManager.createMedia(DEFAULT_MEDIATYPE, archiveItem.getMediaTitle(), archiveItem.getMediaDescription(),\r
- archiveItem.getMediaHouseId());\r
- } else {\r
- ItemType mediaItemType = itemManager.getItemType(mediaType);\r
- if (mediaItemType == null)\r
- itemManager.createItemType(mediaType, mediaType).add();\r
- mediaCubeMedia = itemManager.createMedia(mediaType, archiveItem.getMediaTitle(), archiveItem.getMediaDescription(),\r
- archiveItem.getMediaHouseId());\r
- }\r
+ mediaCubeMedia = itemManager.createMedia(DEFAULT_MEDIATYPE, archiveItem.getMediaTitle(), archiveItem.getMediaDescription(),\r
+ archiveItem.getMediaHouseId());\r
+ // String mediaType = archiveItem.getMediaType();\r
+ // if (StringUtils.isBlank(mediaType)) {\r
+ // mediaCubeMedia = itemManager.createMedia(DEFAULT_MEDIATYPE, archiveItem.getMediaTitle(), archiveItem.getMediaDescription(),\r
+ // archiveItem.getMediaHouseId());\r
+ // } else {\r
+ // ItemType mediaItemType = itemManager.getItemType(mediaType);\r
+ // if (mediaItemType == null)\r
+ // itemManager.createItemType(mediaType, mediaType).add();\r
+ // mediaCubeMedia = itemManager.createMedia(mediaType, archiveItem.getMediaTitle(), archiveItem.getMediaDescription(),\r
+ // archiveItem.getMediaHouseId());\r
+ // }\r
\r
mediaCubeMedia.setLength(archiveItem.getDuration());\r
mediaCubeItem.appendMedia(mediaCubeMedia);\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class MultiParamStep extends JobStep {\r
+\r
+ @StepEntry\r
+ public Object[] execute(long p1, String p2, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+ Object[] result = { p1 + 1, p2 + "x" };\r
+\r
+ return result;\r
+ }\r
+\r
+}\r
import user.jobengine.server.steps.MetadataTypeDetector.MetadataType;\r
\r
public class OctopusDataMiner {\r
+ private static final String MOS_ABSTRACT = "<mosAbstract>";\r
+ private static final String MOS_ABSTRACT_END = "</mosAbstract>";\r
private static final Logger logger = LogManager.getLogger();\r
private static final String ARCHIVED = "archived";\r
private static final String FILTER = "filter";\r
private static final String ENTER = "Enter";\r
private static final String FINISHED = "Finished";\r
private static final String STARTING = "Starting";\r
- private static final String MOSOBJECT = "Bejátszó: ";\r
+ private static final String MOSLABEL = "MOS: ";\r
private static final Object STORY = "Story";\r
\r
private DB db;\r
case IOctopusAPI.MOS: {\r
BasicDBObject mosObject = NoSQLUtils.asDBObject(content, IOctopusAPI.OBJECT);\r
if (mosObject != null && !mosObject.isEmpty()) {\r
- if (mosObject.containsKey(IOctopusAPI.OBJ_ID)) {\r
- String objID = mosObject.getString(IOctopusAPI.OBJ_ID);\r
- scriptContent += String.format("%s %s%s", MOSOBJECT, objID, LINEFEED);\r
+ String xml = NoSQLUtils.asString(mosObject, IOctopusAPI.XML);\r
+ if (xml != null) {\r
+ int pos1 = xml.indexOf(MOS_ABSTRACT) + MOS_ABSTRACT.length();\r
+ int pos2 = xml.indexOf(MOS_ABSTRACT_END);\r
+\r
+ if (pos1 > -1 && pos2 > -1) {\r
+ scriptContent += String.format("%s %s%s", MOSLABEL, xml.substring(pos1, pos2), LINEFEED);\r
+ }\r
}\r
}\r
break;\r
StringBuilder sb = new StringBuilder();\r
\r
for (BasicDBObject bodyItem : body) {\r
+ if (bodyItem.containsKey(IOctopusAPI.TYPE)) {\r
+ sb.append(bodyItem.getString(IOctopusAPI.TYPE));\r
+ sb.append(LINEFEED);\r
+ }\r
if (bodyItem.containsKey(IOctopusAPI.LABEL)) {\r
sb.append(bodyItem.getString(IOctopusAPI.LABEL));\r
sb.append(LINEFEED);\r
story.put(IOctopusAPI.REF_RUNDOWN, rundownRef);\r
if (storyFolderRef != null)\r
story.put(IOctopusAPI.REF_STORYFOLDER, storyFolderRef);\r
+\r
String scriptContent = extractScriptContent(story);\r
story.put(IOctopusAPI.SCRIPT_CONTENT, scriptContent);\r
- if (modifiedMOS == null || modifiedMOS.isEmpty()) {\r
- if (story.containsKey(IOctopusAPI.MOS_OBJECTS))\r
- story.remove(IOctopusAPI.MOS_OBJECTS);\r
- } else\r
+ story.remove(IOctopusAPI.SCRIPT);\r
+\r
+ if (modifiedMOS == null || modifiedMOS.isEmpty())\r
+ story.remove(IOctopusAPI.MOS_OBJECTS);\r
+ else\r
story.put(IOctopusAPI.MOS_OBJECTS, modifiedMOS);\r
\r
String parentStoryId = extractCustomColumnValue(IOctopusAPI.PARENT_STORY_ID, story);\r
story.append(IOctopusAPI.PARENT_STORY_ID, storyID);\r
} else\r
story.append(IOctopusAPI.PARENT_STORY_ID, parentStoryId);\r
+\r
+ story.remove(IOctopusAPI.CUSTOM_COLUMNS);\r
+\r
logger.debug(SAVING_STORY_ID, storyID);\r
setObjectID(currentStories, storyID, story);\r
if (!disableWrite)\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.nio.file.FileVisitResult;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+import java.nio.file.SimpleFileVisitor;\r
+import java.nio.file.attribute.BasicFileAttributes;\r
+import java.text.ParseException;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Date;\r
+import java.util.List;\r
+\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.Marker;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+import com.ibm.nosql.json.api.DBObject;\r
+\r
+import user.commons.CalendarUtils;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.commons.octopus.IOctopusAPI;\r
+import user.commons.octopus.OctopusAPI;\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class RecordingsArchiveItemBuilderStep extends JobStep {\r
+ private static final String RECORDING = "Visszarögzítés";\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private static final String STATUSFOLDER = ".STATUS";\r
+ private static final String LXFEXT = ".lxf";\r
+ private static final String CATCHEDEXT = ".catched";\r
+ private static final SimpleDateFormat startTimeformat = new SimpleDateFormat("HHmm");\r
+ private static final SimpleDateFormat startDateformat = new SimpleDateFormat("yyMMdd");\r
+ private static final String SCHEDULED_FORMAT = "yyyy.MM.dd HH:mm";\r
+\r
+ private Marker marker;\r
+\r
+ private ArchiveItem createArchiveItem(Path mediaFilePath, Path catchedFilePath) {\r
+ ArchiveItem result = null;\r
+ try {\r
+\r
+ Date recordDate = startDateformat.parse(mediaFilePath.getParent().toFile().getName());\r
+ String clipName = mediaFilePath.toFile().getName();\r
+ Date scheduledStart = getScheduledStart(clipName, recordDate);\r
+ IOctopusAPI octopusAPI = new OctopusAPI();\r
+ DBObject rundown = octopusAPI.getRundown(scheduledStart);\r
+ if (rundown == null) {\r
+ logger.error(marker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, ezért nem archiválható.", clipName, scheduledStart);\r
+ return null;\r
+ }\r
+ //DB db = NoSQLUtils.getNoSQLDB();\r
+\r
+ //\r
+ // BasicDBObject dbObject = (BasicDBObject) JSONUtil.jsonToDbObject(new String(readAllBytes));\r
+ // if (dbObject == null)\r
+ // throw new NullPointerException("Can not parse JSON file: " + jsonFilePath);\r
+ result = processRundow(octopusAPI, rundown);\r
+ if (result == null)\r
+ return null;\r
+\r
+ result.setMediaTitle(clipName);\r
+ result.setMediaType(RECORDING);\r
+ result.setMediaFile(mediaFilePath.toString());\r
+ result.setCatchedFile(catchedFilePath.toString());\r
+ // result.setDuration(NoSQLUtils.asLong(dbObject, DURATION));\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(getJobRuntime().getMarker(), "A metaadat nem elérhető. A rendszer üzenete: {}", e.getMessage());\r
+ return null;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ private void createCatchedFile(Path catchedFilePath) throws Exception {\r
+ try {\r
+ EscortFiles.ensureUNCFolder(catchedFilePath.getParent());\r
+ Files.createFile(catchedFilePath);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(marker, "A '{}' jelzőfájl nem hozható létre. A rendszer üzenete: {}", catchedFilePath, e.getMessage());\r
+ throw e;\r
+ }\r
+ }\r
+\r
+ @StepEntry\r
+ public Object[] execute(String sourcePath, IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
+ final ArchiveItem[] archiveItems = { null };\r
+ marker = getJobRuntime().getMarker();\r
+ try {\r
+ Files.walkFileTree(Paths.get(sourcePath), new SimpleFileVisitor<Path>() {\r
+\r
+ @Override\r
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\r
+ FileVisitResult result = FileVisitResult.SKIP_SUBTREE;\r
+\r
+ if (dir.equals(Paths.get(sourcePath)) || "HIRADO".equals(dir.toFile().getName().toUpperCase())\r
+ || "NAPIAKT".equals(dir.toFile().getName().toUpperCase()))\r
+ result = FileVisitResult.CONTINUE;\r
+ else {\r
+ if ("HIRADO".equals(dir.getParent().toFile().getName().toUpperCase())\r
+ || "NAPIAKT".equals(dir.getParent().toFile().getName().toUpperCase())) {\r
+ try {\r
+ startDateformat.parse(dir.toFile().getName());\r
+ result = FileVisitResult.CONTINUE;\r
+ } catch (ParseException e) {\r
+ }\r
+ }\r
+ }\r
+\r
+ if (result == FileVisitResult.CONTINUE)\r
+ logger.info(dir);\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {\r
+ FileVisitResult result = FileVisitResult.TERMINATE;\r
+ ArchiveItem item = null;\r
+ try {\r
+ item = processPathItem(file);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(marker, "Az '{}' állomány feldolgozása sikertelen. A rendszer hibaüzenete: {}", file, e.getMessage());\r
+ }\r
+ if (item == null) {\r
+ result = FileVisitResult.CONTINUE;\r
+ } else {\r
+ logger.info(file);\r
+ archiveItems[0] = item;\r
+ }\r
+ return result;\r
+ }\r
+\r
+ });\r
+\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(marker, "Az '{}' mappa elérése sikertelen. A rendszer hibaüzenete: {}", sourcePath, e.getMessage());\r
+ } finally {\r
+ }\r
+ ArchiveItem archiveItem = archiveItems[0];\r
+ String targetFileName = null;\r
+\r
+ if (archiveItem == null || archiveItem.getMediaFile() == null)\r
+ logger.warn(marker, "Az archiváló folyamat nem talált új anyagot.");\r
+ else {\r
+ String mediaFile = archiveItem.getMediaFile();\r
+ String name = new File(mediaFile).getName();\r
+ int extPos = name.toLowerCase().lastIndexOf(LXFEXT);\r
+ targetFileName = String.format("20%s-%s", Paths.get(mediaFile).getParent().getFileName(), name.substring(0, extPos));\r
+ logger.info(marker, "Az archiváló folyamat az '{}' anyagot archiválja.", mediaFile);\r
+ }\r
+\r
+ return new Object[] { archiveItem, targetFileName };\r
+ }\r
+\r
+ private Date getScheduledStart(String clipName, Date recordDate) {\r
+\r
+ if (StringUtils.isBlank(clipName)) {\r
+ logger.warn(marker, "A fájlnak nincs neve, ezért nem archiválható.");\r
+ return null;\r
+ }\r
+ if (recordDate == null) {\r
+ logger.warn(marker, "Az '{}' fájl rögzítésének ideje nem meghatározható, ezért nem archiválható.", clipName);\r
+ return null;\r
+ }\r
+\r
+ Date timePart = null;\r
+ try {\r
+ String clipNameTime = clipName.split("_")[0];\r
+ timePart = startTimeformat.parse(clipNameTime);\r
+ } catch (ParseException e) {\r
+ logger.warn(marker, "A '{}' fájl neve nem időbélyeggel kezdődik, ezért nem archiválható.", clipName);\r
+ return null;\r
+ }\r
+ return CalendarUtils.createCalendar(CalendarUtils.createCalendar(recordDate), timePart).getTime();\r
+ }\r
+\r
+ private ArchiveItem processPathItem(Path mediaFilePath) throws Exception {\r
+ File mediaFile = mediaFilePath.toFile();\r
+\r
+ Path dotStorePath = Paths.get(mediaFilePath.getParent().toString(), STATUSFOLDER);\r
+ Path catchedFilePath = Paths.get(dotStorePath.toString(), mediaFile.getName() + CATCHEDEXT);\r
+ File catchedFile = catchedFilePath.toFile();\r
+ if (catchedFile.exists()) {\r
+ //logger.info("'{}' file is already catched", mediaFilePath);\r
+ return null;\r
+ }\r
+ createCatchedFile(catchedFilePath);\r
+ if (!catchedFile.exists()) {\r
+ logger.warn("'{}' catchfile not exists.", catchedFilePath);\r
+ return null;\r
+ }\r
+\r
+ if (mediaFile.isDirectory() || !mediaFile.getName().toLowerCase().endsWith(LXFEXT.toLowerCase())\r
+ || mediaFilePath.getParent().toFile().getName().length() != 6) {\r
+ logger.info("Skipping '{}'", mediaFilePath);\r
+ return null;\r
+ }\r
+\r
+ ArchiveItem archiveItem = createArchiveItem(mediaFilePath, catchedFilePath);\r
+\r
+ if (archiveItem == null) {\r
+ logger.warn("'{}' has no metadata specified.", mediaFilePath);\r
+ return null;\r
+ }\r
+\r
+ if (StringUtils.isBlank(archiveItem.getItemHouseId())) {\r
+ logger.warn("'{}' has no Item HouseID specified in metadata.", mediaFilePath);\r
+ return null;\r
+ }\r
+\r
+ if (StringUtils.isBlank(archiveItem.getItemTitle())) {\r
+ logger.warn("'{}' has no Item Title specified in metadata.", mediaFilePath);\r
+ return null;\r
+ }\r
+\r
+ if (StringUtils.isBlank(archiveItem.getMediaHouseId())) {\r
+ logger.warn("'{}' has no Media HouseID specified in metadata.", mediaFilePath);\r
+ return null;\r
+ }\r
+\r
+ if (StringUtils.isBlank(archiveItem.getMediaTitle())) {\r
+ logger.warn("'{}' has no Media Title specified in metadata.", mediaFilePath);\r
+ return null;\r
+ }\r
+ return archiveItem;\r
+ }\r
+\r
+ private ArchiveItem processRundow(IOctopusAPI octopusAPI, DBObject r) throws Exception {\r
+ BasicDBObject rundown = (BasicDBObject) r;\r
+ long rundownID = rundown.getLong(IOctopusAPI.ID);\r
+ logger.info("Processing rundown {} {}", rundownID, rundown.getString(IOctopusAPI.NAME));\r
+\r
+ List<DBObject> stories = octopusAPI.getRundownFullStories(rundownID);\r
+ if (stories == null)\r
+ return null;\r
+\r
+ String name = NoSQLUtils.asString(NoSQLUtils.asDBObject(rundown, IOctopusAPI.RUNDOWN_TYPE), IOctopusAPI.NAME);\r
+ if (StringUtils.isBlank(name))\r
+ return null;\r
+ String channel = NoSQLUtils.asString(NoSQLUtils.asDBObject(rundown, IOctopusAPI.CHANNEL), IOctopusAPI.NAME);\r
+ Date scheduledStart = rundown.getDate(IOctopusAPI.SCHEDULED_START);\r
+ if (scheduledStart == null)\r
+ return null;\r
+\r
+ ArchiveItem result = new ArchiveItem();\r
+ result.setItemHouseId(String.valueOf(rundownID));\r
+ String start = CalendarUtils.toString(CalendarUtils.createCalendar(scheduledStart), SCHEDULED_FORMAT);\r
+ result.setItemTitle(String.format("%s %s %s", start, name, channel));\r
+\r
+ StringBuilder sb = new StringBuilder();\r
+ for (DBObject s : stories) {\r
+ BasicDBObject story = (BasicDBObject) s;\r
+\r
+ sb.append("*** ");\r
+ sb.append(story.getString(IOctopusAPI.PARENT_STORY_ID));\r
+ sb.append(" [" + story.getString(IOctopusAPI.FORMAT) + "] ");\r
+ sb.append(story.getString(IOctopusAPI.NAME));\r
+ sb.append(" ***");\r
+ sb.append("\r\n");\r
+ String content = story.getString(IOctopusAPI.SCRIPT_CONTENT);\r
+ if (content != null) {\r
+ content = content.replace("\r\n\r\n\r\n\r\n", "\r\n");\r
+ content = content.replace("\r\n\r\n\r\n", "\r\n");\r
+ content = content.replace("\r\n\r\n", "\r\n");\r
+ sb.append(content);\r
+ sb.append("\r\n");\r
+ }\r
+ }\r
+ result.setMediaHouseId(result.getItemHouseId());\r
+ result.setMediaDescription(sb.toString());\r
+ return result;\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.File;\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.Marker;\r
+import org.apache.logging.log4j.message.Message;\r
+import org.apache.logging.log4j.message.ParameterizedMessage;\r
+\r
+import com.ibm.nosql.json.api.DB;\r
+\r
+import user.commons.RemoteFile;\r
+import user.commons.StoreUri;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.commons.octopus.OctopusAPI;\r
+import user.commons.remotestore.IProgressEventListener;\r
+import user.commons.remotestore.IStatusEventListener;\r
+import user.commons.remotestore.ProgressEvent;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+import user.commons.remotestore.StatusEvent;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class UploadRecordingToNexioStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ private OctopusAPI octopusAPI;\r
+ private IItemManager manager;\r
+ private DB db;\r
+ private StoreUri sourceUri;\r
+ private StoreUri targetUri;\r
+ private Marker marker;\r
+\r
+ private int check(int value, String name) {\r
+ if (value == 0) {\r
+ logger.error(marker, "A folyamat '{}' bemeneti paramétere 0.", name);\r
+ throw new NullPointerException(String.format("System is not configured properly, missing '%s' input parameter.", name));\r
+ }\r
+ return value;\r
+ }\r
+\r
+ private String check(String value, String name) {\r
+ if (StringUtils.isBlank(value)) {\r
+ logger.error(marker, "A folyamat '{}' bemeneti paramétere üres.", name);\r
+ throw new NullPointerException(String.format("System is not configured properly, missing '%s' input parameter.", name));\r
+ }\r
+ return value;\r
+ }\r
+\r
+ @StepEntry\r
+ public Object[] execute(ArchiveItem archiveItem, String targetFileName, int nexioPort, String nexioUserName, String nexioPassword, IJobEngine jobEngine,\r
+ IJobRuntime jobRuntime) throws Exception {\r
+ marker = jobRuntime.getMarker();\r
+ manager = jobEngine.getItemManager();\r
+ setAndCheck(archiveItem, targetFileName, nexioPort, nexioUserName, nexioPassword);\r
+ String sourceFileName = new File(archiveItem.getMediaFile()).getName();\r
+ try {\r
+ sourceUri.addProgressListener(new IProgressEventListener() {\r
+ @Override\r
+ public void progressChanged(ProgressEvent evt) {\r
+ setProgress(evt.getProgress());\r
+ }\r
+ });\r
+ sourceUri.addStatusListener(new IStatusEventListener() {\r
+ @Override\r
+ public void statusChanged(StatusEvent evt) {\r
+ evt.setCancel(!canContinue());\r
+ }\r
+ });\r
+\r
+ RemoteFile targetFile = null;\r
+ try {\r
+ targetFile = targetUri.getRemoteFile(targetFileName);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ }\r
+ if (targetFile != null)\r
+ throw new Exception("Exists!");\r
+\r
+ RemoteFile remoteFile = sourceUri.transferFrom(targetUri, sourceFileName, targetFileName);\r
+\r
+ logger.info(marker, "Az '{}' állomány feltöltése sikeres volt '{}' néven.", sourceFileName, targetFileName);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ Message m = new ParameterizedMessage("Az '{}' állomány feltöltése sikertelen. A rendszer hibaüzenete: {}", sourceFileName, e.getMessage());\r
+ logger.error(marker, m);\r
+ throw new Exception(m.getFormattedMessage());\r
+ }\r
+ return null;\r
+ }\r
+\r
+ private void setAndCheck(ArchiveItem archiveItem, String targetFileName, int nexioPort, String nexioUserName, String nexioPassword) throws Exception {\r
+ db = NoSQLUtils.getNoSQLDB();\r
+ if (db == null) {\r
+ logger.error(marker, "Az NoSQL adatkezelő réteg nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing NoSQL DB reference.");\r
+ }\r
+\r
+ if (archiveItem == null) {\r
+ logger.error(marker, "A folyamat 'archiveItem' bemeneti paramétere üres.");\r
+ throw new NullPointerException("Internal error, missing 'archiveItem'.");\r
+ }\r
+\r
+ if (archiveItem.getMediaFile() == null) {\r
+ logger.error(marker, "A folyamat 'archiveItem.mediaFile' paramétere üres.");\r
+ throw new NullPointerException("Internal error, missing 'archiveItem.mediaFile'.");\r
+ }\r
+\r
+ check(targetFileName, "targetFileName");\r
+\r
+ String nexioHost = System.getProperty("nexio.host");\r
+ if (StringUtils.isBlank(nexioHost)) {\r
+ logger.error(marker, "A 'nexio.host' rendszer paraméter nem található.");\r
+ throw new NullPointerException("System is not configured properly, 'jobengine.selenio.address' startup parameter missing.");\r
+ }\r
+ check(nexioPort, "nexioPort");\r
+ check(nexioUserName, "nexioUserName");\r
+ check(nexioPassword, "nexioPassword");\r
+\r
+ targetUri = manager.createStoreUri(RemoteStoreProtocol.FTP, nexioHost);\r
+ targetUri.setPortNumber(nexioPort);\r
+ targetUri.setUserName(nexioUserName);\r
+ targetUri.setPassword(nexioPassword);\r
+ if (targetUri == null) {\r
+ logger.error(marker, "A forrás nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing 'sourceUri'.");\r
+ }\r
+\r
+ sourceUri = manager.createStoreUri(RemoteStoreProtocol.LOCAL, Paths.get(archiveItem.getMediaFile()).getParent().toString());\r
+ if (sourceUri == null) {\r
+ logger.error(marker, "A cél nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing 'targetUri'.");\r
+ }\r
+\r
+ }\r
+\r
+}\r
String targetFileName = targetName;
if (StringUtils.isEmpty(targetFileName))
targetFileName = source.getName();
- else {
- String name = source.getName();
- int sep1 = name.lastIndexOf(".");
- int sep2 = targetFileName.lastIndexOf(".");
- if (sep2 == -1)
- targetFileName = targetFileName + name.substring(sep1);
- }
+
+ // Nexio feltöltésnél nem jó ha automatikusan másoljuk a kiterjesztést
+ // else {
+ // String name = source.getName();
+ // int sep1 = name.lastIndexOf(".");
+ // int sep2 = targetFileName.lastIndexOf(".");
+ // if (sep2 == -1)
+ // targetFileName = targetFileName + name.substring(sep1);
+ // }
result.setName(targetFileName);
result.setSize(source.getSize());
OutputStream outputStream = outputLister.getOutputStream(result);
static final String LABEL = "label";\r
static final String CLIP = "clip";\r
static final String OBJ_ID = "objId";\r
+ static final String XML = "xml";\r
static final String OBJECT = "object";\r
static final String MOS = "mos";\r
static final String TEXT = "text";\r
import java.sql.SQLException;\r
import java.util.ArrayList;\r
import java.util.Calendar;\r
+import java.util.Collections;\r
import java.util.Date;\r
import java.util.List;\r
\r
DBCollection collection = db.getCollection(STORY_COLLECTION);\r
DBCursor find = collection.find(new BasicDBObject(REF_RUNDOWN, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, id))))\r
.sort(new BasicDBObject("name", 1));\r
- if (find.hasNext())\r
+ if (find.hasNext()) {\r
result = find.toArray();\r
+ result.forEach(o -> {\r
+ BasicDBObject dbo = (BasicDBObject) o;\r
+ NoSQLUtils.asList(dbo, REF_RUNDOWN).forEach(io -> {\r
+ if (io.getLong(IOctopusAPI.ID) == id)\r
+ o.put(IOctopusAPI.POSITION, io.getLong(IOctopusAPI.POSITION));\r
+ });\r
+\r
+ });\r
+ Collections.sort(result, (o1, o2) -> {\r
+ long long1 = ((BasicDBObject) o1).getLong(IOctopusAPI.POSITION);\r
+ long long2 = ((BasicDBObject) o2).getLong(IOctopusAPI.POSITION);\r
+ return (int) (long1 - long2);\r
+ });\r
+ }\r
+\r
return result;\r
}\r
\r
System.out.println(count);\r
}\r
\r
+ @Test\r
+ public void test5() throws Exception {\r
+ List<String> restorables = Files.readAllLines(Paths.get("c:\\Temp\\restorables3.txt"));\r
+ List<String> dates = new ArrayList<>();\r
+ // String last = null;\r
+ for (String line : restorables) {\r
+ if (StringUtils.isBlank(line))\r
+ continue;\r
+\r
+ int pos = line.indexOf('\t');\r
+ String date = line.substring(2, line.indexOf(' ')).replace(".", "");\r
+ String name = line.substring(pos + 1);\r
+ dates.add(date + "-" + name);\r
+ // if (name.equals(last)) {\r
+ // } else {\r
+ // last = name;\r
+ // if (dates.size() > 1)\r
+ // dates.remove(dates.get(dates.size() - 1));\r
+ // }\r
+ }\r
+ System.out.println(dates.size());\r
+\r
+ int count = 0;\r
+ List<String> saved = Files.readAllLines(Paths.get("c:\\Temp\\list.txt"));\r
+ for (String line : saved) {\r
+ if (StringUtils.isBlank(line))\r
+ continue;\r
+\r
+ int pos1 = line.lastIndexOf('\\');\r
+ int pos2 = line.lastIndexOf('\\', pos1 - 1);\r
+ String date = line.substring(pos2 + 1, pos1);\r
+ String name = line.substring(pos1 + 1).replace(".lxf", ".MXF");\r
+\r
+ String o = date + "-" + name;\r
+ if (dates.contains(o)) {\r
+ System.out.println(o);\r
+ count++;\r
+ }\r
+\r
+ }\r
+ System.out.println(count);\r
+\r
+ // Date limit = new Date(2018 - 1900, 1, 19, 6, 0, 0);\r
+ // Set<String> keys = dates.keySet();\r
+ // for (String name : keys) {\r
+ //\r
+ // boolean haslower = false;\r
+ // boolean hasupper = false;\r
+ // //System.out.println("processing " + name);\r
+ //\r
+ // for (Date date : dates.get(name)) {\r
+ //\r
+ // if (date.before(limit))\r
+ // haslower = true;\r
+ // if (date.after(limit))\r
+ // hasupper = true;\r
+ // //System.out.println("checked " + df.format(date) + " " + haslower + " " + hasupper);\r
+ // }\r
+ //\r
+ // if (haslower && hasupper) {\r
+ // System.out.println(name);\r
+ // count++;\r
+ // }\r
+ // }\r
+ // System.out.println(count);\r
+ }\r
+\r
+ @Test\r
+ public void test6() throws Exception {\r
+ BasicDBObject x = new BasicDBObject();\r
+ x.remove("y");\r
+ }\r
+\r
@Test\r
public void testClient() {\r
ResteasyWebTarget webTarget = new ResteasyClientBuilder().build().target("http://10.10.1.28/services/rest/octopus/");\r
MEDIAID BIGINT NOT NULL,\r
STOREID BIGINT NOT NULL,\r
FILETYPEID BIGINT NOT NULL,\r
- RELATIVEPATH VARCHAR(255) NOT NULL,\r
+ RELATIVEPATH VARCHAR(1000) NOT NULL,\r
FILESTRUCTINFO VARCHAR(255),\r
CONSTRAINT FK_MEDIAFILE_MEDIAID FOREIGN KEY (MEDIAID) REFERENCES MEDIA (ID),\r
CONSTRAINT FK_MEDIAFILE_STOREID FOREIGN KEY (STOREID) REFERENCES STORE (ID),\r
-select * from mediafile where houseid = 'M009781A-0.MXF'\r
+2.19 6:00\r
+\r
+0700_hirado_PGM_-_H.MXF\r
+\r
+select itemtitle, mediafilehouseid, archived from vw_items where mediafilehouseid = '2200_hirado_PGM_-_SZO1.MXF' order by archived\r
+select itemtitle, mediafilehouseid, archived from vw_items where mediafilehouseid in (\r
+'1900_hirado_napiakt_PGM_-_CS.MXF',\r
+'1900_hirado_napiakt_PGM_-_H.MXF',\r
+'0700_hirado_PGM_-_CS.MXF',\r
+'0700_hirado_PGM_-_H.MXF',\r
+'0700_hirado_PGM_-_P1.MXF',\r
+'0700_hirado_PGM_-_SZO.MXF',\r
+'0700_hirado_PGM_-_V.MXF',\r
+'0800_hirado_PGM_-_CS.MXF',\r
+'0800_hirado_PGM_-_H.MXF',\r
+'0800_hirado_PGM_-_P1.MXF',\r
+'0800_hirado_PGM_-_SZO.MXF',\r
+'0800_hirado_PGM_-_V.MXF',\r
+'0900_hirado_PGM_-_CS.MXF',\r
+'0900_hirado_PGM_-_H.MXF',\r
+'0900_hirado_PGM_-_P1.MXF',\r
+'0900_hirado_PGM_-_SZO.MXF',\r
+'0900_hirado_PGM_-_V.MXF',\r
+'1000_hirado_PGM_-_CS.MXF',\r
+'1000_hirado_PGM_-_H.MXF',\r
+'1000_hirado_PGM_-_P1.MXF',\r
+'1000_hirado_PGM_-_SZO.MXF',\r
+'1000_hirado_PGM_-_V.MXF',\r
+'1100_hirado_PGM_-_CS.MXF',\r
+'1100_hirado_PGM_-_H.MXF',\r
+'1100_hirado_PGM_-_P1.MXF',\r
+'1100_hirado_PGM_-_SZO.MXF',\r
+'1100_hirado_PGM_-_V.MXF',\r
+'1200_hirado_PGM_-_CS.MXF',\r
+'1200_hirado_PGM_-_H.MXF',\r
+'1200_hirado_PGM_-_P1.MXF',\r
+'1200_hirado_PGM_-_SZE.MXF',\r
+'1200_hirado_PGM_-_SZO.MXF',\r
+'1200_hirado_PGM_-_V.MXF',\r
+'1300_hirado_PGM_-_CS.MXF',\r
+'1300_hirado_PGM_-_H.MXF',\r
+'1300_hirado_PGM_-_P1.MXF',\r
+'1300_hirado_PGM_-_SZE.MXF',\r
+'1300_hirado_PGM_-_SZO.MXF',\r
+'1300_hirado_PGM_-_V.MXF',\r
+'1400_hirado_PGM_-_CS.MXF',\r
+'1400_hirado_PGM_-_H.MXF',\r
+'1400_hirado_PGM_-_P1.MXF',\r
+'1400_hirado_PGM_-_SZE.MXF',\r
+'1400_hirado_PGM_-_SZO.MXF',\r
+'1400_hirado_PGM_-_V.MXF',\r
+'1500_hirado_PGM_-_CS.MXF',\r
+'1500_hirado_PGM_-_H.MXF',\r
+'1500_hirado_PGM_-_SZE.MXF',\r
+'1500_hirado_PGM_-_SZO.MXF',\r
+'1600_hirado_PGM_-_CS.MXF',\r
+'1600_hirado_PGM_-_H.MXF',\r
+'1600_hirado_PGM_-_P1.MXF',\r
+'1600_hirado_PGM_-_SZE.MXF',\r
+'1600_hirado_PGM_-_SZO.MXF',\r
+'1700_hirado_PGM_-_CS.MXF',\r
+'1700_hirado_PGM_-_H.MXF',\r
+'1700_hirado_PGM_-_P.MXF',\r
+'1700_hirado_PGM_-_SZE.MXF',\r
+'1700_hirado_PGM_-_SZO.MXF',\r
+'1700_hirado_PGM_-_V.MXF',\r
+'1800_hirado_PGM_-_CS.MXF',\r
+'1800_hirado_PGM_-_H.MXF',\r
+'1800_hirado_PGM_-_P1.MXF',\r
+'1800_hirado_PGM_-_SZE.MXF',\r
+'1800_hirado_PGM_-_SZO.MXF',\r
+'1800_hirado_PGM_-_V.MXF',\r
+'1900_hirado_napiakt_PGM_-_K.MXF',\r
+'1900_hirado_napiakt_PGM_-_P.MXF',\r
+'1900_hirado_napiakt_PGM_-_SZE.MXF',\r
+'2000_hirado_PGM_-_CS.MXF',\r
+'2000_hirado_PGM_-_H.MXF',\r
+'2000_hirado_PGM_-_P.MXF',\r
+'2000_hirado_PGM_-_SZE.MXF',\r
+'2000_hirado_PGM_-_SZO.MXF',\r
+'2000_hirado_PGM_-_V.MXF',\r
+'2200_hirado_PGM_-_CS.MXF',\r
+'2200_hirado_PGM_-_H.MXF',\r
+'2200_hirado_PGM_-_P.MXF',\r
+'2200_hirado_PGM_-_SZE.MXF',\r
+'2200_hirado_PGM_-_SZO.MXF',\r
+'2200_hirado_PGM_-_V.MXF',\r
+'0700_hirado_PGM_-_CS2.MXF',\r
+'0700_hirado_PGM_-_H1.MXF',\r
+'0700_hirado_PGM_-_K.MXF',\r
+'0700_hirado_PGM_-_K1.MXF',\r
+'0700_hirado_PGM_-_P.MXF',\r
+'0700_hirado_PGM_-_SZE.MXF',\r
+'0700_hirado_PGM_-_SZE1.MXF',\r
+'0700_hirado_PGM_-_SZO1.MXF',\r
+'0700_hirado_PGM_-_V1.MXF',\r
+'0800_hirado_PGM_-_H1.MXF',\r
+'0800_hirado_PGM_-_K.MXF',\r
+'0800_hirado_PGM_-_K1.MXF',\r
+'0800_hirado_PGM_-_P.MXF',\r
+'0800_hirado_PGM_-_SZE.MXF',\r
+'0800_hirado_PGM_-_SZE1.MXF',\r
+'0800_hirado_PGM_-_SZO1.MXF',\r
+'0800_hirado_PGM_-_V1.MXF',\r
+'0900_hirado_PGM_-_H1.MXF',\r
+'0900_hirado_PGM_-_K.MXF',\r
+'0900_hirado_PGM_-_K1.MXF',\r
+'0900_hirado_PGM_-_P.MXF',\r
+'0900_hirado_PGM_-_SZE.MXF',\r
+'0900_hirado_PGM_-_SZE1.MXF',\r
+'0900_hirado_PGM_-_SZO1.MXF',\r
+'0900_hirado_PGM_-_V1.MXF',\r
+'1000_hirado_PGM_-_H1.MXF',\r
+'1000_hirado_PGM_-_K.MXF',\r
+'1000_hirado_PGM_-_K1.MXF',\r
+'1000_hirado_PGM_-_P.MXF',\r
+'1000_hirado_PGM_-_SZE.MXF',\r
+'1000_hirado_PGM_-_SZE1.MXF',\r
+'1000_hirado_PGM_-_SZO1.MXF',\r
+'1000_hirado_PGM_-_V1.MXF',\r
+'1100_hirado_PGM_-_H1.MXF',\r
+'1100_hirado_PGM_-_K.MXF',\r
+'1100_hirado_PGM_-_K1.MXF',\r
+'1100_hirado_PGM_-_P.MXF',\r
+'1100_hirado_PGM_-_SZE.MXF',\r
+'1100_hirado_PGM_-_SZE1.MXF',\r
+'1100_hirado_PGM_-_SZO1.MXF',\r
+'1100_hirado_PGM_-_V1.MXF',\r
+'1200_hirado_PGM_-_CS1.MXF',\r
+'1200_hirado_PGM_-_H1.MXF',\r
+'1200_hirado_PGM_-_K.MXF',\r
+'1200_hirado_PGM_-_K1.MXF',\r
+'1200_hirado_PGM_-_P.MXF',\r
+'1200_hirado_PGM_-_SZO1.MXF',\r
+'1200_hirado_PGM_-_V1.MXF',\r
+'1300_hirado_PGM_-_CS1.MXF',\r
+'1300_hirado_PGM_-_H1.MXF',\r
+'1300_hirado_PGM_-_K.MXF',\r
+'1300_hirado_PGM_-_K1.MXF',\r
+'1300_hirado_PGM_-_P.MXF',\r
+'1300_hirado_PGM_-_SZO1.MXF',\r
+'1300_hirado_PGM_-_V1.MXF',\r
+'1400_hirado_PGM_-_CS1.MXF',\r
+'1400_hirado_PGM_-_H1.MXF',\r
+'1400_hirado_PGM_-_K.MXF',\r
+'1400_hirado_PGM_-_K1.MXF',\r
+'1400_hirado_PGM_-_P.MXF',\r
+'1400_hirado_PGM_-_SZO1.MXF',\r
+'1400_hirado_PGM_-_V1.MXF',\r
+'1500_hirado_PGM_-_H1.MXF',\r
+'1500_hirado_PGM_-_K.MXF',\r
+'1500_hirado_PGM_-_K1.MXF',\r
+'1500_hirado_PGM_-_P.MXF',\r
+'1500_hirado_PGM_-_P1.MXF',\r
+'1500_hirado_PGM_-_SZO1.MXF',\r
+'1500_hirado_PGM_-_V.MXF',\r
+'1500_hirado_PGM_-_V1.MXF',\r
+'1600_hirado_PGM_-_H1.MXF',\r
+'1600_hirado_PGM_-_K.MXF',\r
+'1600_hirado_PGM_-_K1.MXF',\r
+'1600_hirado_PGM_-_P.MXF',\r
+'1600_hirado_PGM_-_SZO1.MXF',\r
+'1600_hirado_PGM_-_V.MXF',\r
+'1600_hirado_PGM_-_V1.MXF',\r
+'1700_hirado_PGM_-_CS1.MXF',\r
+'1700_hirado_PGM_-_H1.MXF',\r
+'1700_hirado_PGM_-_K.MXF',\r
+'1700_hirado_PGM_-_K1.MXF',\r
+'1700_hirado_PGM_-_P1.MXF',\r
+'1700_hirado_PGM_-_SZO1.MXF',\r
+'1700_hirado_PGM_-_V1.MXF',\r
+'1800_hirado_PGM_-_CS1.MXF',\r
+'1800_hirado_PGM_-_H1.MXF',\r
+'1800_hirado_PGM_-_K.MXF',\r
+'1800_hirado_PGM_-_K1.MXF',\r
+'1800_hirado_PGM_-_P.MXF',\r
+'1800_hirado_PGM_-_SZO1.MXF',\r
+'1800_hirado_PGM_-_V1.MXF',\r
+'1900_hirado_napiakt_PGM_-_CS1.MXF',\r
+'1900_hirado_napiakt_PGM_-_H1.MXF',\r
+'1900_hirado_napiakt_PGM_-_K1.MXF',\r
+'1900_hirado_napiakt_PGM_-_P1.MXF',\r
+'1900_hirado_napiakt_PGM_-_SZE1.MXF',\r
+'1900_hirado_PGM_-_V.MXF',\r
+'2000_hirado_PGM_-_CS1.MXF',\r
+'2000_hirado_PGM_-_H1.MXF',\r
+'2000_hirado_PGM_-_K.MXF',\r
+'2000_hirado_PGM_-_K1.MXF',\r
+'2000_hirado_PGM_-_P1.MXF',\r
+'2000_hirado_PGM_-_SZO1.MXF',\r
+'2000_hirado_PGM_-_V1.MXF',\r
+'2100_hirek_PGM_-_4.MXF',\r
+'2100_hirek_PGM_-_5.MXF',\r
+'2100_hirek_PGM_-_6.MXF',\r
+'2200_hirado_PGM_-_CS1.MXF',\r
+'2200_hirado_PGM_-_H1.MXF',\r
+'2200_hirado_PGM_-_K.MXF',\r
+'2200_hirado_PGM_-_K1.MXF',\r
+'2200_hirado_PGM_-_P1.MXF',\r
+'2200_hirado_PGM_-_SZO1.MXF',\r
+'2200_hirado_PGM_-_V1.MXF'\r
+) order by mediafilehouseid, archived\r
+\r
\r
select *, replace(mediafilehouseid, concat('-',itemhouseid), '') from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%'\r
select count(distinct(replace(mediafilehouseid, concat('-',itemhouseid), ''))) from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%'\r
\r
select * from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%'\r
select count(distinct(mediafilehouseid)) from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%'\r
+select concat('''', concat(mediatitle,'.MXF'',')), count(*) as c from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%' group by mediatitle order by c desc\r
+\r
+select mediafilehouseid, count(*) as c from vw_items where mediatitle like '%PGM%' group by mediafilehouseid order by c desc\r
+\r
+select concat('''', concat(mediafilehouseid,''',')), count(*) as c from vw_items group by mediafilehouseid order by c desc\r
\r
-select mediatitle, count(*) from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%' group by mediatitle\r
+select mediatitle, count(*) from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%' and mediatitle like '%napiakt%' group by mediatitle\r
\r
select * from vw_items where itemtitle like 'MC-%' and mediahouseid like 'MC-%'\r
select count(distinct(mediafilehouseid)) from vw_items where itemtitle like 'MC-%' and mediahouseid like 'MC-%' \r
+select mediafilehouseid, count(*) as c from vw_items where itemtitle like 'MC-%' and mediahouseid like 'MC-%' group by mediafilehouseid order by c desc\r
+select mediafilehouseid, count(*) as c from vw_items group by mediafilehouseid order by c desc\r
\r
select * from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%'\r
and itemtitle not like '%Echo TV%' and itemtitle not like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%' and itemhouseid != itemtitle\r
select count(distinct(mediafilehouseid)) from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%'\r
and itemtitle not like '%Echo TV%' and itemtitle not like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%' and itemhouseid != itemtitle\r
\r
+--Hosszak\r
+select * from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle like '%PGM%'\r
+select i.title, sum(length(m.description)) from media m, item i where i.id=m.itemid and ITEMID in (\r
+select id from item where title like '2%' and title like '%Echo%'\r
+) group by i.title order by i.title desc\r
+\r
+select i.title, sum(length(m.description)) as l from media m, item i where i.id=m.itemid and ITEMID in (\r
+select id from item where title like '2%' and title like '%Echo%'\r
+) group by i.title order by l desc\r
+\r
+select * from item where title='2018.01.24 22:00 Híradó Echo TV'\r
+select * from media where itemid = 32962\r
+\r
+select mediafilehouseid, count(*) as c from vw_items where mediatitle like '%PGM%' group by mediafilehouseid order by c desc\r
\r
+--Napi duplikátum\r
+select mediafilehouseid, count(*) as c from vw_items where archived like '%02.%' group by mediafilehouseid order by c desc\r
--- /dev/null
+create view vw_items_rd as\r
+select *, replace(mediafilehouseid, concat('-', itemhouseid), '') as filename from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%' \r
+\r
+select * from vw_items_rd\r
+\r
+select count(*) from vw_items_rd\r
+\r
+select filename, count(*) as c from vw_items_rd group by filename order by c desc\r
+\r
+select distinct(concat('''', concat(mediafilehouseid,''','))) from vw_items_rd\r
+\r
+select itemtitle, mediafilehouseid, filename, archived from vw_items_rd where mediafilehouseid in (\r
+ select distinct(mediafilehouseid) from vw_items_rd\r
+) order by filename\r
}
private void signal(SignalType signalType) {
- if (jobEngine != null) {
+ if (jobEngine != null)
jobEngine.fireJobChangedEvent(new JobChangedEvent(this, signalType));
- /*
- IItemManager manager = jobEngine.getItemManager();
- if (manager != null) {
- manager.signal(getId(), signalType, StaticTables.JOB);
- logger.debug("signal " + signalType + ", " + toString());
- if (signalType == SignalType.UPDATE)
- modify();
- }
- */
- }
}
@Override
package user.jobengine.server.ast;\r
\r
/**\r
- * Bementi paraméter osztály.\r
+ * Bementi param�ter oszt�ly.\r
*/\r
public class InputParameter extends Parameter {\r
\r
}\r
\r
/**\r
- * Példányosítás kifejezés megadásával.\r
- * \r
+ * P�ld�nyos�t�s kifejez�s megad�s�val.\r
+ *\r
* @param expression\r
- * Kifejezés.\r
+ * Kifejez�s.\r
*/\r
public InputParameter(Expression expression) {\r
this.expression = expression;\r
}\r
\r
/**\r
- * Kifejezés lekérdezése.\r
- * \r
- * @return Kifejezés.\r
+ * Kifejez�s lek�rdez�se.\r
+ *\r
+ * @return Kifejez�s.\r
*/\r
public Expression getExpression() {\r
return expression;\r
}\r
\r
/**\r
- * Kifejezés beállítása.\r
- * \r
+ * Kifejez�s be�ll�t�sa.\r
+ *\r
* @param expression\r
- * Kifejezés.\r
+ * Kifejez�s.\r
*/\r
public void setExpression(Expression expression) {\r
+ if (this.expression != null)\r
+ throw new RuntimeException("Malformed step parameter template. Missing <input> tag. It is required for all inputs.");\r
this.expression = expression;\r
}\r
\r
try {\r
Files.createDirectories(filePath, attr);\r
} catch (Exception e) {\r
- logger.catching(e);\r
+ //logger.catching(e);\r
try {\r
Files.createDirectory(filePath);\r
} catch (Exception e1) {\r
extendedInputs = addParameter(method, extendedInputs, IJobEngine.class, jobEngine);\r
extendedInputs = addParameter(method, extendedInputs, IJobRuntime.class, jobRuntime);\r
result = (Object[]) method.invoke(this, extendedInputs);\r
+ break;\r
}\r
}\r
return result;\r
import user.jobengine.server.instructions.SendMessageToUserInstruction;
public class ParserTest {
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
private Parser sut = null;
private Encoder encoder = null;
private IProgram expected = null;
+
private IProgram encoded = null;
-
- @BeforeClass
- public static void setUpClass() throws Exception {
+
+ void exercise(String xml) throws Exception {
+ sut = new Parser(new ByteArrayInputStream(xml.getBytes()));
+ encoded = (IProgram) encoder.visitJobTemplate(sut.parse(), null);
}
-
+
@Before
public void setup() throws Exception {
expected = new Program();
@After
public void tearDown() throws Exception {
}
-
- void exercise(String xml) throws Exception {
- sut = new Parser(new ByteArrayInputStream(xml.getBytes()));
- encoded = (IProgram) encoder.visitJobTemplate(sut.parse(), null);
- }
@Test
- public void testParseParameterDeclaration() throws Exception {
- // Fixture
- expected.addInstruction(new PushToStackInstruction("p1"));
- expected.addInstruction(new PushToStackInstruction(java.lang.String.class));
- expected.addInstruction(new CheckParameterInstruction());
-
- final String xml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<jobtemplate>" +
- "<declarations>" +
- "<parameters>" +
- "<parameter name=\"p1\" type=\"java.lang.String\"/>"+
- "</parameters>" +
- "</declarations>" +
- "</jobtemplate>";
-
- // Exercise
- exercise(xml);
-
- // Verify
- assertEquals(expected, encoded);
- }
-
- @Test
- public void testParseVariableDeclaration() throws Exception {
- // Fixture
- expected.addInstruction(new PushToStackInstruction("v1"));
- expected.addInstruction(new PushToStackInstruction(java.lang.Integer.class));
- expected.addInstruction(new DeclareVariableInstruction());
-
- final String xml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<jobtemplate>" +
- "<declarations>" +
- "<variables>" +
- "<variable name=\"v1\" type=\"java.lang.Integer\"/>"+
- "</variables>" +
- "</declarations>" +
- "</jobtemplate>";
-
- // Exercise
- exercise(xml);
-
- // Verify
- assertEquals(expected, encoded);
+ public void testDigester() throws Exception {
+ String path = DirectoryUtils.checkSlash(System.getProperty("user.dir"), false, true);
+ String file = path + "..\\user.jobengine.executors\\jobtemplates\\test-multiparam.xml";
+ InputStream is = new FileInputStream(file);
+ Parser parser = new Parser(is);
+ JobTemplate template = parser.parse();
+ is.close();
+ assertNotNull(template);
+
+ IProgram program = (IProgram) encoder.visitJobTemplate(template, null);
+ assertNotNull(program);
+
}
-
+
@Test
public void testParseCallJobStep() throws Exception {
// Fixture
expected.addInstruction(new CallJobStepInstruction());
expected.addInstruction(new AssignVariableInstruction());
expected.addInstruction(new AssignVariableInstruction());
-
- final String xml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<jobtemplate>" +
- "<commands>" +
- "<calljobstep id=\"id1\" type=\"step1\">" +
- "<inputs>" +
- "<input>" +
- "<variable name=\"v1\" />" +
- "</input>" +
- "<input>" +
- "<parameter name=\"v2\" />" +
- "</input>" +
- "</inputs>" +
- "<outputs>" +
- "<output>" +
- "<variable name=\"o1\" />" +
- "</output>" +
- "<output>" +
- "<variable name=\"o2\" />" +
- "</output>" +
- "</outputs>" +
- "</calljobstep>" +
- "</commands>" +
- "</jobtemplate>";
-
-
+
+ final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<jobtemplate>" + "<commands>" + "<calljobstep id=\"id1\" type=\"step1\">"
+ + "<inputs>" + "<input>" + "<variable name=\"v1\" />" + "</input>" + "<input>" + "<parameter name=\"v2\" />" + "</input>" + "</inputs>"
+ + "<outputs>" + "<output>" + "<variable name=\"o1\" />" + "</output>" + "<output>" + "<variable name=\"o2\" />" + "</output>" + "</outputs>"
+ + "</calljobstep>" + "</commands>" + "</jobtemplate>";
+
// Exercise
exercise(xml);
-
+
+ // Verify
+ assertEquals(expected, encoded);
+ }
+
+ @Test
+ public void testParseParameterDeclaration() throws Exception {
+ // Fixture
+ expected.addInstruction(new PushToStackInstruction("p1"));
+ expected.addInstruction(new PushToStackInstruction(java.lang.String.class));
+ expected.addInstruction(new CheckParameterInstruction());
+
+ final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<jobtemplate>" + "<declarations>" + "<parameters>"
+ + "<parameter name=\"p1\" type=\"java.lang.String\"/>" + "</parameters>" + "</declarations>" + "</jobtemplate>";
+
+ // Exercise
+ exercise(xml);
+
// Verify
assertEquals(expected, encoded);
}
expected.addInstruction(new PushToStackInstruction(1));
expected.addInstruction(new SendMessageToUserInstruction());
expected.addInstruction(new AssignVariableInstruction());
-
- final String xml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<jobtemplate>" +
- "<commands>" +
- "<sendusermessage id=\"id1\" catalogName=\"catalog1\" messageNumber=\"1\">" +
- "<inputs>" +
- "<input>" +
- "<variable name=\"v1\" />" +
- "</input>" +
- "<input>" +
- "<parameter name=\"v2\" />" +
- "</input>" +
- "</inputs>" +
- "<outputs>" +
- "<output>" +
- "<variable name=\"r1\" />" +
- "</output>" +
- "</outputs>" +
- "</sendusermessage>" +
- "</commands>" +
- "</jobtemplate>";
-
+
+ final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<jobtemplate>" + "<commands>"
+ + "<sendusermessage id=\"id1\" catalogName=\"catalog1\" messageNumber=\"1\">" + "<inputs>" + "<input>" + "<variable name=\"v1\" />" + "</input>"
+ + "<input>" + "<parameter name=\"v2\" />" + "</input>" + "</inputs>" + "<outputs>" + "<output>" + "<variable name=\"r1\" />" + "</output>"
+ + "</outputs>" + "</sendusermessage>" + "</commands>" + "</jobtemplate>";
+
// Exercise
exercise(xml);
-
+
// Verify
assertEquals(expected, encoded);
}
-
+
@Test
- public void testDigester() throws Exception {
- String path = DirectoryUtils.checkSlash(System.getProperty("user.dir"), false, true);
- String file = path + "resources\\templates\\program1.xml";
- InputStream is = new FileInputStream(file);
- Parser parser = new Parser(is);
- JobTemplate template = parser.parse();
- is.close();
- assertNotNull(template);
-
- IProgram program = (IProgram) encoder.visitJobTemplate(template, null);
- assertNotNull(program);
-
- }
-
+ public void testParseVariableDeclaration() throws Exception {
+ // Fixture
+ expected.addInstruction(new PushToStackInstruction("v1"));
+ expected.addInstruction(new PushToStackInstruction(java.lang.Integer.class));
+ expected.addInstruction(new DeclareVariableInstruction());
+
+ final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<jobtemplate>" + "<declarations>" + "<variables>"
+ + "<variable name=\"v1\" type=\"java.lang.Integer\"/>" + "</variables>" + "</declarations>" + "</jobtemplate>";
+
+ // Exercise
+ exercise(xml);
+
+ // Verify
+ assertEquals(expected, encoded);
+ }
+
}