Fixed test isolation
This commit is contained in:
parent
91ae96516c
commit
fa5443d0dc
1 changed files with 27 additions and 4 deletions
|
@ -2,12 +2,12 @@ package support.beans.dlna.upnp
|
|||
|
||||
import org.jupnp.DefaultUpnpServiceConfiguration
|
||||
import org.jupnp.model.message.OutgoingDatagramMessage
|
||||
import org.jupnp.transport.Router
|
||||
import org.jupnp.transport.impl.DatagramIOConfigurationImpl
|
||||
import org.jupnp.transport.impl.DatagramIOImpl
|
||||
import org.jupnp.transport.spi.DatagramIO
|
||||
import org.jupnp.transport.spi.NetworkAddressFactory
|
||||
import org.jupnp.transport.spi.StreamClient
|
||||
import org.jupnp.transport.spi.StreamServer
|
||||
import org.jupnp.transport.impl.MulticastReceiverConfigurationImpl
|
||||
import org.jupnp.transport.impl.MulticastReceiverImpl
|
||||
import org.jupnp.transport.spi.*
|
||||
import org.springframework.context.annotation.Profile
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
|
@ -31,10 +31,33 @@ class UpnpServiceConfigurationInt extends DefaultUpnpServiceConfiguration {
|
|||
return new MockDatagramIO(this, new DatagramIOConfigurationImpl())
|
||||
}
|
||||
|
||||
@Override
|
||||
public MulticastReceiver createMulticastReceiver(NetworkAddressFactory networkAddressFactory) {
|
||||
return new MockMulticastReceiver(
|
||||
new MulticastReceiverConfigurationImpl(
|
||||
networkAddressFactory.getMulticastGroup(),
|
||||
networkAddressFactory.getMulticastPort()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private void onOutgoingDatagramMessage(OutgoingDatagramMessage message) {
|
||||
outgoingDatagramMessages.add(message)
|
||||
}
|
||||
|
||||
class MockMulticastReceiver extends MulticastReceiverImpl {
|
||||
MockMulticastReceiver(MulticastReceiverConfigurationImpl configuration) {
|
||||
super(configuration)
|
||||
}
|
||||
|
||||
@Override
|
||||
void init(NetworkInterface networkInterface, Router router, NetworkAddressFactory networkAddressFactory, DatagramProcessor datagramProcessor) throws InitializationException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {}
|
||||
}
|
||||
|
||||
class MockDatagramIO extends DatagramIOImpl {
|
||||
private final UpnpServiceConfigurationInt upnpServiceConfiguration
|
||||
|
||||
|
|
Loading…
Reference in a new issue