adopting ManagedExecutorServiceGetPrincipalInTaskTest to tc9 tomcat9 is a bit more strict it seems
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/12c42815 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/12c42815 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/12c42815 Branch: refs/heads/master Commit: 12c4281580845ae0b488d2aab0de5e2cf504c96a Parents: d8467b2 Author: Mark Struberg <strub...@apache.org> Authored: Thu Feb 15 21:40:48 2018 +0100 Committer: Jonathan Gallimore <j...@jrg.me.uk> Committed: Thu Mar 1 23:03:19 2018 +0000 ---------------------------------------------------------------------- ...edExecutorServiceGetPrincipalInTaskTest.java | 11 +++-- .../src/test/resources/managed/web.xml | 49 ++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/12c42815/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java ---------------------------------------------------------------------- diff --git a/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java b/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java index 789aeda..d44d4b9 100644 --- a/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java +++ b/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java @@ -26,11 +26,11 @@ import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.asset.UrlAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; -import java.io.File; import java.io.IOException; import java.net.URL; @@ -40,14 +40,17 @@ import static org.junit.Assert.assertEquals; public class ManagedExecutorServiceGetPrincipalInTaskTest { @Deployment(testable = false) public static Archive<?> app() { + ClassLoader cl = ManagedExecutorServiceGetPrincipalInTaskTest.class.getClassLoader(); + URL tcUserFile = cl.getResource("managed/tomcat-users.xml"); + return ShrinkWrap.create(WebArchive.class, "mp.war") .addClasses(ConcurrencyServlet.class, User.class) .addAsManifestResource(new StringAsset( "<Context>" + " <Realm className=\"" + MemoryRealm.class.getName() + - "\" pathname=\"" + - new File("src/test/resources/managed/tomcat-users.xml").getAbsolutePath() + "\" />" + - "</Context>"), "context.xml"); + "\" pathname=\""+ tcUserFile.getFile() + "\" />" + + "</Context>"), "context.xml") + .addAsWebInfResource(new UrlAsset(cl.getResource("managed/web.xml")), "web.xml"); } @ArquillianResource http://git-wip-us.apache.org/repos/asf/tomee/blob/12c42815/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml ---------------------------------------------------------------------- diff --git a/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml b/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml new file mode 100644 index 0000000..1c6fb24 --- /dev/null +++ b/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<web-app xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + <login-config> + <auth-method>BASIC</auth-method> + <realm-name>PropertiesLoginModule</realm-name> + </login-config> + + <security-constraint> + <web-resource-collection> + <web-resource-name>Secured REST Service with JAAS</web-resource-name> + <url-pattern>/rest/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <role-name>*</role-name> + <!-- we'll use JAAS so don't filter too much here --> + </auth-constraint> + <user-data-constraint> + <transport-guarantee>CONFIDENTIAL</transport-guarantee> + </user-data-constraint> + </security-constraint> + + <security-role> + <role-name>admin</role-name> + </security-role> + <security-role> + <role-name>superUser</role-name> + </security-role> +</web-app>