@Test public void testNormalizeFilename() throws Exception { EventAdminApplication app = new EventAdminApplication(); Assert.assertEquals("data.events.xml", app.normalizeFilename("data")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.Xml")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.events")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.events.")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.events.xml")); Assert.assertEquals("data.events.xml", app.normalizeFilename("data.events.XML")); }
protected String normalizeFilename(String currentFileName) { String fileName = currentFileName.replaceFirst("\\.$", ""); if (fileName.toLowerCase().endsWith(".xml")) { if (fileName.toLowerCase().endsWith(".events.xml")) { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".xml"); } else { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".events.xml"); } } else { if (fileName.toLowerCase().endsWith(".events")) { fileName += ".xml"; } else { fileName += ".events.xml"; } } return fileName; }
EventAdminApplication extends Application { protected String normalizeFilename(String currentFileName) { String fileName = currentFileName.replaceFirst("\\.$", ""); if (fileName.toLowerCase().endsWith(".xml")) { if (fileName.toLowerCase().endsWith(".events.xml")) { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".xml"); } else { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".events.xml"); } } else { if (fileName.toLowerCase().endsWith(".events")) { fileName += ".xml"; } else { fileName += ".events.xml"; } } return fileName; } }
EventAdminApplication extends Application { protected String normalizeFilename(String currentFileName) { String fileName = currentFileName.replaceFirst("\\.$", ""); if (fileName.toLowerCase().endsWith(".xml")) { if (fileName.toLowerCase().endsWith(".events.xml")) { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".xml"); } else { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".events.xml"); } } else { if (fileName.toLowerCase().endsWith(".events")) { fileName += ".xml"; } else { fileName += ".events.xml"; } } return fileName; }  }
EventAdminApplication extends Application { protected String normalizeFilename(String currentFileName) { String fileName = currentFileName.replaceFirst("\\.$", ""); if (fileName.toLowerCase().endsWith(".xml")) { if (fileName.toLowerCase().endsWith(".events.xml")) { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".xml"); } else { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".events.xml"); } } else { if (fileName.toLowerCase().endsWith(".events")) { fileName += ".xml"; } else { fileName += ".events.xml"; } } return fileName; }  void setEventConfDao(EventConfDao eventConfDao); void setEventProxy(EventProxy eventProxy); @Override void init(); }
EventAdminApplication extends Application { protected String normalizeFilename(String currentFileName) { String fileName = currentFileName.replaceFirst("\\.$", ""); if (fileName.toLowerCase().endsWith(".xml")) { if (fileName.toLowerCase().endsWith(".events.xml")) { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".xml"); } else { fileName = fileName.replaceFirst("\\.[Xx][Mm][Ll]", ".events.xml"); } } else { if (fileName.toLowerCase().endsWith(".events")) { fileName += ".xml"; } else { fileName += ".events.xml"; } } return fileName; }  void setEventConfDao(EventConfDao eventConfDao); void setEventProxy(EventProxy eventProxy); @Override void init();  }