Polling condition added
This commit is contained in:
parent
c3dadfd845
commit
249b5fc33e
1 changed files with 13 additions and 9 deletions
|
@ -8,6 +8,7 @@ import org.jupnp.model.message.header.STAllHeader
|
||||||
import org.jupnp.model.message.header.UpnpHeader
|
import org.jupnp.model.message.header.UpnpHeader
|
||||||
import org.jupnp.model.types.HostPort
|
import org.jupnp.model.types.HostPort
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import spock.util.concurrent.PollingConditions
|
||||||
import support.IntegrationSpecification
|
import support.IntegrationSpecification
|
||||||
import support.beans.dlna.upnp.UpnpServiceConfigurationInt
|
import support.beans.dlna.upnp.UpnpServiceConfigurationInt
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ class DlnaServiceIntTest extends IntegrationSpecification {
|
||||||
private UpnpService upnpService
|
private UpnpService upnpService
|
||||||
@Autowired
|
@Autowired
|
||||||
private MediaServer mediaServer
|
private MediaServer mediaServer
|
||||||
|
def conditions = new PollingConditions(timeout: 1)
|
||||||
|
|
||||||
def "should send initial multicast Upnp datagrams on start"() {
|
def "should send initial multicast Upnp datagrams on start"() {
|
||||||
given:
|
given:
|
||||||
|
@ -36,16 +38,18 @@ class DlnaServiceIntTest extends IntegrationSpecification {
|
||||||
sut.start()
|
sut.start()
|
||||||
|
|
||||||
then:
|
then:
|
||||||
configuration.outgoingDatagramMessages.any()
|
conditions.eventually {
|
||||||
configuration.outgoingDatagramMessages[0].class == OutgoingSearchRequest
|
assert configuration.outgoingDatagramMessages.any()
|
||||||
with(configuration.outgoingDatagramMessages[0] as OutgoingSearchRequest) {
|
assert configuration.outgoingDatagramMessages[0].class == OutgoingSearchRequest
|
||||||
assert it.operation.method == MSEARCH
|
with(configuration.outgoingDatagramMessages[0] as OutgoingSearchRequest) {
|
||||||
assert it.destinationAddress == InetAddress.getByName(IPV4_UPNP_MULTICAST_GROUP)
|
assert it.operation.method == MSEARCH
|
||||||
assert it.destinationPort == UPNP_MULTICAST_PORT
|
assert it.destinationAddress == InetAddress.getByName(IPV4_UPNP_MULTICAST_GROUP)
|
||||||
|
assert it.destinationPort == UPNP_MULTICAST_PORT
|
||||||
|
|
||||||
assert header(it, MAN, MANHeader.class) == DISCOVER.headerString
|
assert header(it, MAN, MANHeader.class) == DISCOVER.headerString
|
||||||
assert header(it, ST, STAllHeader.class).headerString == ALL.headerString
|
assert header(it, ST, STAllHeader.class).headerString == ALL.headerString
|
||||||
assert header(it, HOST, HostHeader.class) == new HostPort(IPV4_UPNP_MULTICAST_GROUP, UPNP_MULTICAST_PORT)
|
assert header(it, HOST, HostHeader.class) == new HostPort(IPV4_UPNP_MULTICAST_GROUP, UPNP_MULTICAST_PORT)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue