org.mule.tck.junit4.rule
Class DynamicPort
java.lang.Object
org.junit.rules.ExternalResource
org.mule.tck.junit4.rule.SystemProperty
org.mule.tck.junit4.rule.DynamicPort
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class DynamicPort
- extends SystemProperty
Defines a socket port number that will be dynamically assigned as an
external resource. The instance will check that the port has been released
on test shutdown.
To use an instance dynamic socket port:
@Rule
public DynamicPort serverPort = new DynamicPort("server_port");
In order to use static dynamic ports:
@ClassRule
public static DynamicPort dynamicPort = new DynamicPort("server_port");
Constructor Summary |
DynamicPort(String name)
Creates a dynamic port resource for a given port name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MIN_PORT_SYSTEM_PROPERTY
public static final String MIN_PORT_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
MAX_PORT_SYSTEM_PROPERTY
public static final String MAX_PORT_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
freePortFinder
protected static FreePortFinder freePortFinder
DynamicPort
public DynamicPort(String name)
- Creates a dynamic port resource for a given port name.
- Parameters:
name
- the name assigned to the port number. On resource creation
a new system property will be created with that name and the
value will be the port number.
getValue
public String getValue()
- Overrides:
getValue
in class SystemProperty
doCleanUp
protected void doCleanUp()
- Overrides:
doCleanUp
in class SystemProperty
getNumber
public int getNumber()
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.