org.seasar.jms.core.mock
クラス BytesMessageMock

java.lang.Object
  上位を拡張 org.seasar.jms.core.mock.MessageMock
      上位を拡張 org.seasar.jms.core.mock.BytesMessageMock
すべての実装されたインタフェース:
BytesMessage, Message

public class BytesMessageMock
extends MessageMock
implements BytesMessage

BytesMessageのモックです。

BytesMessageは二つの状態を持ちます。

writable
メッセージにデータを設定できる状態です
readable
メッセージからデータを読み出せる状態です
モックオブジェクトをデフォルトコンストラクタで構築するとwritable状態のインスタンスが作成されます。 データを設定した後、 reset()メソッドを呼び出すことにより、 readable状態に遷移します。
モックオブジェクトをBytesMessageMock(byte[])で構築するとreadable状態のインスタンスが作成されます。

作成者:
koichik

入れ子のクラスの概要
static class BytesMessageMock.State
          BytesMessageMockの状態を表す列挙
 
フィールドの概要
protected  ByteArrayInputStream bais
          状態がBytesMessageMock.State.READABLEの場合にbytesから読み込むための入力ストリーム
protected  ByteArrayOutputStream baos
          状態がBytesMessageMock.State.WRITABLEの場合にbytesに書き込むための出力ストリーム
protected  byte[] bytes
          JMSメッセージのペイロード
protected  DataInputStream is
          状態がBytesMessageMock.State.READABLEの場合にbytesから読み込むための入力ストリーム
protected  DataOutputStream os
          状態がBytesMessageMock.State.WRITABLEの場合にbytesに書き込むための出力ストリーム
protected  BytesMessageMock.State state
          状態
 
クラス org.seasar.jms.core.mock.MessageMock から継承されたフィールド
JMSCorrelationID, JMSCorrelationIDAsBytes, JMSDeliveryMode, JMSDestination, JMSExpiration, JMSMessageID, JMSPriority, JMSRedelivered, JMSReplyTo, JMSTimestamp, JMSType, properties
 
インタフェース javax.jms.Message から継承されたフィールド
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
コンストラクタの概要
BytesMessageMock()
          writable状態のインスタンスを構築します。
BytesMessageMock(byte[] bytes)
          バイト列を指定してreadable状態のインスタンスを構築します。
 
メソッドの概要
protected  void assertReadable()
          インスタンスがreadable状態であることを検証します。
protected  void assertWritable()
          インスタンスがwritable状態であることを検証します。
 long getBodyLength()
           
protected  JMSException newJMSException(Throwable cause)
          causeを原因として持つJMSExceptionを作成してスローします。
 boolean readBoolean()
           
 byte readByte()
           
 int readBytes(byte[] bytes)
           
 int readBytes(byte[] bytes, int length)
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 int readInt()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 String readUTF()
           
 void reset()
           
 void writeBoolean(boolean value)
           
 void writeByte(byte value)
           
 void writeBytes(byte[] value)
           
 void writeBytes(byte[] value, int offset, int length)
           
 void writeChar(char value)
           
 void writeDouble(double value)
           
 void writeFloat(float value)
           
 void writeInt(int value)
           
 void writeLong(long value)
           
 void writeObject(Object value)
           
 void writeShort(short value)
           
 void writeUTF(String value)
           
 
クラス org.seasar.jms.core.mock.MessageMock から継承されたメソッド
acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
インタフェース javax.jms.Message から継承されたメソッド
acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

フィールドの詳細

state

protected BytesMessageMock.State state
状態


bytes

protected byte[] bytes
JMSメッセージのペイロード


baos

protected ByteArrayOutputStream baos
状態がBytesMessageMock.State.WRITABLEの場合にbytesに書き込むための出力ストリーム


os

protected DataOutputStream os
状態がBytesMessageMock.State.WRITABLEの場合にbytesに書き込むための出力ストリーム


bais

protected ByteArrayInputStream bais
状態がBytesMessageMock.State.READABLEの場合にbytesから読み込むための入力ストリーム


is

protected DataInputStream is
状態がBytesMessageMock.State.READABLEの場合にbytesから読み込むための入力ストリーム

コンストラクタの詳細

BytesMessageMock

public BytesMessageMock()
writable状態のインスタンスを構築します。


BytesMessageMock

public BytesMessageMock(byte[] bytes)
バイト列を指定してreadable状態のインスタンスを構築します。

パラメータ:
bytes - バイト列
メソッドの詳細

assertWritable

protected void assertWritable()
                       throws MessageNotWriteableException
インスタンスがwritable状態であることを検証します。

例外:
MessageNotWriteableException - インスタンスがwritable状態でない場合にスローされます

assertReadable

protected void assertReadable()
                       throws MessageNotReadableException
インスタンスがreadable状態であることを検証します。

例外:
MessageNotReadableException - インスタンスがreadable状態でない場合にスローされます

newJMSException

protected JMSException newJMSException(Throwable cause)
causeを原因として持つJMSExceptionを作成してスローします。

パラメータ:
cause - 原因となった例外
戻り値:
causeを原因として持つJMSException

getBodyLength

public long getBodyLength()
                   throws JMSException
定義:
インタフェース BytesMessage 内の getBodyLength
例外:
JMSException

readBoolean

public boolean readBoolean()
                    throws JMSException
定義:
インタフェース BytesMessage 内の readBoolean
例外:
JMSException

readByte

public byte readByte()
              throws JMSException
定義:
インタフェース BytesMessage 内の readByte
例外:
JMSException

readUnsignedByte

public int readUnsignedByte()
                     throws JMSException
定義:
インタフェース BytesMessage 内の readUnsignedByte
例外:
JMSException

readShort

public short readShort()
                throws JMSException
定義:
インタフェース BytesMessage 内の readShort
例外:
JMSException

readUnsignedShort

public int readUnsignedShort()
                      throws JMSException
定義:
インタフェース BytesMessage 内の readUnsignedShort
例外:
JMSException

readChar

public char readChar()
              throws JMSException
定義:
インタフェース BytesMessage 内の readChar
例外:
JMSException

readInt

public int readInt()
            throws JMSException
定義:
インタフェース BytesMessage 内の readInt
例外:
JMSException

readLong

public long readLong()
              throws JMSException
定義:
インタフェース BytesMessage 内の readLong
例外:
JMSException

readFloat

public float readFloat()
                throws JMSException
定義:
インタフェース BytesMessage 内の readFloat
例外:
JMSException

readDouble

public double readDouble()
                  throws JMSException
定義:
インタフェース BytesMessage 内の readDouble
例外:
JMSException

readUTF

public String readUTF()
               throws JMSException
定義:
インタフェース BytesMessage 内の readUTF
例外:
JMSException

readBytes

public int readBytes(byte[] bytes)
              throws JMSException
定義:
インタフェース BytesMessage 内の readBytes
例外:
JMSException

readBytes

public int readBytes(byte[] bytes,
                     int length)
              throws JMSException
定義:
インタフェース BytesMessage 内の readBytes
例外:
JMSException

writeBoolean

public void writeBoolean(boolean value)
                  throws JMSException
定義:
インタフェース BytesMessage 内の writeBoolean
例外:
JMSException

writeByte

public void writeByte(byte value)
               throws JMSException
定義:
インタフェース BytesMessage 内の writeByte
例外:
JMSException

writeShort

public void writeShort(short value)
                throws JMSException
定義:
インタフェース BytesMessage 内の writeShort
例外:
JMSException

writeChar

public void writeChar(char value)
               throws JMSException
定義:
インタフェース BytesMessage 内の writeChar
例外:
JMSException

writeInt

public void writeInt(int value)
              throws JMSException
定義:
インタフェース BytesMessage 内の writeInt
例外:
JMSException

writeLong

public void writeLong(long value)
               throws JMSException
定義:
インタフェース BytesMessage 内の writeLong
例外:
JMSException

writeFloat

public void writeFloat(float value)
                throws JMSException
定義:
インタフェース BytesMessage 内の writeFloat
例外:
JMSException

writeDouble

public void writeDouble(double value)
                 throws JMSException
定義:
インタフェース BytesMessage 内の writeDouble
例外:
JMSException

writeUTF

public void writeUTF(String value)
              throws JMSException
定義:
インタフェース BytesMessage 内の writeUTF
例外:
JMSException

writeBytes

public void writeBytes(byte[] value)
                throws JMSException
定義:
インタフェース BytesMessage 内の writeBytes
例外:
JMSException

writeBytes

public void writeBytes(byte[] value,
                       int offset,
                       int length)
                throws JMSException
定義:
インタフェース BytesMessage 内の writeBytes
例外:
JMSException

writeObject

public void writeObject(Object value)
                 throws JMSException
定義:
インタフェース BytesMessage 内の writeObject
例外:
JMSException

reset

public void reset()
           throws JMSException
定義:
インタフェース BytesMessage 内の reset
例外:
JMSException


Copyright © 2005-2009 The Seasar Foundation. All Rights Reserved.