View Javadoc

1   package org.apache.maven.surefire.booter;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.surefire.providerapi.AbstractProvider;
23  import org.apache.maven.surefire.providerapi.SurefireProvider;
24  import org.apache.maven.surefire.report.ReporterConfiguration;
25  import org.apache.maven.surefire.report.ReporterException;
26  import org.apache.maven.surefire.suite.RunResult;
27  import org.apache.maven.surefire.testset.TestSetFailedException;
28  
29  import java.util.Iterator;
30  
31  import junit.framework.TestCase;
32  
33  /**
34   * @author Kristian Rosenvold
35   */
36  public class ForkTimeoutTest
37      extends TestCase
38  {
39      public void testClose()
40          throws Exception
41      {
42          final Integer forkTimeout1 = new Integer( 100 );
43          SurefireProvider surefireProvider = new TestProvider();
44          ReporterConfiguration reporterConfiguration = new ReporterConfiguration( null, null, null, forkTimeout1 );
45          new ForkTimeout( 100, reporterConfiguration, surefireProvider );
46          try
47          {
48              Thread.sleep( 1500 );
49          }
50          catch ( InterruptedException ignore )
51          {
52  
53          }
54      }
55  
56      public class TestProvider
57          extends AbstractProvider
58      {
59  
60          public TestProvider()
61          {
62          }
63  
64          public Iterator getSuites()
65          {
66              return null;
67          }
68  
69          public RunResult invoke( Object forkTestSet )
70              throws TestSetFailedException, ReporterException
71          {
72              return new RunResult( 1, 0, 0, 2 );
73          }
74      }
75  
76  }