Search in sources :

Example 31 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class ServiceRefTestCase method deployment.

@Deployment
public static JavaArchive deployment() {
    String wsdl = FileUtils.readFile(ServiceRefTestCase.class, "TestService.wsdl");
    final Properties properties = new Properties();
    properties.putAll(System.getProperties());
    final String node0 = NetworkUtils.formatPossibleIpv6Address((String) properties.get("node0"));
    if (properties.containsKey("node0")) {
        properties.put("node0", node0);
    }
    return ShrinkWrap.create(JavaArchive.class, "ws-serviceref-example.jar").addClasses(EJB3Bean.class, EndpointInterface.class, EndpointService.class, StatelessBean.class, StatelessRemote.class, CdiBean.class).addAsManifestResource(ServiceRefTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml").addAsManifestResource(ServiceRefTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(wsdl, properties)), "wsdl/TestService.wsdl").addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").addAsManifestResource(createPermissionsXmlAsset(new FilePermission(System.getProperty("java.home") + File.separator + "lib" + File.separator + "wsdl.properties", "read"), new PropertyPermission("user.dir", "read"), new RuntimePermission("getClassLoader"), new RuntimePermission("org.apache.cxf.permission", "resolveUri"), new RuntimePermission("createClassLoader"), new RuntimePermission("accessDeclaredMembers"), new SocketPermission(node0 + ":8080", "connect,resolve")), "jboss-permissions.xml");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) SocketPermission(java.net.SocketPermission) Properties(java.util.Properties) FilePermission(java.io.FilePermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 32 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class ServiceRefEarTestCase method deployment.

@Deployment(testable = false)
public static Archive<?> deployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "ws-serviceref-example.jar").addClasses(EJB3Bean.class, EndpointInterface.class);
    WebArchive war = ShrinkWrap.create(WebArchive.class, "ws-serviceref-example-servlet-client.war").addClasses(EndpointInterface.class, EndpointService.class, ServletClient.class).addAsWebInfResource(ServiceRefEarTestCase.class.getPackage(), "web.xml", "web.xml").addAsWebInfResource(ServiceRefEarTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
    String wsdl = FileUtils.readFile(ServiceRefEarTestCase.class, "TestService.wsdl");
    final Properties properties = new Properties();
    properties.putAll(System.getProperties());
    final String node0 = NetworkUtils.formatPossibleIpv6Address((String) properties.get("node0"));
    if (properties.containsKey("node0")) {
        properties.put("node0", node0);
    }
    war.addAsWebInfResource(new StringAsset(PropertiesValueResolver.replaceProperties(wsdl, properties)), "wsdl/TestService.wsdl");
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "ws-serviceref-example.ear").addAsModule(jar).addAsModule(war);
    // all the following permissions are needed because EndpointService directly extends javax.xml.ws.Service class
    // and CXF guys are not willing to add more privileged blocks into their code, thus deployments need to have
    // the following permissions (note that the wsdl.properties permission is needed by wsdl4j)
    ear.addAsManifestResource(createPermissionsXmlAsset(new FilePermission(System.getProperty("java.home") + File.separator + "lib" + File.separator + "wsdl.properties", "read"), new PropertyPermission("user.dir", "read"), new RuntimePermission("getClassLoader"), new RuntimePermission("org.apache.cxf.permission", "resolveUri"), new RuntimePermission("createClassLoader"), new RuntimePermission("accessDeclaredMembers"), new SocketPermission(node0 + ":8080", "connect,resolve")), "jboss-permissions.xml");
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Properties(java.util.Properties) FilePermission(java.io.FilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 33 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class DatasourceNonCcmTestCase method getDeployment.

@Deployment
public static Archive<?> getDeployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "dummy.jar");
    jar.addClasses(DatasourceNonCcmTestCase.class, Datasource.class, JcaMgmtBase.class, ManagementOperations.class, ContainerResourceMgmtTestBase.class, AbstractMgmtTestBase.class, JcaMgmtServerSetupTask.class, MgmtOperationException.class, DsMgmtTestBase.class, JcaTestsUtil.class);
    jar.addAsManifestResource(new StringAsset("Dependencies: javax.inject.api,org.jboss.as.connector," + "org.jboss.as.controller, " + "org.jboss.dmr,org.jboss.as.cli, " + "org.jboss.staxmapper,  " + "org.jboss.ironjacamar.impl, " + "org.jboss.ironjacamar.jdbcadapters, " + "org.jboss.remoting3\n"), "MANIFEST.MF");
    jar.addAsManifestResource(createPermissionsXmlAsset(new RemotingPermission("createEndpoint"), new RemotingPermission("addConnectionProvider"), new RemotingPermission("connect"), new RuntimePermission("createXnioWorker"), new SocketPermission(TestSuiteEnvironment.getServerAddress(), "connect,resolve")), "permissions.xml");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) SocketPermission(java.net.SocketPermission) RemotingPermission(org.jboss.remoting3.security.RemotingPermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 34 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class RebindTestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    String tmpdir = System.getProperty("jboss.home");
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "RebindTestCase.jar");
    jar.addClasses(RebindTestCase.class, BindingLookupBean.class);
    jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller, " + "org.jboss.remoting3\n"), "MANIFEST.MF");
    jar.addAsManifestResource(createPermissionsXmlAsset(new RemotingPermission("addConnectionProvider"), new RemotingPermission("connect"), new RemotingPermission("createEndpoint"), new RuntimePermission("createXnioWorker"), new FilePermission(tmpdir + "/standalone/tmp/auth/-", "read"), new SocketPermission(TestSuiteEnvironment.getServerAddress(), "connect,resolve")), "permissions.xml");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) SocketPermission(java.net.SocketPermission) RemotingPermission(org.jboss.remoting3.security.RemotingPermission) FilePermission(java.io.FilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 35 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class RolloutPlanTestCase method before.

@BeforeClass
public static void before() throws Exception {
    CLITestSuite.createSupport(RolloutPlanTestCase.class.getSimpleName());
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "RolloutPlanTestCase.war");
    war.addClass(RolloutPlanTestServlet.class);
    war.addAsManifestResource(createPermissionsXmlAsset(// main-one
    new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + TEST_PORT, "listen,resolve"), // main-three
    new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + (TEST_PORT + 350), "listen,resolve")), "permissions.xml");
    String tempDir = System.getProperty("java.io.tmpdir");
    warFile = new File(tempDir + File.separator + "RolloutPlanTestCase.war");
    new ZipExporterImpl(war).exportTo(warFile, true);
    AbstractCliTestBase.initCLI(DomainTestSupport.masterAddress);
    // add another server group to default profile
    cli.sendLine("/server-group=test-server-group:add(profile=default,socket-binding-group=standard-sockets)");
    // add a server to the group
    cli.sendLine("/host=master/server-config=test-one:add(group=test-server-group,socket-binding-port-offset=700");
    cli.sendLine("/host=master/server-config=test-one/interface=public:add(inet-address=" + CLITestSuite.hostAddresses.get("master") + ")");
    CLITestSuite.addServer("test-one", "master", "test-server-group", "default", 700, true);
    // start main-two
    cli.sendLine("/host=master/server-config=main-two:start(blocking=true)");
    CLIOpResult res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("main-two", "STARTED");
    // start test-one
    cli.sendLine("/host=master/server-config=test-one:start(blocking=true)");
    res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("test-one", "STARTED");
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) BeforeClass(org.junit.BeforeClass)

Aggregations

SocketPermission (java.net.SocketPermission)52 Deployment (org.jboss.arquillian.container.test.api.Deployment)13 FilePermission (java.io.FilePermission)12 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)10 AccessControlContext (java.security.AccessControlContext)9 PropertyPermission (java.util.PropertyPermission)9 Test (org.testng.annotations.Test)8 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)7 URL (java.net.URL)6 IOException (java.io.IOException)5 DatagramSocket (java.net.DatagramSocket)5 InetAddress (java.net.InetAddress)4 InetSocketAddress (java.net.InetSocketAddress)4 MulticastSocket (java.net.MulticastSocket)4 ServerSocket (java.net.ServerSocket)3 Permissions (java.security.Permissions)3 PrivilegedActionException (java.security.PrivilegedActionException)3 Properties (java.util.Properties)3 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)3 File (java.io.File)2