Tweaking basedir

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1187 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Joakim Erdfelt 2010-01-07 22:24:32 +00:00
parent 830d8691f6
commit 1090bd1ae4
2 changed files with 14 additions and 27 deletions

View File

@ -43,10 +43,12 @@ public class JettyPolicyRuntimeTest extends TestCase
super.setUp();
evaluator.put("jetty.home",MavenTestingUtils.getBaseURI().toASCIIString());
evaluator.put("basedir",MavenTestingUtils.getBaseURI().toASCIIString());
String basedir = MavenTestingUtils.getBaseURI().toASCIIString();
System.out.println("basedir: " + MavenTestingUtils.getBaseURI().toASCIIString());
evaluator.put("jetty.home",basedir);
evaluator.put("basedir",basedir);
System.out.println("basedir: " + basedir);
}
@Override

View File

@ -41,8 +41,8 @@ public class JettyPolicyTest extends TestCase
{
super.setUp();
evaluator.put("jetty.home",MavenTestingUtils.getBasedir().getAbsolutePath());
evaluator.put("basedir",MavenTestingUtils.getBasedir().getAbsolutePath());
evaluator.put("jetty.home",MavenTestingUtils.getBaseURI().toASCIIString());
evaluator.put("basedir",MavenTestingUtils.getBaseURI().toASCIIString());
}
public void testGlobalAllPermissionLoader()
@ -50,7 +50,7 @@ public class JettyPolicyTest extends TestCase
{
JettyPolicy ap =
new JettyPolicy( Collections.singleton( getWorkingDirectory() + "/src/test/resources/global-all-permission.policy" ), evaluator );
new JettyPolicy( Collections.singleton( MavenTestingUtils.getBasedir().getAbsolutePath() + "/src/test/resources/global-all-permission.policy" ), evaluator );
ap.refresh();
@ -74,7 +74,7 @@ public class JettyPolicyTest extends TestCase
throws Exception
{
JettyPolicy ap =
new JettyPolicy( Collections.singleton( getWorkingDirectory()
new JettyPolicy( Collections.singleton( MavenTestingUtils.getBasedir().getAbsolutePath()
+ "/src/test/resources/single-codebase-file-permission.policy" ), evaluator );
ap.refresh();
@ -96,7 +96,7 @@ public class JettyPolicyTest extends TestCase
throws Exception
{
JettyPolicy ap =
new JettyPolicy( Collections.singleton( getWorkingDirectory()
new JettyPolicy( Collections.singleton( MavenTestingUtils.getBasedir().getAbsolutePath()
+ "/src/test/resources/multiple-codebase-file-permission.policy" ), evaluator );
ap.refresh();
@ -122,7 +122,7 @@ public class JettyPolicyTest extends TestCase
throws Exception
{
JettyPolicy ap =
new JettyPolicy( Collections.singleton( getWorkingDirectory()
new JettyPolicy( Collections.singleton( MavenTestingUtils.getBasedir().getAbsolutePath()
+ "/src/test/resources/multiple-codebase-mixed-permission.policy" ), evaluator );
ap.refresh();
@ -132,7 +132,7 @@ public class JettyPolicyTest extends TestCase
public void testSCLoader() throws Exception
{
JettyPolicy ap = new JettyPolicy(Collections.singleton(getWorkingDirectory() + "/src/main/config/lib/policy/jetty.policy"),evaluator);
JettyPolicy ap = new JettyPolicy(Collections.singleton(MavenTestingUtils.getBasedir().getAbsolutePath() + "/src/main/config/lib/policy/jetty.policy"),evaluator);
ap.refresh();
ap.dump(System.out);
@ -143,8 +143,8 @@ public class JettyPolicyTest extends TestCase
{
Set<String> files = new HashSet<String>();
files.add( getWorkingDirectory() + "/src/test/resources/single-codebase-file-permission.policy" );
files.add( getWorkingDirectory() + "/src/test/resources/single-codebase-file-permission-2.policy" );
files.add( MavenTestingUtils.getBasedir().getAbsolutePath() + "/src/test/resources/single-codebase-file-permission.policy" );
files.add( MavenTestingUtils.getBasedir().getAbsolutePath() + "/src/test/resources/single-codebase-file-permission-2.policy" );
JettyPolicy ap = new JettyPolicy( files, evaluator );
@ -164,19 +164,4 @@ public class JettyPolicyTest extends TestCase
assertFalse( pc.implies( testPerm2 ) );
}
private String getWorkingDirectory()
{
String cwd = System.getProperty( "basedir" );
if ( cwd == null )
{
cwd = System.getProperty( "user.dir" );
}
return cwd;
}
}