SessionInfoTest xref

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18  package org.codehaus.activemq.message;
    19
    20
    21  /***
    22   * @version $Revision: 1.1 $
    23   */
    24  public class SessionInfoTest extends PacketTestSupport {
    25
    26      private String producerId = "producer:123";
    27      private String clientId = "client:ABC";
    28      private long startTime = 1234L;
    29      private boolean started = true;
    30
    31      protected void assertValidPacket(Packet packet) {
    32          assertTrue(packet instanceof SessionInfo);
    33          SessionInfo testInfo = (SessionInfo) packet;
    34          assertTrue(testInfo.getId().equals(this.producerId));
    35          assertTrue(testInfo.getClientId().equals(this.clientId));
    36          assertTrue(testInfo.getStartTime() == this.startTime);
    37          assertTrue(testInfo.isStarted() == this.started);
    38      }
    39
    40      protected void assertPacket(Packet packet, Packet expected) {
    41          assertValidPacket(packet);
    42      }
    43
    44      protected Packet createPacket() {
    45          SessionInfo info = new SessionInfo();
    46          info.setId(this.producerId);
    47          info.setClientId(this.clientId);
    48          info.setStartTime(this.startTime);
    49          info.setStarted(this.started);
    50          return info;
    51      }
    52
    53  }