From e7cab478b3b5146d546419d9da698bfbd3984144 Mon Sep 17 00:00:00 2001 From: Patrick Gotthard Date: Sat, 7 Jan 2017 10:54:04 +0100 Subject: [PATCH] Fixes problem with space in properties path --- pom.xml | 26 ------------ .../rometools/fetcher/AbstractJettyTest.java | 40 +++++++++---------- 2 files changed, 20 insertions(+), 46 deletions(-) diff --git a/pom.xml b/pom.xml index 3b4d6bb..f88c1c3 100644 --- a/pom.xml +++ b/pom.xml @@ -100,32 +100,6 @@ maven-scm-publish-plugin 1.1 - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [1.0.0,) - - copy-dependencies - - - - - - - - - - org.apache.felix maven-bundle-plugin diff --git a/rome-fetcher/src/test/java/com/rometools/fetcher/AbstractJettyTest.java b/rome-fetcher/src/test/java/com/rometools/fetcher/AbstractJettyTest.java index 141c2b2..7d25158 100644 --- a/rome-fetcher/src/test/java/com/rometools/fetcher/AbstractJettyTest.java +++ b/rome-fetcher/src/test/java/com/rometools/fetcher/AbstractJettyTest.java @@ -175,29 +175,29 @@ public abstract class AbstractJettyTest extends TestCase { try { setupServer(); + + final URL url = this.getClass().getClassLoader().getResource("testuser.properties"); + final UserRealm userRealm = new HashUserRealm("test", url.toString()); + + final BasicAuthenticator basicauthenticator = new BasicAuthenticator(); + + final SecurityHandler securityHandler = new SecurityHandler(); + + final SecurityConstraint securityConstraint = new SecurityConstraint(); + securityConstraint.setName("test"); + securityConstraint.addRole("*"); + securityConstraint.setAuthenticate(true); + + final ServletHandler servletHandler = createServletHandler(); + final HttpContext context = createContext(); - - final URL url = this.getClass().getResource("/testuser.properties"); - final UserRealm ur = new HashUserRealm("test", url.getFile()); - context.setRealm(ur); - - final BasicAuthenticator ba = new BasicAuthenticator(); - context.setAuthenticator(ba); - - final SecurityHandler sh = new SecurityHandler(); - context.addHandler(sh); - - final SecurityConstraint sc = new SecurityConstraint(); - sc.setName("test"); - sc.addRole("*"); - sc.setAuthenticate(true); - context.addSecurityConstraint("/", sc); - - final ServletHandler servlets = createServletHandler(); - context.addHandler(servlets); + context.setRealm(userRealm); + context.setAuthenticator(basicauthenticator); + context.addHandler(securityHandler); + context.addSecurityConstraint("/", securityConstraint); + context.addHandler(servletHandler); server.addContext(context); - server.start(); final FeedFetcher feedFetcher = getAuthenticatedFeedFetcher();