@Test public void testIQ() { IQEntityTimeHandler iqEntityTimeHandler = new IQEntityTimeHandler(); IQ input = new IQ(IQ.Type.get, "1"); IQ result = iqEntityTimeHandler.handleIQ(input); assertEquals(result.getChildElement().getName(), "time"); assertEquals(result.getChildElement().getNamespace().getText(), "urn:xmpp:time"); assertEquals(result.getChildElement().content().size(), 2); assertTrue(result.getChildElement().content().get(0) instanceof Element); assertTrue(result.getChildElement().content().get(1) instanceof Element); assertEquals(((Element) result.getChildElement().content().get(0)).getName(), "tzo"); assertEquals(((Element) result.getChildElement().content().get(1)).getName(), "utc"); }
@Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { @Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; } }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { @Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; } IQEntityTimeHandler(); }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { @Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; } IQEntityTimeHandler(); @Override IQ handleIQ(IQ packet); @Override IQHandlerInfo getInfo(); @Override Iterator<String> getFeatures(); }
IQEntityTimeHandler extends IQHandler implements ServerFeaturesProvider { @Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; } IQEntityTimeHandler(); @Override IQ handleIQ(IQ packet); @Override IQHandlerInfo getInfo(); @Override Iterator<String> getFeatures();  }