当前位置: 首页>>代码示例>>Java>>正文


Java PrivacyProvider类代码示例

本文整理汇总了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());
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:42,代码来源:PrivacyProviderTest.java

示例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());
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:34,代码来源:PrivacyProviderTest.java

示例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());
    }
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:42,代码来源:PrivacyProviderTest.java

示例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());
    }
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:34,代码来源:PrivacyProviderTest.java


注:本文中的org.jivesoftware.smack.provider.PrivacyProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。