OozieFeedMapper extends AbstractOozieEntityMapper<Feed> { @Override protected List<COORDINATORAPP> getCoordinators(Cluster cluster, Path bundlePath) throws IvoryException { List<COORDINATORAPP> coords = new ArrayList<COORDINATORAPP>(); COORDINATORAPP retentionCoord = getRetentionCoordinator(cluster, bundlePath); if (retentionCoord != null) { coords.add(retentionCoord); } List<COORDINATORAPP> replicationCoords = getReplicationCoordinators(cluster, bundlePath); coords.addAll(replicationCoords); return coords; } OozieFeedMapper(Feed feed);   }
@Test public void testReplicationCoords() throws IvoryException { OozieFeedMapper feedMapper = new OozieFeedMapper(feed); List<COORDINATORAPP> coords = feedMapper.getCoordinators(trgCluster, new Path("/projects/ivory/")); COORDINATORAPP coord = coords.get(0); Assert.assertEquals("2010-01-01T00:40Z", coord.getStart()); Assert.assertEquals("${nameNode}/projects/ivory/REPLICATION", coord .getAction().getWorkflow().getAppPath()); Assert.assertEquals("IVORY_FEED_REPLICATION_" + feed.getName() + "_" + srcCluster.getName(), coord.getName()); Assert.assertEquals("${coord:minutes(20)}", coord.getFrequency()); SYNCDATASET inputDataset = (SYNCDATASET) coord.getDatasets() .getDatasetOrAsyncDataset().get(0); SYNCDATASET outputDataset = (SYNCDATASET) coord.getDatasets() .getDatasetOrAsyncDataset().get(1); Assert.assertEquals("${coord:minutes(20)}", inputDataset.getFrequency()); Assert.assertEquals("input-dataset", inputDataset.getName()); Assert.assertEquals( ClusterHelper.getStorageUrl(srcCluster) + "/examples/input-data/rawLogs/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}", inputDataset.getUriTemplate()); Assert.assertEquals("${coord:minutes(20)}", outputDataset.getFrequency()); Assert.assertEquals("output-dataset", outputDataset.getName()); Assert.assertEquals( "${nameNode}" + "/examples/input-data/rawLogs/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}", outputDataset.getUriTemplate()); String inEventName =coord.getInputEvents().getDataIn().get(0).getName(); String inEventDataset =coord.getInputEvents().getDataIn().get(0).getDataset(); String inEventInstance = coord.getInputEvents().getDataIn().get(0).getInstance().get(0); Assert.assertEquals("input", inEventName); Assert.assertEquals("input-dataset", inEventDataset); Assert.assertEquals("${now(0,-40)}", inEventInstance); String outEventInstance = coord.getOutputEvents().getDataOut().get(0).getInstance(); Assert.assertEquals("${now(0,-40)}", outEventInstance); for(Property prop:coord.getAction().getWorkflow().getConfiguration().getProperty()){ if(prop.getName().equals("mapred.job.priority")){ assertEquals(prop.getValue(), "NORMAL"); break; } } }