Search in sources :

Example 81 with Deployment

use of org.jboss.arquillian.container.test.api.Deployment in project wildfly by wildfly.

the class AuthenticationTestCase method deployment.

/*
     * Authentication Scenarios
     *
     * Client -> Bean
     * Client -> Bean -> Bean
     * Client -> Bean (Re-auth) -> Bean
     * Client -> Servlet -> Bean
     * Client -> Servlet (Re-auth) -> Bean
     * Client -> Servlet -> Bean -> Bean
     * Client -> Servlet -> Bean (Re Auth) -> Bean
     */
@Deployment
public static Archive<?> deployment() {
    final Package currentPackage = AuthenticationTestCase.class.getPackage();
    // using JavaArchive doesn't work, because of a bug in Arquillian, it only deploys wars properly
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "ejb3security.war").addPackage(WhoAmIBean.class.getPackage()).addPackage(EntryBean.class.getPackage()).addClass(WhoAmI.class).addClass(Util.class).addClass(Entry.class).addClasses(WhoAmIServlet.class, AuthenticationTestCase.class).addClasses(AbstractSecurityDomainSetup.class, EjbElytronDomainSetup.class).addClass(TestSuiteEnvironment.class).addAsResource(currentPackage, "users.properties", "users.properties").addAsResource(currentPackage, "roles.properties", "roles.properties").addAsWebInfResource(currentPackage, "web.xml", "web.xml").addAsWebInfResource(currentPackage, "jboss-web.xml", "jboss-web.xml").addAsWebInfResource(currentPackage, "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset("Manifest-Version: 1.0\nDependencies: org.jboss.as.controller-client,org.jboss.dmr\n"), "MANIFEST.MF").addAsManifestResource(createPermissionsXmlAsset(// login module needs to modify principal to commit logging in
    new AuthPermission("modifyPrincipals"), // AuthenticationTestCase#testAuthenticatedCall calls org.jboss.security.client.JBossSecurityClient#performSimpleLogin
    new RuntimePermission("org.jboss.security.getSecurityContext"), new RuntimePermission("org.jboss.security.SecurityContextFactory.createSecurityContext"), new RuntimePermission("org.jboss.security.SecurityContextFactory.createUtil"), new RuntimePermission("org.jboss.security.plugins.JBossSecurityContext.setSubjectInfo"), new RuntimePermission("org.jboss.security.setSecurityContext"), // AuthenticationTestCase#execute calls ExecutorService#shutdownNow
    new RuntimePermission("modifyThread"), // AuthenticationTestCase#execute calls sun.net.www.http.HttpClient#openServer under the hood
    new SocketPermission(SERVER_HOST_PORT, "connect,resolve"), // TestSuiteEnvironment reads system properties
    new PropertyPermission("management.address", "read"), new PropertyPermission("node0", "read"), new PropertyPermission("jboss.http.port", "read")), "permissions.xml");
    war.addPackage(CommonCriteria.class.getPackage());
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) AuthPermission(javax.security.auth.AuthPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Util(org.jboss.as.test.shared.integration.ejb.security.Util) WhoAmIBean(org.wildfly.test.integration.elytron.ejb.base.WhoAmIBean) TestSuiteEnvironment(org.jboss.as.test.shared.TestSuiteEnvironment) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 82 with Deployment

use of org.jboss.arquillian.container.test.api.Deployment in project wildfly by wildfly.

the class BatchSubsystemSecurityTestCase method createDeployment.

@Deployment
public static Archive<?> createDeployment() {
    final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "batch-test.jar");
    jar.addClasses(AbstractElytronSetupTask.class, SecurityDomainSettingEJB.class, TimeoutUtil.class, IdentityBatchlet.class, FailingBatchlet.class, LongRunningBatchlet.class);
    jar.addAsManifestResource(BatchSubsystemSecurityTestCase.class.getPackage(), "assert-identity.xml", "batch-jobs/assert-identity.xml");
    jar.addAsManifestResource(BatchSubsystemSecurityTestCase.class.getPackage(), "failing-batchlet.xml", "batch-jobs/failing-batchlet.xml");
    jar.addAsManifestResource(BatchSubsystemSecurityTestCase.class.getPackage(), "long-running-batchlet.xml", "batch-jobs/long-running-batchlet.xml");
    jar.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    jar.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(new AllPermission()), "permissions.xml");
    return jar;
}
Also used : AllPermission(java.security.AllPermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 83 with Deployment

use of org.jboss.arquillian.container.test.api.Deployment in project wildfly by wildfly.

the class AltDDTestCase method deployment.

@Deployment
public static Archive<?> deployment() {
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "altdd.ear");
    ear.addAsManifestResource(AltDDTestCase.class.getPackage(), "application.xml", "application.xml");
    ear.addAsResource(AltDDTestCase.class.getPackage(), "alt-ejb-jar.xml", "alt-ejb-jar.xml");
    final JavaArchive ejbs = ShrinkWrap.create(JavaArchive.class, "ejb.jar");
    ejbs.addClasses(AltDDTestCase.class, AltDDEjb.class);
    ejbs.addAsManifestResource(AltDDTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml");
    ear.addAsModule(ejbs);
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 84 with Deployment

use of org.jboss.arquillian.container.test.api.Deployment in project wildfly by wildfly.

the class SimpleApplicationClientTestCase method deploy.

@Deployment(testable = false)
public static Archive<?> deploy() {
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, APP_NAME + ".ear");
    final JavaArchive lib = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    lib.addClasses(AppClientSingletonRemote.class, AppClientWrapper.class, CallbackHandler.class);
    ear.addAsLibrary(lib);
    final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
    ejb.addClasses(SimpleApplicationClientTestCase.class, AppClientStateSingleton.class);
    ear.addAsModule(ejb);
    final JavaArchive appClient = ShrinkWrap.create(JavaArchive.class, "client-annotation.jar");
    appClient.addClasses(AppClientMain.class);
    appClient.addAsManifestResource(new StringAsset("Main-Class: " + AppClientMain.class.getName() + "\n"), "MANIFEST.MF");
    ear.addAsModule(appClient);
    final JavaArchive clientDD = ShrinkWrap.create(JavaArchive.class, "client-dd.jar");
    clientDD.addClasses(DescriptorClientMain.class);
    clientDD.addAsManifestResource(new StringAsset("Main-Class: " + DescriptorClientMain.class.getName() + "\n"), "MANIFEST.MF");
    clientDD.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "application-client.xml", "application-client.xml");
    ear.addAsModule(clientDD);
    final JavaArchive clientOverride = ShrinkWrap.create(JavaArchive.class, "client-override.jar");
    clientOverride.addClasses(DescriptorClientMain.class);
    clientOverride.addAsManifestResource(new StringAsset("Main-Class: " + DescriptorClientMain.class.getName() + "\n"), "MANIFEST.MF");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "application-client.xml", "application-client.xml");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "jboss-client.xml", "jboss-client.xml");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "wildfly-config.xml", "wildfly-config.xml");
    ear.addAsModule(clientOverride);
    archive = ear;
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 85 with Deployment

use of org.jboss.arquillian.container.test.api.Deployment in project wildfly by wildfly.

the class JCETestCase method deployment.

@Deployment
public static Archive<?> deployment() throws Exception {
    final JavaArchive jce = ShrinkWrap.create(JavaArchive.class, "jcetest.jar").addPackage(DummyProvider.class.getPackage());
    final File jceJar = new File("jcetest.jar");
    jce.as(ZipExporter.class).exportTo(jceJar, true);
    final File signedJceJar = new File("jcetestsigned.jar");
    JavaArchive signedJce;
    if (isJCETestable()) {
        // see genkey-jcetest-keystore in pom.xml for the keystore creation
        final JarSignerUtil signer = new JarSignerUtil(new File("../jcetest.keystore"), "password", "password", /* alias */
        "test");
        signer.sign(jceJar, signedJceJar);
        signer.verify(signedJceJar);
        signedJce = ShrinkWrap.create(ZipImporter.class, "jcetestsigned.jar").importFrom(signedJceJar).as(JavaArchive.class);
    } else {
        log.trace("skipping the test since it can run on Oracle JDK only");
        signedJce = jce;
    }
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war").addClasses(ControllerServlet.class);
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "jcetest.ear").addAsLibrary(signedJce).addAsModule(war).addAsManifestResource(JCETestCase.class.getPackage(), "jboss-deployment-structure.xml", "jboss-deployment-structure.xml");
    // ControllerServlet and DummyProvider need the following perms for their "dirty" game
    ear.addAsManifestResource(createPermissionsXmlAsset(new FilePermission("../jcetest.keystore", "read"), new RuntimePermission("accessDeclaredMembers"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessClassInPackage.sun.security.validator"), new SecurityPermission("putProviderProperty.DP"), new SecurityPermission("insertProvider"), new RuntimePermission("getProtectionDomain")), "permissions.xml");
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) DummyProvider(org.jboss.as.test.integration.deployment.jcedeployment.provider.DummyProvider) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) FilePermission(java.io.FilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ZipImporter(org.jboss.shrinkwrap.api.importer.ZipImporter) ReflectPermission(java.lang.reflect.ReflectPermission) File(java.io.File) SecurityPermission(java.security.SecurityPermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

Deployment (org.jboss.arquillian.container.test.api.Deployment)869 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)530 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)423 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)299 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)146 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)139 ResourceAdapterArchive (org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive)48 Asset (org.jboss.shrinkwrap.api.asset.Asset)45 HttpRequest (org.jboss.as.test.integration.common.HttpRequest)28 TargetsContainer (org.jboss.arquillian.container.test.api.TargetsContainer)27 PropertyPermission (java.util.PropertyPermission)26 CommonCriteria (org.jboss.as.test.categories.CommonCriteria)23 AbstractMgmtTestBase (org.jboss.as.test.integration.management.base.AbstractMgmtTestBase)23 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)22 File (java.io.File)17 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)16 SocketPermission (java.net.SocketPermission)13 BatchTestHelper (org.javaee7.util.BatchTestHelper)13 Util (org.jboss.as.test.shared.integration.ejb.security.Util)11 Properties (java.util.Properties)10