1 /*
2 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
3 * The software in this package is published under the terms of the CPAL v1.0
4 * license, a copy of which has been included with this distribution in the
5 * LICENSE.txt file.
6 */
7 package org.mule.tck;
8
9
10 /**
11 * Extend this class instead of FunctionalTestCase to add dynamic port support to
12 * your tests. The test will need to only implement 'getNumPortsToFind' to tell this
13 * class how many free test ports to find.
14 *
15 * @Deprecated: use {@link org.mule.tck.junit4.rule.DynamicPort} in a JUnit 4 test.
16 */
17 @Deprecated
18 public abstract class DynamicPortTestCase extends FunctionalTestCase
19 {
20 protected abstract int getNumPortsToFind();
21
22 public DynamicPortTestCase()
23 {
24 super();
25
26 // each test class sets the number of free ports to find
27 numPorts = getNumPortsToFind();
28 }
29
30 @Override
31 protected void doSetUp() throws Exception
32 {
33 super.doSetUp();
34 }
35
36 @Override
37 protected void doTearDown() throws Exception
38 {
39 super.doTearDown();
40 // make sure that the ports have been freed. It's not a fatal error, but we
41 // want to track down why it's not being released
42 PortUtils.checkPorts(false, "TEARDOWN", getPorts());
43 }
44 }