tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject [06/12] tomee git commit: converting simple mdb with descriptor from md to adoc
Date Wed, 02 Jan 2019 21:18:17 GMT
converting simple mdb with descriptor from md to adoc


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/36b7a1ef
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/36b7a1ef
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/36b7a1ef

Branch: refs/heads/master
Commit: 36b7a1ef5d0f9e77514e6b2de818c5ed6c276d96
Parents: f8be746
Author: ivanjunckes <ijunckes@tomitribe.com>
Authored: Wed Jan 2 12:32:02 2019 -0200
Committer: ivanjunckes <ijunckes@tomitribe.com>
Committed: Wed Jan 2 12:32:02 2019 -0200

----------------------------------------------------------------------
 examples/simple-mdb-with-descriptor/README.adoc | 249 +++++++++++++++++++
 examples/simple-mdb-with-descriptor/README.md   | 245 ------------------
 2 files changed, 249 insertions(+), 245 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/36b7a1ef/examples/simple-mdb-with-descriptor/README.adoc
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-with-descriptor/README.adoc b/examples/simple-mdb-with-descriptor/README.adoc
new file mode 100644
index 0000000..0c5ccc5
--- /dev/null
+++ b/examples/simple-mdb-with-descriptor/README.adoc
@@ -0,0 +1,249 @@
+= Simple MDB with Descriptor
+:index-group: JMS and MDBs
+:jbake-type: page
+:jbake-status: published
+
+_Help us document this example! Click the blue pencil icon in the upper right to edit this
page._
+
+== ChatBean
+
+....
+package org.superbiz.mdbdesc;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+public class ChatBean implements MessageListener {
+
+    private ConnectionFactory connectionFactory;
+
+    private Queue answerQueue;
+
+    public void onMessage(Message message) {
+        try {
+
+            final TextMessage textMessage = (TextMessage) message;
+            final String question = textMessage.getText();
+
+            if ("Hello World!".equals(question)) {
+
+                respond("Hello, Test Case!");
+            } else if ("How are you?".equals(question)) {
+
+                respond("I'm doing well.");
+            } else if ("Still spinning?".equals(question)) {
+
+                respond("Once every day, as usual.");
+            }
+        } catch (JMSException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    private void respond(String text) throws JMSException {
+
+        Connection connection = null;
+        Session session = null;
+
+        try {
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            // Create a Session
+            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+            // Create a MessageProducer from the Session to the Topic or Queue
+            MessageProducer producer = session.createProducer(answerQueue);
+            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+            // Create a message
+            TextMessage message = session.createTextMessage(text);
+
+            // Tell the producer to send the message
+            producer.send(message);
+        } finally {
+            // Clean up
+            if (session != null) session.close();
+            if (connection != null) connection.close();
+        }
+    }
+}
+....
+
+== ejb-jar.xml
+
+....
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" metadata-complete="true">
+  <enterprise-beans>
+
+    <message-driven>
+
+      <ejb-name>ChatBean</ejb-name>
+      <ejb-class>org.superbiz.mdbdesc.ChatBean</ejb-class>
+
+      <messaging-type>javax.jms.MessageListener</messaging-type>
+
+      <activation-config>
+        <activation-config-property>
+          <activation-config-property-name>destination</activation-config-property-name>
+          <activation-config-property-value>ChatBean</activation-config-property-value>
+        </activation-config-property>
+        <activation-config-property>
+          <activation-config-property-name>destinationType</activation-config-property-name>
+          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
+        </activation-config-property>
+      </activation-config>
+
+      <resource-ref>
+        <res-ref-name>java:comp/env/org.superbiz.mdbdesc.ChatBean/connectionFactory</res-ref-name>
+        <res-type>javax.jms.ConnectionFactory</res-type>
+        <injection-target>
+          <injection-target-class>org.superbiz.mdbdesc.ChatBean</injection-target-class>
+          <injection-target-name>connectionFactory</injection-target-name>
+        </injection-target>
+      </resource-ref>
+
+      <resource-env-ref>
+        <resource-env-ref-name>java:comp/env/AnswerQueue</resource-env-ref-name>
+        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
+        <mapped-name>AnswerQueue</mapped-name>
+        <injection-target>
+          <injection-target-class>org.superbiz.mdbdesc.ChatBean</injection-target-class>
+          <injection-target-name>answerQueue</injection-target-name>
+        </injection-target>
+      </resource-env-ref>
+
+    </message-driven>
+
+  </enterprise-beans>
+</ejb-jar>
+....
+
+== ChatBeanTest
+
+....
+package org.superbiz.mdb;
+
+import junit.framework.TestCase;
+
+import javax.annotation.Resource;
+import javax.ejb.embeddable.EJBContainer;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+public class ChatBeanTest extends TestCase {
+
+    @Resource
+    private ConnectionFactory connectionFactory;
+
+    @Resource(name = "ChatBean")
+    private Queue questionQueue;
+
+    @Resource(name = "AnswerQueue")
+    private Queue answerQueue;
+
+    public void test() throws Exception {
+
+        EJBContainer.createEJBContainer().getContext().bind("inject", this);
+
+        final Connection connection = connectionFactory.createConnection();
+
+        connection.start();
+
+        final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        final MessageProducer questions = session.createProducer(questionQueue);
+
+        final MessageConsumer answers = session.createConsumer(answerQueue);
+
+
+        sendText("Hello World!", questions, session);
+
+        assertEquals("Hello, Test Case!", receiveText(answers));
+
+
+        sendText("How are you?", questions, session);
+
+        assertEquals("I'm doing well.", receiveText(answers));
+
+
+        sendText("Still spinning?", questions, session);
+
+        assertEquals("Once every day, as usual.", receiveText(answers));
+    }
+
+    private void sendText(String text, MessageProducer questions, Session session) throws
JMSException {
+
+        questions.send(session.createTextMessage(text));
+    }
+
+    private String receiveText(MessageConsumer answers) throws JMSException {
+
+        return ((TextMessage) answers.receive(1000)).getText();
+    }
+}
+....
+
+= Running
+
+....
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.mdb.ChatBeanTest
+Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+http://tomee.apache.org/
+INFO - openejb.home = /Users/dblevins/examples/simple-mdb-with-descriptor
+INFO - openejb.base = /Users/dblevins/examples/simple-mdb-with-descriptor
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default
Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default
Transaction Manager)
+INFO - Found EjbModule in classpath: /Users/dblevins/examples/simple-mdb-with-descriptor/target/classes
+INFO - Beginning load: /Users/dblevins/examples/simple-mdb-with-descriptor/target/classes
+INFO - Configuring enterprise application: /Users/dblevins/examples/simple-mdb-with-descriptor
+WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an
older Runtime.
+INFO - Configuring Service(id=Default MDB Container, type=Container, provider-id=Default
MDB Container)
+INFO - Auto-creating a container for bean ChatBean: Container(type=MESSAGE, id=Default MDB
Container)
+INFO - Configuring Service(id=Default JMS Resource Adapter, type=Resource, provider-id=Default
JMS Resource Adapter)
+INFO - Configuring Service(id=Default JMS Connection Factory, type=Resource, provider-id=Default
JMS Connection Factory)
+INFO - Auto-creating a Resource with id 'Default JMS Connection Factory' of type 'javax.jms.ConnectionFactory
for 'ChatBean'.
+INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.mdbdesc.ChatBean/connectionFactory'
in bean ChatBean to Resource(id=Default JMS Connection Factory)
+INFO - Configuring Service(id=AnswerQueue, type=Resource, provider-id=Default Queue)
+INFO - Auto-creating a Resource with id 'AnswerQueue' of type 'javax.jms.Queue for 'ChatBean'.
+INFO - Auto-linking resource-env-ref 'java:comp/env/AnswerQueue' in bean ChatBean to Resource(id=AnswerQueue)
+INFO - Configuring Service(id=ChatBean, type=Resource, provider-id=Default Queue)
+INFO - Auto-creating a Resource with id 'ChatBean' of type 'javax.jms.Queue for 'ChatBean'.
+INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default
Managed Container)
+INFO - Auto-creating a container for bean org.superbiz.mdb.ChatBeanTest: Container(type=MANAGED,
id=Default Managed Container)
+INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.mdb.ChatBeanTest/connectionFactory'
in bean org.superbiz.mdb.ChatBeanTest to Resource(id=Default JMS Connection Factory)
+INFO - Auto-linking resource-env-ref 'java:comp/env/AnswerQueue' in bean org.superbiz.mdb.ChatBeanTest
to Resource(id=AnswerQueue)
+INFO - Auto-linking resource-env-ref 'java:comp/env/ChatBean' in bean org.superbiz.mdb.ChatBeanTest
to Resource(id=ChatBean)
+INFO - Enterprise application "/Users/dblevins/examples/simple-mdb-with-descriptor" loaded.
+INFO - Assembling app: /Users/dblevins/examples/simple-mdb-with-descriptor
+INFO - Jndi(name="java:global/EjbModule1842275169/org.superbiz.mdb.ChatBeanTest!org.superbiz.mdb.ChatBeanTest")
+INFO - Jndi(name="java:global/EjbModule1842275169/org.superbiz.mdb.ChatBeanTest")
+INFO - Created Ejb(deployment-id=org.superbiz.mdb.ChatBeanTest, ejb-name=org.superbiz.mdb.ChatBeanTest,
container=Default Managed Container)
+INFO - Created Ejb(deployment-id=ChatBean, ejb-name=ChatBean, container=Default MDB Container)
+INFO - Started Ejb(deployment-id=org.superbiz.mdb.ChatBeanTest, ejb-name=org.superbiz.mdb.ChatBeanTest,
container=Default Managed Container)
+INFO - Started Ejb(deployment-id=ChatBean, ejb-name=ChatBean, container=Default MDB Container)
+INFO - Deployed Application(path=/Users/dblevins/examples/simple-mdb-with-descriptor)
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.914 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+....

http://git-wip-us.apache.org/repos/asf/tomee/blob/36b7a1ef/examples/simple-mdb-with-descriptor/README.md
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-with-descriptor/README.md b/examples/simple-mdb-with-descriptor/README.md
deleted file mode 100644
index 3b248ed..0000000
--- a/examples/simple-mdb-with-descriptor/README.md
+++ /dev/null
@@ -1,245 +0,0 @@
-index-group=JMS and MDBs
-type=page
-status=published
-title=Simple MDB with Descriptor
-~~~~~~
-
-*Help us document this example! Click the blue pencil icon in the upper right to edit this
page.*
-
-## ChatBean
-
-    package org.superbiz.mdbdesc;
-    
-    import javax.jms.Connection;
-    import javax.jms.ConnectionFactory;
-    import javax.jms.DeliveryMode;
-    import javax.jms.JMSException;
-    import javax.jms.Message;
-    import javax.jms.MessageListener;
-    import javax.jms.MessageProducer;
-    import javax.jms.Queue;
-    import javax.jms.Session;
-    import javax.jms.TextMessage;
-    
-    public class ChatBean implements MessageListener {
-    
-        private ConnectionFactory connectionFactory;
-    
-        private Queue answerQueue;
-    
-        public void onMessage(Message message) {
-            try {
-    
-                final TextMessage textMessage = (TextMessage) message;
-                final String question = textMessage.getText();
-    
-                if ("Hello World!".equals(question)) {
-    
-                    respond("Hello, Test Case!");
-                } else if ("How are you?".equals(question)) {
-    
-                    respond("I'm doing well.");
-                } else if ("Still spinning?".equals(question)) {
-    
-                    respond("Once every day, as usual.");
-                }
-            } catch (JMSException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-    
-        private void respond(String text) throws JMSException {
-    
-            Connection connection = null;
-            Session session = null;
-    
-            try {
-                connection = connectionFactory.createConnection();
-                connection.start();
-    
-                // Create a Session
-                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-    
-                // Create a MessageProducer from the Session to the Topic or Queue
-                MessageProducer producer = session.createProducer(answerQueue);
-                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-    
-                // Create a message
-                TextMessage message = session.createTextMessage(text);
-    
-                // Tell the producer to send the message
-                producer.send(message);
-            } finally {
-                // Clean up
-                if (session != null) session.close();
-                if (connection != null) connection.close();
-            }
-        }
-    }
-
-## ejb-jar.xml
-
-    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" metadata-complete="true">
-      <enterprise-beans>
-    
-        <message-driven>
-    
-          <ejb-name>ChatBean</ejb-name>
-          <ejb-class>org.superbiz.mdbdesc.ChatBean</ejb-class>
-    
-          <messaging-type>javax.jms.MessageListener</messaging-type>
-    
-          <activation-config>
-            <activation-config-property>
-              <activation-config-property-name>destination</activation-config-property-name>
-              <activation-config-property-value>ChatBean</activation-config-property-value>
-            </activation-config-property>
-            <activation-config-property>
-              <activation-config-property-name>destinationType</activation-config-property-name>
-              <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
-            </activation-config-property>
-          </activation-config>
-    
-          <resource-ref>
-            <res-ref-name>java:comp/env/org.superbiz.mdbdesc.ChatBean/connectionFactory</res-ref-name>
-            <res-type>javax.jms.ConnectionFactory</res-type>
-            <injection-target>
-              <injection-target-class>org.superbiz.mdbdesc.ChatBean</injection-target-class>
-              <injection-target-name>connectionFactory</injection-target-name>
-            </injection-target>
-          </resource-ref>
-    
-          <resource-env-ref>
-            <resource-env-ref-name>java:comp/env/AnswerQueue</resource-env-ref-name>
-            <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
-            <mapped-name>AnswerQueue</mapped-name>
-            <injection-target>
-              <injection-target-class>org.superbiz.mdbdesc.ChatBean</injection-target-class>
-              <injection-target-name>answerQueue</injection-target-name>
-            </injection-target>
-          </resource-env-ref>
-    
-        </message-driven>
-    
-      </enterprise-beans>
-    </ejb-jar>
-    
-
-## ChatBeanTest
-
-    package org.superbiz.mdb;
-    
-    import junit.framework.TestCase;
-    
-    import javax.annotation.Resource;
-    import javax.ejb.embeddable.EJBContainer;
-    import javax.jms.Connection;
-    import javax.jms.ConnectionFactory;
-    import javax.jms.JMSException;
-    import javax.jms.MessageConsumer;
-    import javax.jms.MessageProducer;
-    import javax.jms.Queue;
-    import javax.jms.Session;
-    import javax.jms.TextMessage;
-    
-    public class ChatBeanTest extends TestCase {
-    
-        @Resource
-        private ConnectionFactory connectionFactory;
-    
-        @Resource(name = "ChatBean")
-        private Queue questionQueue;
-    
-        @Resource(name = "AnswerQueue")
-        private Queue answerQueue;
-    
-        public void test() throws Exception {
-    
-            EJBContainer.createEJBContainer().getContext().bind("inject", this);
-    
-            final Connection connection = connectionFactory.createConnection();
-    
-            connection.start();
-    
-            final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-    
-            final MessageProducer questions = session.createProducer(questionQueue);
-    
-            final MessageConsumer answers = session.createConsumer(answerQueue);
-    
-    
-            sendText("Hello World!", questions, session);
-    
-            assertEquals("Hello, Test Case!", receiveText(answers));
-    
-    
-            sendText("How are you?", questions, session);
-    
-            assertEquals("I'm doing well.", receiveText(answers));
-    
-    
-            sendText("Still spinning?", questions, session);
-    
-            assertEquals("Once every day, as usual.", receiveText(answers));
-        }
-    
-        private void sendText(String text, MessageProducer questions, Session session) throws
JMSException {
-    
-            questions.send(session.createTextMessage(text));
-        }
-    
-        private String receiveText(MessageConsumer answers) throws JMSException {
-    
-            return ((TextMessage) answers.receive(1000)).getText();
-        }
-    }
-
-# Running
-
-    
-    -------------------------------------------------------
-     T E S T S
-    -------------------------------------------------------
-    Running org.superbiz.mdb.ChatBeanTest
-    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
-    http://tomee.apache.org/
-    INFO - openejb.home = /Users/dblevins/examples/simple-mdb-with-descriptor
-    INFO - openejb.base = /Users/dblevins/examples/simple-mdb-with-descriptor
-    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default
Security Service)
-    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default
Transaction Manager)
-    INFO - Found EjbModule in classpath: /Users/dblevins/examples/simple-mdb-with-descriptor/target/classes
-    INFO - Beginning load: /Users/dblevins/examples/simple-mdb-with-descriptor/target/classes
-    INFO - Configuring enterprise application: /Users/dblevins/examples/simple-mdb-with-descriptor
-    WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using
an older Runtime.
-    INFO - Configuring Service(id=Default MDB Container, type=Container, provider-id=Default
MDB Container)
-    INFO - Auto-creating a container for bean ChatBean: Container(type=MESSAGE, id=Default
MDB Container)
-    INFO - Configuring Service(id=Default JMS Resource Adapter, type=Resource, provider-id=Default
JMS Resource Adapter)
-    INFO - Configuring Service(id=Default JMS Connection Factory, type=Resource, provider-id=Default
JMS Connection Factory)
-    INFO - Auto-creating a Resource with id 'Default JMS Connection Factory' of type 'javax.jms.ConnectionFactory
for 'ChatBean'.
-    INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.mdbdesc.ChatBean/connectionFactory'
in bean ChatBean to Resource(id=Default JMS Connection Factory)
-    INFO - Configuring Service(id=AnswerQueue, type=Resource, provider-id=Default Queue)
-    INFO - Auto-creating a Resource with id 'AnswerQueue' of type 'javax.jms.Queue for 'ChatBean'.
-    INFO - Auto-linking resource-env-ref 'java:comp/env/AnswerQueue' in bean ChatBean to
Resource(id=AnswerQueue)
-    INFO - Configuring Service(id=ChatBean, type=Resource, provider-id=Default Queue)
-    INFO - Auto-creating a Resource with id 'ChatBean' of type 'javax.jms.Queue for 'ChatBean'.
-    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default
Managed Container)
-    INFO - Auto-creating a container for bean org.superbiz.mdb.ChatBeanTest: Container(type=MANAGED,
id=Default Managed Container)
-    INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.mdb.ChatBeanTest/connectionFactory'
in bean org.superbiz.mdb.ChatBeanTest to Resource(id=Default JMS Connection Factory)
-    INFO - Auto-linking resource-env-ref 'java:comp/env/AnswerQueue' in bean org.superbiz.mdb.ChatBeanTest
to Resource(id=AnswerQueue)
-    INFO - Auto-linking resource-env-ref 'java:comp/env/ChatBean' in bean org.superbiz.mdb.ChatBeanTest
to Resource(id=ChatBean)
-    INFO - Enterprise application "/Users/dblevins/examples/simple-mdb-with-descriptor" loaded.
-    INFO - Assembling app: /Users/dblevins/examples/simple-mdb-with-descriptor
-    INFO - Jndi(name="java:global/EjbModule1842275169/org.superbiz.mdb.ChatBeanTest!org.superbiz.mdb.ChatBeanTest")
-    INFO - Jndi(name="java:global/EjbModule1842275169/org.superbiz.mdb.ChatBeanTest")
-    INFO - Created Ejb(deployment-id=org.superbiz.mdb.ChatBeanTest, ejb-name=org.superbiz.mdb.ChatBeanTest,
container=Default Managed Container)
-    INFO - Created Ejb(deployment-id=ChatBean, ejb-name=ChatBean, container=Default MDB Container)
-    INFO - Started Ejb(deployment-id=org.superbiz.mdb.ChatBeanTest, ejb-name=org.superbiz.mdb.ChatBeanTest,
container=Default Managed Container)
-    INFO - Started Ejb(deployment-id=ChatBean, ejb-name=ChatBean, container=Default MDB Container)
-    INFO - Deployed Application(path=/Users/dblevins/examples/simple-mdb-with-descriptor)
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.914 sec
-    
-    Results :
-    
-    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-    


Mime
View raw message