本文整理汇总了Java中org.jivesoftware.smack.filter.FromMatchesFilter.create方法的典型用法代码示例。如果您正苦于以下问题:Java FromMatchesFilter.create方法的具体用法?Java FromMatchesFilter.create怎么用?Java FromMatchesFilter.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.filter.FromMatchesFilter
的用法示例。
在下文中一共展示了FromMatchesFilter.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoCompareMatchingServiceJid
import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
public void autoCompareMatchingServiceJid()
{
FromMatchesFilter filter = FromMatchesFilter.create(SERVICE_JID1);
Stanza packet = new Stanza() {
@Override
public String toXML() { return null; }
};
packet.setFrom(SERVICE_JID1);
assertTrue(filter.accept(packet));
packet.setFrom(SERVICE_JID2);
assertFalse(filter.accept(packet));
packet.setFrom(BASE_JID1);
assertFalse(filter.accept(packet));
packet.setFrom(FULL_JID1_R1);
assertFalse(filter.accept(packet));
packet.setFrom(BASE_JID3);
assertFalse(filter.accept(packet));
}
示例2: autoCompareMatchingFullJid
import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
public void autoCompareMatchingFullJid()
{
FromMatchesFilter filter = FromMatchesFilter.create(FULL_JID1_R1);
Stanza packet = new Stanza() {
@Override
public String toXML() { return null; }
};
packet.setFrom(FULL_JID1_R1);
assertTrue(filter.accept(packet));
packet.setFrom(BASE_JID1);
assertFalse(filter.accept(packet));
packet.setFrom(FULL_JID1_R2);
assertFalse(filter.accept(packet));
packet.setFrom(BASE_JID2);
assertFalse(filter.accept(packet));
packet.setFrom(FULL_JID2);
assertFalse(filter.accept(packet));
packet.setFrom(BASE_JID3);
assertFalse(filter.accept(packet));
}
示例3: autoCompareMatchingBaseJid
import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
public void autoCompareMatchingBaseJid()
{
FromMatchesFilter filter = FromMatchesFilter.create(BASE_JID1);
Stanza packet = new Stanza() {
@Override
public String toXML() { return null; }
};
packet.setFrom(BASE_JID1);
assertTrue(filter.accept(packet));
packet.setFrom(FULL_JID1_R1);
assertTrue(filter.accept(packet));
packet.setFrom(FULL_JID1_R2);
assertTrue(filter.accept(packet));
packet.setFrom(BASE_JID2);
assertFalse(filter.accept(packet));
packet.setFrom(FULL_JID2);
assertFalse(filter.accept(packet));
packet.setFrom(BASE_JID3);
assertFalse(filter.accept(packet));
}
示例4: isAvailable
import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
/**
* Returns true if the workgroup is available for receiving new requests. The workgroup will be
* available only when agents are available for this workgroup.
*
* @return true if the workgroup is available for receiving new requests.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
*/
public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException {
Presence directedPresence = new Presence(Presence.Type.available);
directedPresence.setTo(workgroupJID);
StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class);
StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID);
PacketCollector collector = connection.createPacketCollectorAndSend(new AndFilter(fromFilter,
typeFilter), directedPresence);
Presence response = (Presence)collector.nextResultOrThrow();
return Presence.Type.available == response.getType();
}