/** * Test of convertXMLToNotificationData method, of class NotificationServerUtil. * * @throws Exception */ @Test public void testConvertXMLToNotificationData() throws Exception { Date dateParam = RandomGenerator.getRandomCalendar().getTime(); String p_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<NOTIFY> <LOGIN> <USER>" + "<![CDATA[user]]></USER> <PASSWORD><![CDATA[password]]></PASSWORD> </LOGIN> " + "<MESSAGE><![CDATA[message]]></MESSAGE> <SENDER> <ID><![CDATA[bart.simpson@silverpeas" + ".com]]></ID> <NAME><![CDATA[Bart Simpson]]></NAME> <ANSWERALLOWED>true" + "</ANSWERALLOWED> </SENDER> <COMMENT><![CDATA[comment]]></COMMENT> <TARGET CHANNEL=\"SMTP\">" + " <NAME><![CDATA[Home Simpson]]></NAME> <RECEIPT><![CDATA[receipt]]></RECEIPT> " + "<PARAM><![CDATA[date=#DATE#" + dateParam.getTime() + ";string=bonjour le monde;; 0 + 0 == la tête à " + "toto]]></PARAM> </TARGET> <PRIORITY SPEED=\"fast\"/> <REPORT> </REPORT></NOTIFY>"; NotificationData expResult = new NotificationData(); Map<String, Object> params = new HashMap<String, Object>(2); params.put("string", "bonjour le monde; 0 + 0 = la tête à toto"); params.put("date", dateParam); expResult.setAnswerAllowed(true); expResult.setComment("comment"); expResult.setLoginPassword("password"); expResult.setLoginUser("user"); expResult.setMessage("message"); expResult.setNotificationId(0L); expResult.setPrioritySpeed("fast"); expResult.setSenderId("*****@*****.**"); expResult.setSenderName("Bart Simpson"); expResult.setTargetChannel("SMTP"); expResult.setTargetName("Home Simpson"); expResult.setTargetParam(params); expResult.setTargetReceipt("receipt"); NotificationData result = NotificationServerUtil.convertXMLToNotificationData(p_XML); assertEquals(expResult, result); }