[jboss-svn-commits] JBoss Common SVN: r3712 - in arquillian/trunk/demo/src: test/java/com/acme/ejb and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Nov 15 10:26:49 EST 2009


Author: aslak
Date: 2009-11-15 10:26:49 -0500 (Sun, 15 Nov 2009)
New Revision: 3712

Added:
   arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManager.java
   arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManagerBean.java
   arquillian/trunk/demo/src/test/java/com/acme/ejb/SystemManagerTest.java
Log:
ARQ-17 Added one more test case, to show that the container is only started and stopped once

Added: arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManager.java
===================================================================
--- arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManager.java	                        (rev 0)
+++ arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManager.java	2009-11-15 15:26:49 UTC (rev 3712)
@@ -0,0 +1,28 @@
+/*
+ * 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.ejb;
+
+/**
+ * SystemManager
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface SystemManager
+{
+   String greet(String userName);
+}

Added: arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManagerBean.java
===================================================================
--- arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManagerBean.java	                        (rev 0)
+++ arquillian/trunk/demo/src/main/java/com/acme/ejb/SystemManagerBean.java	2009-11-15 15:26:49 UTC (rev 3712)
@@ -0,0 +1,37 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+/**
+ * SystemManagerBean
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at Local(SystemManager.class)
+ at Stateless
+public class SystemManagerBean implements SystemManager
+{
+   @Override
+   public String greet(String userName)
+   {
+      return "System " + userName;
+   }
+}

Added: arquillian/trunk/demo/src/test/java/com/acme/ejb/SystemManagerTest.java
===================================================================
--- arquillian/trunk/demo/src/test/java/com/acme/ejb/SystemManagerTest.java	                        (rev 0)
+++ arquillian/trunk/demo/src/test/java/com/acme/ejb/SystemManagerTest.java	2009-11-15 15:26:49 UTC (rev 3712)
@@ -0,0 +1,59 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.EJB;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * GreetingManagerTest
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at RunWith(Arquillian.class)
+public class SystemManagerTest
+{
+   @Deployment
+   public static JavaArchive createDeployment() {
+      return Archives.create("test.jar", JavaArchive.class)
+               .addClasses(
+                     SystemManager.class,
+                     SystemManagerBean.class);
+   }
+   
+   @EJB
+   private SystemManager systemManager;
+   
+   @Test
+   public void shouldGreetUser() throws Exception {
+      
+      String userName = "Devoxx";
+      
+      Assert.assertEquals(
+            "System " + userName,
+            systemManager.greet(userName));
+   }
+}



More information about the jboss-svn-commits mailing list