01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)TestHeartBeatInfo.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: package com.sun.jbi.binding.proxy;
30:
31: import java.util.LinkedList;
32:
33: /**
34: * Tests for the LeaveInfo class
35: *
36: * @author Sun Microsystems, Inc.
37: */
38: public class TestHeartBeatInfo extends junit.framework.TestCase {
39: /**
40: * The constructor for this testcase, forwards the test name to
41: * the jUnit TestCase base class.
42: * @param aTestName String with the name of this test.
43: */
44: public TestHeartBeatInfo(String aTestName) {
45: super (aTestName);
46: }
47:
48: /**
49: * Setup for the test. This creates the ComponentRegistry instance
50: * and other objects needed for the tests.
51: * @throws Exception when set up fails for any reason.
52: */
53: public void setUp() throws Exception {
54: super .setUp();
55: }
56:
57: /**
58: * Cleanup for the test.
59: * @throws Exception when tearDown fails for any reason.
60: */
61: public void tearDown() throws Exception {
62: super .tearDown();
63: }
64:
65: // ============================= test methods ================================
66:
67: /**
68: * testBasics
69: * @throws Exception if an unexpected error occurs
70: */
71: public void testBasics() throws Exception {
72: HeartBeatInfo hbi;
73: HeartBeatInfo hbi2;
74: EventImpl e = new EventImpl();
75: LinkedList ll = new LinkedList();
76:
77: hbi = new HeartBeatInfo("a", 1, 2);
78: assertEquals(hbi.getInstanceId(), "a");
79: assertEquals(hbi.getBirthtime(), 1);
80: assertEquals(hbi.getLastTransitionTime(), 2);
81: assertEquals(hbi.getEventName(), HeartBeatInfo.EVENTNAME);
82: hbi.setEndpoints(ll);
83: assertEquals(hbi.getEndpoints(), ll);
84: hbi.encodeEvent(e);
85: hbi2 = new HeartBeatInfo(e);
86: assertEquals(hbi.getInstanceId(), hbi2.getInstanceId());
87: assertEquals(hbi.getBirthtime(), hbi2.getBirthtime());
88: assertEquals(hbi.getLastTransitionTime(), hbi2
89: .getLastTransitionTime());
90: assertEquals(hbi.getEndpoints(), hbi2.getEndpoints());
91: }
92: }
|