@Test public void testToMap() throws Exception { EmailData emailData = new EmailData("data1", workflowInstance, catalogs, failedOperation, incidents); Map<String, Object> map = emailData.toMap(); Object catalogs = map.get("catalogs"); Assert.assertNotNull(catalogs); Assert.assertTrue(catalogs instanceof HashMap); Object catalogHash = ((HashMap) catalogs).get("episode"); Assert.assertNotNull(catalogHash); Assert.assertTrue(catalogHash instanceof HashMap); Assert.assertEquals("Test Media Package", ((HashMap) catalogHash).get("title")); catalogHash = ((HashMap) catalogs).get("series"); Assert.assertNotNull(catalogHash); Assert.assertTrue(catalogHash instanceof HashMap); Assert.assertEquals("20140119997", ((HashMap) catalogHash).get("identifier")); Object mp = map.get("mediaPackage"); Assert.assertNotNull(mp); Assert.assertTrue(mp instanceof MediaPackage); Assert.assertEquals("Test Media Package", ((MediaPackage) mp).getTitle()); Object wf = map.get("workflow"); Assert.assertNotNull(wf); Assert.assertTrue(wf instanceof WorkflowInstance); Assert.assertEquals(1, ((WorkflowInstance) wf).getId()); Object wfConf = map.get("workflowConfig"); Assert.assertNotNull(wfConf); Assert.assertTrue(wfConf instanceof Map); Assert.assertEquals("user@domain.com", ((Map) wfConf).get("emailAddress")); Object op = map.get("failedOperation"); Assert.assertNotNull(op); Assert.assertTrue(op instanceof WorkflowOperationInstance); Assert.assertEquals("operation1", ((WorkflowOperationInstance) op).getTemplate()); Object inc = map.get("incident"); Assert.assertNotNull(inc); Assert.assertTrue(inc instanceof List); Assert.assertEquals(2, ((List) inc).size()); Assert.assertTrue(((List) inc).contains(incident1)); Assert.assertTrue(((List) inc).contains(incident2)); }
@Override public Map<String, Object> toMap() throws IllegalStateException { LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>(); m.put("meta", meta); m.put("notes", notes); m.put("mediaPackage", mediaPackage); m.put("workflow", workflow); m.put("workflowConfig", workflowConfig); m.put("catalogs", catalogs); m.put("failedOperation", failed); m.put("incident", incidents); return m; }
EmailData extends DocData { @Override public Map<String, Object> toMap() throws IllegalStateException { LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>(); m.put("meta", meta); m.put("notes", notes); m.put("mediaPackage", mediaPackage); m.put("workflow", workflow); m.put("workflowConfig", workflowConfig); m.put("catalogs", catalogs); m.put("failedOperation", failed); m.put("incident", incidents); return m; } }
EmailData extends DocData { @Override public Map<String, Object> toMap() throws IllegalStateException { LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>(); m.put("meta", meta); m.put("notes", notes); m.put("mediaPackage", mediaPackage); m.put("workflow", workflow); m.put("workflowConfig", workflowConfig); m.put("catalogs", catalogs); m.put("failedOperation", failed); m.put("incident", incidents); return m; } EmailData(String name, WorkflowInstance workflow, HashMap<String, HashMap<String, String>> catalogs,
          WorkflowOperationInstance failed, List<Incident> incidents); }
EmailData extends DocData { @Override public Map<String, Object> toMap() throws IllegalStateException { LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>(); m.put("meta", meta); m.put("notes", notes); m.put("mediaPackage", mediaPackage); m.put("workflow", workflow); m.put("workflowConfig", workflowConfig); m.put("catalogs", catalogs); m.put("failedOperation", failed); m.put("incident", incidents); return m; } EmailData(String name, WorkflowInstance workflow, HashMap<String, HashMap<String, String>> catalogs,
          WorkflowOperationInstance failed, List<Incident> incidents); @Override String toString(); @Override Map<String, Object> toMap(); }
EmailData extends DocData { @Override public Map<String, Object> toMap() throws IllegalStateException { LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>(); m.put("meta", meta); m.put("notes", notes); m.put("mediaPackage", mediaPackage); m.put("workflow", workflow); m.put("workflowConfig", workflowConfig); m.put("catalogs", catalogs); m.put("failedOperation", failed); m.put("incident", incidents); return m; } EmailData(String name, WorkflowInstance workflow, HashMap<String, HashMap<String, String>> catalogs,
          WorkflowOperationInstance failed, List<Incident> incidents); @Override String toString(); @Override Map<String, Object> toMap();  }