summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/FT_App/FT_TestReplica.idl
blob: 7df01cb3cfc42c217d386b2ab6038eadc5ffd665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* -*- IDL -*- */
//=============================================================================
/**
 *  @file    FT_TestReplica.idl
 *
 *  $Id$
 *
 *  This file defines an interface used to test Fault Tolerant CORBA.
 *
 *  @author Dale Wilson <wilson_d@ociweb.com>
 */
//=============================================================================
//
#ifndef FT_TESTREPLICA_IDL
#define FT_TESTREPLICA_IDL

#include "orbsvcs/orbsvcs/FT_Replica.idl"

module FT_TEST
{
  /**
   * A FT_TEST::Replica provides a test target for a FT::FaultDetector
   * It is Updateable (and therefore Checkpointable)
   * and PullMonitorable
   * It declares a simple counter that can be set, incremented, and read
   * via method calls.  The counter is also exposed as a property.
   */
  interface TestReplica : ::FT::Updateable, ::FT::PullMonitorable, ::PortableGroup::TAO_UpdateObjectGroup
  {
    /**
     *  set the counter to an specific value.
     * @param value is the number to be set.
     */
    void set(in long value);

    /**
     * add delta to the counter.
     * @param delta is the number to be added: (delta may be positive, negative or zero).
     * @returns the new value of the counter.
     */
    long increment(in long delta);

    /**
     * retrieve the current counter.
     * @returns the value of the counter.
     */
    long get();


    /**
     * enumerate the points at which
     * the test replica might be convinced to die.
     */
    enum Bane
    {
      NOT_YET,              // normal state, also used to revoke a previous request
      RIGHT_NOW,            // fault immediately during the die() call
      WHILE_IDLE,           // fault while not processing a request
                        // FT_TestReplica interface:
      BEFORE_STATE_CHANGE,  // after receiving request
      BEFORE_REPLICATION,   // after state change
      BEFORE_REPLY,         // after state replication
                        // FT::PullMonitorable interface:
      DURING_IS_ALIVE,
      DENY_IS_ALIVE,
                        // FT::Updatable interface:
      DURING_GET_UPDATE,
      BEFORE_SET_UPDATE,
      AFTER_SET_UPDATE,
                        // FT::Checkpointable interface:
      DURING_GET_STATE,
      BEFORE_SET_STATE,
      AFTER_SET_STATE,
                        // Reserved
      CLEAN_EXIT            // reserved for use by shutdown
    };


    /**
     * die a horrid death.
     * @param when is an arbitrary code to indicate how and when to die.
     */
    void die(in Bane when);


    /**
     * die a clean death.
     */
    oneway void shutdown();

    /**
     * provide direct access to the counter.
     * Suports the same functionality as set and get.
     * Can you say "Encapsulization???" this is a test, remember.
     */
    attribute long counter;
  };

  interface ReplicaFactory : ::PortableGroup::GenericFactory, ::FT::PullMonitorable
  {
    /**
     * die a clean death.
     */
    oneway void shutdown();
  };

  ///////////////////////
  // roles for unit tests
  // A TestReplica can act as a...

//  typedef TestReplica Hobbit;
//  typedef TestReplica Elf;
//  typedef TestReplica Human;

};

#endif // for #ifndef FT_TESTREPLICA_IDL