mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Reduce scope of 'discoInfoSend' in EntityCapsTest integratino test
This commit is contained in:
parent
e8923b9d16
commit
6f83553c1b
1 changed files with 7 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2013-2016 Florian Schmaus
|
* Copyright 2013-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
|
@ -56,8 +57,6 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
||||||
private final ServiceDiscoveryManager sdmOne;
|
private final ServiceDiscoveryManager sdmOne;
|
||||||
private final ServiceDiscoveryManager sdmTwo;
|
private final ServiceDiscoveryManager sdmTwo;
|
||||||
|
|
||||||
private boolean discoInfoSend = false;
|
|
||||||
|
|
||||||
public EntityCapsTest(SmackIntegrationTestEnvironment environment) {
|
public EntityCapsTest(SmackIntegrationTestEnvironment environment) {
|
||||||
super(environment);
|
super(environment);
|
||||||
ecmTwo = EntityCapsManager.getInstanceFor(environment.conTwo);
|
ecmTwo = EntityCapsManager.getInstanceFor(environment.conTwo);
|
||||||
|
@ -134,11 +133,12 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
||||||
@SmackIntegrationTest
|
@SmackIntegrationTest
|
||||||
public void testPreventDiscoInfo() throws Exception {
|
public void testPreventDiscoInfo() throws Exception {
|
||||||
final String dummyFeature = getNewDummyFeature();
|
final String dummyFeature = getNewDummyFeature();
|
||||||
|
final AtomicBoolean discoInfoSend = new AtomicBoolean();
|
||||||
conOne.addStanzaSendingListener(new StanzaListener() {
|
conOne.addStanzaSendingListener(new StanzaListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processStanza(Stanza stanza) {
|
public void processStanza(Stanza stanza) {
|
||||||
discoInfoSend = true;
|
discoInfoSend.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, new AndFilter(new StanzaTypeFilter(DiscoverInfo.class), IQTypeFilter.GET));
|
}, new AndFilter(new StanzaTypeFilter(DiscoverInfo.class), IQTypeFilter.GET));
|
||||||
|
@ -168,14 +168,14 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
||||||
// discover that
|
// discover that
|
||||||
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
|
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
|
||||||
// that discovery should cause a disco#info
|
// that discovery should cause a disco#info
|
||||||
assertTrue(discoInfoSend);
|
assertTrue(discoInfoSend.get());
|
||||||
assertTrue(info.containsFeature(dummyFeature));
|
assertTrue(info.containsFeature(dummyFeature));
|
||||||
discoInfoSend = false;
|
discoInfoSend.set(false);
|
||||||
|
|
||||||
// discover that
|
// discover that
|
||||||
info = sdmOne.discoverInfo(conTwo.getUser());
|
info = sdmOne.discoverInfo(conTwo.getUser());
|
||||||
// that discovery shouldn't cause a disco#info
|
// that discovery shouldn't cause a disco#info
|
||||||
assertFalse(discoInfoSend);
|
assertFalse(discoInfoSend.get());
|
||||||
assertTrue(info.containsFeature(dummyFeature));
|
assertTrue(info.containsFeature(dummyFeature));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue