@Test public void testGenerateLeaInfoDefaultEvent() throws ADKException { String messageFile = getPathForFile("/element_xml/LEAInfo.xml"); Event leaInfoEvent = CustomEventGenerator.generateEvent(messageFile, EventAction.ADD); EventAction eventAction = leaInfoEvent.getAction(); Assert.assertEquals(EventAction.ADD, eventAction); checkLeaInfo(leaInfoEvent); }
public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; while (in.ready()) { bufSize = in.read(buf, 0, buf.length); xml.append(buf, 0, bufSize); } SIFDataObject generic = (SIFDataObject) p.parse(xml.toString(), null, 0, SIFVersion.SIF23); event = new Event(generic, eventAction); } catch (SIFException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKParsingException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (IOException e) { LOG.error("Caught exception trying to load entity from file", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Unable to close file", e); } } } return event; }
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; while (in.ready()) { bufSize = in.read(buf, 0, buf.length); xml.append(buf, 0, bufSize); } SIFDataObject generic = (SIFDataObject) p.parse(xml.toString(), null, 0, SIFVersion.SIF23); event = new Event(generic, eventAction); } catch (SIFException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKParsingException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (IOException e) { LOG.error("Caught exception trying to load entity from file", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Unable to close file", e); } } } return event; } }
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; while (in.ready()) { bufSize = in.read(buf, 0, buf.length); xml.append(buf, 0, bufSize); } SIFDataObject generic = (SIFDataObject) p.parse(xml.toString(), null, 0, SIFVersion.SIF23); event = new Event(generic, eventAction); } catch (SIFException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKParsingException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (IOException e) { LOG.error("Caught exception trying to load entity from file", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Unable to close file", e); } } } return event; }  }
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; while (in.ready()) { bufSize = in.read(buf, 0, buf.length); xml.append(buf, 0, bufSize); } SIFDataObject generic = (SIFDataObject) p.parse(xml.toString(), null, 0, SIFVersion.SIF23); event = new Event(generic, eventAction); } catch (SIFException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKParsingException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (IOException e) { LOG.error("Caught exception trying to load entity from file", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Unable to close file", e); } } } return event; }  static Event generateEvent(String messageFile, EventAction eventAction); }
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; while (in.ready()) { bufSize = in.read(buf, 0, buf.length); xml.append(buf, 0, bufSize); } SIFDataObject generic = (SIFDataObject) p.parse(xml.toString(), null, 0, SIFVersion.SIF23); event = new Event(generic, eventAction); } catch (SIFException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKParsingException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (ADKException e) { LOG.error("Caught exception trying to load entity from file", e); } catch (IOException e) { LOG.error("Caught exception trying to load entity from file", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { LOG.warn("Unable to close file", e); } } } return event; }  static Event generateEvent(String messageFile, EventAction eventAction);  }