1   package org.apache.maven.surefire.its;
2   
3   
4   import junit.framework.TestCase;
5   import org.apache.maven.it.Verifier;
6   import org.apache.maven.it.util.FileUtils;
7   import org.apache.maven.it.util.ResourceExtractor;
8   
9   import java.io.File;
10  import java.io.IOException;
11  import java.util.ArrayList;
12  
13  /**
14   * Test a directory with an umlaut
15   * 
16   * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
17   * 
18   */
19  public class UmlautDirTest
20      extends TestCase
21  {
22      File testDir;
23  
24      public void testUmlaut ()
25          throws Exception
26      {
27          Verifier verifier = new Verifier( testDir.getAbsolutePath() );
28          verifier.executeGoal( "test" );
29          verifier.verifyErrorFreeLog();
30          verifier.resetStreams();
31          
32          HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );
33      }
34  
35      public void testUmlautIsolatedClassLoader ()
36          throws Exception
37      {
38          Verifier verifier = new Verifier( testDir.getAbsolutePath() );
39          ArrayList goals = new ArrayList();
40          goals.add( "test" );
41          goals.add( "-DuseSystemClassLoader=false" );
42          verifier.executeGoals( goals );
43          verifier.verifyErrorFreeLog();
44          verifier.resetStreams();
45  
46          HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );
47      }
48  
49      public void setUp()
50          throws IOException
51      {
52          String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) );
53          File tempDir = new File(tempDirPath);
54          File targetDir = new File("target").getAbsoluteFile();
55          if (targetDir.exists() && targetDir.isDirectory()) {
56              tempDir = targetDir;
57          }
58          testDir = new File( tempDir, "/junit-pathWith\u00DCmlaut" );
59          FileUtils.deleteDirectory( testDir );
60          testDir = ResourceExtractor.extractResourcePath(getClass(), "/junit-pathWithUmlaut", testDir, true);
61      }
62  }