Please look at the following code below, and see if you can write a couple of simple junit test scripts
//The name of the file to be saved as JSON //Get a Hashmap of Name/Value pairs HashMapString, String> streamSetsJsonProperties = AdapaterF11eUtils.getStreamSetsJSONToHashMap (file.getAbsolutePath( 54 56 57 58 59 60 61 62 63 64 65 //Get File Name and save for later String jsonFileName-getJsonFileName (streamSetsJsonProperties); //ProcessDataContainer is main composite TAP object that will be saved to disk as JSON ProcessDataContainer pdc- new ProcessDataContainer //In the TAP Model there will always be a sourceResource and targetResource //Each Resource will have their own set of properties HashMap
sourceResourceProperties new HashMap(); HashMap targetResource Properties new HashMap(); 68 69 70 71 72 73 74 75 76 //Looping through each record of mapping document for (CSVRecord record records) i MappingRecord recordobjectnew MappingRecord (record) String propertyValue recordobject.getPropertyValue ) if (propertyvalue.isEmpty )) //If the value starts with "ADAPT (" we need to transform based on StreamsetValues if (propertyValue.startswith ("ADAPT( String streamSetsHashKey StringUtils.substringBetween (propertyValue, "ADAPT(", ")" propertyValue -(String) streamSetsusonProperties.get (streamSetsHashKey) if (streamSetsHashKey.equals ("TEMPLATE NAME")) t 78 79 80 81 82 83 84 85 86 87 AdaptremplateTosourceResource (propertyValue, streamSetsHashKey, sourceResourceProperties,streamSetsJsonProperties if (streamSetsHashKey.equals ("FILENAME PATTERN")) ( propertyValue -StringUtils.substringBefore (propertyValue, ".*") 124 125 126 127 128 static void AdaptTemplateToSourceResource (String propertyValue, String streamSetsHashKey, HashMap sourceResourceProperties, HashMap streamSetsJsonProperties //We are going to have a custom trigger here We need to check to see if the fileNamePattern /is parsed as it will be necessary to establish a file name to save //We will also need to know if its a zip or EBCDIC file switch (streamSetsHashKey) 130 131 132 133 134 135 136 case "TEMPLATE NAME": if (propertyValue.contains ("_VSAM_")) sourceResourceProperties.put ("IsEBCDIC","true") else f sourceResourceProperties.put ("IsEBCDIC", "false") if (propertyValue.contains(" ZIP") 138 139 140 141 142 143 144 145 146 147 148static String AdaptStreamsetsPropertyValueFromGlobals (String propertyValue, HashMap streamSetsJsonProperties) { //Get File Name and save for later String filePatternstreamSetsJsonProperties.get (" FILENAME PATTERN") String time stamp = new SimpleDateFormat ( "yyyy-MM-dd hh-mm-ss"). format (new Date()); time stamp = StringUtils. remove (timestamp, " "); return StringUtils. substringBefore (filePattern, " *) //The name of the file to be saved as JSON //Get a Hashmap of Name/Value pairs HashMapString, String> streamSetsJsonProperties = AdapaterF11eUtils.getStreamSetsJSONToHashMap (file.getAbsolutePath( 54 56 57 58 59 60 61 62 63 64 65 //Get File Name and save for later String jsonFileName-getJsonFileName (streamSetsJsonProperties); //ProcessDataContainer is main composite TAP object that will be saved to disk as JSON ProcessDataContainer pdc- new ProcessDataContainer //In the TAP Model there will always be a sourceResource and targetResource //Each Resource will have their own set of properties HashMap sourceResourceProperties new HashMap(); HashMap targetResource Properties new HashMap(); 68 69 70 71 72 73 74 75 76 //Looping through each record of mapping document for (CSVRecord record records) i MappingRecord recordobjectnew MappingRecord (record) String propertyValue recordobject.getPropertyValue ) if (propertyvalue.isEmpty )) //If the value starts with "ADAPT (" we need to transform based on StreamsetValues if (propertyValue.startswith ("ADAPT( String streamSetsHashKey StringUtils.substringBetween (propertyValue, "ADAPT(", ")" propertyValue -(String) streamSetsusonProperties.get (streamSetsHashKey) if (streamSetsHashKey.equals ("TEMPLATE NAME")) t 78 79 80 81 82 83 84 85 86 87 AdaptremplateTosourceResource (propertyValue, streamSetsHashKey, sourceResourceProperties,streamSetsJsonProperties if (streamSetsHashKey.equals ("FILENAME PATTERN")) ( propertyValue -StringUtils.substringBefore (propertyValue, ".*") 124 125 126 127 128 static void AdaptTemplateToSourceResource (String propertyValue, String streamSetsHashKey, HashMap sourceResourceProperties, HashMap streamSetsJsonProperties //We are going to have a custom trigger here We need to check to see if the fileNamePattern /is parsed as it will be necessary to establish a file name to save //We will also need to know if its a zip or EBCDIC file switch (streamSetsHashKey) 130 131 132 133 134 135 136 case "TEMPLATE NAME": if (propertyValue.contains ("_VSAM_")) sourceResourceProperties.put ("IsEBCDIC","true") else f sourceResourceProperties.put ("IsEBCDIC", "false") if (propertyValue.contains(" ZIP") 138 139 140 141 142 143 144 145 146 147 148static String AdaptStreamsetsPropertyValueFromGlobals (String propertyValue, HashMap streamSetsJsonProperties) { //Get File Name and save for later String filePatternstreamSetsJsonProperties.get (" FILENAME PATTERN") String time stamp = new SimpleDateFormat ( "yyyy-MM-dd hh-mm-ss"). format (new Date()); time stamp = StringUtils. remove (timestamp, " "); return StringUtils. substringBefore (filePattern, " *)