Permalink
Browse files

Committed Jazoon 2010 Showcase + Presentation

  • Loading branch information...
1 parent 16b9ab2 commit acf15cf243bce63fbee9cadb939d0a387d7d0d69 @aslakknutsen aslakknutsen committed Jul 5, 2010
Showing with 12,336 additions and 18 deletions.
  1. +5 −0 .gitignore
  2. +102 −0 cdi/pom.xml
  3. +29 −0 cdi/src/main/java/com/acme/cdi/payment/Asynchronous.java
  4. +29 −0 cdi/src/main/java/com/acme/cdi/payment/AsynchronousPaymentProcessor.java
  5. +31 −0 cdi/src/main/java/com/acme/cdi/payment/MockPaymentProcessor.java
  6. +23 −0 cdi/src/main/java/com/acme/cdi/payment/PaymentProcessor.java
  7. +29 −0 cdi/src/main/java/com/acme/cdi/payment/Synchronous.java
  8. +29 −0 cdi/src/main/java/com/acme/cdi/payment/SynchronousPaymentProcessor.java
  9. +53 −0 cdi/src/test/java/com/acme/cdi/payment/SynchronousPaymentProcessorTestCase.java
  10. +6 −0 cdi/src/test/resources/com/acme/cdi/payment/beans.xml
  11. +3 −0 cdi/src/test/resources/jndi.properties
  12. +87 −0 ejb/pom.xml
  13. +22 −0 ejb/src/main/java/com/acme/ejb/GreetingManager.java
  14. +31 −0 ejb/src/main/java/com/acme/ejb/GreetingManagerBean.java
  15. +24 −0 ejb/src/main/java/com/acme/ejb/TemperatureConverter.java
  16. +35 −0 ejb/src/main/java/com/acme/ejb/TemperatureConverterBean.java
  17. +53 −0 ejb/src/test/java/com/acme/ejb/InjectionTestCase.java
  18. +57 −0 ejb/src/test/java/com/acme/ejb/TemperatureConverterTestCase.java
  19. +3 −0 ejb/src/test/resources/jndi.properties
  20. +9 −0 jaxrs/WORKLOG
  21. +9 −0 jaxrs/about.txt
  22. +185 −0 jaxrs/domain.xml
  23. +18 −0 jaxrs/nb-configuration.xml
  24. +13 −0 jaxrs/nbactions.xml
  25. +205 −0 jaxrs/pom.xml
  26. +18 −0 jaxrs/profiles.xml
  27. +135 −0 jaxrs/readme.txt
  28. +45 −0 jaxrs/src/main/java/org/jboss/example/sellmore/action/ContactEditor.java
  29. +38 −0 jaxrs/src/main/java/org/jboss/example/sellmore/action/CustomerEditor.java
  30. +78 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact.java
  31. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact_.java
  32. +81 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer.java
  33. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer_.java
  34. +61 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem.java
  35. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem_.java
  36. +60 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product.java
  37. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product_.java
  38. +78 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder.java
  39. +19 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder_.java
  40. +42 −0 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/DataLoader.java
  41. +19 −0 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/EntityManagerProducer.java
  42. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/ContactListProducer.java
  43. +35 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/CustomerListProducer.java
  44. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/LineItemListProducer.java
  45. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/OrderListProducer.java
  46. +10 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/Selected.java
  47. +48 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/SelectedCustomerProducer.java
  48. +47 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/SelectedOrderProducer.java
  49. +109 −0 jaxrs/src/main/java/org/jboss/example/sellmore/resource/CustomerResource.java
  50. +9 −0 jaxrs/src/main/java/org/jboss/example/sellmore/rs/JaxRsConfig.java
  51. +30 −0 jaxrs/src/main/resources/META-INF/persistence.xml
  52. +8 −0 jaxrs/src/main/resources/import.sql
  53. BIN jaxrs/src/main/resources/rest/app.gif
  54. BIN jaxrs/src/main/resources/rest/cc.gif
  55. BIN jaxrs/src/main/resources/rest/cg.gif
  56. BIN jaxrs/src/main/resources/rest/collapse.gif
  57. +5,087 −0 jaxrs/src/main/resources/rest/css_master-all.css
  58. BIN jaxrs/src/main/resources/rest/expand.gif
  59. BIN jaxrs/src/main/resources/rest/images/background_border_bottom.gif
  60. BIN jaxrs/src/main/resources/rest/images/bg_gradient.gif
  61. BIN jaxrs/src/main/resources/rest/images/level1_selected-1lvl.jpg
  62. BIN jaxrs/src/main/resources/rest/images/masthead.png
  63. BIN jaxrs/src/main/resources/rest/images/pbdis.png
  64. BIN jaxrs/src/main/resources/rest/images/pbena.png
  65. BIN jaxrs/src/main/resources/rest/images/pbmou.png
  66. BIN jaxrs/src/main/resources/rest/images/pbsel.png
  67. BIN jaxrs/src/main/resources/rest/images/pname.png
  68. BIN jaxrs/src/main/resources/rest/images/primary-enabled.gif
  69. BIN jaxrs/src/main/resources/rest/images/primary-roll.gif
  70. BIN jaxrs/src/main/resources/rest/images/secondary-enabled.gif
  71. BIN jaxrs/src/main/resources/rest/images/tbsel.png
  72. BIN jaxrs/src/main/resources/rest/images/tbuns.png
  73. BIN jaxrs/src/main/resources/rest/item.gif
  74. BIN jaxrs/src/main/resources/rest/og.gif
  75. +320 −0 jaxrs/src/main/resources/rest/test-resbeans.css
  76. +2,003 −0 jaxrs/src/main/resources/rest/test-resbeans.js
  77. +56 −0 jaxrs/src/main/resources/rest/test-services.html
  78. +5 −0 jaxrs/src/main/webapp/META-INF/context.xml
  79. +10 −0 jaxrs/src/main/webapp/WEB-INF/beans.xml
  80. +31 −0 jaxrs/src/main/webapp/WEB-INF/faces-config.xml
  81. +11 −0 jaxrs/src/main/webapp/WEB-INF/sun-web.xml
  82. +40 −0 jaxrs/src/main/webapp/WEB-INF/templates/default.xhtml
  83. +57 −0 jaxrs/src/main/webapp/WEB-INF/web.xml
  84. +62 −0 jaxrs/src/main/webapp/addContact.xhtml
  85. +38 −0 jaxrs/src/main/webapp/addCustomer.xhtml
  86. +49 −0 jaxrs/src/main/webapp/contacts.xhtml
  87. +40 −0 jaxrs/src/main/webapp/customers.xhtml
  88. +1 −0 jaxrs/src/main/webapp/index.jsp
  89. +54 −0 jaxrs/src/main/webapp/lineItems.xhtml
  90. +53 −0 jaxrs/src/main/webapp/orders.xhtml
  91. +103 −0 jaxrs/src/main/webapp/resources/css/screen.css
  92. BIN jaxrs/src/main/webapp/resources/gfx/add-contact-tilt.gif
  93. BIN jaxrs/src/main/webapp/resources/gfx/add-customer-tilt.gif
  94. BIN jaxrs/src/main/webapp/resources/gfx/contacts-tilt.gif
  95. BIN jaxrs/src/main/webapp/resources/gfx/customers-tilt.gif
  96. BIN jaxrs/src/main/webapp/resources/gfx/delete.png
  97. BIN jaxrs/src/main/webapp/resources/gfx/edit.png
  98. BIN jaxrs/src/main/webapp/resources/gfx/feed.png
  99. BIN jaxrs/src/main/webapp/resources/gfx/header-gradient.gif
  100. BIN jaxrs/src/main/webapp/resources/gfx/line-items-tilt.gif
  101. BIN jaxrs/src/main/webapp/resources/gfx/orders-tilt.gif
  102. BIN jaxrs/src/main/webapp/resources/gfx/sellmore-logo.png
  103. BIN jaxrs/src/main/webapp/resources/gfx/view.png
  104. BIN jaxrs/src/main/webapp/resources/gfx/weld.png
  105. BIN jaxrs/src/main/webapp/resources/gfx/xml.png
  106. +16 −0 jaxrs/src/main/webapp/resources/locale/outputDate.xhtml
  107. +36 −0 jaxrs/src/main/webapp/resources/sellmore/rowInputContainer.xhtml
  108. +42 −0 jaxrs/src/manual/sellmore-manual.xhtml
  109. +4 −0 jaxrs/src/test/glassfish/META-INF/MANIFEST.MF
  110. BIN jaxrs/src/test/glassfish/__cp_jdbc_ra.rar
  111. BIN jaxrs/src/test/glassfish/__dm_jdbc_ra.rar
  112. BIN jaxrs/src/test/glassfish/__ds_jdbc_ra.rar
  113. BIN jaxrs/src/test/glassfish/__xa_jdbc_ra.rar
  114. 0 jaxrs/src/test/glassfish/config/admin-keyfile
  115. +185 −0 jaxrs/src/test/glassfish/config/domain.xml
  116. 0 jaxrs/src/test/glassfish/config/keyfile
  117. +1 −0 jaxrs/src/test/glassfish/config/local-password
  118. +8 −0 jaxrs/src/test/glassfish/generated/policy/__default-web-module/__default-web-module/granted.policy
  119. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/META-INF/MANIFEST.MF
  120. +266 −0 jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/META-INF/ra.xml
  121. BIN jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/__cp_jdbc_ra.jar
  122. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/META-INF/MANIFEST.MF
  123. +224 −0 jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/META-INF/ra.xml
  124. BIN jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/__dm_jdbc_ra.jar
  125. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/META-INF/MANIFEST.MF
  126. +266 −0 jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/META-INF/ra.xml
  127. BIN jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/__ds_jdbc_ra.jar
  128. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/META-INF/MANIFEST.MF
  129. +264 −0 jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/META-INF/ra.xml
  130. BIN jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/__xa_jdbc_ra.jar
  131. +22 −0 jaxrs/src/test/java/org/jboss/example/sellmore/ArtifactResolver.java
  132. +18 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerClient.java
  133. +121 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerResourceClientTest.java
  134. +16 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerResourceStub.java
  135. +3 −0 jaxrs/src/test/resources-jbossas/jndi.properties
  136. +37 −0 jaxrs/src/test/resources/WEB-INF/test-web.xml
  137. +15 −0 jaxrs/src/test/resources/arquillian.xml
  138. +3 −0 jaxrs/src/test/resources/jndi.properties
  139. +140 −0 jms/pom.xml
  140. +62 −0 jms/src/main/java/com/acme/jms/MessageEcho.java
  141. +43 −0 jms/src/main/java/com/acme/web/TestServlet.java
  142. +90 −0 jms/src/test/java/com/acme/jms/InjectionTestCase.java
  143. +3 −0 jms/src/test/resources/jndi.properties
  144. +1 −0 jms/src/test/resources/log4j.properties
  145. +25 −18 pom.xml
  146. BIN presentations/Arquillian_Jazoon-2010.pdf
  147. +154 −0 profiles/pom.xml
View
@@ -0,0 +1,5 @@
+classpath
+.project
+.settings/
+target/
+
View
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!-- Model Information -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.arquillian.sandbox.showcase</groupId>
+ <artifactId>arquillian-sandbox-showcase-profiles</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../profiles/pom.xml</relativePath>
+ </parent>
+
+ <!-- Artifact Information -->
+ <artifactId>arquillian-sandbox-showcase-cdi</artifactId>
+ <packaging>jar</packaging>
+ <name>Arquillian Showcase - CDI</name>
+ <url>http://www.jboss.org</url>
+ <description>Arquillian Showcase - CDI</description>
+
+ <properties>
+ <version.weld_core>1.0.1-SP1</version.weld_core>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>weld-embedded</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core-bom</artifactId>
+ <version>${version.weld_core}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ </profile>
+ <profile>
+ <id>integration</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface Asynchronous {}
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+
+@Asynchronous
+@RequestScoped
+public class AsynchronousPaymentProcessor implements PaymentProcessor {
+
+ public void process(String payment)
+ {
+
+ }
+}
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Alternative;
+
+@Alternative @Asynchronous @Synchronous
+@RequestScoped
+public class MockPaymentProcessor implements PaymentProcessor {
+
+ public static Boolean HAS_BEEN_CALLED = false;
+
+ public void process(String payment) {
+ HAS_BEEN_CALLED = true;
+ }
+}
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+public interface PaymentProcessor {
+
+ void process(String payment);
+
+}
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface Synchronous {}
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+
+@Synchronous
+@RequestScoped
+public class SynchronousPaymentProcessor implements PaymentProcessor {
+
+ public void process(String payment)
+ {
+
+ }
+}
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.acme.cdi.payment;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class SynchronousPaymentProcessorTestCase {
+
+ @Deployment
+ public static JavaArchive createDeployment() {
+ return ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addPackage(
+ Synchronous.class.getPackage()
+ )
+ .addManifestResource(
+ "com/acme/cdi/payment/beans.xml",
+ ArchivePaths.create("beans.xml"));
+ }
+
+ @Inject @Synchronous
+ private PaymentProcessor processor;
+
+ @Test
+ public void shouldBeReplacedByAMock() throws Exception
+ {
+ processor.process("");
+ Assert.assertTrue(MockPaymentProcessor.HAS_BEEN_CALLED);
+ }
+}
@@ -0,0 +1,6 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <class>com.acme.cdi.payment.MockPaymentProcessor</class>
+ </alternatives>
+</beans>
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Oops, something went wrong.

0 comments on commit acf15cf

Please sign in to comment.