本文整理汇总了Java中org.jivesoftware.smack.provider.PrivacyProvider类的典型用法代码示例。如果您正苦于以下问题:Java PrivacyProvider类的具体用法?Java PrivacyProvider怎么用?Java PrivacyProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrivacyProvider类属于org.jivesoftware.smack.provider包,在下文中一共展示了PrivacyProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmptyLists
import org.jivesoftware.smack.provider.PrivacyProvider; //导入依赖的package包/类
/**
* Check the parser with an xml with empty lists. It includes the active,
* default and special list.
* To create the xml string based from an xml file, replace:\n with: "\n + "
*/
public void testEmptyLists() {
// Make the XML to test
String xml = ""
+ " <iq type='result' id='getlist1' to='[email protected]/orchard'> "
+ " <query xmlns='jabber:iq:privacy'> "
+ " <active/> "
+ " <default name='public'/> "
+ " <list name='public'/> "
+ " <list name='private'/> "
+ " <list name='special'/> "
+ " </query> "
+ " </iq> ";
try {
// Create the xml parser
XmlPullParser parser = getParserFromXML(xml);
// Create a packet from the xml
Privacy packet = (Privacy) (new PrivacyProvider()).parse(parser);
assertNotNull(packet);
assertNotNull(packet.getChildElementXML());
assertEquals("public", packet.getDefaultName());
assertEquals(null, packet.getActiveName());
assertEquals(0, packet.getPrivacyList("public").size());
assertEquals(0, packet.getPrivacyList("private").size());
assertEquals(0, packet.getPrivacyList("special").size());
assertEquals(true, packet.isDeclineActiveList());
assertEquals(false, packet.isDeclineDefaultList());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例2: testDeclineLists
import org.jivesoftware.smack.provider.PrivacyProvider; //导入依赖的package包/类
/**
* Check the parser with an xml with empty lists. It includes the active,
* default and special list.
* To create the xml string based from an xml file, replace:\n with: "\n + "
*/
public void testDeclineLists() {
// Make the XML to test
String xml = ""
+ " <iq type='result' id='getlist1' to='[email protected]/orchard'> "
+ " <query xmlns='jabber:iq:privacy'> "
+ " <active/> "
+ " <default/> "
+ " </query> "
+ " </iq> ";
try {
// Create the xml parser
XmlPullParser parser = getParserFromXML(xml);
// Create a packet from the xml
Privacy packet = (Privacy) (new PrivacyProvider()).parse(parser);
assertNotNull(packet);
assertEquals(null, packet.getDefaultName());
assertEquals(null, packet.getActiveName());
assertEquals(true, packet.isDeclineActiveList());
assertEquals(true, packet.isDeclineDefaultList());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例3: testEmptyLists
import org.jivesoftware.smack.provider.PrivacyProvider; //导入依赖的package包/类
/**
* Check the parser with an xml with empty lists. It includes the active,
* default and special list.
* To create the xml string based from an xml file, replace:\n with: "\n + "
*/
public void testEmptyLists() {
// Make the XML to test
String xml = ""
+ " <iq type='result' id='getlist1' to='[email protected]/orchard'> "
+ " <query xmlns='jabber:iq:privacy'> "
+ " <active/> "
+ " <default name='public'/> "
+ " <list name='public'/> "
+ " <list name='private'/> "
+ " <list name='special'/> "
+ " </query> "
+ " </iq> ";
try {
// Create the xml parser
XmlPullParser parser = getParserFromXML(xml);
// Create a packet from the xml
Privacy packet = (Privacy) (new PrivacyProvider()).parseIQ(parser);
assertNotNull(packet);
assertNotNull(packet.getChildElementXML());
assertEquals("public", packet.getDefaultName());
assertEquals(null, packet.getActiveName());
assertEquals(0, packet.getPrivacyList("public").size());
assertEquals(0, packet.getPrivacyList("private").size());
assertEquals(0, packet.getPrivacyList("special").size());
assertEquals(true, packet.isDeclineActiveList());
assertEquals(false, packet.isDeclineDefaultList());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例4: testDeclineLists
import org.jivesoftware.smack.provider.PrivacyProvider; //导入依赖的package包/类
/**
* Check the parser with an xml with empty lists. It includes the active,
* default and special list.
* To create the xml string based from an xml file, replace:\n with: "\n + "
*/
public void testDeclineLists() {
// Make the XML to test
String xml = ""
+ " <iq type='result' id='getlist1' to='[email protected]/orchard'> "
+ " <query xmlns='jabber:iq:privacy'> "
+ " <active/> "
+ " <default/> "
+ " </query> "
+ " </iq> ";
try {
// Create the xml parser
XmlPullParser parser = getParserFromXML(xml);
// Create a packet from the xml
Privacy packet = (Privacy) (new PrivacyProvider()).parseIQ(parser);
assertNotNull(packet);
assertEquals(null, packet.getDefaultName());
assertEquals(null, packet.getActiveName());
assertEquals(true, packet.isDeclineActiveList());
assertEquals(true, packet.isDeclineDefaultList());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}