Fixes problem with space in properties path

This commit is contained in:
Patrick Gotthard 2017-01-07 10:54:04 +01:00
parent 700dd58514
commit e7cab478b3
2 changed files with 20 additions and 46 deletions

26
pom.xml
View file

@ -100,32 +100,6 @@
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.1</version>
</plugin>
<!-- The following plugin doesn't modify the build. It is
only used to hide irrelevant warnings in Eclipse -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>

View file

@ -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();