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 |