├── arquillian-tutorial ├── src │ ├── main │ │ ├── resources │ │ │ └── .gitkeep │ │ └── java │ │ │ └── org │ │ │ └── arquillian │ │ │ └── example │ │ │ ├── Greeter.java │ │ │ └── PhraseBuilder.java │ └── test │ │ ├── resources │ │ └── arquillian.xml │ │ └── java │ │ └── org │ │ └── arquillian │ │ └── example │ │ └── GreeterTest.java └── pom-no-container-profiles.xml ├── arquillian-drone-tutorial └── src │ ├── main │ ├── resources │ │ └── .gitkeep │ ├── webapp │ │ ├── home.xhtml │ │ └── login.xhtml │ └── java │ │ └── org │ │ └── arquillian │ │ └── example │ │ ├── OrderRepository.java │ │ ├── ui │ │ ├── User.java │ │ ├── Credentials.java │ │ └── LoginController.java │ │ ├── Greeter.java │ │ ├── PhraseBuilder.java │ │ └── Basket.java │ └── test │ ├── resources │ └── arquillian.xml │ └── java │ └── org │ └── arquillian │ └── example │ ├── SingletonOrderRepository.java │ ├── GreeterTest.java │ └── BasketTest.java ├── arquillian-tutorial-rinse-repeat └── src │ ├── main │ ├── resources │ │ └── .gitkeep │ └── java │ │ └── org │ │ └── arquillian │ │ └── example │ │ ├── OrderRepository.java │ │ ├── Greeter.java │ │ ├── PhraseBuilder.java │ │ └── Basket.java │ └── test │ ├── java │ └── org │ │ └── arquillian │ │ └── example │ │ ├── SingletonOrderRepository.java │ │ ├── GreeterTest.java │ │ └── BasketTest.java │ └── resources │ └── arquillian.xml ├── quickstart └── src │ ├── main │ ├── webapp │ │ ├── index.jsp │ │ ├── resources │ │ │ ├── gfx │ │ │ │ ├── banner.png │ │ │ │ └── weld.png │ │ │ └── css │ │ │ │ └── screen.css │ │ ├── META-INF │ │ │ └── context.xml │ │ ├── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── faces-config.xml │ │ │ ├── web.xml │ │ │ └── templates │ │ │ │ └── default.xhtml │ │ └── home.xhtml │ ├── resources │ │ ├── import.sql │ │ └── META-INF │ │ │ └── persistence.xml │ └── java │ │ └── org │ │ └── jboss │ │ └── arquillian │ │ └── examples │ │ ├── quickstart │ │ ├── HelloEJB.java │ │ ├── HelloEJBBean.java │ │ └── HelloWorld.java │ │ ├── WidgetRepository.java │ │ ├── WidgetListProducer.java │ │ ├── WidgetRepositoryProducer.java │ │ └── Widget.java │ └── test │ ├── resources │ ├── glassfish-remote-3 │ │ └── test-web.xml │ └── arquillian.xml │ └── java │ └── org │ └── jboss │ └── arquillian │ └── examples │ └── quickstart │ ├── HelloWorldContainerTest.java │ └── HelloEJBContainerTest.java ├── arquillian-deployment-extension-tutorial ├── functional-tests │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── .gitkeep │ │ ├── webapp │ │ │ ├── WEB-INF │ │ │ │ ├── beans.xml │ │ │ │ └── faces-config.xml │ │ │ ├── home.xhtml │ │ │ └── login.xhtml │ │ └── java │ │ │ └── org │ │ │ └── arquillian │ │ │ └── tutorial │ │ │ └── extension │ │ │ └── deployment │ │ │ ├── User.java │ │ │ ├── Credentials.java │ │ │ └── LoginController.java │ │ └── test │ │ ├── resources │ │ └── arquillian.xml │ │ └── java │ │ └── org │ │ └── arquillian │ │ └── tutorial │ │ └── extension │ │ └── deployment │ │ └── LoginScreenUiTest.java ├── integration-tests │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── .gitkeep │ │ │ └── META-INF │ │ │ │ └── beans.xml │ │ └── java │ │ │ └── org │ │ │ └── arquillian │ │ │ └── tutorial │ │ │ └── extension │ │ │ └── deployment │ │ │ ├── Greeter.java │ │ │ └── PhraseBuilder.java │ │ └── test │ │ ├── resources │ │ └── arquillian.xml │ │ └── java │ │ └── org │ │ └── arquillian │ │ └── tutorial │ │ └── extension │ │ └── deployment │ │ └── GreeterTest.java ├── impl │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── org.jboss.arquillian.core.spi.LoadableExtension │ │ │ └── java │ │ │ └── org │ │ │ └── arquillian │ │ │ └── tutorial │ │ │ └── extension │ │ │ └── deployment │ │ │ ├── api │ │ │ └── DeployProjectArtifact.java │ │ │ └── ProjectArtifactDeploymentExtension.java │ └── pom.xml └── pom.xml ├── arquillian-persistence-tutorial └── src │ ├── test │ ├── resources │ │ ├── arquillian.launch │ │ ├── jbossas-ds.xml │ │ └── arquillian.xml │ ├── resources-glassfish-embedded │ │ ├── logging.properties │ │ ├── test-persistence.xml │ │ └── glassfish-resources.xml │ ├── resources-glassfish-remote │ │ └── test-persistence.xml │ └── resources-jbossas-managed │ │ └── test-persistence.xml │ └── main │ ├── resources │ └── META-INF │ │ └── persistence.xml │ └── java │ └── org │ └── arquillian │ └── example │ └── Game.java ├── quickstart-extension └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── org.jboss.arquillian.core.spi.LoadableExtension │ └── java │ │ └── org │ │ └── jboss │ │ └── arquillian │ │ └── examples │ │ └── quickstart │ │ └── extension │ │ ├── QuickstartLoadableExtension.java │ │ └── QuickstartObserver.java │ └── test │ ├── resources │ └── arquillian.xml │ └── java │ └── org │ └── jboss │ └── arquillian │ └── examples │ └── quickstart │ └── extension │ ├── integration │ └── IntegrationTestCase.java │ └── unit │ └── UnitTestCase.java ├── arquillian-lifecycle-extension-tutorial ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── org.jboss.arquillian.core.spi.LoadableExtension │ │ └── java │ │ │ └── org │ │ │ └── arquillian │ │ │ └── tutorial │ │ │ └── extension │ │ │ └── lifecycle │ │ │ ├── api │ │ │ ├── AfterDeploy.java │ │ │ ├── BeforeDeploy.java │ │ │ ├── AfterUnDeploy.java │ │ │ └── BeforeUnDeploy.java │ │ │ └── LifecycleExtension.java │ └── test │ │ ├── resources │ │ └── arquillian.xml │ │ └── java │ │ └── org │ │ └── arquillian │ │ └── tutorial │ │ └── extension │ │ └── lifecycle │ │ └── LifecycleTestCase.java └── README.md ├── .github ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── xa └── src │ ├── test │ ├── resources-jbossas-remote │ │ ├── jndi.properties │ │ └── test-persistence.xml │ ├── resources │ │ └── arquillian.xml │ ├── resources-glassfish-remote │ │ └── test-persistence.xml │ ├── resources-glassfish-embedded │ │ ├── sun-resources.xml │ │ └── test-persistence.xml │ └── java │ │ └── com │ │ └── acme │ │ └── jpa │ │ └── TwoPhaseCommitTestCase.java │ └── main │ └── java │ └── com │ └── acme │ └── jpa │ ├── GameRepository.java │ ├── InvoiceRepository.java │ ├── AbstractRepository.java │ ├── Invoice.java │ ├── DualRepositoryService.java │ └── Game.java ├── jpalab └── src │ ├── test │ ├── resources-openejb-embedded-shared │ │ └── jndi.properties │ ├── resources │ │ └── arquillian.xml │ ├── resources-openejb-embedded-openjpa │ │ └── test-persistence.xml │ ├── resources-glassfish-embedded │ │ ├── test-persistence.xml │ │ └── glassfish-resources.xml │ ├── resources-openejb-embedded-eclipselink │ │ └── test-persistence.xml │ ├── resources-openejb-embedded-hibernate │ │ └── test-persistence.xml │ └── java │ │ └── com │ │ └── acme │ │ └── jpa │ │ └── business │ │ └── GamePersistenceTestCase.java │ └── main │ └── java │ └── com │ └── acme │ └── jpa │ ├── business │ ├── Games.java │ ├── EntityInitializer.java │ ├── JavaPersistenceHelper.java │ ├── GamesBean.java │ └── Repository.java │ └── model │ ├── Game.java │ ├── LineItem.java │ └── Record.java ├── arquillian-jpa-drone ├── README.textile └── src │ ├── main │ ├── webapp │ │ ├── home.xhtml │ │ ├── login.xhtml │ │ └── register.xhtml │ ├── resources │ │ └── META-INF │ │ │ └── persistence.xml │ └── java │ │ └── org │ │ └── arquillian │ │ └── example │ │ ├── dao │ │ ├── UserDAOException.java │ │ └── UserDAO.java │ │ ├── model │ │ ├── Credentials.java │ │ └── User.java │ │ ├── security │ │ └── Authenticator.java │ │ └── controller │ │ ├── RegisterController.java │ │ └── LoginController.java │ └── test │ └── resources │ ├── jbossas-ds.xml │ ├── test-persistence.xml │ └── arquillian.xml ├── jsfunit-servlet └── src │ ├── test │ ├── resources │ │ ├── arquillian.xml │ │ ├── basic │ │ │ └── index.xhtml │ │ ├── faces-config.xml │ │ └── confcal │ │ │ ├── submission.xhtml │ │ │ └── submit.xhtml │ ├── resources-jetty │ │ └── jsf-web.xml │ └── resources-tomcat │ │ └── jsf-web.xml │ └── main │ └── java │ └── com │ └── acme │ └── jsf │ ├── confcal │ ├── ConferenceCalendar.java │ └── Conference.java │ └── basic │ └── HitchhikersGuide.java ├── ejb3-openejb ├── src │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── jboss │ │ │ └── arquillian │ │ │ └── examples │ │ │ └── openejb │ │ │ ├── HelloEJB.java │ │ │ └── HelloEJBBean.java │ └── test │ │ └── java │ │ └── org │ │ └── jboss │ │ └── arquillian │ │ └── examples │ │ └── openejb │ │ └── HelloEJBTest.java └── readme.txt ├── ejb31-gfembedded ├── src │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── jboss │ │ │ └── arquillian │ │ │ └── examples │ │ │ └── gfembedded │ │ │ └── HelloEJB.java │ └── test │ │ └── java │ │ └── org │ │ └── jboss │ │ └── arquillian │ │ └── examples │ │ └── gfembedded │ │ └── HelloEJBTest.java ├── readme.txt └── pom.xml ├── ejb31-jbembedded ├── src │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── jboss │ │ │ └── arquillian │ │ │ └── examples │ │ │ └── jbembedded │ │ │ └── HelloEJB.java │ └── test │ │ └── java │ │ └── org │ │ └── jboss │ │ └── arquillian │ │ └── examples │ │ └── jbembedded │ │ └── HelloEJBIT.java └── readme.txt ├── .gitignore └── pom.xml /arquillian-tutorial/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <% response.sendRedirect("home.jsf"); %> 2 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources/arquillian.launch: -------------------------------------------------------------------------------- 1 | #jbossas-managed 2 | #glassfish-remote 3 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/resources/gfx/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arquillian/arquillian-examples/HEAD/quickstart/src/main/webapp/resources/gfx/banner.png -------------------------------------------------------------------------------- /quickstart/src/main/webapp/resources/gfx/weld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arquillian/arquillian-examples/HEAD/quickstart/src/main/webapp/resources/gfx/weld.png -------------------------------------------------------------------------------- /quickstart-extension/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension: -------------------------------------------------------------------------------- 1 | org.jboss.arquillian.examples.quickstart.extension.QuickstartLoadableExtension -------------------------------------------------------------------------------- /quickstart/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | insert into Widget (id, partno, name, description) values (1, 'AAA001', 'Portable Hole', 'A hole for when you need to disappear fast.') 2 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension: -------------------------------------------------------------------------------- 1 | org.arquillian.tutorial.extension.lifecycle.LifecycleExtension -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question about usage, etc. 4 | title: "[Question]" 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/impl/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension: -------------------------------------------------------------------------------- 1 | org.arquillian.tutorial.extension.deployment.ProjectArtifactDeploymentExtension -------------------------------------------------------------------------------- /quickstart/src/main/webapp/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /xa/src/test/resources-jbossas-remote/jndi.properties: -------------------------------------------------------------------------------- 1 | java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory 2 | java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces 3 | java.naming.provider.url=jnp://localhost:1099 4 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources-glassfish-embedded/logging.properties: -------------------------------------------------------------------------------- 1 | handlers=java.util.logging.ConsoleHandler 2 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 3 | java.util.logging.SimpleFormatter.format=%4$s: %5$s%n 4 | java.util.logging.ConsoleHandler.level=FINEST 5 | -------------------------------------------------------------------------------- /jpalab/src/test/resources-openejb-embedded-shared/jndi.properties: -------------------------------------------------------------------------------- 1 | java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory 2 | testDatabase=new://Resource?type=DataSource 3 | testDatabase.JdbcDriver=org.hsqldb.jdbcDriver 4 | testDatabase.JdbcUrl=jdbc:hsqldb:mem:testdb 5 | testDatabase.JtaManaged=true 6 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/README.textile: -------------------------------------------------------------------------------- 1 | h2. Arquillian JPA + Drone functional testing 2 | 3 | This example covers JPA testing with Selenium testing. It is the enhanced fusion of the following tutorials: 4 | 5 | http://arquillian.org/guides/testing_java_persistence/ 6 | 7 | http://arquillian.org/guides/functional_testing_using_drone/ 8 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ejb3-openejb/src/main/java/org/jboss/arquillian/examples/openejb/HelloEJB.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.openejb; 2 | 3 | import javax.ejb.Local; 4 | 5 | /** 6 | * @author Michael Schuetz 7 | */ 8 | @Local 9 | public interface HelloEJB { 10 | 11 | String sayHelloEJB(String name); 12 | } 13 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/quickstart/HelloEJB.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart; 2 | 3 | import javax.ejb.Local; 4 | 5 | /** 6 | * @author Michael Schuetz 7 | */ 8 | @Local 9 | public interface HelloEJB { 10 | 11 | String sayHelloEJB(String string); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/webapp/WEB-INF/faces-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /quickstart-extension/src/main/java/org/jboss/arquillian/examples/quickstart/extension/QuickstartLoadableExtension.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart.extension; 2 | 3 | import org.jboss.arquillian.core.spi.LoadableExtension; 4 | 5 | public class QuickstartLoadableExtension implements LoadableExtension { 6 | 7 | public void register(ExtensionBuilder builder) { 8 | builder.observer(QuickstartObserver.class); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ejb31-gfembedded/src/main/java/org/jboss/arquillian/examples/gfembedded/HelloEJB.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.gfembedded; 2 | 3 | import javax.ejb.Stateless; 4 | 5 | /** 6 | * EJB3.1. with no-interface view. 7 | * 8 | * @author Michael Schuetz 9 | */ 10 | @Stateless 11 | public class HelloEJB { 12 | 13 | public String sayHelloEJB(String name) { 14 | 15 | return "Hello " + name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ejb31-jbembedded/src/main/java/org/jboss/arquillian/examples/jbembedded/HelloEJB.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.jbembedded; 2 | 3 | import javax.ejb.Stateless; 4 | 5 | /** 6 | * EJB3.1. with no-interface view. 7 | * 8 | * @author Michael Schuetz 9 | */ 10 | @Stateless 11 | public class HelloEJB { 12 | 13 | public String sayHelloEJB(String name) { 14 | 15 | return "Hello " + name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ejb3-openejb/src/main/java/org/jboss/arquillian/examples/openejb/HelloEJBBean.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.openejb; 2 | 3 | import javax.ejb.Stateless; 4 | 5 | /** 6 | * EJB3 Stateless Session Bean. 7 | * 8 | * @author Michael Schuetz 9 | */ 10 | @Stateless 11 | public class HelloEJBBean implements HelloEJB { 12 | 13 | public String sayHelloEJB(String name) { 14 | return "Hello " + name; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/WidgetRepository.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import javax.inject.Qualifier; 9 | 10 | @Qualifier 11 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface WidgetRepository {} 14 | -------------------------------------------------------------------------------- /quickstart/src/test/resources/glassfish-remote-3/test-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | test 10 | 11 | -------------------------------------------------------------------------------- /quickstart-extension/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | target 8 | 9 | --> 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/webapp/home.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Home 8 | 9 | 10 | 11 | 12 |

You are signed in as #{currentUser.username}.

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/webapp/home.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Home 8 | 9 | 10 | 11 | 12 |

You are signed in as #{currentUser.username}.

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/WEB-INF/faces-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | #### Short description of what this resolves: 13 | 14 | 15 | #### Changes proposed in this pull request: 16 | 17 | - 18 | - 19 | - 20 | 21 | 22 | **Fixes**: # 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | 6 | # IntelliJ 7 | *.iml 8 | *.ipr 9 | *.iws 10 | .idea 11 | 12 | # Gradle 13 | .gradle/ 14 | .ivy/ 15 | 16 | # Maven 17 | target/ 18 | pom.xml.versionsBackup 19 | pom.xml.releaseBackup 20 | release.properties 21 | dependency-reduced-pom.xml 22 | 23 | # TestNG 24 | test-output/ 25 | 26 | # JBoss AS 27 | transaction.log 28 | 29 | # Infinitest configuration 30 | infinitest.filters 31 | 32 | # Logs 33 | *.log 34 | *.log~ 35 | 36 | # Libreoffice leftovers (XLS) 37 | .~lock* 38 | 39 | atlassian-ide-plugin.xml 40 | .autoenv.zsh 41 | gh-pages 42 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/GameRepository.java: -------------------------------------------------------------------------------- 1 | package com.acme.jpa; 2 | 3 | import javax.ejb.Stateless; 4 | import javax.persistence.EntityManager; 5 | import javax.persistence.PersistenceContext; 6 | 7 | @Stateless 8 | public class GameRepository extends AbstractRepository 9 | { 10 | @PersistenceContext(unitName = "a") 11 | private EntityManager em; 12 | 13 | @Override 14 | public EntityManager getPersistenceContext() 15 | { 16 | return em; 17 | } 18 | 19 | @Override 20 | public String getEntityName() 21 | { 22 | return Game.class.getSimpleName(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/InvoiceRepository.java: -------------------------------------------------------------------------------- 1 | package com.acme.jpa; 2 | 3 | import javax.ejb.Stateless; 4 | import javax.persistence.EntityManager; 5 | import javax.persistence.PersistenceContext; 6 | 7 | @Stateless 8 | public class InvoiceRepository extends AbstractRepository 9 | { 10 | @PersistenceContext(unitName = "b") 11 | private EntityManager em; 12 | 13 | @Override 14 | public EntityManager getPersistenceContext() 15 | { 16 | return em; 17 | } 18 | 19 | @Override 20 | public String getEntityName() 21 | { 22 | return Invoice.class.getSimpleName(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/impl/src/main/java/org/arquillian/tutorial/extension/deployment/api/DeployProjectArtifact.java: -------------------------------------------------------------------------------- 1 | package org.arquillian.tutorial.extension.deployment.api; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.TYPE) 11 | @Documented 12 | public @interface DeployProjectArtifact { 13 | String value() default ""; 14 | boolean testable() default false; 15 | } 16 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/webapp/home.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Home 8 | 9 | 10 | 11 | 12 |

You are signed in as #{currentUser.username}.

13 |
14 | 15 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/test/resources/jbossas-ds.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 11 | h2 12 | 13 | 14 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources/jbossas-ds.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 11 | h2 12 | 13 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | target/jboss-as-${jboss.version:7.1.1.Final} 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /xa/src/test/resources-jbossas-remote/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | java:/DefaultDS 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /jpalab/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 12 | 13 | 14 | src/test/resources-glassfish-embedded/glassfish-resources.xml 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /jpalab/src/test/resources-openejb-embedded-openjpa/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | testDatabase 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/quickstart/HelloEJBBean.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart; 2 | 3 | import org.jboss.arquillian.examples.quickstart.HelloEJB; 4 | 5 | import javax.ejb.Stateless; 6 | 7 | /** 8 | * As there is a know issue with JBoss6M3, naming conventions apply for EJB 9 | * injection within Arquillian tests. 10 | * 11 | * @see {@link EJBInjectionEnricher#lookup} 12 | * 13 | * @author Michael Schuetz 14 | */ 15 | @Stateless 16 | public class HelloEJBBean implements HelloEJB { 17 | 18 | @Override 19 | public String sayHelloEJB(String name) { 20 | 21 | String hello = "Hello " + name; 22 | 23 | return hello; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /xa/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | 13 | 14 | src/test/resources-glassfish-embedded/sun-resources.xml 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | java:jboss/datasources/ExampleDS 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/test/resources/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | jdbc/arquillian 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | java:jboss/datasources/ExampleDS 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/impl/src/main/java/org/arquillian/tutorial/extension/deployment/ProjectArtifactDeploymentExtension.java: -------------------------------------------------------------------------------- 1 | package org.arquillian.tutorial.extension.deployment; 2 | 3 | import org.arquillian.tutorial.extension.deployment.impl.ProjectArtifactDeploymentGenerator; 4 | import org.jboss.arquillian.container.test.spi.client.deployment.DeploymentScenarioGenerator; 5 | import org.jboss.arquillian.core.spi.LoadableExtension; 6 | 7 | import java.lang.Override; 8 | 9 | public class ProjectArtifactDeploymentExtension implements LoadableExtension { 10 | 11 | @Override 12 | public void register(ExtensionBuilder builder) { 13 | builder.service(DeploymentScenarioGenerator.class, ProjectArtifactDeploymentGenerator.class); 14 | } 15 | } -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/WidgetListProducer.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples; 2 | 3 | import org.jboss.arquillian.examples.Widget; 4 | 5 | import java.util.List; 6 | 7 | import javax.enterprise.context.RequestScoped; 8 | import javax.enterprise.inject.Produces; 9 | import javax.inject.Inject; 10 | import javax.inject.Named; 11 | import javax.persistence.EntityManager; 12 | 13 | public class WidgetListProducer 14 | { 15 | @Inject @WidgetRepository 16 | EntityManager widgetRepository; 17 | 18 | @Produces 19 | @Named 20 | @RequestScoped 21 | @SuppressWarnings("unchecked") 22 | List getWidgets() { 23 | return widgetRepository.createQuery("select w from Widget w order by w.name").getResultList(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources/basic/index.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | Sample JSF Page 8 | 9 | 10 | 11 |

12 |

13 |

14 |

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/WidgetRepositoryProducer.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples; 2 | 3 | import org.jboss.arquillian.examples.WidgetRepository; 4 | 5 | import javax.ejb.Stateless; 6 | import javax.enterprise.inject.Produces; 7 | import javax.enterprise.inject.Disposes; 8 | import javax.persistence.EntityManager; 9 | import javax.persistence.PersistenceContext; 10 | 11 | @Stateless 12 | public class WidgetRepositoryProducer 13 | { 14 | // NOTE cannot use producer field because Weld attempts to close EntityManager 15 | @PersistenceContext EntityManager em; 16 | 17 | public @Produces @WidgetRepository 18 | EntityManager retrieveEntityManager() { 19 | return em; 20 | } 21 | 22 | public void disposeEntityManager(@Disposes @WidgetRepository EntityManager em) {} 23 | } 24 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources-glassfish-embedded/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | jdbc/arquillian 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /quickstart/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | \temp\ 9 | 10 | 11 | 13 | 14 | \server\jboss-6.0.0.20100429-M3 15 | 16 | 127.0.0.1 17 | 8080 19 | 20 | 21 | -------------------------------------------------------------------------------- /jpalab/src/test/resources-glassfish-embedded/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | org.hibernate.ejb.HibernatePersistence 7 | testDatabase 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /jpalab/src/test/resources-openejb-embedded-eclipselink/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | org.eclipse.persistence.jpa.PersistenceProvider 7 | testDatabase 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/webapp/login.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Log in 8 | 9 | 10 | 11 | 12 | 13 | Username: 14 | 15 | Password: 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/AbstractRepository.java: -------------------------------------------------------------------------------- 1 | package com.acme.jpa; 2 | 3 | import javax.persistence.EntityManager; 4 | 5 | public abstract class AbstractRepository 6 | { 7 | public void create(T entity) 8 | { 9 | create(entity, false); 10 | } 11 | 12 | public void create(T entity, boolean flush) 13 | { 14 | getPersistenceContext().persist(entity); 15 | if (flush) 16 | { 17 | getPersistenceContext().flush(); 18 | } 19 | } 20 | 21 | public long getRecordCount() 22 | { 23 | return (Long) getPersistenceContext().createQuery("select count(e) from " + getEntityName() + " e").getSingleResult(); 24 | } 25 | 26 | public void purge() 27 | { 28 | getPersistenceContext().createQuery("delete from " + getEntityName()).executeUpdate(); 29 | } 30 | 31 | public abstract EntityManager getPersistenceContext(); 32 | public abstract String getEntityName(); 33 | } 34 | -------------------------------------------------------------------------------- /quickstart-extension/src/test/java/org/jboss/arquillian/examples/quickstart/extension/integration/IntegrationTestCase.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart.extension.integration; 2 | 3 | import org.jboss.arquillian.container.test.api.Deployment; 4 | import org.jboss.arquillian.junit.Arquillian; 5 | import org.jboss.shrinkwrap.api.ShrinkWrap; 6 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 7 | import org.jboss.shrinkwrap.api.spec.WebArchive; 8 | import org.junit.Assert; 9 | import org.junit.Ignore; 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | 13 | @RunWith(Arquillian.class) 14 | @Ignore 15 | public class IntegrationTestCase { 16 | 17 | @Deployment 18 | public static WebArchive deploy() { 19 | return ShrinkWrap.create(WebArchive.class) 20 | .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); 21 | } 22 | 23 | @Test 24 | public void shouldBeAbleTo() { 25 | Assert.fail("Not implemented"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/webapp/login.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Log in 8 | 9 | 10 | 11 | 12 | 13 | Username: 14 | 15 | Password: 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.arquillian.tutorial 8 | arquillian-deployment-extension-tutorial-parent 9 | 1.0.0-SNAPSHOT 10 | pom 11 | Arquillian Tutorial: Deployment Extension 12 | An example that demonstrates how to provide a custom deployment scenario in place of a @Deployment method via an Arquillian extension 13 | 14 | 15 | impl 16 | integration-tests 17 | functional-tests 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | firefox 10 | 11 | 12 | 16 | 17 | 23 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/resources/css/screen.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | background-color: #EAECEE; 5 | font-family: Verdana, sans-serif; 6 | font-size: 0.9em; 7 | } 8 | #container { 9 | margin: 0 auto; 10 | padding: 0 20px 10px 20px; 11 | border: 1px solid #666666; 12 | width: 865px; /* subtract 40px from banner width for padding */ 13 | background: #FFFFFF url(#{request.contextPath}/resources/gfx/banner.png) no-repeat; 14 | padding-top: 110px; 15 | } 16 | #sidebar { 17 | font-size: 0.9em; 18 | width: 225px; 19 | float: right; 20 | border: 1px solid #666666; 21 | background: #EAECEE; 22 | padding: 0 15px 5px 15px; 23 | } 24 | #sidebar ul { 25 | padding-left: 30px; 26 | } 27 | #footer { 28 | clear: both; 29 | text-align: center; 30 | color: #666666; 31 | font-size: 0.85em; 32 | } 33 | code { 34 | font-size: 1.1em; 35 | } 36 | span.invalid { 37 | padding-left: 3px; 38 | color: red; 39 | } -------------------------------------------------------------------------------- /jpalab/src/test/resources-openejb-embedded-hibernate/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | org.hibernate.ejb.HibernatePersistence 7 | testDatabase 8 | 9 | com.acme.jpa.model.Game 10 | com.acme.jpa.model.LineItem 11 | com.acme.jpa.model.Record 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources/faces-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | org.jboss.jsfunit.context.JSFUnitFacesContextFactory 10 | 11 | 12 | 13 | org.jboss.jsfunit.seam.ConversationScopeVariableResolver 14 | 15 | 16 | 17 | /submit.xhtml 18 | 19 | success 20 | /submission.xhtml 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources/confcal/submission.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | Conference Summary 8 | 9 | 10 | 11 |

Conference Summary

12 |

13 | 14 |
15 | 16 | - 17 | 18 |
19 | 20 |

21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /quickstart-extension/src/main/java/org/jboss/arquillian/examples/quickstart/extension/QuickstartObserver.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart.extension; 2 | 3 | import org.jboss.arquillian.core.api.InstanceProducer; 4 | import org.jboss.arquillian.core.api.annotation.Inject; 5 | import org.jboss.arquillian.core.api.annotation.Observes; 6 | import org.jboss.arquillian.test.spi.annotation.SuiteScoped; 7 | import org.jboss.arquillian.test.spi.event.suite.BeforeSuite; 8 | 9 | public class QuickstartObserver { 10 | 11 | @Inject @SuiteScoped 12 | private InstanceProducer typeInstance; 13 | 14 | public void exposeInternalState(@Observes BeforeSuite event) { 15 | typeInstance.set(new QuickstartType("Arquillian")); 16 | } 17 | 18 | public static class QuickstartType { 19 | private String name; 20 | 21 | public QuickstartType(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources-glassfish-remote/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | jdbc/__default 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /arquillian-tutorial/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | target/deployments 10 | 11 | 12 | 13 | 14 | 15 | target/wildfly 16 | true 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | /tmp/ 10 | 11 | 12 | 13 | 14 | 15 | 16 | target/jboss-as-7.1.1.Final 17 | true 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /xa/src/test/resources-glassfish-remote/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | jdbc/__default 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/webapp/login.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Log in 8 | 9 | 10 |

Log in

11 | 12 | 13 | 14 | Username: 15 | 16 | Password: 17 | 18 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/README.md: -------------------------------------------------------------------------------- 1 | Lifecycle Callback Extension 2 | ======================================================== 3 | 4 | Extension showing how you can hook into the internal Arquillian lifecycle events and expose callbacks in your TestClass. 5 | 6 | @RunWith(Arquillian.class) 7 | public class MyTestCase { 8 | 9 | @Deployment 10 | public static WebArchive deploy() { 11 | return ShrinkWrap.create(WebArchive.class); 12 | } 13 | 14 | @BeforeDeploy 15 | public static void doBeforeDeploy() {} 16 | 17 | @AfterDeploy 18 | public static void doAfterDeploy() {} 19 | 20 | @BeforeUnDeploy 21 | public static void doBeforeUnDeploy() {} 22 | 23 | @AfterUnDeploy 24 | public static void doAfterUnDeploy() {} 25 | 26 | @Test 27 | public void shouldBeAbleTo() {} 28 | } 29 | 30 | Following SPI's are used: 31 | 32 | Client side 33 | ------------ 34 | 35 | * org.jboss.arquillian.core.spi.LoadableExtension 36 | * Core @Observers 37 | -------------------------------------------------------------------------------- /ejb31-jbembedded/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | ejb31-jbembedded 3 | 4 | Arquillian enables you to test your business logic in a remote or embedded container. Alternatively, it can deploy an archive to the container so the test can interact as a remote client. 5 | 6 | All about arquillian: http://jboss.org/arquillian 7 | 8 | Example contains EJB3.1 integration test and runs against JBoss AS 6 Embedded container. The projects target is to provide simplest possible setup for this test combination. 9 | 10 | Getting started 11 | ================ 12 | 1) Download sources. 13 | 2) Configure JBoss Maven repositories in settings.xml (http://community.jboss.org/wiki/MavenGettingStarted). 14 | 3) Run: mvn test. 15 | 16 | Tests will be executed within container. Container will be started by Arquillian, automatically. 17 | 18 | System requirements 19 | =================== 20 | All you need to run this project is Java 5.0 (Java SDK 1.5) or greater and 21 | Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6 22 | certified application server. 23 | -------------------------------------------------------------------------------- /ejb3-openejb/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | ejb3-openejb 3 | 4 | Arquillian enables you to test your business logic in a remote or embedded container. Alternatively, it can deploy an archive to the container so the test can interact as a remote client. 5 | 6 | All about arquillian: http://jboss.org/arquillian 7 | 8 | Example contains EJB3 integration test and runs against Apache OpenEJB 3.1 Embedded container. The projects target is to provide simplest possible setup for this test combination. 9 | 10 | Getting started 11 | ================ 12 | 1) Download sources. 13 | 2) Configure JBoss Maven repositories in settings.xml (http://community.jboss.org/wiki/MavenGettingStarted). 14 | 3) Run: mvn test. 15 | 16 | Tests will be executed within container. Container will be started by Arquillian, automatically. 17 | 18 | System requirements 19 | =================== 20 | All you need to run this project is Java 5.0 (Java SDK 1.5) or greater and 21 | Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6 22 | certified application server. 23 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/webapp/register.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Register 8 | 9 | 10 |

Register

11 | 12 | 13 | 14 | Username: 15 | 16 | Password: 17 | 18 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ejb31-gfembedded/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | ejb31-gfembedded 3 | 4 | Arquillian enables you to test your business logic in a remote or embedded container. Alternatively, it can deploy an archive to the container so the test can interact as a remote client. 5 | 6 | All about arquillian: http://jboss.org/arquillian 7 | 8 | Example contains EJB3.1 integration test and runs against Glassfish Embedded 3 container. The projects target is to provide simplest possible setup for this test combination. 9 | 10 | Getting started 11 | ================ 12 | 1) Download sources. 13 | 2) Configure JBoss Maven repositories in settings.xml (http://community.jboss.org/wiki/MavenGettingStarted). 14 | 3) Run: mvn test. 15 | 16 | Tests will be executed within container. Container will be started by Arquillian, automatically. 17 | 18 | System requirements 19 | =================== 20 | All you need to run this project is Java 5.0 (Java SDK 1.5) or greater and 21 | Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6 22 | certified application server. 23 | -------------------------------------------------------------------------------- /ejb31-jbembedded/src/test/java/org/jboss/arquillian/examples/jbembedded/HelloEJBIT.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.jbembedded; 2 | 3 | import javax.ejb.EJB; 4 | 5 | import org.jboss.arquillian.api.Deployment; 6 | import org.jboss.arquillian.junit.Arquillian; 7 | import org.jboss.shrinkwrap.api.ShrinkWrap; 8 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | 12 | import static org.junit.Assert.assertEquals; 13 | 14 | /** 15 | * @author Michael Schuetz 16 | */ 17 | @RunWith(Arquillian.class) 18 | public class HelloEJBIT { 19 | @EJB 20 | private HelloEJB helloEJB; 21 | 22 | @Deployment 23 | public static JavaArchive createTestArchive() { 24 | return ShrinkWrap.create(JavaArchive.class, "helloEJB.jar") 25 | .addClasses(HelloEJB.class); 26 | } 27 | 28 | @Test 29 | public void testHelloEJB() { 30 | String result = helloEJB.sayHelloEJB("Michael"); 31 | assertEquals("Hello Michael", result); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /ejb31-gfembedded/src/test/java/org/jboss/arquillian/examples/gfembedded/HelloEJBTest.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.gfembedded; 2 | 3 | import javax.ejb.EJB; 4 | 5 | import org.jboss.arquillian.api.Deployment; 6 | import org.jboss.arquillian.junit.Arquillian; 7 | import org.jboss.shrinkwrap.api.ShrinkWrap; 8 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | 12 | import static org.junit.Assert.assertEquals; 13 | 14 | /** 15 | * @author Michael Schuetz 16 | */ 17 | @RunWith(Arquillian.class) 18 | public class HelloEJBTest { 19 | @EJB 20 | private HelloEJB helloEJB; 21 | 22 | @Deployment 23 | public static JavaArchive createTestArchive() { 24 | return ShrinkWrap.create(JavaArchive.class, "helloEJB.jar") 25 | .addClasses(HelloEJB.class); 26 | } 27 | 28 | @Test 29 | public void testHelloEJB() { 30 | String result = helloEJB.sayHelloEJB("Michael"); 31 | assertEquals("Hello Michael", result); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /ejb3-openejb/src/test/java/org/jboss/arquillian/examples/openejb/HelloEJBTest.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.openejb; 2 | 3 | import javax.ejb.EJB; 4 | 5 | import org.jboss.arquillian.api.Deployment; 6 | import org.jboss.arquillian.junit.Arquillian; 7 | import org.jboss.shrinkwrap.api.ShrinkWrap; 8 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | 12 | import static org.junit.Assert.assertEquals; 13 | 14 | /** 15 | * @author Michael Schuetz 16 | */ 17 | @RunWith(Arquillian.class) 18 | public class HelloEJBTest { 19 | @EJB 20 | private HelloEJB helloEJB; 21 | 22 | @Deployment 23 | public static JavaArchive createTestArchive() { 24 | return ShrinkWrap.create(JavaArchive.class, "helloEJB.jar") 25 | .addClasses(HelloEJB.class, HelloEJBBean.class); 26 | } 27 | 28 | @Test 29 | public void testHelloEJB() { 30 | String result = helloEJB.sayHelloEJB("Michael"); 31 | assertEquals("Hello Michael", result); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/business/Games.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | import java.util.List; 20 | 21 | import com.acme.jpa.model.Game; 22 | 23 | public interface Games 24 | { 25 | public void clear(); 26 | public void add(Game game); 27 | public List selectAllUsingJpql(); 28 | } 29 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources-jbossas-managed/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | jdbc/arquillian 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 4.0.0 8 | 9 | org.jboss.arquillian.examples 10 | parent 11 | 1.0.0-SNAPSHOT 12 | pom 13 | 14 | Arquillian Examples Runner 15 | A parent project for running all the example projects together 16 | https://github.com/arquillian/arquillian-examples 17 | 18 | 19 | arquillian-tutorial 20 | arquillian-tutorial-rinse-repeat 21 | arquillian-persistence-tutorial 22 | arquillian-jpa-drone 23 | quickstart 24 | ejb31-gfembedded 25 | ejb31-jbembedded 26 | ejb3-openejb 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | target/jboss-as-7.1.1.Final 13 | -Xmx512m -XX:MaxPermSize=128m -Xverify:none -XX:+UseFastAccessorMethods 14 | true 15 | 16 | 17 | 18 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/business/EntityInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | /** 20 | * A callback interface to initialize a record inside the context of the transaction 21 | * being used to retrieve it. 22 | * 23 | * @param Entity type 24 | */ 25 | public interface EntityInitializer 26 | { 27 | public T initialize(T entity); 28 | } 29 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | target/jboss-as-7.1.1.Final 13 | -Xmx512m -XX:MaxPermSize=128m -Xverify:none -XX:+UseFastAccessorMethods 14 | true 15 | 16 | 17 | 18 | 19 | firefox 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /xa/src/test/resources-glassfish-embedded/sun-resources.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 11 | 12 | 13 | 14 | 16 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/OrderRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.util.List; 21 | 22 | import javax.ejb.Local; 23 | 24 | /** 25 | * @author Dan Allen 26 | */ 27 | @Local 28 | public interface OrderRepository { 29 | void addOrder(List order); 30 | List> getOrders(); 31 | int getOrderCount(); 32 | } 33 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/main/java/org/arquillian/example/OrderRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.util.List; 21 | import javax.ejb.Local; 22 | 23 | /** 24 | * @author Dan Allen 25 | */ 26 | @Local 27 | public interface OrderRepository { 28 | void addOrder(List order); 29 | List> getOrders(); 30 | int getOrderCount(); 31 | } 32 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources/confcal/submit.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | Submit Conference 8 | 9 | 10 | 11 |

Submit Conference

12 | 13 | Title: 14 |
15 | Start date: 16 |
17 | End date: 18 |
19 | Location: 20 |
21 | Topic: 22 |
23 | 24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /jpalab/src/test/resources-glassfish-embedded/glassfish-resources.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 12 | 13 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | src/test/resources-glassfish-embedded/glassfish-resources.xml 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | target/jboss-as-7.1.1.Final 21 | -Xmx512m -XX:MaxPermSize=128m -Xverify:none -XX:+UseFastAccessorMethods 22 | true 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/test/resources-glassfish-embedded/glassfish-resources.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 12 | 13 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/ui/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example.ui; 19 | 20 | /** 21 | * @author Dan Allen 22 | */ 23 | public class User { 24 | private String username; 25 | 26 | public User() {} 27 | 28 | public User(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getUsername() { 33 | return username; 34 | } 35 | 36 | public void setUsername(String username) { 37 | this.username = username; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /quickstart/src/test/java/org/jboss/arquillian/examples/quickstart/HelloWorldContainerTest.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart; 2 | 3 | import javax.inject.Inject; 4 | 5 | import junit.framework.Assert; 6 | 7 | import org.jboss.arquillian.api.Deployment; 8 | import org.jboss.arquillian.examples.quickstart.HelloWorld; 9 | import org.jboss.arquillian.junit.Arquillian; 10 | import org.jboss.shrinkwrap.api.ShrinkWrap; 11 | import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; 12 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 13 | import org.junit.Test; 14 | import org.junit.runner.RunWith; 15 | 16 | /** 17 | * @author Michael Schuetz 18 | */ 19 | @RunWith(Arquillian.class) 20 | public class HelloWorldContainerTest { 21 | private static ByteArrayAsset EMPTY_BEANS_XML = new ByteArrayAsset( 22 | "".getBytes()); 23 | 24 | @Inject 25 | private HelloWorld helloWorld; 26 | 27 | @Deployment 28 | public static JavaArchive createTestArchive() { 29 | JavaArchive arch = ShrinkWrap.create(JavaArchive.class, 30 | "helloWorld.jar").addClasses(HelloWorld.class) 31 | .addManifestResource(EMPTY_BEANS_XML, "beans.xml"); 32 | 33 | System.out.println("### building " + arch.getName()); 34 | 35 | return arch; 36 | } 37 | 38 | @Test 39 | public void testSayHello() { 40 | System.out.println("### testSayHello"); 41 | Assert.assertEquals("Hello World!", helloWorld.getText()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/business/JavaPersistenceHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | import java.io.Serializable; 20 | import java.util.List; 21 | 22 | import com.acme.jpa.model.Record; 23 | 24 | /** 25 | * An interface that provides JPA helper operations 26 | */ 27 | public interface JavaPersistenceHelper 28 | { 29 | public List seed(boolean clear); 30 | public T retrieveById(Class type, Long id); 31 | public boolean isManaging(Serializable entity); 32 | public void transact(); 33 | public String getProvider(); 34 | public boolean isLazyLoadingPermittedOnClosedSession(); 35 | } 36 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/java/org/arquillian/tutorial/extension/deployment/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | /** 21 | * @author Dan Allen 22 | */ 23 | public class User { 24 | private String username; 25 | 26 | public User() {} 27 | 28 | public User(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getUsername() { 33 | return username; 34 | } 35 | 36 | public void setUsername(String username) { 37 | this.username = username; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/java/org/arquillian/tutorial/extension/lifecycle/api/AfterDeploy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 4 | * as indicated by the @authors tag. All rights reserved. 5 | * See the copyright.txt in the distribution for a 6 | * full listing of individual contributors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.lifecycle.api; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * 27 | * @author Aslak Knutsen 28 | * @version $Revision: $ 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface AfterDeploy { 33 | } 34 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/java/org/arquillian/tutorial/extension/lifecycle/api/BeforeDeploy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 4 | * as indicated by the @authors tag. All rights reserved. 5 | * See the copyright.txt in the distribution for a 6 | * full listing of individual contributors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.lifecycle.api; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * 27 | * @author Aslak Knutsen 28 | * @version $Revision: $ 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface BeforeDeploy { 33 | } 34 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/java/org/arquillian/tutorial/extension/lifecycle/api/AfterUnDeploy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 4 | * as indicated by the @authors tag. All rights reserved. 5 | * See the copyright.txt in the distribution for a 6 | * full listing of individual contributors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.lifecycle.api; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * 27 | * @author Aslak Knutsen 28 | * @version $Revision: $ 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface AfterUnDeploy { 33 | } 34 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/java/org/arquillian/tutorial/extension/lifecycle/api/BeforeUnDeploy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 4 | * as indicated by the @authors tag. All rights reserved. 5 | * See the copyright.txt in the distribution for a 6 | * full listing of individual contributors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.lifecycle.api; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * 27 | * @author Aslak Knutsen 28 | * @version $Revision: $ 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface BeforeUnDeploy { 33 | } 34 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/main/java/org/arquillian/tutorial/extension/lifecycle/LifecycleExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 4 | * as indicated by the @authors tag. All rights reserved. 5 | * See the copyright.txt in the distribution for a 6 | * full listing of individual contributors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.lifecycle; 19 | 20 | import org.jboss.arquillian.core.spi.LoadableExtension; 21 | 22 | /** 23 | * LifecycleExtension 24 | * 25 | * @author Aslak Knutsen 26 | * @version $Revision: $ 27 | */ 28 | public class LifecycleExtension implements LoadableExtension 29 | { 30 | @Override 31 | public void register(ExtensionBuilder builder) 32 | { 33 | builder.observer(LifecycleExecuter.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | ##### Issue Overview 18 | 19 | Tell us briefly what the problem is about. 20 | 21 | ##### Expected Behaviour 22 | 23 | ##### Current Behaviour 24 | 25 | ##### Steps To Reproduce 26 | 1. [step 1] 27 | 2. [step 2] 28 | 29 | ##### Additional Information 30 | 31 | Anything relevant to help us resolving the problem. For example if you are using `mvn` you can share output for `mvn --version` as well as dependencies in use `mvn dependency:tree`. OS as well as JDK version would be helpful too. 32 | 33 | For long outputs such as stacktraces please use HTML5 `
` 34 | 35 | ``` 36 |
37 | $mvn --version 38 | Maven home: /usr/share/maven/latest 39 | Java version: 1.7.0_79, vendor: Oracle Corporation 40 | Java home: /usr/java/jdk1.7.0_79/jre 41 | Default locale: en_US, platform encoding: UTF-8 42 | OS name: "linux", version: "4.7.7-200.fc24.x86_64", arch: "amd64", family: "unix" 43 |
44 | ``` 45 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/Widget.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.Id; 9 | 10 | @Entity 11 | public class Widget implements Serializable 12 | { 13 | private Long id; 14 | private String partNumber; 15 | private String name; 16 | private String description; 17 | 18 | @Id 19 | @GeneratedValue 20 | public Long getId() 21 | { 22 | return id; 23 | } 24 | 25 | public void setId(Long id) 26 | { 27 | this.id = id; 28 | } 29 | 30 | // demonstrates a column name override 31 | @Column(name = "partno") 32 | public String getPartNumber() 33 | { 34 | return partNumber; 35 | } 36 | 37 | public void setPartNumber(String partNumber) 38 | { 39 | this.partNumber = partNumber; 40 | } 41 | 42 | public String getName() 43 | { 44 | return name; 45 | } 46 | 47 | public void setName(String name) 48 | { 49 | this.name = name; 50 | } 51 | 52 | public String getDescription() 53 | { 54 | return description; 55 | } 56 | 57 | public void setDescription(String description) 58 | { 59 | this.description = description; 60 | } 61 | 62 | /** Default value included to remove warning. Remove or modify at will. */ 63 | private static final long serialVersionUID = 1L; 64 | } -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/dao/UserDAOException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.dao; 18 | 19 | /** 20 | * @author Stefan Miklosovic 21 | */ 22 | public class UserDAOException extends RuntimeException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | public UserDAOException() { 27 | } 28 | 29 | public UserDAOException(String message) { 30 | super(message); 31 | } 32 | 33 | public UserDAOException(Throwable cause) { 34 | super(cause); 35 | } 36 | 37 | public UserDAOException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/model/Credentials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.model; 18 | 19 | import javax.enterprise.inject.Model; 20 | 21 | /** 22 | * @author Stefan Miklosovic 23 | */ 24 | @Model 25 | public class Credentials { 26 | private String username; 27 | 28 | private String password; 29 | 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | 38 | public String getPassword() { 39 | return password; 40 | } 41 | 42 | public void setPassword(String password) { 43 | this.password = password; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/main/java/org/arquillian/example/Greeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.PrintStream; 21 | import javax.inject.Inject; 22 | 23 | /** 24 | * @author Dan Allen 25 | */ 26 | public class Greeter { 27 | 28 | private PhraseBuilder phraseBuilder; 29 | 30 | @Inject 31 | public Greeter(PhraseBuilder phraseBuilder) { 32 | this.phraseBuilder = phraseBuilder; 33 | } 34 | 35 | public void greet(PrintStream to, String name) { 36 | to.println(createGreeting(name)); 37 | } 38 | 39 | public String createGreeting(String name) { 40 | return phraseBuilder.buildPhrase("hello", name); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/ui/Credentials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example.ui; 19 | 20 | import javax.enterprise.inject.Model; 21 | 22 | /** 23 | * @author Dan Allen 24 | */ 25 | @Model 26 | public class Credentials { 27 | private String username; 28 | private String password; 29 | 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | 38 | public String getPassword() { 39 | return password; 40 | } 41 | 42 | public void setPassword(String password) { 43 | this.password = password; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /quickstart-extension/src/test/java/org/jboss/arquillian/examples/quickstart/extension/unit/UnitTestCase.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart.extension.unit; 2 | 3 | import java.util.List; 4 | 5 | import junit.framework.Assert; 6 | 7 | import org.jboss.arquillian.container.test.test.AbstractContainerTestTestBase; 8 | import org.jboss.arquillian.core.api.Instance; 9 | import org.jboss.arquillian.core.api.annotation.Inject; 10 | import org.jboss.arquillian.examples.quickstart.extension.QuickstartObserver; 11 | import org.jboss.arquillian.examples.quickstart.extension.QuickstartObserver.QuickstartType; 12 | import org.jboss.arquillian.test.spi.event.suite.BeforeClass; 13 | import org.jboss.arquillian.test.spi.event.suite.BeforeSuite; 14 | import org.junit.Test; 15 | 16 | 17 | public class UnitTestCase extends AbstractContainerTestTestBase { 18 | 19 | @Override 20 | protected void addExtensions(List> extensions) { 21 | extensions.add(QuickstartObserver.class); 22 | } 23 | 24 | @Inject 25 | private Instance typeInstance; 26 | 27 | @Test 28 | public void shouldExposeQucikStartTypeDuringBeforeSuite() { 29 | 30 | fire(new BeforeSuite()); 31 | 32 | assertEventFired(QuickstartType.class, 1); 33 | Assert.assertEquals("Arquillian", typeInstance.get().getName()); 34 | } 35 | 36 | @Test 37 | public void shouldNotExposeQucikStartTypeDuringBeforeClass() { 38 | 39 | fire(new BeforeClass(this.getClass())); 40 | 41 | assertEventFired(QuickstartType.class, 0); 42 | Assert.assertNull(typeInstance.get()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/Greeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.PrintStream; 21 | 22 | import javax.inject.Inject; 23 | 24 | /** 25 | * @author Dan Allen 26 | */ 27 | public class Greeter { 28 | 29 | private PhraseBuilder phraseBuilder; 30 | 31 | @Inject 32 | public Greeter(PhraseBuilder phraseBuilder) { 33 | this.phraseBuilder = phraseBuilder; 34 | } 35 | 36 | public void greet(PrintStream to, String name) { 37 | to.println(createGreeting(name)); 38 | } 39 | 40 | public String createGreeting(String name) { 41 | return phraseBuilder.buildPhrase("hello", name); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/main/java/org/arquillian/example/PhraseBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.text.MessageFormat; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import javax.annotation.PostConstruct; 24 | 25 | /** 26 | * @author Dan Allen 27 | */ 28 | public class PhraseBuilder { 29 | private Map templates; 30 | 31 | public String buildPhrase(String id, Object... args) { 32 | return MessageFormat.format(templates.get(id), args); 33 | } 34 | 35 | @PostConstruct 36 | public void initialize() { 37 | templates = new HashMap(); 38 | templates.put("hello", "Hello, {0}!"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/PhraseBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.text.MessageFormat; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | import javax.annotation.PostConstruct; 25 | 26 | /** 27 | * @author Dan Allen 28 | */ 29 | public class PhraseBuilder { 30 | private Map templates; 31 | 32 | public String buildPhrase(String id, Object... args) { 33 | return MessageFormat.format(templates.get(id), args); 34 | } 35 | 36 | @PostConstruct 37 | public void initialize() { 38 | templates = new HashMap(); 39 | templates.put("hello", "Hello, {0}!"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources-jetty/jsf-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | com.sun.faces.config.ConfigureListener 12 | 13 | 14 | 15 | org.jboss.weld.environment.servlet.Listener 16 | 17 | 18 | 19 | com.sun.faces.expressionFactory 20 | com.sun.el.ExpressionFactoryImpl 21 | 22 | 23 | 24 | javax.faces.PROJECT_STAGE 25 | Development 26 | 27 | 28 | 29 | Faces Servlet 30 | javax.faces.webapp.FacesServlet 31 | 1 32 | 33 | 34 | 35 | Faces Servlet 36 | *.jsf 37 | 38 | 39 | 40 | index.xhtml 41 | 42 | 43 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/main/java/org/arquillian/tutorial/extension/deployment/Greeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import java.io.PrintStream; 21 | import javax.inject.Inject; 22 | 23 | /** 24 | * @author Dan Allen 25 | */ 26 | public class Greeter { 27 | 28 | private PhraseBuilder phraseBuilder; 29 | 30 | @Inject 31 | public Greeter(PhraseBuilder phraseBuilder) { 32 | this.phraseBuilder = phraseBuilder; 33 | } 34 | 35 | public void greet(PrintStream to, String name) { 36 | to.println(createGreeting(name)); 37 | } 38 | 39 | public String createGreeting(String name) { 40 | return phraseBuilder.buildPhrase("hello", name); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/java/org/arquillian/tutorial/extension/deployment/Credentials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import javax.enterprise.inject.Model; 21 | 22 | /** 23 | * @author Dan Allen 24 | */ 25 | @Model 26 | public class Credentials { 27 | private String username; 28 | private String password; 29 | 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | 38 | public String getPassword() { 39 | return password; 40 | } 41 | 42 | public void setPassword(String password) { 43 | this.password = password; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/main/java/org/arquillian/tutorial/extension/deployment/PhraseBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import java.text.MessageFormat; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import javax.annotation.PostConstruct; 24 | 25 | /** 26 | * @author Dan Allen 27 | */ 28 | public class PhraseBuilder { 29 | private Map templates; 30 | 31 | public String buildPhrase(String id, Object... args) { 32 | return MessageFormat.format(templates.get(id), args); 33 | } 34 | 35 | @PostConstruct 36 | public void initialize() { 37 | templates = new HashMap(); 38 | templates.put("hello", "Hello, {0}!"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/Invoice.java: -------------------------------------------------------------------------------- 1 | package com.acme.jpa; 2 | 3 | import java.io.Serializable; 4 | import java.math.BigDecimal; 5 | import java.util.Date; 6 | 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.Id; 10 | import javax.persistence.Temporal; 11 | import javax.persistence.TemporalType; 12 | import javax.validation.constraints.Max; 13 | 14 | @Entity 15 | public class Invoice implements Serializable 16 | { 17 | private Long id; 18 | 19 | private BigDecimal amount; 20 | 21 | private Long customerId; 22 | 23 | private Date date; 24 | 25 | public Invoice() {} 26 | 27 | public Invoice(Long customerId, BigDecimal amount, Date date) 28 | { 29 | this.customerId = customerId; 30 | this.amount = amount; 31 | this.date = date; 32 | } 33 | 34 | @Id 35 | @GeneratedValue 36 | public Long getId() 37 | { 38 | return id; 39 | } 40 | 41 | public void setId(Long id) 42 | { 43 | this.id = id; 44 | } 45 | 46 | @Max(100) 47 | public BigDecimal getAmount() 48 | { 49 | return amount; 50 | } 51 | 52 | public void setAmount(BigDecimal amount) 53 | { 54 | this.amount = amount; 55 | } 56 | 57 | public Long getCustomerId() 58 | { 59 | return customerId; 60 | } 61 | 62 | public void setCustomerId(Long customerId) 63 | { 64 | this.customerId = customerId; 65 | } 66 | 67 | @Temporal(TemporalType.DATE) 68 | public Date getDate() 69 | { 70 | return date; 71 | } 72 | 73 | public void setDate(Date date) 74 | { 75 | this.date = date; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /arquillian-tutorial/src/main/java/org/arquillian/example/Greeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.PrintStream; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.enterprise.context.Dependent; 24 | import jakarta.inject.Inject; 25 | 26 | /** 27 | * @author Dan Allen 28 | */ 29 | @Dependent 30 | public class Greeter { 31 | 32 | private PhraseBuilder phraseBuilder; 33 | 34 | @Inject 35 | public Greeter(PhraseBuilder phraseBuilder) { 36 | this.phraseBuilder = phraseBuilder; 37 | } 38 | 39 | public void greet(PrintStream to, String name) { 40 | to.println(createGreeting(name)); 41 | } 42 | 43 | public String createGreeting(String name) { 44 | return phraseBuilder.buildPhrase("hello", name); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /arquillian-tutorial/src/main/java/org/arquillian/example/PhraseBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.text.MessageFormat; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import jakarta.annotation.PostConstruct; 24 | import jakarta.enterprise.context.ApplicationScoped; 25 | import jakarta.enterprise.context.Dependent; 26 | 27 | /** 28 | * @author Dan Allen 29 | */ 30 | @Dependent 31 | public class PhraseBuilder { 32 | private Map templates; 33 | 34 | public String buildPhrase(String id, Object... args) { 35 | return MessageFormat.format(templates.get(id), args); 36 | } 37 | 38 | @PostConstruct 39 | public void initialize() { 40 | templates = new HashMap(); 41 | templates.put("hello", "Hello, {0}!"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /quickstart/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | java:/DefaultDS 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /xa/src/test/resources-glassfish-embedded/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.hibernate.ejb.HibernatePersistence 8 | jdbc/a 9 | com.acme.jpa.Game 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | jdbc/b 23 | com.acme.jpa.Invoice 24 | true 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/integration-tests/src/test/java/org/arquillian/tutorial/extension/deployment/GreeterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import javax.inject.Inject; 21 | 22 | import org.arquillian.tutorial.extension.deployment.api.DeployProjectArtifact; 23 | import org.jboss.arquillian.junit.Arquillian; 24 | import org.junit.Assert; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | 28 | /** 29 | * @author Dan Allen 30 | */ 31 | @RunWith(Arquillian.class) 32 | @DeployProjectArtifact(testable = true) 33 | public class GreeterTest { 34 | 35 | @Inject 36 | Greeter greeter; 37 | 38 | @Test 39 | public void should_create_greeting() { 40 | Assert.assertEquals("Hello, Earthling!", 41 | greeter.createGreeting("Earthling")); 42 | greeter.greet(System.out, "Earthling"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/business/GamesBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | import java.util.List; 20 | 21 | import javax.ejb.Local; 22 | import javax.ejb.Stateless; 23 | import javax.persistence.EntityManager; 24 | import javax.persistence.PersistenceContext; 25 | 26 | import com.acme.jpa.model.Game; 27 | 28 | @Stateless 29 | @Local(Games.class) 30 | public class GamesBean implements Games 31 | { 32 | @PersistenceContext 33 | private EntityManager em; 34 | 35 | @Override 36 | public void clear() 37 | { 38 | em.createQuery("delete from Game").executeUpdate(); 39 | } 40 | 41 | @Override 42 | public void add(Game game) 43 | { 44 | em.persist(game); 45 | } 46 | 47 | @Override 48 | @SuppressWarnings("unchecked") 49 | public List selectAllUsingJpql() 50 | { 51 | return em.createQuery("select g from Game g order by g.id").getResultList(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /quickstart/src/main/java/org/jboss/arquillian/examples/quickstart/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart; 2 | 3 | import javax.annotation.PostConstruct; 4 | import javax.enterprise.inject.Model; 5 | import javax.validation.constraints.Digits; 6 | import javax.validation.constraints.NotNull; 7 | import javax.validation.constraints.Pattern; 8 | 9 | import org.hibernate.validator.constraints.Email; 10 | import org.hibernate.validator.constraints.NotEmpty; 11 | 12 | public @Model class HelloWorld 13 | { 14 | private final String text = "Hello World!"; 15 | 16 | private String letters; 17 | 18 | private String numbers; 19 | 20 | private String email; 21 | 22 | public HelloWorld() {} 23 | 24 | @PostConstruct 25 | public void initialize() 26 | { 27 | System.out.println(this.getClass().getSimpleName() + " was constructed"); 28 | } 29 | 30 | public String getText() 31 | { 32 | return text; 33 | } 34 | 35 | @NotNull 36 | @NotEmpty 37 | @Pattern(regexp = "[A-Za-z]*", message = "must contain only letters") 38 | public String getLetters() 39 | { 40 | return letters; 41 | } 42 | 43 | public void setLetters(String letters) 44 | { 45 | this.letters = letters; 46 | } 47 | 48 | @NotNull 49 | @NotEmpty 50 | @Digits(fraction = 0, integer = 2) 51 | public String getNumbers() 52 | { 53 | return numbers; 54 | } 55 | 56 | public void setNumbers(String numbers) 57 | { 58 | this.numbers = numbers; 59 | } 60 | 61 | @NotNull 62 | @NotEmpty 63 | @Email 64 | public String getEmail() 65 | { 66 | return email; 67 | } 68 | 69 | public void setEmail(String email) 70 | { 71 | this.email = email; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 15 | 16 | 17 | Faces Servlet 18 | javax.faces.webapp.FacesServlet 19 | 1 20 | 21 | 22 | 23 | 24 | Faces Servlet 25 | *.jsf 26 | 27 | 28 | 29 | 30 | 31 | facelets.DEVELOPMENT 32 | true 33 | 34 | 35 | 36 | widgets/pu 37 | widgets 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/DualRepositoryService.java: -------------------------------------------------------------------------------- 1 | package com.acme.jpa; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | import javax.annotation.Resource; 7 | import javax.ejb.EJB; 8 | import javax.ejb.EJBContext; 9 | import javax.ejb.Stateless; 10 | import javax.ejb.TransactionAttribute; 11 | import javax.ejb.TransactionAttributeType; 12 | 13 | @Stateless 14 | public class DualRepositoryService 15 | { 16 | @EJB 17 | private GameRepository gameRepository; 18 | 19 | @EJB 20 | private InvoiceRepository invoiceRepository; 21 | 22 | @Resource 23 | private EJBContext ejbContext; 24 | 25 | public void succeedFirstFailSecondInTx() 26 | { 27 | succeedFirstFailSecondWithoutTx(); 28 | } 29 | 30 | @TransactionAttribute(TransactionAttributeType.NEVER) 31 | public void succeedFirstFailSecondWithoutTx() 32 | { 33 | performSucceedFirstFailSecond(); 34 | } 35 | 36 | public void insertBothThenRollbackInTx() 37 | { 38 | gameRepository.create(new Game("Super Mario Brothers"), true); 39 | invoiceRepository.create(new Invoice(1L, new BigDecimal(50), new Date()), true); 40 | ejbContext.setRollbackOnly(); 41 | } 42 | 43 | public long getGameCount() 44 | { 45 | return gameRepository.getRecordCount(); 46 | } 47 | 48 | public long getInvoiceCount() 49 | { 50 | return invoiceRepository.getRecordCount(); 51 | } 52 | 53 | public void purge() 54 | { 55 | gameRepository.purge(); 56 | invoiceRepository.purge(); 57 | } 58 | 59 | private void performSucceedFirstFailSecond() 60 | { 61 | gameRepository.create(new Game("Super Mario Brothers"), true); 62 | invoiceRepository.create(new Invoice(1L, new BigDecimal(200), new Date()), true); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/model/Game.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.model; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.persistence.Entity; 22 | import javax.persistence.GeneratedValue; 23 | import javax.persistence.Id; 24 | 25 | @Entity 26 | public class Game implements Serializable 27 | { 28 | private Long id; 29 | private String title; 30 | 31 | public Game() 32 | { 33 | } 34 | 35 | public Game(String title) 36 | { 37 | this.title = title; 38 | } 39 | 40 | @Id @GeneratedValue 41 | public Long getId() 42 | { 43 | return id; 44 | } 45 | 46 | public void setId(Long id) 47 | { 48 | this.id = id; 49 | } 50 | 51 | public String getTitle() 52 | { 53 | return title; 54 | } 55 | 56 | public void setTitle(String name) 57 | { 58 | this.title = name; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "Game@" + hashCode() + "[id = " + id + "; title = " + title + "]"; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/main/java/com/acme/jsf/confcal/ConferenceCalendar.java: -------------------------------------------------------------------------------- 1 | package com.acme.jsf.confcal; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | import java.util.TreeSet; 7 | 8 | import javax.enterprise.context.ApplicationScoped; 9 | import javax.enterprise.context.Dependent; 10 | import javax.enterprise.context.RequestScoped; 11 | import javax.enterprise.inject.Produces; 12 | import javax.inject.Named; 13 | 14 | @Named 15 | @ApplicationScoped 16 | public class ConferenceCalendar 17 | { 18 | private Set conferenceDatabase = new TreeSet(); 19 | 20 | private List conferences = new ArrayList(); 21 | 22 | @Produces @Named @Dependent 23 | public List getConferences() 24 | { 25 | System.out.println("Retrieving " + conferences.size() + " conference(s)"); 26 | for (Conference c : conferences) 27 | { 28 | System.out.println(c.getTitle()); 29 | } 30 | return conferences; 31 | } 32 | 33 | public String submit(final Conference conference) 34 | { 35 | synchronized (conferenceDatabase) 36 | { 37 | System.out.println("Adding conference " + conference.getTitle()); 38 | // copy to erase proxy 39 | conferenceDatabase.add(new Conference(conference)); 40 | conferences = new ArrayList(conferenceDatabase); 41 | System.out.println(conferences.size() + " conference(s) after insert"); 42 | for (Conference c : conferences) 43 | { 44 | System.out.println(c.getTitle()); 45 | } 46 | } 47 | return "success"; 48 | } 49 | 50 | @Produces @RequestScoped @Named 51 | public Conference getConference() 52 | { 53 | System.out.println("Initializing new conference model"); 54 | return new Conference(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/test/java/org/arquillian/example/SingletonOrderRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Collections; 22 | import java.util.List; 23 | 24 | import javax.annotation.PostConstruct; 25 | import javax.ejb.Lock; 26 | import javax.ejb.LockType; 27 | import javax.ejb.Singleton; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @Singleton 33 | @Lock(LockType.READ) 34 | public class SingletonOrderRepository implements OrderRepository { 35 | private List> orders; 36 | 37 | @Override 38 | @Lock(LockType.WRITE) 39 | public void addOrder(List order) { 40 | orders.add(order); 41 | } 42 | 43 | @Override 44 | public List> getOrders() { 45 | return Collections.unmodifiableList(orders); 46 | } 47 | 48 | @Override 49 | public int getOrderCount() { 50 | return orders.size(); 51 | } 52 | 53 | @PostConstruct 54 | void initialize() { 55 | orders = new ArrayList>(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /xa/src/main/java/com/acme/jpa/Game.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa; 18 | 19 | import java.io.Serializable; 20 | import javax.persistence.Entity; 21 | import javax.persistence.GeneratedValue; 22 | import javax.persistence.Id; 23 | import javax.validation.constraints.NotNull; 24 | import javax.validation.constraints.Size; 25 | 26 | @Entity 27 | public class Game implements Serializable 28 | { 29 | private Long id; 30 | private String title; 31 | 32 | public Game() {} 33 | 34 | public Game(String title) 35 | { 36 | this.title = title; 37 | } 38 | 39 | @Id @GeneratedValue 40 | public Long getId() 41 | { 42 | return id; 43 | } 44 | 45 | public void setId(Long id) 46 | { 47 | this.id = id; 48 | } 49 | 50 | @NotNull 51 | @Size(min = 3, max = 50) 52 | public String getTitle() 53 | { 54 | return title; 55 | } 56 | 57 | public void setTitle(String name) 58 | { 59 | this.title = name; 60 | } 61 | 62 | @Override 63 | public String toString() 64 | { 65 | return "Game@" + hashCode() + "[id = " + id + "; title = " + title + "]"; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/test/java/org/arquillian/example/SingletonOrderRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Collections; 22 | import java.util.List; 23 | 24 | import javax.annotation.PostConstruct; 25 | import javax.ejb.Lock; 26 | import javax.ejb.LockType; 27 | import javax.ejb.Singleton; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @Singleton 33 | @Lock(LockType.READ) 34 | public class SingletonOrderRepository implements OrderRepository { 35 | private List> orders; 36 | 37 | @Override 38 | @Lock(LockType.WRITE) 39 | public void addOrder(List order) { 40 | orders.add(order); 41 | } 42 | 43 | @Override 44 | public List> getOrders() { 45 | return Collections.unmodifiableList(orders); 46 | } 47 | 48 | @Override 49 | public int getOrderCount() { 50 | return orders.size(); 51 | } 52 | 53 | @PostConstruct 54 | void initialize() { 55 | orders = new ArrayList>(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/business/Repository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | import java.io.Serializable; 20 | import java.util.List; 21 | 22 | /** 23 | * A generic repository interface for inserting and retrieving entities from the 24 | * database. Designed with the capabilities of JPA in mind. 25 | */ 26 | public interface Repository 27 | { 28 | public void create(Serializable entity); 29 | 30 | public void delete(Serializable entity); 31 | 32 | public T retrieveById(Class entityType, Object primaryKey); 33 | 34 | public T retrieveById(Class entityType, Object primaryKey, EntityInitializer callback); 35 | 36 | public List retrieveAll(Class entityType); 37 | 38 | public List retrieveByQuery(Class entityType, String query, String... params); 39 | 40 | public void update(Serializable entity); 41 | 42 | public T save(T entity); 43 | 44 | public T saveNonManaged(T entity); 45 | 46 | public boolean isManaging(Serializable entity); 47 | 48 | public void close(); 49 | } 50 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 13 | 14 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | target/jboss-as-7.1.1.Final 27 | -Xmx512m -XX:MaxPermSize=128m -Xverify:none -XX:+UseFastAccessorMethods 28 | 29 | 34 | true 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/Basket.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.Serializable; 21 | import java.util.ArrayList; 22 | import java.util.Collections; 23 | import java.util.List; 24 | 25 | import javax.annotation.PostConstruct; 26 | import javax.ejb.EJB; 27 | import javax.enterprise.context.SessionScoped; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @SessionScoped 33 | public class Basket implements Serializable { 34 | private static final long serialVersionUID = 1L; 35 | 36 | private List items; 37 | 38 | @EJB 39 | private OrderRepository repo; 40 | 41 | public void addItem(String item) { 42 | items.add(item); 43 | } 44 | 45 | public List getItems() { 46 | return Collections.unmodifiableList(items); 47 | } 48 | 49 | public int getItemCount() { 50 | return items.size(); 51 | } 52 | 53 | public void placeOrder() { 54 | repo.addOrder(items); 55 | items.clear(); 56 | } 57 | 58 | @PostConstruct 59 | void initialize() { 60 | items = new ArrayList(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/main/java/org/arquillian/example/Basket.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.Serializable; 21 | import java.util.ArrayList; 22 | import java.util.Collections; 23 | import java.util.List; 24 | 25 | import javax.annotation.PostConstruct; 26 | import javax.ejb.EJB; 27 | import javax.enterprise.context.SessionScoped; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @SessionScoped 33 | public class Basket implements Serializable { 34 | private static final long serialVersionUID = 1L; 35 | private List items; 36 | 37 | @EJB 38 | private OrderRepository repo; 39 | 40 | public void addItem(String item) { 41 | items.add(item); 42 | } 43 | 44 | public List getItems() { 45 | return Collections.unmodifiableList(items); 46 | } 47 | 48 | public int getItemCount() { 49 | return items.size(); 50 | } 51 | 52 | public void placeOrder() { 53 | repo.addOrder(items); 54 | items.clear(); 55 | } 56 | 57 | @PostConstruct 58 | void initialize() { 59 | items = new ArrayList(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/dao/UserDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.dao; 18 | 19 | import javax.ejb.Local; 20 | 21 | import org.arquillian.example.model.User; 22 | 23 | /** 24 | * @author Stefan Miklosovic 25 | */ 26 | @Local 27 | public interface UserDAO { 28 | 29 | /** 30 | * This method create a new user. 31 | * 32 | * @param user 33 | * user to create 34 | * @return id of a newly created user or null 35 | */ 36 | Long createUser(User user); 37 | 38 | /** 39 | * This method deletes some user. 40 | * 41 | * @param user 42 | * user to delete 43 | */ 44 | void deleteUser(User user); 45 | 46 | /** 47 | * This method finds a user by its name. 48 | * 49 | * @param name 50 | * name of user to find 51 | * @return user of specified name or null 52 | */ 53 | User findByName(String name); 54 | 55 | /** 56 | * Checks if user with such name and password is in the system 57 | * 58 | * @param user 59 | * user to check if he can login 60 | * @return true if user can login, false otherwise 61 | */ 62 | boolean canLogin(User user); 63 | } 64 | -------------------------------------------------------------------------------- /arquillian-persistence-tutorial/src/main/java/org/arquillian/example/Game.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import java.io.Serializable; 21 | 22 | import javax.persistence.Entity; 23 | import javax.persistence.GeneratedValue; 24 | import javax.persistence.Id; 25 | import javax.validation.constraints.NotNull; 26 | import javax.validation.constraints.Size; 27 | 28 | /** 29 | * @author Dan Allen 30 | */ 31 | @Entity 32 | public class Game implements Serializable { 33 | private Long id; 34 | private String title; 35 | 36 | public Game() {} 37 | 38 | public Game(String title) { 39 | this.title = title; 40 | } 41 | 42 | @Id @GeneratedValue 43 | public Long getId() { 44 | return id; 45 | } 46 | 47 | public void setId(Long id) { 48 | this.id = id; 49 | } 50 | 51 | @NotNull 52 | @Size(min = 3, max = 50) 53 | public String getTitle() { 54 | return title; 55 | } 56 | 57 | public void setTitle(String title) { 58 | this.title = title; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "Game@" + hashCode() + 64 | "[id = " + id + "; title = " + title + "]"; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/test/java/org/arquillian/example/GreeterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import javax.inject.Inject; 21 | 22 | import org.jboss.arquillian.container.test.api.Deployment; 23 | import org.jboss.arquillian.junit.Arquillian; 24 | import org.jboss.shrinkwrap.api.ShrinkWrap; 25 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 26 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 27 | import org.junit.Assert; 28 | import org.junit.Test; 29 | import org.junit.runner.RunWith; 30 | 31 | /** 32 | * @author Dan Allen 33 | */ 34 | @RunWith(Arquillian.class) 35 | public class GreeterTest { 36 | 37 | @Deployment 38 | public static JavaArchive createDeployment() { 39 | JavaArchive jar = ShrinkWrap.create(JavaArchive.class) 40 | .addClasses(Greeter.class, PhraseBuilder.class) 41 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 42 | // System.out.println(jar); 43 | return jar; 44 | } 45 | 46 | @Inject 47 | Greeter greeter; 48 | 49 | @Test 50 | public void should_create_greeting() { 51 | Assert.assertEquals("Hello, Earthling!", 52 | greeter.createGreeting("Earthling")); 53 | greeter.greet(System.out, "Earthling"); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /arquillian-tutorial/src/test/java/org/arquillian/example/GreeterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import jakarta.inject.Inject; 21 | import org.jboss.arquillian.container.test.api.Deployment; 22 | import org.jboss.arquillian.junit.Arquillian; 23 | import org.jboss.shrinkwrap.api.ShrinkWrap; 24 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 25 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 26 | import org.junit.Test; 27 | import org.junit.Assert; 28 | import org.junit.runner.RunWith; 29 | 30 | /** 31 | * @author Dan Allen 32 | */ 33 | @RunWith(Arquillian.class) 34 | public class GreeterTest { 35 | 36 | @Deployment 37 | public static JavaArchive createDeployment() { 38 | JavaArchive jar = ShrinkWrap.create(JavaArchive.class) 39 | .addClasses(Greeter.class, PhraseBuilder.class) 40 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 41 | // System.out.println(jar.toString(true)); 42 | return jar; 43 | } 44 | 45 | @Inject 46 | Greeter greeter; 47 | 48 | @Test 49 | public void should_create_greeting() { 50 | Assert.assertEquals("Hello, Earthling!", 51 | greeter.createGreeting("Earthling")); 52 | greeter.greet(System.out, "Earthling"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/test/java/org/arquillian/example/GreeterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import javax.inject.Inject; 21 | import org.jboss.arquillian.container.test.api.Deployment; 22 | import org.jboss.arquillian.junit.Arquillian; 23 | import org.jboss.shrinkwrap.api.ShrinkWrap; 24 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 25 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 26 | import org.junit.Test; 27 | import org.junit.Assert; 28 | import org.junit.runner.RunWith; 29 | 30 | /** 31 | * @author Dan Allen 32 | */ 33 | @RunWith(Arquillian.class) 34 | public class GreeterTest { 35 | 36 | @Deployment 37 | public static JavaArchive createDeployment() { 38 | JavaArchive jar = ShrinkWrap.create(JavaArchive.class) 39 | .addClasses(Greeter.class, PhraseBuilder.class) 40 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 41 | // System.out.println(jar.toString(true)); 42 | return jar; 43 | } 44 | 45 | @Inject 46 | Greeter greeter; 47 | 48 | @Test 49 | public void should_create_greeting() { 50 | Assert.assertEquals("Hello, Earthling!", 51 | greeter.createGreeting("Earthling")); 52 | greeter.greet(System.out, "Earthling"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/model/LineItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.model; 18 | 19 | import java.io.Serializable; 20 | import java.math.BigDecimal; 21 | 22 | import javax.persistence.Entity; 23 | import javax.persistence.GeneratedValue; 24 | import javax.persistence.Id; 25 | import javax.persistence.ManyToOne; 26 | import javax.persistence.Table; 27 | 28 | @Entity 29 | @Table(name = "LINE_ITEM") 30 | public class LineItem implements Serializable 31 | { 32 | private Long id; 33 | private BigDecimal amount; 34 | private Record record; 35 | 36 | public LineItem() 37 | { 38 | } 39 | 40 | public LineItem(BigDecimal amount) 41 | { 42 | super(); 43 | this.amount = amount; 44 | } 45 | 46 | @Id 47 | @GeneratedValue 48 | public Long getId() 49 | { 50 | return id; 51 | } 52 | 53 | public void setId(Long id) 54 | { 55 | this.id = id; 56 | } 57 | 58 | public BigDecimal getAmount() 59 | { 60 | return amount; 61 | } 62 | 63 | public void setAmount(BigDecimal amount) 64 | { 65 | this.amount = amount; 66 | } 67 | 68 | @ManyToOne 69 | public Record getRecord() 70 | { 71 | return record; 72 | } 73 | 74 | public void setRecord(Record record) 75 | { 76 | this.record = record; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/main/java/com/acme/jsf/confcal/Conference.java: -------------------------------------------------------------------------------- 1 | package com.acme.jsf.confcal; 2 | 3 | import java.util.Date; 4 | 5 | public class Conference implements Comparable 6 | { 7 | private String title; 8 | private Date startDate; 9 | private Date endDate; 10 | private String location; 11 | private String topic; 12 | 13 | public Conference() {} 14 | 15 | public Conference(String title, Date startDate, Date endDate, String location, String topic) 16 | { 17 | this.title = title; 18 | this.startDate = startDate; 19 | this.endDate = endDate; 20 | this.location = location; 21 | this.topic = topic; 22 | } 23 | 24 | public Conference(Conference source) 25 | { 26 | this.title = source.getTitle(); 27 | this.startDate = source.getStartDate(); 28 | this.endDate = source.getEndDate(); 29 | this.location = source.getLocation(); 30 | this.topic = source.getTopic(); 31 | } 32 | 33 | public String getTitle() 34 | { 35 | return title; 36 | } 37 | 38 | public void setTitle(String title) 39 | { 40 | this.title = title; 41 | } 42 | 43 | public Date getStartDate() 44 | { 45 | return startDate; 46 | } 47 | 48 | public void setStartDate(Date startDate) 49 | { 50 | this.startDate = startDate; 51 | } 52 | 53 | public Date getEndDate() 54 | { 55 | return endDate; 56 | } 57 | 58 | public void setEndDate(Date endDate) 59 | { 60 | this.endDate = endDate; 61 | } 62 | 63 | public String getLocation() 64 | { 65 | return location; 66 | } 67 | 68 | public void setLocation(String location) 69 | { 70 | this.location = location; 71 | } 72 | 73 | public String getTopic() 74 | { 75 | return topic; 76 | } 77 | 78 | public void setTopic(String topic) 79 | { 80 | this.topic = topic; 81 | } 82 | 83 | 84 | @Override 85 | public int compareTo(Conference o) 86 | { 87 | int r = getStartDate().compareTo(o.getStartDate()); 88 | if (r == 0) 89 | { 90 | r = getTitle().compareTo(o.getTitle()); 91 | } 92 | return r; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/main/java/com/acme/jsf/basic/HitchhikersGuide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2009, Red Hat Middleware LLC, and individual contributors 4 | * as indicated by the @author tags. See the copyright.txt file in the 5 | * distribution for a full listing of individual contributors. 6 | * 7 | * This is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation; either version 2.1 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This software is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this software; if not, write to the Free 19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 | */ 22 | 23 | package com.acme.jsf.basic; 24 | 25 | import javax.annotation.PostConstruct; 26 | import javax.enterprise.context.RequestScoped; 27 | import javax.faces.application.ProjectStage; 28 | import javax.faces.bean.ManagedBean; 29 | import javax.faces.bean.ManagedProperty; 30 | 31 | @RequestScoped 32 | @ManagedBean(name = "hitchhikersGuide") 33 | public class HitchhikersGuide 34 | { 35 | private String ultimateAnswer; 36 | 37 | @ManagedProperty(value = "#{facesContext.application.projectStage}") 38 | private ProjectStage journeyStage; 39 | 40 | public String getUltimateAnswer() 41 | { 42 | return ultimateAnswer; 43 | } 44 | 45 | public void setUltimateAnswer(String ultimateAnswer) 46 | { 47 | this.ultimateAnswer = ultimateAnswer; 48 | } 49 | 50 | public ProjectStage getJourneyStage() 51 | { 52 | return journeyStage; 53 | } 54 | 55 | public void setJourneyStage(ProjectStage journeyStage) 56 | { 57 | this.journeyStage = journeyStage; 58 | } 59 | 60 | @PostConstruct 61 | public void findUltimateAnswerToUltimateQuestion() 62 | { 63 | ultimateAnswer = "42"; 64 | } 65 | } -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/security/Authenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.security; 18 | 19 | import java.util.logging.Level; 20 | import java.util.logging.Logger; 21 | 22 | import javax.ejb.Lock; 23 | import javax.ejb.LockType; 24 | import javax.ejb.Singleton; 25 | import javax.ejb.Startup; 26 | import javax.inject.Inject; 27 | 28 | import org.arquillian.example.dao.UserDAO; 29 | import org.arquillian.example.dao.UserDAOException; 30 | import org.arquillian.example.model.User; 31 | 32 | /** 33 | * @author Stefan Miklosovic 34 | */ 35 | @Startup 36 | @Singleton 37 | public class Authenticator { 38 | 39 | private static final Logger logger = 40 | Logger.getLogger(Authenticator.class.getName()); 41 | 42 | User user; 43 | 44 | @Inject 45 | UserDAO userDAO; 46 | 47 | @Lock(LockType.READ) 48 | public boolean login(User user) { 49 | try { 50 | return userDAO.canLogin(user); 51 | } catch (UserDAOException ex) { 52 | logger.log(Level.INFO, "Unable to login a user{0}", user); 53 | return false; 54 | } 55 | } 56 | 57 | @Lock(LockType.WRITE) 58 | public boolean register(User user) { 59 | try { 60 | if (userDAO.findByName(user.getUsername()) == null) { 61 | userDAO.createUser(user); 62 | return true; 63 | } 64 | return false; 65 | } catch (UserDAOException ex) { 66 | logger.log(Level.INFO, "Unable to register a user{0}", user); 67 | return false; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.model; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.persistence.Entity; 22 | import javax.persistence.GeneratedValue; 23 | import javax.persistence.Id; 24 | import javax.validation.constraints.NotNull; 25 | import javax.validation.constraints.Size; 26 | 27 | /** 28 | * @author Stefan Miklosovic 29 | */ 30 | @Entity 31 | public class User implements Serializable { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Id 36 | @GeneratedValue 37 | private Long id; 38 | 39 | @NotNull 40 | @Size(min = 3, max = 15) 41 | private String username; 42 | 43 | @NotNull 44 | @Size(min = 5, max = 20) 45 | private String password; 46 | 47 | public User() { 48 | } 49 | 50 | public User(String username) { 51 | this.username = username; 52 | } 53 | 54 | public Long getId() { 55 | return id; 56 | } 57 | 58 | public void setId(Long id) { 59 | this.id = id; 60 | } 61 | 62 | public String getUsername() { 63 | return username; 64 | } 65 | 66 | public void setUsername(String username) { 67 | this.username = username; 68 | } 69 | 70 | public String getPassword() { 71 | return password; 72 | } 73 | 74 | public void setPassword(String password) { 75 | this.password = password; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "User [id=" + id + ", username=" + username + "]"; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /quickstart/src/test/java/org/jboss/arquillian/examples/quickstart/HelloEJBContainerTest.java: -------------------------------------------------------------------------------- 1 | package org.jboss.arquillian.examples.quickstart; 2 | 3 | import javax.ejb.EJB; 4 | 5 | import junit.framework.Assert; 6 | 7 | import org.jboss.arquillian.api.Deployment; 8 | import org.jboss.arquillian.examples.quickstart.HelloEJB; 9 | import org.jboss.arquillian.examples.quickstart.HelloEJBBean; 10 | import org.jboss.arquillian.junit.Arquillian; 11 | import org.jboss.shrinkwrap.api.ShrinkWrap; 12 | import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; 13 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 14 | import org.jboss.shrinkwrap.api.spec.WebArchive; 15 | import org.junit.Test; 16 | import org.junit.runner.RunWith; 17 | 18 | /** 19 | * @author Michael Schuetz 20 | */ 21 | @RunWith(Arquillian.class) 22 | public class HelloEJBContainerTest { 23 | private static ByteArrayAsset EMPTY_BEANS_XML = new ByteArrayAsset( 24 | "".getBytes()); 25 | 26 | /** 27 | * TODO Works for Glassfish at the moment, JBoss settings see comments. 28 | */ 29 | //@Inject works as well --> CDI injection 30 | @EJB 31 | private HelloEJB helloEJB; 32 | 33 | @Deployment 34 | public static WebArchive createTestArchive() { 35 | 36 | JavaArchive arch = ShrinkWrap.create(JavaArchive.class, "helloEJB.jar") 37 | .addClasses(HelloEJB.class, HelloEJBBean.class) 38 | .addManifestResource(EMPTY_BEANS_XML, "beans.xml"); 39 | 40 | WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war") 41 | .setWebXML("glassfish-remote-3/test-web.xml").addLibrary(arch); 42 | 43 | return webArchive; 44 | } 45 | 46 | /** 47 | * JBossAS6 config 48 | */ 49 | // @Inject currently not working due to bug in JBoss6M3. 50 | // @EJB 51 | // private HelloEJB helloEJB; 52 | // 53 | // @Deployment 54 | // public static JavaArchive createTestArchive() { 55 | // JavaArchive arch = ShrinkWrap.create(JavaArchive.class, "helloEJB.jar") 56 | // .addClasses(HelloEJB.class, HelloEJBBean.class) 57 | // .addManifestResource(EMPTY_BEANS_XML, "beans.xml"); 58 | // 59 | // System.out.println("### building " + arch.getName()); 60 | // 61 | // return arch; 62 | // } 63 | 64 | @Test 65 | public void testHelloEJB() { 66 | System.out.println("### testSayHelloEJB"); 67 | String result = helloEJB.sayHelloEJB("Simon"); 68 | Assert.assertEquals("Hello Simon", result); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/test/java/org/arquillian/tutorial/extension/deployment/LoginScreenUiTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import java.net.URL; 21 | 22 | import org.arquillian.tutorial.extension.deployment.api.DeployProjectArtifact; 23 | import org.jboss.arquillian.drone.api.annotation.Drone; 24 | import org.jboss.arquillian.junit.Arquillian; 25 | import org.jboss.arquillian.test.api.ArquillianResource; 26 | import org.junit.Assert; 27 | import org.junit.Test; 28 | import org.junit.runner.RunWith; 29 | import org.openqa.selenium.By; 30 | import org.openqa.selenium.WebDriver; 31 | 32 | /** 33 | * @author Dan Allen 34 | * @author Karel Piwko 35 | */ 36 | @RunWith(Arquillian.class) 37 | @DeployProjectArtifact 38 | public class LoginScreenUiTest { 39 | 40 | @Drone 41 | WebDriver browser; 42 | 43 | @ArquillianResource 44 | URL deploymentUrl; 45 | 46 | @Test 47 | public void should_login_with_valid_credentials() throws Exception { 48 | browser.navigate().to(new URL(deploymentUrl, "login.jsf")); 49 | 50 | browser.findElement(By.id("loginForm:username")).sendKeys("user1"); 51 | browser.findElement(By.id("loginForm:password")).sendKeys("demo"); 52 | browser.findElement(By.id("loginForm:login")).click(); 53 | 54 | Assert.assertTrue("User should be logged in!", 55 | browser.findElement(By.xpath("//li[contains(text(),'Welcome')]")).isDisplayed()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/main/java/org/arquillian/example/ui/LoginController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example.ui; 19 | 20 | import java.io.Serializable; 21 | 22 | import javax.enterprise.context.SessionScoped; 23 | import javax.enterprise.inject.Produces; 24 | import javax.faces.application.FacesMessage; 25 | import javax.faces.context.FacesContext; 26 | import javax.inject.Inject; 27 | import javax.inject.Named; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @Named 33 | @SessionScoped 34 | public class LoginController implements Serializable { 35 | private static final long serialVersionUID = 1L; 36 | 37 | private static final String SUCCESS_MESSAGE = "Welcome!"; 38 | private static final String FAILURE_MESSAGE = "Incorrect username and password combination."; 39 | 40 | private User currentUser; 41 | 42 | @Inject 43 | private Credentials credentials; 44 | 45 | public String login() { 46 | if ("user1".equals(credentials.getUsername()) && 47 | "demo".equals(credentials.getPassword())) { 48 | currentUser = new User("demo"); 49 | FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(SUCCESS_MESSAGE)); 50 | return "home.xhtml"; 51 | } 52 | FacesContext.getCurrentInstance().addMessage(null, 53 | new FacesMessage(FacesMessage.SEVERITY_WARN, FAILURE_MESSAGE, FAILURE_MESSAGE)); 54 | return null; 55 | } 56 | 57 | public boolean isLoggedIn() { 58 | return currentUser != null; 59 | } 60 | 61 | @Produces 62 | public User getCurrentUser() { 63 | return currentUser; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/controller/RegisterController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.controller; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.enterprise.context.SessionScoped; 22 | import javax.faces.application.FacesMessage; 23 | import javax.faces.context.FacesContext; 24 | import javax.inject.Inject; 25 | import javax.inject.Named; 26 | 27 | import org.arquillian.example.model.Credentials; 28 | import org.arquillian.example.model.User; 29 | import org.arquillian.example.security.Authenticator; 30 | 31 | /** 32 | * @author Stefan Miklosovic 33 | */ 34 | @Named 35 | @SessionScoped 36 | public class RegisterController implements Serializable { 37 | 38 | private static final long serialVersionUID = 1L; 39 | 40 | private static final String FAILURE_MESSAGE = 41 | "Both username and password have to be provided"; 42 | 43 | @Inject 44 | private Credentials credentials; 45 | 46 | @Inject 47 | Authenticator authentizator; 48 | 49 | public String register() { 50 | String username = credentials.getUsername(); 51 | String password = credentials.getPassword(); 52 | 53 | User user; 54 | 55 | if (username != null && password != null) { 56 | user = new User(); 57 | user.setUsername(username); 58 | user.setPassword(password); 59 | if (authentizator.register(user)) { 60 | return "login.xhtml"; 61 | } else { 62 | return "register.xhtml"; 63 | } 64 | } else { 65 | FacesContext.getCurrentInstance().addMessage( 66 | null, 67 | new FacesMessage(FacesMessage.SEVERITY_WARN, 68 | FAILURE_MESSAGE, FAILURE_MESSAGE)); 69 | return "register.xhtml"; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /arquillian-tutorial/pom-no-container-profiles.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 4.0.0 8 | 9 | org.arquillian.example 10 | arquillian-tutorial 11 | 1.0-SNAPSHOT 12 | jar 13 | 14 | arquillian-tutorial 15 | http://arquillian.org/guides/getting_started/ 16 | 17 | 18 | UTF-8 19 | 20 | 21 | 22 | 23 | 24 | maven-compiler-plugin 25 | 2.3.2 26 | 27 | 1.6 28 | 1.6 29 | 30 | 31 | 32 | maven-surefire-plugin 33 | 2.12 34 | 35 | 36 | 37 | 38 | 39 | 40 | org.jboss.arquillian 41 | arquillian-bom 42 | 1.0.0.Final 43 | import 44 | pom 45 | 46 | 47 | 48 | 49 | 50 | org.jboss.spec 51 | jboss-javaee-7.0 52 | 1.0.3.Final 53 | pom 54 | provided 55 | 56 | 57 | junit 58 | junit 59 | 4.8.1 60 | test 61 | 62 | 63 | org.jboss.arquillian.junit 64 | arquillian-junit-container 65 | test 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/functional-tests/src/main/java/org/arquillian/tutorial/extension/deployment/LoginController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.tutorial.extension.deployment; 19 | 20 | import java.io.Serializable; 21 | 22 | import javax.enterprise.context.SessionScoped; 23 | import javax.enterprise.inject.Produces; 24 | import javax.faces.application.FacesMessage; 25 | import javax.faces.context.FacesContext; 26 | import javax.inject.Inject; 27 | import javax.inject.Named; 28 | 29 | /** 30 | * @author Dan Allen 31 | */ 32 | @Named 33 | @SessionScoped 34 | public class LoginController implements Serializable { 35 | private static final long serialVersionUID = 1L; 36 | 37 | private static final String SUCCESS_MESSAGE = "Welcome!"; 38 | private static final String FAILURE_MESSAGE = "Incorrect username and password combination."; 39 | 40 | private User currentUser; 41 | 42 | @Inject 43 | private Credentials credentials; 44 | 45 | public String login() { 46 | if ("user1".equals(credentials.getUsername()) && 47 | "demo".equals(credentials.getPassword())) { 48 | currentUser = new User("demo"); 49 | FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(SUCCESS_MESSAGE)); 50 | return "home.xhtml"; 51 | } 52 | FacesContext.getCurrentInstance().addMessage(null, 53 | new FacesMessage(FacesMessage.SEVERITY_WARN, FAILURE_MESSAGE, FAILURE_MESSAGE)); 54 | return null; 55 | } 56 | 57 | public boolean isLoggedIn() { 58 | return currentUser != null; 59 | } 60 | 61 | @Produces 62 | public User getCurrentUser() { 63 | return currentUser; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /jpalab/src/main/java/com/acme/jpa/model/Record.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.model; 18 | 19 | import java.io.Serializable; 20 | import java.util.HashSet; 21 | import java.util.Set; 22 | 23 | import javax.persistence.CascadeType; 24 | import javax.persistence.Entity; 25 | import javax.persistence.GeneratedValue; 26 | import javax.persistence.Id; 27 | import javax.persistence.OneToMany; 28 | import javax.persistence.Table; 29 | 30 | @Entity 31 | @Table(name = "RECORD") 32 | public class Record implements Serializable 33 | { 34 | private Long id; 35 | private String name; 36 | private Set lineItems; 37 | 38 | public Record() 39 | { 40 | } 41 | 42 | public Record(String name) 43 | { 44 | this.name = name; 45 | } 46 | 47 | @Id 48 | @GeneratedValue 49 | public Long getId() 50 | { 51 | return id; 52 | } 53 | 54 | public void setId(Long id) 55 | { 56 | this.id = id; 57 | } 58 | 59 | public String getName() 60 | { 61 | return name; 62 | } 63 | 64 | public void setName(String name) 65 | { 66 | this.name = name; 67 | } 68 | 69 | @OneToMany(mappedBy = "record", cascade = CascadeType.ALL) 70 | public Set getLineItems() 71 | { 72 | return lineItems; 73 | } 74 | 75 | public void setLineItems(Set lineItems) 76 | { 77 | this.lineItems = lineItems; 78 | } 79 | 80 | public void addLineItem(LineItem e) 81 | { 82 | if (lineItems == null) 83 | { 84 | lineItems = new HashSet(); 85 | } 86 | lineItems.add(e); 87 | e.setRecord(this); 88 | } 89 | 90 | @Override 91 | public String toString() 92 | { 93 | return "Record@" + hashCode() + "[id = " + id + "; name = " + name + "]"; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ejb31-gfembedded/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | org.jboss.arquillian.examples 8 | parent 9 | 1.0.0-SNAPSHOT 10 | 11 | 12 | 13 | 4.0.0 14 | 15 | 16 | org.jboss.arquillian.examples 17 | ejb31-gfembedded 18 | Arquillian Examples EJB3.1 Glassfish Embedded 3 19 | Simple Arquillian EJB3.1 Glassfish Embedded 3 Project 20 | 21 | 22 | 23 | 4.13.1 24 | 1.0.0.Alpha5 25 | 3.1-b41 26 | 27 | 28 | 29 | 30 | 31 | org.jboss.arquillian 32 | arquillian-junit 33 | ${version.org.jboss.arquillian} 34 | test 35 | 36 | 37 | 38 | junit 39 | junit 40 | ${version.junit} 41 | test 42 | 43 | 44 | 45 | 46 | 47 | 48 | glassfish-embedded-3 49 | 50 | 51 | true 52 | 53 | 54 | 55 | 56 | org.jboss.arquillian.container 57 | arquillian-glassfish-embedded-3 58 | ${version.org.jboss.arquillian} 59 | 60 | 61 | org.glassfish.extras 62 | glassfish-embedded-all 63 | ${version.org.glassfish.embedded} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/WEB-INF/templates/default.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | Java EE 6 Starter Application 8 | 9 | 10 | 11 | 12 |
13 |
14 | 39 | 40 | [Template content will be inserted here] 41 | 42 |
43 | 50 |
51 |
52 | 53 | -------------------------------------------------------------------------------- /arquillian-drone-tutorial/src/test/java/org/arquillian/example/BasketTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import javax.ejb.EJB; 21 | import javax.inject.Inject; 22 | 23 | import org.jboss.arquillian.container.test.api.Deployment; 24 | import org.jboss.arquillian.junit.Arquillian; 25 | import org.jboss.arquillian.junit.InSequence; 26 | import org.jboss.shrinkwrap.api.ShrinkWrap; 27 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 28 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 29 | import org.junit.Assert; 30 | import org.junit.Test; 31 | import org.junit.runner.RunWith; 32 | 33 | /** 34 | * @author Dan Allen 35 | */ 36 | @RunWith(Arquillian.class) 37 | public class BasketTest { 38 | @Deployment 39 | public static JavaArchive createDeployment() { 40 | return ShrinkWrap.create(JavaArchive.class, "test.jar") 41 | .addClasses(Basket.class, OrderRepository.class, SingletonOrderRepository.class) 42 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 43 | } 44 | 45 | @Inject 46 | Basket basket; 47 | 48 | @EJB 49 | OrderRepository repo; 50 | 51 | @Test 52 | @InSequence(1) 53 | public void place_order_should_add_order() { 54 | basket.addItem("sunglasses"); 55 | basket.addItem("suit"); 56 | basket.placeOrder(); 57 | Assert.assertEquals(1, repo.getOrderCount()); 58 | Assert.assertEquals(0, basket.getItemCount()); 59 | 60 | basket.addItem("raygun"); 61 | basket.addItem("spaceship"); 62 | basket.placeOrder(); 63 | Assert.assertEquals(2, repo.getOrderCount()); 64 | Assert.assertEquals(0, basket.getItemCount()); 65 | } 66 | 67 | @Test 68 | @InSequence(2) 69 | public void order_should_be_persistent() { 70 | Assert.assertEquals(2, repo.getOrderCount()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /arquillian-tutorial-rinse-repeat/src/test/java/org/arquillian/example/BasketTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 3 | * by the @authors tag. See the copyright.txt in the distribution for a 4 | * full listing of individual contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.arquillian.example; 19 | 20 | import javax.ejb.EJB; 21 | import javax.inject.Inject; 22 | 23 | import org.jboss.arquillian.container.test.api.Deployment; 24 | import org.jboss.arquillian.junit.Arquillian; 25 | import org.jboss.arquillian.junit.InSequence; 26 | import org.jboss.shrinkwrap.api.ShrinkWrap; 27 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; 28 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 29 | import org.junit.Assert; 30 | import org.junit.Test; 31 | import org.junit.runner.RunWith; 32 | 33 | /** 34 | * @author Dan Allen 35 | */ 36 | @RunWith(Arquillian.class) 37 | public class BasketTest { 38 | @Deployment 39 | public static JavaArchive createDeployment() { 40 | return ShrinkWrap.create(JavaArchive.class, "test.jar") 41 | .addClasses(Basket.class, OrderRepository.class, SingletonOrderRepository.class) 42 | .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 43 | } 44 | 45 | @Inject 46 | Basket basket; 47 | 48 | @EJB 49 | OrderRepository repo; 50 | 51 | @Test 52 | @InSequence(1) 53 | public void place_order_should_add_order() { 54 | basket.addItem("sunglasses"); 55 | basket.addItem("suit"); 56 | basket.placeOrder(); 57 | Assert.assertEquals(1, repo.getOrderCount()); 58 | Assert.assertEquals(0, basket.getItemCount()); 59 | 60 | basket.addItem("raygun"); 61 | basket.addItem("spaceship"); 62 | basket.placeOrder(); 63 | Assert.assertEquals(2, repo.getOrderCount()); 64 | Assert.assertEquals(0, basket.getItemCount()); 65 | } 66 | 67 | @Test 68 | @InSequence(2) 69 | public void order_should_be_persistent() { 70 | Assert.assertEquals(2, repo.getOrderCount()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /arquillian-lifecycle-extension-tutorial/src/test/java/org/arquillian/tutorial/extension/lifecycle/LifecycleTestCase.java: -------------------------------------------------------------------------------- 1 | package org.arquillian.tutorial.extension.lifecycle; 2 | /* 3 | * JBoss, Home of Professional Open Source 4 | * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors 5 | * as indicated by the @authors tag. All rights reserved. 6 | * See the copyright.txt in the distribution for a 7 | * full listing of individual contributors. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | import org.arquillian.tutorial.extension.lifecycle.api.AfterDeploy; 21 | import org.arquillian.tutorial.extension.lifecycle.api.AfterUnDeploy; 22 | import org.arquillian.tutorial.extension.lifecycle.api.BeforeDeploy; 23 | import org.arquillian.tutorial.extension.lifecycle.api.BeforeUnDeploy; 24 | import org.jboss.arquillian.container.test.api.Deployment; 25 | import org.jboss.arquillian.junit.Arquillian; 26 | import org.jboss.shrinkwrap.api.ShrinkWrap; 27 | import org.jboss.shrinkwrap.api.spec.WebArchive; 28 | import org.junit.Test; 29 | import org.junit.runner.RunWith; 30 | 31 | /** 32 | * DeclarativeTestCase 33 | * 34 | * @author Aslak Knutsen 35 | * @version $Revision: $ 36 | */ 37 | @RunWith(Arquillian.class) 38 | public class LifecycleTestCase 39 | { 40 | @Deployment 41 | public static WebArchive deploy() { 42 | return ShrinkWrap.create(WebArchive.class); 43 | } 44 | 45 | @BeforeDeploy 46 | public static void doBeforeDeploy() { 47 | System.out.println("@BeforeDeploy"); 48 | } 49 | 50 | @AfterDeploy 51 | public static void doAfterDeploy() { 52 | System.out.println("@AfterDeploy"); 53 | } 54 | 55 | @BeforeUnDeploy 56 | public static void doBeforeUnDeploy() { 57 | System.out.println("@BeforeUnDeploy"); 58 | } 59 | 60 | @AfterUnDeploy 61 | public static void doAfterUnDeploy() { 62 | System.out.println("@AfterUnDeploy"); 63 | } 64 | 65 | @Test 66 | public void shouldBeAbleToOne() throws Exception { 67 | System.out.println("@Test - 1"); 68 | } 69 | 70 | @Test 71 | public void shouldBeAbleToTwo() throws Exception { 72 | System.out.println("@Test - 2"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /arquillian-deployment-extension-tutorial/impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.arquillian.tutorial 6 | arquillian-deployment-extension-tutorial 7 | 1.0.0-SNAPSHOT 8 | 9 | 10 | 11 | org.jboss.arquillian 12 | arquillian-bom 13 | 1.0.3.Final 14 | pom 15 | import 16 | 17 | 18 | 19 | 20 | 21 | org.jboss.arquillian.core 22 | arquillian-core-spi 23 | 24 | 25 | org.jboss.arquillian.test 26 | arquillian-test-spi 27 | 28 | 29 | org.jboss.arquillian.container 30 | arquillian-container-spi 31 | 32 | 33 | org.jboss.arquillian.container 34 | arquillian-container-test-spi 35 | 36 | 37 | org.jboss.shrinkwrap.resolver 38 | shrinkwrap-resolver-api-maven 39 | 40 | 41 | org.jboss.shrinkwrap.resolver 42 | shrinkwrap-resolver-impl-maven 43 | 44 | 45 | 46 | install 47 | project-artifact-deployment-generator 48 | 49 | 50 | maven-compiler-plugin 51 | 2.3.2 52 | 53 | 1.6 54 | 1.6 55 | 56 | 57 | 58 | maven-surefire-plugin 59 | 2.12 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /jsfunit-servlet/src/test/resources-tomcat/jsf-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | com.sun.faces.config.ConfigureListener 12 | 13 | 14 | 15 | org.jboss.weld.environment.servlet.Listener 16 | 17 | 18 | 19 | com.sun.faces.expressionFactory 20 | com.sun.el.ExpressionFactoryImpl 21 | 22 | 23 | 24 | javax.faces.PROJECT_STAGE 25 | Development 26 | 27 | 28 | 29 | Faces Servlet 30 | javax.faces.webapp.FacesServlet 31 | 1 32 | 33 | 34 | 35 | Faces Servlet 36 | *.jsf 37 | 38 | 39 | 40 | 41 | JSFUnitCleanupTestTreadFilter 42 | org.jboss.arquillian.framework.jsfunit.JSFUnitCleanupTestTreadFilter 43 | 44 | 45 | 46 | JSFUnitFilter 47 | org.jboss.jsfunit.framework.JSFUnitFilter 48 | 49 | 50 | 51 | JSFUnitCleanupTestTreadFilter 52 | /ArquillianServletRunner 53 | 54 | 55 | 56 | JSFUnitFilter 57 | /ArquillianServletRunner 58 | 59 | 60 | 61 | ServletTestRunner 62 | org.jboss.arquillian.protocol.servlet_3.ServletTestRunner 63 | 64 | 65 | 66 | ServletTestRunner 67 | /ArquillianServletRunner 68 | 69 | 70 | 71 | index.xhtml 72 | 73 | 74 | -------------------------------------------------------------------------------- /quickstart/src/main/webapp/home.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |

Hello World!

9 |

Your CDI bean HelloWorld says #{helloWorld.text} using the Unified EL.

10 | 11 | 12 |

Bean Validation examples

13 |

Enforces annotation-based constraints defined on the model class.

14 | 15 | 16 | 19 | 23 | 24 | 25 | 28 | 32 | 33 | 34 | 37 | 41 | 42 |
17 | 18 | 20 | 21 | 22 |
26 | 27 | 29 | 30 | 31 |
35 | 36 | 38 | 39 | 40 |
43 |

44 | 45 | 46 |

47 |
48 |

Widgets

49 | 50 | 51 | Id 52 | #{_widget.id} 53 | 54 | 55 | Part Number 56 | #{_widget.partNumber} 57 | 58 | 59 | Name 60 | #{_widget.name} 61 | 62 | 63 | Description 64 | #{_widget.description} 65 | 66 | 67 |
68 |
69 | -------------------------------------------------------------------------------- /jpalab/src/test/java/com/acme/jpa/business/GamePersistenceTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa.business; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | 21 | import java.util.List; 22 | 23 | import javax.ejb.EJB; 24 | 25 | import org.jboss.arquillian.container.test.api.Deployment; 26 | import org.jboss.arquillian.junit.Arquillian; 27 | import org.jboss.shrinkwrap.api.Archive; 28 | import org.jboss.shrinkwrap.api.ShrinkWrap; 29 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 30 | import org.junit.Test; 31 | import org.junit.runner.RunWith; 32 | 33 | import com.acme.jpa.model.Game; 34 | 35 | @RunWith(Arquillian.class) 36 | public class GamePersistenceTestCase 37 | { 38 | private static final String[] GAME_TITLES = 39 | { 40 | "Super Mario Brothers", 41 | "Mario Kart", 42 | "F-Zero" 43 | }; 44 | 45 | @Deployment 46 | public static Archive createDeployment() 47 | { 48 | return ShrinkWrap.create(JavaArchive.class) 49 | .addClasses(Game.class, Games.class, GamesBean.class) 50 | .addAsManifestResource("test-persistence.xml", "persistence.xml"); 51 | } 52 | 53 | @EJB 54 | Games games; 55 | 56 | @Test 57 | public void testInsert() throws Exception 58 | { 59 | // flushing database 60 | System.out.println("Clearing records..."); 61 | games.clear(); 62 | 63 | // insert records 64 | System.out.println("Inserting records..."); 65 | for (String title : GAME_TITLES) 66 | { 67 | Game game = new Game(title); 68 | games.add(game); 69 | } 70 | 71 | List results; 72 | 73 | // query with JPQL 74 | System.out.println("Selecting (using JPQL)..."); 75 | results = games.selectAllUsingJpql(); 76 | System.out.println("Found " + results.size() + " games (using JPQL)"); 77 | assertEquals(GAME_TITLES.length, results.size()); 78 | for (int i = 0; i < GAME_TITLES.length; i++) { 79 | assertEquals(GAME_TITLES[i], results.get(i).getTitle()); 80 | System.out.println(results.get(i)); 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /xa/src/test/java/com/acme/jpa/TwoPhaseCommitTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2010, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.acme.jpa; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | 21 | import javax.ejb.EJB; 22 | 23 | import org.jboss.arquillian.api.Deployment; 24 | import org.jboss.arquillian.junit.Arquillian; 25 | import org.jboss.shrinkwrap.api.Archive; 26 | import org.jboss.shrinkwrap.api.ShrinkWrap; 27 | import org.jboss.shrinkwrap.api.spec.WebArchive; 28 | import org.junit.Test; 29 | import org.junit.runner.RunWith; 30 | 31 | @RunWith(Arquillian.class) 32 | public class TwoPhaseCommitTestCase 33 | { 34 | @Deployment 35 | public static Archive createDeployment() 36 | { 37 | return ShrinkWrap.create(WebArchive.class, "test.war") 38 | .addPackage(Game.class.getPackage()) 39 | .addManifestResource("test-persistence.xml", "persistence.xml"); 40 | } 41 | 42 | @EJB 43 | DualRepositoryService service; 44 | 45 | protected void purge() 46 | { 47 | service.purge(); 48 | } 49 | 50 | @Test 51 | public void should_not_modify_database_transaction_fails() 52 | { 53 | purge(); 54 | 55 | try 56 | { 57 | service.succeedFirstFailSecondInTx(); 58 | } 59 | catch (Exception e) 60 | { 61 | } 62 | 63 | assertEquals(0, service.getGameCount()); 64 | assertEquals(0, service.getInvoiceCount()); 65 | } 66 | 67 | @Test 68 | public void should_modify_database_if_no_transaction() throws Exception 69 | { 70 | purge(); 71 | 72 | try 73 | { 74 | service.succeedFirstFailSecondWithoutTx(); 75 | } 76 | catch (Exception e) 77 | { 78 | } 79 | 80 | assertEquals(1, service.getGameCount()); 81 | assertEquals(0, service.getInvoiceCount()); 82 | } 83 | 84 | @Test 85 | public void should_not_modify_database_if_rollback_transaction() throws Exception 86 | { 87 | purge(); 88 | 89 | service.insertBothThenRollbackInTx(); 90 | 91 | assertEquals(0, service.getGameCount()); 92 | assertEquals(0, service.getInvoiceCount()); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /arquillian-jpa-drone/src/main/java/org/arquillian/example/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2012, Red Hat Middleware LLC, and individual contributors 4 | * by the @authors tag. See the copyright.txt in the distribution for a 5 | * full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.arquillian.example.controller; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.enterprise.context.SessionScoped; 22 | import javax.enterprise.inject.Produces; 23 | import javax.faces.application.FacesMessage; 24 | import javax.faces.context.FacesContext; 25 | import javax.inject.Inject; 26 | import javax.inject.Named; 27 | 28 | import org.arquillian.example.model.Credentials; 29 | import org.arquillian.example.model.User; 30 | import org.arquillian.example.security.Authenticator; 31 | 32 | /** 33 | * @author Stefan Miklosovic 34 | */ 35 | @Named 36 | @SessionScoped 37 | public class LoginController implements Serializable { 38 | 39 | private static final long serialVersionUID = 1L; 40 | 41 | private static final String SUCCESS_MESSAGE = "Welcome"; 42 | private static final String FAILURE_MESSAGE = 43 | "Incorrect username and password combination"; 44 | 45 | private User currentUser; 46 | 47 | @Inject 48 | private Credentials credentials; 49 | 50 | @Inject 51 | Authenticator authentizator; 52 | 53 | public String login() { 54 | String username = credentials.getUsername(); 55 | String password = credentials.getPassword(); 56 | 57 | if (username == null || password == null) { 58 | FacesContext.getCurrentInstance().addMessage(null, 59 | new FacesMessage(FacesMessage.SEVERITY_WARN, 60 | FAILURE_MESSAGE, FAILURE_MESSAGE)); 61 | return null; 62 | } 63 | 64 | User user = new User(); 65 | user.setPassword(password); 66 | user.setUsername(username); 67 | 68 | if (authentizator.login(user)) { 69 | currentUser = new User(username); 70 | FacesContext.getCurrentInstance().addMessage(null, 71 | new FacesMessage(SUCCESS_MESSAGE)); 72 | return "home.xhtml"; 73 | } else { 74 | FacesContext.getCurrentInstance().addMessage(null, 75 | new FacesMessage(FacesMessage.SEVERITY_WARN, 76 | FAILURE_MESSAGE, FAILURE_MESSAGE)); 77 | return null; 78 | } 79 | } 80 | 81 | public boolean isLoggedIn() { 82 | return currentUser != null; 83 | } 84 | 85 | @Produces 86 | @Named 87 | public User getCurrentUser() { 88 | return currentUser; 89 | } 90 | 91 | } 92 | --------------------------------------------------------------------------------