/** * Test of convertNotificationDataToXML method, of class NotificationServerUtil. * * @throws Exception */ @Test public void testConvertNotificationDataToXML() throws Exception { NotificationData p_Data = new NotificationData(); Map<String, Object> params = new HashMap<String, Object>(2); Date dateParam = RandomGenerator.getRandomCalendar().getTime(); params.put("date", dateParam); params.put("string", "bonjour le monde; 0 + 0 = la tête à toto"); p_Data.setAnswerAllowed(true); p_Data.setComment("comment"); p_Data.setLoginPassword("password"); p_Data.setLoginUser("user"); p_Data.setMessage("message"); p_Data.setNotificationId(RandomGenerator.getRandomLong()); p_Data.setPrioritySpeed("fast"); p_Data.setReportToLogStatus("logStatus"); p_Data.setReportToSenderStatus("senderStatus"); p_Data.setReportToSenderTargetChannel("POPUP"); p_Data.setReportToSenderTargetParam("MyParms"); p_Data.setReportToSenderTargetReceipt("SenderReceipt"); p_Data.setSenderId("*****@*****.**"); p_Data.setSenderName("Bart Simpson"); p_Data.setTargetChannel("SMTP"); p_Data.setTargetName("Home Simpson"); p_Data.setTargetParam(params); p_Data.setTargetReceipt("receipt"); String result = NotificationServerUtil.convertNotificationDataToXML(p_Data); assertEquals( "<?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>", result); }