Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DynamicPortTestCase |
|
| 0.0;0 |
1 | /* | |
2 | * $Id$ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.tck; | |
12 | ||
13 | ||
14 | /** | |
15 | * Extend this class instead of FunctionalTestCase to add dynamic port support to | |
16 | * your tests. The test will need to only implement 'getNumPortsToFind' to tell this | |
17 | * class how many free test ports to find. | |
18 | */ | |
19 | public abstract class DynamicPortTestCase extends FunctionalTestCase | |
20 | { | |
21 | protected abstract int getNumPortsToFind(); | |
22 | ||
23 | public DynamicPortTestCase() | |
24 | { | |
25 | 0 | super(); |
26 | ||
27 | // each test class sets the number of free ports to find | |
28 | 0 | numPorts = getNumPortsToFind(); |
29 | 0 | } |
30 | ||
31 | @Override | |
32 | protected void doSetUp() throws Exception | |
33 | { | |
34 | 0 | super.doSetUp(); |
35 | // see if the ports are available, tests should fail if they are not | |
36 | //checkPorts(false, "SETUP"); | |
37 | 0 | } |
38 | ||
39 | @Override | |
40 | protected void doTearDown() throws Exception | |
41 | { | |
42 | 0 | super.doTearDown(); |
43 | // make sure that the ports have been freed. It's not a fatal error, but we | |
44 | // want to track down why it's not being released | |
45 | 0 | checkPorts(false, "TEARDOWN"); |
46 | ||
47 | //find a new set of ports so the next test does not fail, regardless of the current ports not being available | |
48 | //ports = findFreePorts(getNumPortsToFind()); | |
49 | // this will propagate to the mule configuration | |
50 | //setPortProperties(); | |
51 | 0 | } |
52 | } |