public void testNotify_Http() throws Exception { // create socket listener SocketListener socketListener = new SocketListener(NOTIFICATION_PORT); // create notification listener Subscriber notificationListener = new Subscriber("http://localhost:" + NOTIFICATION_PORT); // create reports ECReports reports = ECElementsUtils.createECReports(); // notify listener about reports notificationListener.notify(reports); // get input stream InputStream inputStream = socketListener.getInputStream(); // read from input stream readHtmlHeaderFromInputStream(inputStream); ECReports resultReports = DeserializerUtil.deserializeECReports(inputStream); // close socket listener socketListener.stop(); // check result // FIXME // ECElementsUtils.assertEquals(reports, resultReports); }
public void testNotify_File() throws Exception { // create file File notificationFile = File.createTempFile("NotifiactionListenerTest", null); // create notification listener Subscriber notificationListener = new Subscriber("file:///" + notificationFile.getAbsolutePath()); // create reports ECReports reports = ECElementsUtils.createECReports(); // notify listener about reports notificationListener.notify(reports); // read file ECReports resultReports = DeserializerUtil.deserializeECReports(new FileInputStream(notificationFile)); // check result // FIXME // ECElementsUtils.assertEquals(reports, resultReports); }