[logback-dev] svn commit: r1197 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic/net test/java/ch/qos/logback/classic/net test/java/ch/qos/logback/classic/net/mock

noreply.seb at qos.ch noreply.seb at qos.ch
Thu Jan 11 14:36:50 CET 2007


Author: seb
Date: Thu Jan 11 14:36:49 2007
New Revision: 1197

Added:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java

Log:


Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java	Thu Jan 11 14:36:49 2007
@@ -40,10 +40,10 @@
  * requires the retreival of a JNDI {@link Context}.
  * 
  * <p>
- * There are two common methods for retrieving a JNDI {@link Context}. If a file
- * resource named <em>jndi.properties</em> is available to the JNDI API, it
- * will use the information found therein to retrieve an initial JNDI context.
- * To obtain an initial context, your code will simply call:
+ * There are two common methods for retrieving a JNDI {@link Context}. If a
+ * file resource named <em>jndi.properties</em> is available to the JNDI API,
+ * it will use the information found therein to retrieve an initial JNDI
+ * context. To obtain an initial context, your code will simply call:
  * 
  * <pre>
  * InitialContext jndiContext = new InitialContext();
@@ -115,7 +115,6 @@
   QueueSession queueSession;
   QueueSender queueSender;
 
-  boolean inOrder = false;
   int successiveFailureCount = 0;
 
   public JMSQueueAppender() {
@@ -159,79 +158,82 @@
     QueueConnectionFactory queueConnectionFactory;
 
     try {
-      Context jndi;
+      Context jndi = buildJNDIContext();
 
-      //addInfo("Getting initial context.");
-      if (initialContextFactoryName != null) {
-        Properties env = new Properties();
-        env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
-        if (providerURL != null) {
-          env.put(Context.PROVIDER_URL, providerURL);
-        } else {
-         addWarn(
-            "You have set InitialContextFactoryName option but not the "
-            + "ProviderURL. This is likely to cause problems.");
-        }
-        if (urlPkgPrefixes != null) {
-          env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
-        }
-
-        if (securityPrincipalName != null) {
-          env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
-          if (securityCredentials != null) {
-            env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
-          } else {
-            addWarn(
-              "You have set SecurityPrincipalName option but not the "
-              + "SecurityCredentials. This is likely to cause problems.");
-          }
-        }
-        jndi = new InitialContext(env);
-      } else {
-        jndi = new InitialContext();
-      }
-
-      //addInfo("Looking up [" + qcfBindingName + "]");
-      queueConnectionFactory =
-        (QueueConnectionFactory) lookup(jndi, qcfBindingName);
-      //addInfo("About to create QueueConnection.");
+      // addInfo("Looking up [" + qcfBindingName + "]");
+      queueConnectionFactory = (QueueConnectionFactory) lookup(jndi,
+          qcfBindingName);
+      // addInfo("About to create QueueConnection.");
       if (userName != null) {
-        this.queueConnection =
-          queueConnectionFactory.createQueueConnection(userName, password);
+        this.queueConnection = queueConnectionFactory.createQueueConnection(
+            userName, password);
       } else {
         this.queueConnection = queueConnectionFactory.createQueueConnection();
       }
 
-      //addInfo(
-      //  "Creating QueueSession, non-transactional, "
-      //  + "in AUTO_ACKNOWLEDGE mode.");
-      this.queueSession =
-        queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      // addInfo(
+      // "Creating QueueSession, non-transactional, "
+      // + "in AUTO_ACKNOWLEDGE mode.");
+      this.queueSession = queueConnection.createQueueSession(false,
+          Session.AUTO_ACKNOWLEDGE);
 
-      //addInfo("Looking up queue name [" + queueBindingName + "].");
+      // addInfo("Looking up queue name [" + queueBindingName + "].");
       Queue queue = (Queue) lookup(jndi, queueBindingName);
 
-      //addInfo("Creating QueueSender.");
+      // addInfo("Creating QueueSender.");
       this.queueSender = queueSession.createSender(queue);
 
-      //addInfo("Starting QueueConnection.");
+      // addInfo("Starting QueueConnection.");
       queueConnection.start();
 
       jndi.close();
     } catch (Exception e) {
-      addError(
-       "Error while activating options for appender named [" + name + "].", e);
+      addError("Error while activating options for appender named [" + name
+          + "].", e);
     }
-    
-    
-    if (this.queueConnection != null && this.queueSession != null && this.queueSender != null) {
-      inOrder = true;
+
+    if (this.queueConnection != null && this.queueSession != null
+        && this.queueSender != null) {
+      super.start();
+    }
+  }
+
+  public Context buildJNDIContext() throws NamingException {
+    Context jndi = null;
+
+    // addInfo("Getting initial context.");
+    if (initialContextFactoryName != null) {
+      Properties env = buildEnvProperties();
+      jndi = new InitialContext(env);
+    } else {
+      jndi = new InitialContext();
+    }
+    return jndi;
+  }
+
+  public Properties buildEnvProperties() {
+    Properties env = new Properties();
+    env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
+    if (providerURL != null) {
+      env.put(Context.PROVIDER_URL, providerURL);
     } else {
-      inOrder = false;
+      addWarn("You have set InitialContextFactoryName option but not the "
+          + "ProviderURL. This is likely to cause problems.");
     }
-    if(inOrder) {
-        super.start();
+    if (urlPkgPrefixes != null) {
+      env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
     }
+
+    if (securityPrincipalName != null) {
+      env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
+      if (securityCredentials != null) {
+        env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
+      } else {
+        addWarn("You have set SecurityPrincipalName option but not the "
+            + "SecurityCredentials. This is likely to cause problems.");
+      }
+    }
+    return env;
   }
 
   protected Object lookup(Context ctx, String name) throws NamingException {
@@ -273,35 +275,23 @@
   }
 
   /**
-   * Gets whether appender is properly configured to append messages.
-   * 
-   * @return true if properly configured.
-   */
-  protected boolean checkEntryConditions() {
-    return inOrder;
-  }
-
-  /**
    * This method called by {@link AppenderSkeleton#doAppend} method to do most
    * of the real appending work.
    */
   public void append(LoggingEvent event) {
-    if (!checkEntryConditions()) {
+    if (!isStarted()) {
       return;
     }
 
     try {
       ObjectMessage msg = queueSession.createObjectMessage();
-
-      // manage caller data
-
       msg.setObject(event);
       queueSender.send(msg);
       successiveFailureCount = 0;
     } catch (Exception e) {
       successiveFailureCount++;
       if (successiveFailureCount > SUCCESSIVE_FAILURE_LIMIT) {
-        inOrder = false;
+        stop();
       }
       addError("Could not send message in JMSAppender [" + name + "].", e);
 
@@ -397,16 +387,16 @@
   }
 
   /**
-   * Returns the QueueSession used for this appender. Only valid after
-   * start() method has been invoked.
+   * Returns the QueueSession used for this appender. Only valid after start()
+   * method has been invoked.
    */
   protected QueueSession getQueueSession() {
     return queueSession;
   }
 
   /**
-   * Returns the QueueSender used for this appender. Only valid after
-   * start() method has been invoked.
+   * Returns the QueueSender used for this appender. Only valid after start()
+   * method has been invoked.
    */
   protected QueueSender getQueueSender() {
     return queueSender;

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,213 @@
+package ch.qos.logback.classic.net;
+
+import java.util.Properties;
+
+import javax.jms.ObjectMessage;
+import javax.naming.Context;
+
+import junit.framework.TestCase;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.net.mock.MockInitialContext;
+import ch.qos.logback.classic.net.mock.MockInitialContextFactory;
+import ch.qos.logback.classic.net.mock.MockQueue;
+import ch.qos.logback.classic.net.mock.MockQueueConnectionFactory;
+import ch.qos.logback.classic.net.mock.MockQueueSender;
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.ContextBase;
+
+public class JMSQueueAppenderTest extends TestCase {
+
+  ch.qos.logback.core.Context context;
+  JMSQueueAppender appender;
+
+  @Override
+  protected void setUp() throws Exception {
+    context = new ContextBase();
+    appender = new JMSQueueAppender();
+    appender.setContext(context);
+    appender.setName("jmsQueue");
+    appender.qcfBindingName = "queueCnxFactory";
+    appender.queueBindingName = "testQueue";
+    appender.providerURL = "url";
+    appender.initialContextFactoryName = MockInitialContextFactory.class.getName();
+    
+    MockInitialContext mic = MockInitialContextFactory.getContext();
+    mic.map.put(appender.qcfBindingName, new MockQueueConnectionFactory());
+    mic.map.put(appender.queueBindingName, new MockQueue(appender.queueBindingName));
+    
+    super.setUp();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    appender = null;
+    context = null;
+    super.tearDown();
+  }
+
+  public void testAppendOk() { 
+    appender.start();
+
+    LoggingEvent le = createLoggingEvent();
+    appender.append(le);
+    
+    MockQueueSender qs = (MockQueueSender)appender.queueSender;
+    assertEquals(1, qs.getMessageList().size());
+    ObjectMessage message = (ObjectMessage) qs.getMessageList().get(0);
+    try {
+      assertEquals(le, message.getObject());
+    } catch (Exception e) {
+      fail();
+    }
+  }
+
+  public void testAppendFailure() {
+    appender.start();
+    
+    //make sure the append method does not work
+    appender.queueSender = null;
+    
+    LoggingEvent le = createLoggingEvent();
+    for (int i = 1; i <= 3; i++) {
+      appender.append(le);
+      assertEquals(i, context.getStatusManager().getCount());
+      assertTrue(appender.isStarted());
+    }
+    appender.append(le);
+    assertEquals(4, context.getStatusManager().getCount());
+    assertFalse(appender.isStarted());
+  }
+
+  public void testBuildEnvProperties() {
+    appender.initialContextFactoryName = "icfn";
+    appender.providerURL = "url";
+    appender.urlPkgPrefixes = "pkgPref";
+    appender.securityPrincipalName = "user";
+    appender.securityCredentials = "cred";
+
+    Properties props = appender.buildEnvProperties();
+    assertEquals(5, props.size());
+    assertEquals(appender.initialContextFactoryName, props
+        .getProperty(Context.INITIAL_CONTEXT_FACTORY));
+    assertEquals(appender.providerURL, props.getProperty(Context.PROVIDER_URL));
+    assertEquals(appender.urlPkgPrefixes, props
+        .getProperty(Context.URL_PKG_PREFIXES));
+    assertEquals(appender.securityPrincipalName, props
+        .getProperty(Context.SECURITY_PRINCIPAL));
+    assertEquals(appender.securityCredentials, props
+        .getProperty(Context.SECURITY_CREDENTIALS));
+  }
+
+  public void testBuildEnvPropertiesWithNullProviderURL() {
+    appender.initialContextFactoryName = "icfn";
+    appender.providerURL = null;
+    appender.urlPkgPrefixes = "pkgPref";
+    appender.securityPrincipalName = "user";
+    appender.securityCredentials = "cred";
+
+    Properties props = appender.buildEnvProperties();
+    assertEquals(4, props.size());
+    assertEquals(appender.initialContextFactoryName, props
+        .getProperty(Context.INITIAL_CONTEXT_FACTORY));
+    assertEquals(null, props.getProperty(Context.PROVIDER_URL));
+    assertEquals(appender.urlPkgPrefixes, props
+        .getProperty(Context.URL_PKG_PREFIXES));
+    assertEquals(appender.securityPrincipalName, props
+        .getProperty(Context.SECURITY_PRINCIPAL));
+    assertEquals(appender.securityCredentials, props
+        .getProperty(Context.SECURITY_CREDENTIALS));
+
+    assertEquals(1, context.getStatusManager().getCount());
+  }
+
+  public void testBuildEnvPropertiesWithNullCredentials() {
+    appender.initialContextFactoryName = "icfn";
+    appender.providerURL = "url";
+    appender.urlPkgPrefixes = "pkgPref";
+    appender.securityPrincipalName = "user";
+    appender.securityCredentials = null;
+
+    Properties props = appender.buildEnvProperties();
+    assertEquals(4, props.size());
+    assertEquals(appender.initialContextFactoryName, props
+        .getProperty(Context.INITIAL_CONTEXT_FACTORY));
+    assertEquals(appender.providerURL, props.getProperty(Context.PROVIDER_URL));
+    assertEquals(appender.urlPkgPrefixes, props
+        .getProperty(Context.URL_PKG_PREFIXES));
+    assertEquals(appender.securityPrincipalName, props
+        .getProperty(Context.SECURITY_PRINCIPAL));
+    assertEquals(null, props
+        .getProperty(Context.SECURITY_CREDENTIALS));
+
+    assertEquals(1, context.getStatusManager().getCount());
+  }
+  
+  public void testBuildEnvPropertiesWithPkgNull() {
+    appender.initialContextFactoryName = "icfn";
+    appender.providerURL = "url";
+    appender.urlPkgPrefixes = null;
+    appender.securityPrincipalName = "user";
+    appender.securityCredentials = "cred";
+
+    Properties props = appender.buildEnvProperties();
+    assertEquals(4, props.size());
+    assertEquals(appender.initialContextFactoryName, props
+        .getProperty(Context.INITIAL_CONTEXT_FACTORY));
+    assertEquals(appender.providerURL, props.getProperty(Context.PROVIDER_URL));
+    assertEquals(null, props
+        .getProperty(Context.URL_PKG_PREFIXES));
+    assertEquals(appender.securityPrincipalName, props
+        .getProperty(Context.SECURITY_PRINCIPAL));
+    assertEquals(appender.securityCredentials, props
+        .getProperty(Context.SECURITY_CREDENTIALS));
+
+    assertEquals(0, context.getStatusManager().getCount());
+  }
+
+  public void testStartMinimalInfo() {
+    //let's leave only what's in the setup()
+    //method, minus the providerURL
+    appender.providerURL = null;
+    appender.start();
+    
+    assertTrue(appender.isStarted());
+    
+    try {
+      assertEquals(appender.queueBindingName, appender.queueSender.getQueue().getQueueName());
+    } catch (Exception e) {
+      fail();
+    }
+  }
+  
+  public void testStartUserPass() {
+    appender.userName = "";
+    appender.password = "";
+    
+    appender.start();
+    
+    assertTrue(appender.isStarted());
+    
+    try {
+      assertEquals(appender.queueBindingName, appender.queueSender.getQueue().getQueueName());
+    } catch (Exception e) {
+      fail();
+    }
+  }
+  
+  public void testStartFails() {
+    appender.queueBindingName = null;
+    
+    appender.start();
+    
+    assertFalse(appender.isStarted());
+  }
+
+  private LoggingEvent createLoggingEvent() {
+    LoggingEvent le = new LoggingEvent();
+    le.setLevel(Level.DEBUG);
+    le.setMessage("test message");
+    le.setTimeStamp(System.currentTimeMillis());
+    le.setThreadName(Thread.currentThread().getName());
+    return le;
+  }
+}

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java	Thu Jan 11 14:36:49 2007
@@ -167,7 +167,7 @@
   public void testStartMinimalInfo() {
     //let's leave only what's in the setup()
     //method, minus the providerURL
-    appender.providerURL = "url";
+    appender.providerURL = null;
     appender.start();
     
     assertTrue(appender.isStarted());

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,18 @@
+package ch.qos.logback.classic.net.mock;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+
+public class MockQueue implements Queue {
+
+  String name;
+  
+  public MockQueue(String name) {
+    this.name = name;
+  }
+  
+  public String getQueueName() throws JMSException {
+    return name;
+  }
+
+}

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,83 @@
+package ch.qos.logback.classic.net.mock;
+
+import javax.jms.ConnectionConsumer;
+import javax.jms.ConnectionMetaData;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.Topic;
+
+public class MockQueueConnection implements QueueConnection {
+
+  MockQueueSession session = new MockQueueSession();
+  
+  public QueueSession createQueueSession(boolean arg0, int arg1) throws JMSException {
+    return session;
+  }
+
+  public ConnectionConsumer createConnectionConsumer(Queue arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
+    
+    return null;
+  }
+  
+  public void close() throws JMSException {
+    
+    
+  }
+
+  public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
+    
+    return null;
+  }
+
+  public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2, ServerSessionPool arg3, int arg4) throws JMSException {
+    
+    return null;
+  }
+
+  public Session createSession(boolean arg0, int arg1) throws JMSException {
+    
+    return null;
+  }
+
+  public String getClientID() throws JMSException {
+    
+    return null;
+  }
+
+  public ExceptionListener getExceptionListener() throws JMSException {
+    
+    return null;
+  }
+
+  public ConnectionMetaData getMetaData() throws JMSException {
+    
+    return null;
+  }
+
+  public void setClientID(String arg0) throws JMSException {
+    
+    
+  }
+
+  public void setExceptionListener(ExceptionListener arg0) throws JMSException {
+    
+    
+  }
+
+  public void start() throws JMSException {
+    
+    
+  }
+
+  public void stop() throws JMSException {
+    
+    
+  }
+
+}

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,29 @@
+package ch.qos.logback.classic.net.mock;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+
+public class MockQueueConnectionFactory implements QueueConnectionFactory {
+
+  MockQueueConnection cnx = new MockQueueConnection();
+  
+  public QueueConnection createQueueConnection() throws JMSException {
+    return cnx;
+  }
+
+  public QueueConnection createQueueConnection(String user, String pass) throws JMSException {
+    
+    return cnx;
+  }
+
+  public Connection createConnection() throws JMSException {
+    return null;
+  }
+
+  public Connection createConnection(String arg0, String arg1) throws JMSException {
+    return null;
+  }
+
+}

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,121 @@
+package ch.qos.logback.classic.net.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.QueueSender;
+
+public class MockQueueSender implements QueueSender {
+
+  List<Message> messageList = new ArrayList<Message>();
+  Queue queue;
+  
+  public MockQueueSender(Queue queue) {
+    this.queue = queue;
+  }
+  
+  public List<Message> getMessageList() {
+    return messageList;
+  }
+  
+  public Queue getQueue() throws JMSException {
+    return queue;
+  }
+
+  public void send(Message message) throws JMSException {
+    messageList.add(message);
+    
+  }
+
+  public void send(Queue arg0, Message arg1) throws JMSException {
+
+    
+  }
+
+  public void send(Message arg0, int arg1, int arg2, long arg3) throws JMSException {
+
+    
+  }
+
+  public void send(Queue arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
+
+    
+  }
+
+  public void close() throws JMSException {
+
+    
+  }
+
+  public int getDeliveryMode() throws JMSException {
+
+    return 0;
+  }
+
+  public Destination getDestination() throws JMSException {
+
+    return null;
+  }
+
+  public boolean getDisableMessageID() throws JMSException {
+
+    return false;
+  }
+
+  public boolean getDisableMessageTimestamp() throws JMSException {
+
+    return false;
+  }
+
+  public int getPriority() throws JMSException {
+
+    return 0;
+  }
+
+  public long getTimeToLive() throws JMSException {
+
+    return 0;
+  }
+
+  public void send(Destination arg0, Message arg1) throws JMSException {
+
+    
+  }
+
+  public void send(Destination arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
+
+    
+  }
+
+  public void setDeliveryMode(int arg0) throws JMSException {
+
+    
+  }
+
+  public void setDisableMessageID(boolean arg0) throws JMSException {
+
+    
+  }
+
+  public void setDisableMessageTimestamp(boolean arg0) throws JMSException {
+
+    
+  }
+
+  public void setPriority(int arg0) throws JMSException {
+
+    
+  }
+
+  public void setTimeToLive(long arg0) throws JMSException {
+
+    
+  }
+  
+  
+
+}

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java	Thu Jan 11 14:36:49 2007
@@ -0,0 +1,195 @@
+package ch.qos.logback.classic.net.mock;
+
+import java.io.Serializable;
+
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.StreamMessage;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+
+public class MockQueueSession implements QueueSession {
+
+  public ObjectMessage createObjectMessage() throws JMSException {
+    return new MockObjectMessage();
+  }
+  
+  public QueueSender createSender(Queue queue) throws JMSException {
+    if (queue == null) {
+      return null;
+    }
+    return new MockQueueSender(queue);
+  }
+
+  public QueueBrowser createBrowser(Queue arg0) throws JMSException {
+
+    return null;
+  }
+
+  public QueueBrowser createBrowser(Queue arg0, String arg1) throws JMSException {
+
+    return null;
+  }
+
+  public Queue createQueue(String arg0) throws JMSException {
+
+    return null;
+  }
+
+  public QueueReceiver createReceiver(Queue arg0) throws JMSException {
+
+    return null;
+  }
+
+  public QueueReceiver createReceiver(Queue arg0, String arg1) throws JMSException {
+
+    return null;
+  }
+
+  public TemporaryQueue createTemporaryQueue() throws JMSException {
+
+    return null;
+  }
+
+  public void close() throws JMSException {
+
+    
+  }
+
+  public void commit() throws JMSException {
+
+    
+  }
+
+  public BytesMessage createBytesMessage() throws JMSException {
+
+    return null;
+  }
+
+  public MessageConsumer createConsumer(Destination arg0) throws JMSException {
+
+    return null;
+  }
+
+  public MessageConsumer createConsumer(Destination arg0, String arg1) throws JMSException {
+
+    return null;
+  }
+
+  public MessageConsumer createConsumer(Destination arg0, String arg1, boolean arg2) throws JMSException {
+
+    return null;
+  }
+
+  public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1) throws JMSException {
+
+    return null;
+  }
+
+  public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1, String arg2, boolean arg3) throws JMSException {
+
+    return null;
+  }
+
+  public MapMessage createMapMessage() throws JMSException {
+
+    return null;
+  }
+
+  public Message createMessage() throws JMSException {
+
+    return null;
+  }
+
+  public ObjectMessage createObjectMessage(Serializable arg0) throws JMSException {
+
+    return null;
+  }
+
+  public MessageProducer createProducer(Destination arg0) throws JMSException {
+
+    return null;
+  }
+
+  public StreamMessage createStreamMessage() throws JMSException {
+
+    return null;
+  }
+
+  public TemporaryTopic createTemporaryTopic() throws JMSException {
+
+    return null;
+  }
+
+  public TextMessage createTextMessage() throws JMSException {
+
+    return null;
+  }
+
+  public TextMessage createTextMessage(String arg0) throws JMSException {
+
+    return null;
+  }
+
+  public Topic createTopic(String arg0) throws JMSException {
+
+    return null;
+  }
+
+  public int getAcknowledgeMode() throws JMSException {
+
+    return 0;
+  }
+
+  public MessageListener getMessageListener() throws JMSException {
+
+    return null;
+  }
+
+  public boolean getTransacted() throws JMSException {
+
+    return false;
+  }
+
+  public void recover() throws JMSException {
+
+    
+  }
+
+  public void rollback() throws JMSException {
+
+    
+  }
+
+  public void run() {
+
+    
+  }
+
+  public void setMessageListener(MessageListener arg0) throws JMSException {
+
+    
+  }
+
+  public void unsubscribe(String arg0) throws JMSException {
+
+    
+  }
+  
+
+}



More information about the logback-dev mailing list