diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java index 55978ade395..620c083892a 100644 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java +++ b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java @@ -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 diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java index 19d1cd82ecc..182e09d36c1 100644 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java +++ b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java @@ -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 files = new HashSet(); - 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; - } - }