diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-11-28 10:50:05 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-11-28 10:50:05 +0000 |
commit | 9dbb80b03e1ed554e29d24d3dbb42e935a586a96 (patch) | |
tree | f963cf9f586381642d0aadeb724a47c969662d85 | |
parent | 3edd80de888c50aa8d255c3249835da9609df3bb (diff) | |
download | ATCD-9dbb80b03e1ed554e29d24d3dbb42e935a586a96.tar.gz |
ChangeLogTag: Wed Nov 28 10:42:20 UTC 2007 Vladimir Zykov <vladimir.zykov@prismtech.com>
-rw-r--r-- | TAO/ChangeLog | 15 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 36 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_init.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/idl_global.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 102 | ||||
-rw-r--r-- | TAO/tests/Bug_3154_Regression/README | 21 | ||||
-rw-r--r-- | TAO/tests/Bug_3154_Regression/orbsvcs/CosNotification.idl | 390 | ||||
-rwxr-xr-x | TAO/tests/Bug_3154_Regression/run_test.pl | 87 | ||||
-rw-r--r-- | TAO/tests/Bug_3154_Regression/test.idl | 316 |
11 files changed, 985 insertions, 2 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d699d4d0256..b4bd6a76211 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,18 @@ +Wed Nov 28 10:42:20 UTC 2007 Vladimir Zykov <vladimir.zykov@prismtech.com> + + * tests/Bug_3154_Regression/orbsvcs/CosNotification.idl: + * tests/Bug_3154_Regression/test.idl: + * tests/Bug_3154_Regression/run_test.pl: + * tests/Bug_3154_Regression/README: + * TAO_IDL/include/idl_global.h: + * TAO_IDL/be/be_global.cpp: + * TAO_IDL/be_include/be_global.h: + * TAO_IDL/fe/fe_init.cpp: + * TAO_IDL/driver/drv_preproc.cpp: + * TAO_IDL/util/utl_global.cpp: + Added a test and implementation of the feature described + by Bug#3154. + Wed Nov 28 07:33:54 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * orbsvcs/LoadBalancer/Signal_Handler.{h,cpp}: diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 5debd35b6b6..23d5441cd95 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -111,7 +111,8 @@ BE_GlobalData::BE_GlobalData (void) gen_local_iface_anyops_ (true), use_clonable_in_args_ (false), gen_template_export_ (false), - gen_ostream_operators_ (false) + gen_ostream_operators_ (false), + gen_custom_ending_ (true) { } @@ -253,6 +254,9 @@ BE_GlobalData::be_get_client_hdr (UTL_String *idl_file_name, ACE_CString fn (idl_file_name->get_string ()); ACE_CString fn_ext = fn.substr (fn.length () - 5); bool orb_file = (fn_ext == ".pidl" || fn_ext == ".PIDL"); + if (!orb_file && !be_global->gen_custom_ending () && + idl_global->validate_orb_include (idl_file_name)) + orb_file = true; return be_change_idl_file_extension (idl_file_name, orb_file @@ -285,6 +289,9 @@ BE_GlobalData::be_get_server_hdr (UTL_String *idl_file_name, ACE_CString fn (idl_file_name->get_string ()); ACE_CString fn_ext = fn.substr (fn.length () - 5); bool orb_file = (fn_ext == ".pidl" || fn_ext == ".PIDL"); + if (!orb_file && !be_global->gen_custom_ending () && + idl_global->validate_orb_include (idl_file_name)) + orb_file = true; return be_change_idl_file_extension (idl_file_name, orb_file @@ -1598,6 +1605,18 @@ BE_GlobalData::gen_local_iface_anyops (bool val) this->gen_local_iface_anyops_ = val; } +bool +BE_GlobalData::gen_custom_ending (void) const +{ + return this->gen_custom_ending_; +} + +void +BE_GlobalData::gen_custom_ending (bool val) +{ + this->gen_custom_ending_ = val; +} + ACE_CString BE_GlobalData::spawn_options (void) { @@ -2321,6 +2340,12 @@ BE_GlobalData::parse_args (long &i, char **av) )); } } + else if (av[i][2] == 'e') + { + // disable custom file endings for included idl/pidl + // files from TAO specific include paths. + be_global->gen_custom_ending (false); + } else { ACE_ERROR (( @@ -2880,6 +2905,15 @@ BE_GlobalData::usage (void) const ACE_TEXT (" -Sorb\t\t\tsuppress generating include of ORB.h") ACE_TEXT (" (disabled by default)\n") )); + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT (" -Se\t\t\tdisable custom file ending for included") + ACE_TEXT (" idl/pidl files\n\t\t\t") + ACE_TEXT ("that are found in TAO specific includes directories,\n\t\t\t") + ACE_TEXT ("(i.e. $TAO_ROOT, $TAO_ROOT/tao, $TAO_ROOT/orbsvcs,\n\t\t\t") + ACE_TEXT ("$TAO_ROOT/CIAO, $TAO_ROOT/CIAO/ciao)") + ACE_TEXT (" (enabled by default)\n") + )); } AST_Generator * diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index c46d3fdfe8a..0c0fe0eaa8e 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -574,6 +574,10 @@ public: void gen_local_iface_anyops (bool val); // Accessors for the member gen_local_iface_anyops_. + bool gen_custom_ending (void) const; + void gen_custom_ending (bool val); + // Accessors for the member gen_custom_ending_. + ACE_CString spawn_options (void); // Command line passed to ACE_Process::spawn. Different // implementations in IDL and IFR backends. @@ -818,6 +822,11 @@ private: bool gen_ostream_operators_; // Generate ostream operators for each type declaration, for // debuggin or logging. + + bool gen_custom_ending_; + // True by default, but a command line option can turn this off so + // custom ending will not be applied to files in $TAO_ROOT/, + // $TAO_ROOT/tao, $TAO_ROOT/orbsvcs, $TAO_ROOT/CIAO, $TAO_ROOT/CIAO/ciao. }; #endif /* _BE_GLOBAL_H */ diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 05489716ebf..748fb1af461 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -269,6 +269,8 @@ DRV_cpp_init (void) char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT"); + // When adding new dirs here don't forget to update + // IDL_GlobalData::validate_orb_include accordingly. if (TAO_ROOT != 0) { DRV_add_include_path (include_path1, TAO_ROOT, 0); @@ -297,7 +299,7 @@ DRV_cpp_init (void) } } - idl_global->tao_root (include_path1.c_str ()); + idl_global->tao_root (include_path1.c_str ()); } // Add any flags in platform_cpp_args to cpp's DRV_arglist. @@ -486,6 +488,8 @@ DRV_cpp_post_init (void) ACE_CString include_path3, include_path4, include_path5; + // When adding new dirs here don't forget to update + // IDL_GlobalData::validate_orb_include accordingly. if (TAO_ROOT != 0) { DRV_add_include_path (include_path3, TAO_ROOT, "/orbsvcs"); diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index d94c7f97d15..23caa1efd4b 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -692,6 +692,8 @@ FE_populate (void) void FE_store_env_include_paths (void) { + // If this method have to change then don't forget to update + // util/utl_global.cpp:IDL_GlobalData::validate_orb_include (...). ACE_Env_Value<char*> incl_paths ("INCLUDE", (char *) 0); const char *aggr_str = incl_paths; diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index c80415e5752..a300eddf740 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -621,6 +621,9 @@ public: static char* translateName(const char* name, char *name_buf); #endif + bool validate_orb_include (UTL_String *); + // Check if included file is in TAO specific include dirs. + private: // Data UTL_ScopeStack pd_scopes; // Store scopes stack diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index b4ebc4c1668..ae4da67cc87 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -81,6 +81,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ace/OS_NS_strings.h" #include "ace/Process.h" #include "ace/OS_NS_ctype.h" +#include "ace/Env_Value_T.h" ACE_RCSID (util, utl_global, @@ -1859,3 +1860,104 @@ IDL_GlobalData::open_included_file (char const * filename, return f; } + +bool +IDL_GlobalData::validate_orb_include (UTL_String *idl_file_name) +{ + // It's important to update the check of include_counter + // at the end of this method once new TAO include dirs are + // added somewhere in driver/drv_preproc.cpp + + // Count number of includes in environment variable. + // If the way how INCLUDE environment variable is processed + // will change in fe/fe_init.cpp:FE_store_env_include_paths () + // then the below do/while loop has to be changed accordingly. + int env_includes = 1; + ACE_Env_Value<char*> incl_paths ("INCLUDE", + (char *) 0); + const char *aggr_str = incl_paths; + if (aggr_str != 0) + { + char separator; +#if defined (ACE_WIN32) + separator = ';'; +#else + separator = ':'; +#endif + do + { + aggr_str = ACE_OS::strchr (aggr_str, separator); + env_includes++; + } while (aggr_str != 0 && aggr_str++); + } + + char abspath[MAXPATHLEN] = ""; + char *full_path = 0; + unsigned int include_counter = 0; + + for (ACE_Unbounded_Queue_Iterator<char *>iter ( + this->include_paths_ + ); + !iter.done (); ) + { + ACE_CString partial; + if (include_counter == 0) + { + char *path_tmp = ACE_OS::getcwd (abspath, MAXPATHLEN); + partial = path_tmp; + } + else + { + char **path_tmp = 0; + iter.next (path_tmp); + iter.advance (); + partial = *path_tmp; + } + + // If the include path has literal "s (because of an include + // of a Windows path with spaces), we must remove them here. + const char *tmp_partial = partial.c_str (); + if (tmp_partial && this->hasspace (tmp_partial) && tmp_partial[0] == '\"') + { + partial = + partial.substr (1, partial.length () - 2); + } + + partial += ACE_DIRECTORY_SEPARATOR_STR; + partial += idl_file_name->get_string (); + full_path = + ACE_OS::realpath (partial.c_str (), abspath); + + if (full_path != 0) + { + FILE *test = ACE_OS::fopen (abspath, "r"); + + if (test == 0) + { + ++include_counter; + continue; + } + + ACE_OS::fclose (test); + + // This file name is an orb file if it is either in first 2 + // dirs (i.e. $TAO_ROOT, $TAO_ROOT/tao) or in + // last 3 dirs (i.e. $TAO_ROOT/orbsvcs, $TAO_ROOT/CIAO, + // $TAO_ROOT/CIAO/ciao) + if (include_counter != 0 && + (include_counter - env_includes <= 2 || + include_counter - env_includes >= this->include_paths_.size () - 3)) + { + return true; + } + else + { + return false; + } + } + + ++include_counter; + } + + return false; +} diff --git a/TAO/tests/Bug_3154_Regression/README b/TAO/tests/Bug_3154_Regression/README new file mode 100644 index 00000000000..effb1a6fd58 --- /dev/null +++ b/TAO/tests/Bug_3154_Regression/README @@ -0,0 +1,21 @@ +This test uses newly implemented -Se feature of tao_idl. Using this feature +user can prohibit custom endings (e.g. -hs or -hc) for TAO specific include fils. + +__Regression Output__ + +[vzykov@glasgow tao566_regression]$ ./run_test.pl +ERROR: Custom endings are incorrectly applied. + + +__Successful Output__ + +[vzykov@glasgow tao563_regression]$ ./run_test.pl +processing test.idl +INFO: orbsvcs/FT_CORBA_ORBC.h +INFO: orbsvcs/CosNotification_stub.h +INFO: orbsvcs/PortableGroupC.h +INFO: test_stub.h +INFO: orbsvcs/FT_CORBA_ORBC.h +INFO: orbsvcs/CosNotification_skel.h +INFO: orbsvcs/PortableGroupS.h +INFO: Test passed! diff --git a/TAO/tests/Bug_3154_Regression/orbsvcs/CosNotification.idl b/TAO/tests/Bug_3154_Regression/orbsvcs/CosNotification.idl new file mode 100644 index 00000000000..ec1a43547ca --- /dev/null +++ b/TAO/tests/Bug_3154_Regression/orbsvcs/CosNotification.idl @@ -0,0 +1,390 @@ +/** + * @file CosNotification.idl + * + * @brief Define the CosNotification module + * + * CosNotification.idl,v 1.3 2002/07/01 14:13:59 parsons Exp + * + * @author Pradeep Gore <pradeep@cs.wustl.edu> + */ + +#ifndef _COS_NOTIFICATION_IDL_ +#define _COS_NOTIFICATION_IDL_ + +#pragma prefix "omg.org" + +/** + * @namespace CosNotification + * + * @brief Define basic data structures used by the Notification + * Service + */ +module CosNotification +{ + /// Dummy typedef for strings, if the intent was to support I18N + /// strings the spec should have used wstring + typedef string Istring; + + /// Properties are named using a string + typedef Istring PropertyName; + + /// Property values are stored using anys + typedef any PropertyValue; + + /** + * @struct Property + * + * @brief Define a name/value pair. + * + * Events are described using named/value sequences, this structure + * defines the name/value pair. + */ + struct Property { + /// The name + PropertyName name; + /// The value + PropertyValue value; + }; + + /// Define a sequence of properties. + typedef sequence<Property> PropertySeq; + + //@{ + /** + * @name Different kinds of property sequences + * + * @brief The following are all sequences of Property, but + * serve different purposes. + */ + /// Property sequence used for optional header fields + typedef PropertySeq OptionalHeaderFields; + + /// Property sequence used for the event body that can be used + /// in filtering + typedef PropertySeq FilterableEventBody; + + /// Specify quality of service properties + typedef PropertySeq QoSProperties; + + /// Specify administrative properties + typedef PropertySeq AdminProperties; + //@} + + /** + * @struct _EventType + * + * @brief Define event type names. + * + * Different vertical industries (domains) can define well-known + * events (event_types). This structure is used for that purpose + */ + struct _EventType { + /// The name of the vertical industry defining the event type. + string domain_name; + /// The type of event. + string type_name; + }; + /// A sequence of event types + typedef sequence<_EventType> EventTypeSeq; + + /** + * @struct PropertyRange + * + * @brief A structure to define property ranges. + * + */ + struct PropertyRange { + /// Lower end of the range + PropertyValue low_val; + /// High end of the range + PropertyValue high_val; + }; + + /** + * @struct NamedPropertyRange + * + * @brief A named property range + */ + struct NamedPropertyRange { + /// The name + PropertyName name; + /// The range + PropertyRange range; + }; + /// A sequence of named property ranges + typedef sequence<NamedPropertyRange> NamedPropertyRangeSeq; + + /** + * @enum QoSError_code + * + * @brief Describe QoS errors. + */ + enum QoSError_code { + /// The application has requested an unsupported QoS property + UNSUPPORTED_PROPERTY, + /// The application has requested a QoS property that, though + /// supported, cannot be set in the requested scope. + UNAVAILABLE_PROPERTY, + /// The application has requested a QoS property with an + /// unsupported value. + UNSUPPORTED_VALUE, + /// The application has requested a QoS property with a supported + /// value, but unavailable at the requeste scope. + UNAVAILABLE_VALUE, + /// The property name is unknown or not recognized. + BAD_PROPERTY, + /// The value type for the requested property is invalid + BAD_TYPE, + /// The value for the requested property is illegal + BAD_VALUE + }; + + /** + * @struct PropertyError + * + * @brief Describe the problems detected with an application + * requested QoS. + * + * If there are any problems with an application request for QoS the + * problems are raised using an exception that contains all the + * problems, and a description of the valid values (if they apply). + */ + struct PropertyError { + /// Property error description + QoSError_code code; + /// Property name with a problem + PropertyName name; + /// Valid range for that property in the Notification Service + /// implementation + PropertyRange available_range; + }; + /// List of property errors. + typedef sequence<PropertyError> PropertyErrorSeq; + + /** + * @exception UnsupportedQoS + * + * @brief Exception used to describe problems with one or more QoS + * requests + * + */ + exception UnsupportedQoS { + /// Complete description of the properties in error + PropertyErrorSeq qos_err; + }; + + /** + * @exception UnsupportedAdmin + * + * @brief Exception used to describe problems with one or more Admin + * properties + */ + exception UnsupportedAdmin { + /// The complete description of the invalid properties. + PropertyErrorSeq admin_err; + }; + + /** + * @struct FixedEventHeader + * + * @brief Define the 'fixed' part of the event header + */ + struct FixedEventHeader { + /// The event type + _EventType event_type; + /// A (possibly unique) name for the particular event + string event_name; + }; + + /** + * @struct EventHeader + * + * @brief Complete event header + */ + struct EventHeader { + /// The fixed part of the event header + FixedEventHeader fixed_header; + /// The optional part + OptionalHeaderFields variable_header; + }; + + /** + * @struct StructuredEvent + * + * @brief Define structured events + */ + struct StructuredEvent { + /// The header + EventHeader header; + /// The part of the body used for filtering + FilterableEventBody filterable_data; + /// The part of the body not used for filtering + any remainder_of_body; + }; + /// Sequence of events, for batch processing + typedef sequence<StructuredEvent> EventBatch; + + //@{ + /** + * @name Constants for QoS Properties + * + * The following constant declarations define the standard QoS + * property names and the associated values each property can take + * on. The name/value pairs for each standard property are grouped, + * beginning with a string constant defined for the property name, + * followed by the values the property can take on. + */ + + const string EventReliability = "EventReliability"; + const short BestEffort = 0; + const short Persistent = 1; + + /// Can take on the same values as EventReliability + const string ConnectionReliability = "ConnectionReliability"; + + const string Priority = "Priority"; + const short LowestPriority = -32767; + const short HighestPriority = 32767; + const short DefaultPriority = 0; + + /// StartTime takes a value of type TimeBase::UtcT. + const string StartTime = "StartTime"; + + /// StopTime takes a value of type TimeBase::UtcT. + const string StopTime = "StopTime"; + + /// Timeout takes on a value of type TimeBase::TimeT + const string Timeout = "Timeout"; + + const string OrderPolicy = "OrderPolicy"; + const short AnyOrder = 0; + const short FifoOrder = 1; + const short PriorityOrder = 2; + const short DeadlineOrder = 3; + + /// DiscardPolicy takes on the same values as OrderPolicy, plus + const string DiscardPolicy = "DiscardPolicy"; + const short LifoOrder = 4; + + /// MaximumBatchSize takes on a value of type long + const string MaximumBatchSize = "MaximumBatchSize"; + + /// PacingInterval takes on a value of type TimeBase::TimeT + const string PacingInterval = "PacingInterval"; + + /// StartTimeSupported takes on a boolean value + const string StartTimeSupported = "StartTimeSupported"; + + /// StopTimeSupported takes on a boolean value + const string StopTimeSupported = "StopTimeSupported"; + + /// MaxEventsPerConsumer takes on a value of type long + const string MaxEventsPerConsumer = "MaxEventsPerConsumer"; + + //@} + + /** + * @interface QoSAdmin + * + * @brief Interface used to control the QoS properties of an Event + * Service components (Channel, Proxy, etc.) + * + * QoS properties of a channel can be set at different levels, + * including the proxies, the ConsumerAdmin and the SupplierAdmin + * objects. Each one of those components offers this interface to + * allow control over the properties. + */ + interface QoSAdmin { + /// Get the current QoS properties + /** + * The operation returns the properties set: + * - At the level queried + * - Not set at the level queried but set at a higher-level + * - Not set at all but having a default value. + */ + QoSProperties get_qos(); + + /// Set the QoS properties + /** + * @param qos The requested QoS properties + * @throws UnsupportedQoS if the requested QoS cannot be + * implemented or is invalid. The exception contents describe + * the problem(s) in detail. + */ + void set_qos ( in QoSProperties qos) + raises ( UnsupportedQoS ); + + /// Validate a set of QoS properties + /** + * @param required_qos the list of properties requested by the + * application + * @param available_qos If the properties are supported this + * argument returns a list of any other properties that + * could also be set. + * @throws UnsupportedQoS if the requested QoS cannot be + * implemented or is invalid. The exception contents describe + * the problem(s) in detail. + */ + void validate_qos (in QoSProperties required_qos, + out NamedPropertyRangeSeq available_qos ) + raises ( UnsupportedQoS ); + }; + + //@{ + /** + * @name Constants for Admin Properties + * + * Admin properties are defined in similar manner as QoS + * properties. The only difference is that these properties are + * related to channel administration policies, as opposed message + * quality of service + */ + /// MaxQueueLength takes on a value of type long + const string MaxQueueLength = "MaxQueueLength"; + + /// MaxConsumers takes on a value of type long + const string MaxConsumers = "MaxConsumers"; + + /// MaxSuppliers takes on a value of type long + const string MaxSuppliers = "MaxSuppliers"; + + /// RejectNewEvents takes on a value of type Boolean + const string RejectNewEvents = "RejectNewEvents"; + //@} + + /** + * @interface AdminPropertiesAdmin + * + * @brief Define the interface to manipulate the Admin properties of + * a Notification Service components + * + * Several Notification Service components have Admin properties, + * including the Event Channel, its ConsumerAdmin and SupplierAdmin + * objects as well as the proxies. This interface is used to + * control the Admin properties of each one of those components. + */ + interface AdminPropertiesAdmin { + /// Get the Admin properties + /** + * The operation returns the properties set: + * - At the level queried + * - Not set at the level queried but set at a higher-level + * - Not set at all but having a default value. + */ + AdminProperties get_admin(); + + /// Set the Admin properities + /** + * @param admin The list of Admin properties requested + * @throws UnsupportedAdmin if the requested admin properties + * cannot be implemented or are invalid + */ + void set_admin (in AdminProperties admin) + raises ( UnsupportedAdmin); + }; + +}; + +#pragma prefix "" + +#endif /* _COS_NOTIFICATION_IDL_ */ diff --git a/TAO/tests/Bug_3154_Regression/run_test.pl b/TAO/tests/Bug_3154_Regression/run_test.pl new file mode 100755 index 00000000000..73c186cb3d7 --- /dev/null +++ b/TAO/tests/Bug_3154_Regression/run_test.pl @@ -0,0 +1,87 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; + +# The location of the tao_idl utility - depends on O/S +if ($^O eq "MSWin32") +{ + $tao_idl = "../../../bin/tao_idl"; +} +else +{ + $tao_idl = "../../../TAO/TAO_IDL/tao_idl"; +} + +# IDL file names +$idl_file = PerlACE::LocalFile ("test.idl"); + +# The IDL compiler +$TAO_IDL = new PerlACE::Process ("$tao_idl"); + +$TAO_IDL->Arguments ("-Se -hs _skel.h -hc _stub.h test.idl"); +$TAO_IDL->SpawnWaitKill (20); + +$found = 0; + +$stub_h = PerlACE::LocalFile("test_stub.h"); +open (STUB_HANDLE, "<$stub_h"); +while ($line = <STUB_HANDLE>) +{ + # Process the line. + chomp $line; + + if ($line =~ /^\#include \"orbsvcs\/FT_CORBA_ORBC\.h\"$/) { + print "INFO: orbsvcs/FT_CORBA_ORBC.h\n"; + $found++; + } + if ($line =~ /^\#include \"orbsvcs\/CosNotification_stub\.h\"$/) { + print "INFO: orbsvcs/CosNotification_stub.h\n"; + $found++; + } + if ($line =~ /\#include \"orbsvcs\/PortableGroupC\.h\"$/) { + print "INFO: orbsvcs/PortableGroupC.h\n"; + $found++; + } +} +close(STUB_HANDLE); + +$skel_h = PerlACE::LocalFile("test_skel.h"); +open (SKEL_HANDLE, "<$skel_h"); +while ($line = <SKEL_HANDLE>) +{ + # Process the line. + chomp $line; + + if ($line =~ /^\#include \"test_stub\.h\"$/) { + print "INFO: test_stub.h\n"; + $found++; + } + if ($line =~ /^\#include \"orbsvcs\/FT_CORBA_ORBS\.h\"$/) { + print "INFO: orbsvcs/FT_CORBA_ORBC.h\n"; + $found++; + } + if ($line =~ /^\#include \"orbsvcs\/CosNotification_skel\.h\"$/) { + print "INFO: orbsvcs/CosNotification_skel.h\n"; + $found++; + } + if ($line =~ /\#include \"orbsvcs\/PortableGroupS\.h\"$/) { + print "INFO: orbsvcs/PortableGroupS.h\n"; + $found++; + } +} +close(SKEL_HANDLE); + +unlink <*.cpp *.inl *.h>; + +if ($found == 7) { + print "INFO: Test passed!\n"; + exit 0; +} else { + print STDERR "ERROR: Custom endings are incorrectly applied.\n"; + exit 1; +} diff --git a/TAO/tests/Bug_3154_Regression/test.idl b/TAO/tests/Bug_3154_Regression/test.idl new file mode 100644 index 00000000000..d28d52656d4 --- /dev/null +++ b/TAO/tests/Bug_3154_Regression/test.idl @@ -0,0 +1,316 @@ +// The next include is TAO specific. +#include "orbsvcs/FT_CORBA_ORB.idl" + +#include "orbsvcs/CosNotification.idl" +#include "orbsvcs/PortableGroup.idl" + +#pragma prefix "omg.org" + +/** +* This module describes interfaces and data types of the CORBA +* Fault Tolerance service. +*/ + +module FT +{ + /// Specification for the Common Types and Exceptions for + /// ReplicationManager + + /// Forward declarations + interface GenericFactory; + interface FaultNotifier; + + /// Useful typedefs. + typedef CORBA::RepositoryId _TypeId; + typedef Object ObjectGroup; + + typedef any Value; + + /** + * @struct Property + * + * @brief A property name and a value association. + */ + struct Property { + Value val; + }; + + /// Some mor euseful typedefs. + typedef sequence<Property> Properties; + typedef Properties Criteria; + + /** + * @struct FactoryInfo + * + * @brief <@todo> + * + */ + struct FactoryInfo { + GenericFactory the_factory; + Criteria the_criteria; + }; + + typedef sequence<FactoryInfo> FactoryInfos; + + typedef long ReplicationStyleValue; + const ReplicationStyleValue STATELESS = 0; + const ReplicationStyleValue COLD_PASSIVE = 1; + const ReplicationStyleValue WARM_PASSIVE = 2; + const ReplicationStyleValue ACTIVE = 3; + const ReplicationStyleValue ACTIVE_WITH_VOTING = 4; + typedef long MembershipStyleValue; + const MembershipStyleValue MEMB_APP_CTRL = 0; + const MembershipStyleValue MEMB_INF_CTRL = 1; + typedef long ConsistencyStyleValue; + const ConsistencyStyleValue CONS_APP_CTRL = 0; + const ConsistencyStyleValue CONS_INF_CTRL = 1; + typedef long FaultMonitoringStyleValue; + const FaultMonitoringStyleValue PULL = 0; + const FaultMonitoringStyleValue PUSH = 1; + const FaultMonitoringStyleValue NOT_MONITORED = 2; + typedef long FaultMonitoringGranularityValue; + const FaultMonitoringGranularityValue MEMB = 0; + const FaultMonitoringGranularityValue LOC = 1; + const FaultMonitoringGranularityValue LOC_AND_TYPE = 2; + typedef FactoryInfos FactoriesValue; + typedef unsigned short InitialNumberReplicasValue; + typedef unsigned short MinimumNumberReplicasValue; + + typedef TimeBase::TimeT CheckpointIntervalValue; + exception InterfaceNotFound {}; + exception ObjectGroupNotFound {}; + exception MemberNotFound {}; + exception MemberAlreadyPresent {}; + exception BadReplicationStyle {}; + exception ObjectNotCreated {}; + exception ObjectNotAdded {}; + exception PrimaryNotSet {}; + exception UnsupportedProperty { + Value val; + }; + + exception InvalidProperty { + Value val; }; + + exception NoFactory { + _TypeId type_id; }; + + exception InvalidCriteria { + Criteria invalid_criteria; }; + + exception CannotMeetCriteria { + Criteria unmet_criteria; }; + + // Specification of PropertyManager Interface + // which ReplicationManager Inherits + + interface PropertyManager { + + void set_default_properties(in Properties props) + raises (InvalidProperty, UnsupportedProperty); + Properties get_default_properties(); + + void remove_default_properties(in Properties props) + raises (InvalidProperty, UnsupportedProperty); + + void set_type_properties(in _TypeId type_id, + in Properties overrides) + raises (InvalidProperty, UnsupportedProperty); + + Properties get_type_properties(in _TypeId type_id); + + void remove_type_properties(in _TypeId type_id, + in Properties props) + raises (InvalidProperty, UnsupportedProperty); + + void set_properties_dynamically(in ObjectGroup object_group, + in Properties overrides) + raises(ObjectGroupNotFound, InvalidProperty, UnsupportedProperty); + + Properties get_properties(in ObjectGroup object_group) + raises(ObjectGroupNotFound); }; + + // Specification of ObjectGroupManager Interface + // which ReplicationManager Inherits + /** + * This interface provides operations that allow an application to add, remove + * and locate members of an object group and to obtain the current reference and + * identifier for an object group. + * + */ + + interface ObjectGroupManager { + /** + * This operation allows the application to exercise explicit control over the + * creation of a member of an object group, and to determine where the member + * is created. + * + * @param object_group Reference for the object group to which the member is + * to be added. + * @param the_location The physical location. + * @param type_id The repository identifier for the type of the object. + * @param the_criteria Parameters to be passed to the factory, which the factory + * evaluates before creating the object. + * + * @return The object group reference of the object group with the member added. + */ + ObjectGroup create_member(in ObjectGroup object_group, + in _TypeId type_id, + in Criteria the_criteria) + raises(ObjectGroupNotFound, + MemberAlreadyPresent, + NoFactory, + ObjectNotCreated, + InvalidCriteria, + CannotMeetCriteria); + + /** + * This operation allows an application to add an existing object to an object + * group at a particular location. + * + * @param object_group Reference for the object group to which the existing object + * is to be added. + * @param the_location The physical location of the object to be added. + * @param member The reference of the object to be added. + * + * @return The object group reference of the object group with the object added. + */ + ObjectGroup add_member(in ObjectGroup object_group, + in Object member) + raises(ObjectGroupNotFound, + MemberAlreadyPresent, + ObjectNotAdded); + + /** + * This operation allows an application to remove a member from an object + * group at a particular location. + * + * @param object_group Reference for the object group to which the member + * is to be removed. + * @param the_location The physical location of the member to be removed. + * + * @return The object group reference of the member removed. + */ + ObjectGroup remove_member(in ObjectGroup object_group) + raises(ObjectGroupNotFound, + MemberNotFound); + + /** + * This operation allows the application to select the member of the object group + * that is to be the primary. + * + * @param object_group Reference for the object group whose primary is to be + * determined. + * @param the_location The physical location of the member that is to become + * the primary. + * + * @return The object group reference with the primary member at the given + * location. + */ + ObjectGroup set_primary_member(in ObjectGroup object_group) + raises(ObjectGroupNotFound, + MemberNotFound, + PrimaryNotSet, + BadReplicationStyle); + + ObjectGroupId get_object_group_id(in ObjectGroup object_group) + raises(ObjectGroupNotFound); + + ObjectGroup get_object_group_ref(in ObjectGroup object_group) + raises(ObjectGroupNotFound); + + Object get_member_ref(in ObjectGroup object_group) + raises(ObjectGroupNotFound, MemberNotFound); }; + + + // Specification of GenericFactory Interface + // which ReplicationManager Inherits and Application Objects Implement + /** + * This interface allows the creation/deletion of replicated objects (object groups), + * replicas (members of object groups), and unreplicated objects. + */ + interface GenericFactory { + typedef any FactoryCreationId; + + /** + * This operation creates an object or an object group, using the type_id + * parameter to determine which type of object to create and the_criteria + * parameter to determine restrictions on how and where to create the object. + * + * @param type_id The repository identifier of the object to be created by + * the factory. + * + * @param the_criteria Information passed to the factory, which the factory + * evaluates before creating the object. Examples of criteria are initialization + * values, constraints on the object, preferred location of the object, fault + * tolerance properties for an object group, etc. + * + * @param factory_creation_id An identifier that allows the factory to delete + * the object subsequently. + * + * @return The reference to the object created by the GenericFactory. When the + * GenericFactory interface is implemented by the application’s local factory + * object, the create_object() operation returns an object reference as a result. + * When the GenericFactory interface is inherited by the Replication Manager, the + * create_object() operation returns an object group reference as a result. + * + * @exception NoFactory Raised if the factory cannot create an individual object + * of the type_id at the location. + * @exception ObjectNotCreated Raised if the factory cannot create the object. + * @exception InvalidCriteria Raised if the factory does not understand the criteria. + * @exception InvalidProperty Raised if a property passed in as criteria is invalid. + * @exception CannotMeetCriteria Raised if the factory understands the criteria but + * cannot satisfy it. + */ + Object create_object(in _TypeId type_id, + in Criteria the_criteria, + out FactoryCreationId factory_creation_id) + raises (NoFactory, + ObjectNotCreated, + InvalidCriteria, + InvalidProperty, + CannotMeetCriteria); }; + + // Specification of ReplicationManager Interface + interface ReplicationManager : PropertyManager, + ObjectGroupManager, + GenericFactory { + void register_fault_notifier(in FaultNotifier fault_notifier); + FaultNotifier get_fault_notifier() + raises (InterfaceNotFound); }; + + // Specification of FaultNotifier Interface + interface FaultNotifier { + typedef unsigned long long ConsumerId; + + void push_structured_fault( + in CosNotification::StructuredEvent event); + + void push_sequence_fault( + in CosNotification::EventBatch events); + + }; + + // Specifications for Logging and Recovery + typedef sequence<octet> State; + + exception NoStateAvailable {}; + exception InvalidState {}; + + exception NoUpdateAvailable {}; + exception InvalidUpdate {}; + + // Specification of Checkpointable Interface + // which Updateable and Application Objects Inherit + interface Checkpointable { State get_state() + raises(NoStateAvailable); + void set_state(in State s) raises(InvalidState); }; + + // Specification of Updateable Interface + // which Application Objects Inherit + interface Updateable : Checkpointable { State get_update() + raises(NoUpdateAvailable); + void set_update(in State s) raises(InvalidUpdate); + }; + +}; |