Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8322 from gytis/master-WFLY-5518-xts-security-man…
…ager [WFLY-5518] Fix XTS tests to work with security manager
- Loading branch information
Showing
8 changed files
with
147 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
testsuite/integration/xts/src/test/java/org/jboss/as/test/xts/util/DeploymentHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.test.xts.util; | ||
|
||
import org.jboss.as.test.shared.TestSuiteEnvironment; | ||
import org.jboss.as.test.shared.integration.ejb.security.PermissionUtils; | ||
import org.jboss.shrinkwrap.api.ArchivePaths; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
|
||
import java.io.File; | ||
import java.io.FilePermission; | ||
import java.net.SocketPermission; | ||
import java.util.PropertyPermission; | ||
|
||
/** | ||
* @author <a href="mailto:gytis@redhat.com">Gytis Trikleris</a> | ||
*/ | ||
public class DeploymentHelper { | ||
|
||
private static final DeploymentHelper INSTANCE = new DeploymentHelper(); | ||
|
||
private DeploymentHelper() { | ||
|
||
} | ||
|
||
public static DeploymentHelper getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
public JavaArchive getJavaArchive(final String archiveName) { | ||
final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
|
||
return javaArchive; | ||
} | ||
|
||
public WebArchive getWebArchive(final String archiveName) { | ||
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName + ".war") | ||
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); | ||
|
||
return webArchive; | ||
} | ||
|
||
public WebArchive getWebArchiveWithPermissions(final String archiveName) { | ||
final String javaHome = TestSuiteEnvironment.getSystemProperty("java.home"); | ||
final String serverHostPort = TestSuiteEnvironment.getServerAddress() + ":" | ||
+ TestSuiteEnvironment.getHttpPort(); | ||
|
||
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName + ".war") | ||
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")) | ||
.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset( | ||
// Permissions for port access | ||
new PropertyPermission("management.address", "read"), | ||
new PropertyPermission("node0", "read"), | ||
new PropertyPermission("jboss.http.port", "read"), | ||
new SocketPermission(serverHostPort, "connect,resolve"), | ||
// Permissions for the new client creation | ||
new RuntimePermission("getClassLoader"), | ||
new FilePermission(javaHome + File.separator + "lib" + File.separator + "wsdl.properties", "read"), | ||
new PropertyPermission("user.dir", "read"), | ||
new RuntimePermission("org.apache.cxf.permission"), | ||
new RuntimePermission("createClassLoader"), | ||
new FilePermission(System.getProperty("basedir") + File.separator + "target" + File.separator | ||
+ "workdir" + File.separator + "xcatalog", "read") | ||
), "permissions.xml"); | ||
|
||
return webArchive; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.