1 package org.apache.maven.surefire.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.Iterator;
24 import java.util.List;
25
26
27
28
29
30
31 public class Relocator
32 {
33 private final String relocation;
34
35 private static final String relocationBase = "org.apache.maven.surefire.";
36
37
38 public Relocator( String relocation )
39 {
40 this.relocation = relocation;
41 }
42
43 public Relocator()
44 {
45 relocation = "shadefire";
46 }
47
48 public List relocateReports( List original )
49 {
50 List result = new ArrayList();
51 for ( Iterator iter = original.iterator(); iter.hasNext(); )
52 {
53 result.add( relocate( (String) iter.next() ) );
54 }
55 return result;
56 }
57
58 private String getRelocation()
59 {
60 return relocation;
61 }
62
63 public String relocate( String className )
64 {
65 if ( relocation == null )
66 {
67 return className;
68 }
69 if (className.indexOf( relocation) >= 0){
70 return className;
71 }
72 String rest = className.substring( "org.apache.maven.surefire.".length() );
73 final String s = relocationBase + getRelocation() + ".";
74 return s + rest;
75 }
76 }