summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-10-07 22:12:00 +0000
committerwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-10-07 22:12:00 +0000
commitd730f1f6c9931ee97d2ba7eba1bb1a821e7fefd7 (patch)
tree56c6713775308bc9bfa7141009a1fcfe6cccae48
parenta4128e366925ca79d6de72bf9e010260819e355f (diff)
downloadATCD-d730f1f6c9931ee97d2ba7eba1bb1a821e7fefd7.tar.gz
ChangeLogTag: Tue Oct 7 16:47:50 2003 Dale Wilson <wilson_d@ociweb.com>
-rw-r--r--TAO/ChangeLog29
-rw-r--r--TAO/orbsvcs/tests/FT_App/FT_App.mpc17
-rw-r--r--TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp35
-rw-r--r--TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h5
-rw-r--r--TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.cpp110
-rw-r--r--TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.h4
-rw-r--r--TAO/orbsvcs/tests/FT_App/StubConfig.cpp322
-rw-r--r--TAO/orbsvcs/tests/FT_App/StubFaultNotifier.cpp64
-rw-r--r--TAO/orbsvcs/tests/FT_App/StubFaultNotifier.h10
-rwxr-xr-xTAO/orbsvcs/tests/FT_App/run_test_detector.pl4
-rwxr-xr-xTAO/orbsvcs/tests/FT_App/run_test_registry.pl248
11 files changed, 625 insertions, 223 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 9e51c761b81..beb90ed1020 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,32 @@
+Tue Oct 7 16:47:50 2003 Dale Wilson <wilson_d@ociweb.com>
+
+ * orbsvcs/tests/FT_App/FT_App.mpc:
+ add *Config project
+
+ * orbsvcs/tests/FT_App/StubConfig.cpp:
+ New file that drives the unit test for FactoryRegistry.
+
+ * orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h:
+ * orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp:
+ Register with FactoryRegistry.
+ New command line options -l location -i type_id
+
+ * orbsvcs/tests/FT_App/FactoryRegistry_i.h:
+ * orbsvcs/tests/FT_App/FactoryRegistry_i.cpp:
+ FactoryRegistry is working.
+
+ * orbsvcs/tests/FT_App/run_test_registry.pl:
+ Unit test for factory registry.
+
+ * orbsvcs/tests/FT_App/run_test_detector.pl:
+ Add new command line options for ReplicaFactory
+
+ * orbsvcs/tests/FT_App/StubFaultNotifier.cpp:
+ * orbsvcs/tests/FT_App/StubFaultNotifier.h:
+ Conform to ACE coding conventions. No functional changes.
+
+ These changes were made in the oci_haft branch.
+
Tues Oct 7 08:44:52 2003 Dale Wilson <wilson_d@ociweb.com>
* tao/Utils/Server_Main.h:
diff --git a/TAO/orbsvcs/tests/FT_App/FT_App.mpc b/TAO/orbsvcs/tests/FT_App/FT_App.mpc
index 946c4e22838..773a43fc6e5 100644
--- a/TAO/orbsvcs/tests/FT_App/FT_App.mpc
+++ b/TAO/orbsvcs/tests/FT_App/FT_App.mpc
@@ -110,7 +110,22 @@ project(*FactoryRegistry): taoclient, fault_tolerance, orbsvcsexe {
IDL_Files {
}
Documentation_Files {
+ }
+}
+
+project(*Config): taoclient, fault_tolerance, orbsvcsexe {
+ exename = ft_config
+
+ Source_Files {
+ StubConfig.cpp
+ }
+
+ // explicitly omit IDL files
+ IDL_Files {
+ }
+
+ Documentation_Files {
// pretend the pl file is documentation for now
run_test_registry.pl
}
-}
+} \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp
index 4ce33159fb1..43436c3aa01 100644
--- a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp
+++ b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp
@@ -48,6 +48,7 @@
FT_ReplicaFactory_i::FT_ReplicaFactory_i ()
: ior_output_file_(0)
, factory_registry_ior_file_(0)
+ , registered_(0)
, ns_name_(0)
, type_id_(0)
, location_(0)
@@ -69,8 +70,6 @@ FT_ReplicaFactory_i::~FT_ReplicaFactory_i ()
// before this object disappears
shutdown_i ();
}
- ACE_DECLARE_NEW_ENV;
- fini (ACE_ENV_SINGLE_ARG_PARAMETER);
}
////////////////////////////////////////////
@@ -219,7 +218,7 @@ int FT_ReplicaFactory_i::idle (int & result)
{
// give the replica's idle processing a change
// ignore the return status (the replica should shut itself down
- // unless result is non-zero.
+ // unless result is non-zero.
// non-zero result means panic.
replica->idle(result);
}
@@ -249,6 +248,13 @@ int FT_ReplicaFactory_i::idle (int & result)
int FT_ReplicaFactory_i::fini (ACE_ENV_SINGLE_ARG_DECL)
{
+static bool hasFinied = false;
+if(hasFinied)
+{
+ ACE_ERROR((LM_ERROR, "******************************************FINI CALLED TWICE!*********************\n"
+ ));
+}
+hasFinied = true;
if (this->ior_output_file_ != 0)
{
ACE_OS::unlink (this->ior_output_file_);
@@ -258,8 +264,28 @@ int FT_ReplicaFactory_i::fini (ACE_ENV_SINGLE_ARG_DECL)
{
this->naming_context_->unbind (this_name_
ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
this->ns_name_ = 0;
}
+
+ if (registered_)
+ {
+ registered_ = 0;
+ ACE_ERROR (( LM_INFO,
+ "%s Unregistering from factory registry\n",
+ identity()
+ ));
+
+ PortableGroup::Location location(1);
+ location.length(1);
+ location[0].id = CORBA::string_dup(location_);
+ this->factory_registry_->unregister_factory (
+ this->type_id_,
+ location
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
return 0;
}
@@ -341,7 +367,7 @@ int FT_ReplicaFactory_i::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
this->type_id_,
info
ACE_ENV_ARG_PARAMETER);
-
+ this->registered_ = 1;
}
else
{
@@ -653,4 +679,3 @@ void FT_ReplicaFactory_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
# pragma instantiate ACE_Vector<FT_TestReplica_i *>
# pragma ACE_Guard<ACE_Mutex>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
diff --git a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h
index c02ddee15fa..3445b15fc12 100644
--- a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h
+++ b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h
@@ -220,6 +220,11 @@ private:
PortableGroup::FactoryRegistry_var factory_registry_;
/**
+ * true if registered with FactoryRegistry
+ */
+ int registered_; // bool
+
+ /**
* A file to which the test replica's IOR will be written
*/
const char * test_output_file_;
diff --git a/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.cpp b/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.cpp
index 104c3e75834..9a3b2dc9016 100644
--- a/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.cpp
+++ b/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.cpp
@@ -174,7 +174,7 @@ int FactoryRegistry_i::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
{
this->identity_ = "file:";
this->identity_ += this->ior_output_file_;
- result = writeIOR (this->ior_output_file_, this->ior_);
+ result = write_ior_file (this->ior_output_file_, this->ior_);
}
else
{
@@ -238,28 +238,16 @@ void FactoryRegistry_i::register_factory (
METHOD_ENTRY(FactoryRegistry_i::register_factory);
PortableGroup::FactoryInfos * infos;
- if (this->registry_.find(type_id, infos) == 0)
- {
- ACE_DEBUG(( LM_DEBUG,
- "register_factory found infos for %s", type_id
- ));
- }
- else
+ if (this->registry_.find(type_id, infos) != 0)
{
ACE_DEBUG(( LM_DEBUG,
- "register_factory: no infos for %s\n", type_id
+ "FactoryRegistry: adding new type: %s\n", type_id
));
// Note the 5. It's a guess about the number of factories
// that might exist for any particular type of object.
// todo: make it a parameter.
- ACE_NEW_NORETURN (infos, PortableGroup::FactoryInfos(5));
- if (infos == 0)
- {
- ACE_ERROR(( LM_ERROR,
- "Can't allocate infos for type: %s\n" , type_id));
- ACE_THROW (CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
- }
+ ACE_NEW_THROW_EX (infos, PortableGroup::FactoryInfos(5),
+ CORBA::NO_MEMORY());
this->registry_.bind(type_id, infos);
}
// at this point infos points to the infos structure
@@ -271,7 +259,9 @@ void FactoryRegistry_i::register_factory (
if (info.the_location == factory_info.the_location)
{
ACE_ERROR(( LM_ERROR,
- "Found duplicate location for type: %s\n" , type_id));
+ "Attempt to register duplicate location %s for type: %s\n" ,
+ ACE_static_cast(const char *, info.the_location[0].id),
+ type_id));
ACE_THROW (PortableGroup::MemberAlreadyPresent() );
}
}
@@ -279,6 +269,13 @@ void FactoryRegistry_i::register_factory (
infos->length(length + 1);
(*infos)[length] = factory_info;
+ ACE_DEBUG(( LM_DEBUG,
+ "FactoryRegistry: Added factory: %s[%d] at %s\n",
+ type_id,
+ ACE_static_cast(int,length + 1),
+ ACE_static_cast(const char *, factory_info.the_location[0].id)
+ ));
+
METHOD_RETURN(FactoryRegistry_i::register_factory);
}
@@ -294,9 +291,6 @@ void FactoryRegistry_i::unregister_factory (
PortableGroup::FactoryInfos * infos;
if (this->registry_.find(type_id, infos) == 0)
{
- ACE_DEBUG(( LM_DEBUG,
- "register_factory found infos for %s", type_id
- ));
// at this point infos points to the infos structure
// for this type..
@@ -308,6 +302,12 @@ void FactoryRegistry_i::unregister_factory (
if (info.the_location == location)
{
found = 1;
+
+ ACE_ERROR(( LM_INFO,
+ "Unregistering factory %s at location %s\n",
+ type_id,
+ ACE_static_cast(const char *, location[0].id)
+ ));
if (length > 1)
{
while (nInfo + 1 < length)
@@ -329,13 +329,21 @@ void FactoryRegistry_i::unregister_factory (
else
{
ACE_ERROR(( LM_ERROR,
- "nregister_factory: no infos for %s", type_id
+ "Attempt to unregister factory for unknown type %s\n", type_id
));
ACE_THROW ( PortableGroup::MemberNotFound() );
infos->length(0);
this->registry_.bind(type_id, infos);
}
+ if (registry_.current_size() == 0)
+ {
+ ACE_ERROR(( LM_INFO,
+ "FactoryRegistry is idle\n"
+ ));
+ this->quit_requested_ |= this->quit_on_idle_;
+ }
+
METHOD_RETURN(FactoryRegistry_i::unregister_factory);
}
@@ -350,7 +358,7 @@ void FactoryRegistry_i::unregister_factory_by_type (
if (this->registry_.unbind(type_id, infos) )
{
ACE_DEBUG(( LM_DEBUG,
- "unregister_factory_by_type found infos for %s", type_id
+ "Unregistering all factories for type %s\n", type_id
));
// delete the entire set of factories for this location.
delete infos;
@@ -358,9 +366,18 @@ void FactoryRegistry_i::unregister_factory_by_type (
else
{
ACE_ERROR(( LM_INFO,
- "Info: unregister_factory_by_type: no infos for %s", type_id
+ "Info: unregister_factory_by_type: unknown type: %s\n", type_id
));
}
+
+ if (registry_.current_size() == 0)
+ {
+ ACE_ERROR(( LM_INFO,
+ "FactoryRegistry is idle\n"
+ ));
+ this->quit_requested_ |= this->quit_on_idle_;
+ }
+
METHOD_RETURN(FactoryRegistry_i::unregister_factory_by_type);
}
@@ -421,9 +438,19 @@ void FactoryRegistry_i::unregister_factory_by_location (
else
{
ACE_ERROR ((LM_ERROR,
- "LOGIC ERROR AT " __FILE__ " (%d): Entry to be deleted disappeared", __LINE__));
+ "LOGIC ERROR AT " __FILE__ " (%d): Entry to be deleted disappeared\n", __LINE__));
}
}
+ //////////////////////////
+ // If all types are gone...
+ if (registry_.current_size() == 0)
+ {
+ ACE_ERROR(( LM_INFO,
+ "FactoryRegistry is idle\n"
+ ));
+ this->quit_requested_ |= this->quit_on_idle_;
+ }
+
METHOD_RETURN(FactoryRegistry_i::unregister_factory_by_location);
}
@@ -437,23 +464,20 @@ void FactoryRegistry_i::unregister_factory_by_location (
METHOD_ENTRY(FactoryRegistry_i::list_factories_by_type);
PortableGroup::FactoryInfos_var infos;
- ACE_NEW_NORETURN(infos, ::PortableGroup::FactoryInfos() );
- if (infos.ptr() == 0)
- {
- ACE_ERROR(( LM_ERROR,
- "list_factories_by_type: Can't allocate infos for type: %s\n" , type_id));
- ACE_THROW (CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
- }
+ ACE_NEW_THROW_EX (infos, ::PortableGroup::FactoryInfos(),
+ CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO));
PortableGroup::FactoryInfos * typeInfos;
- if (this->registry_.unbind(type_id, typeInfos) )
+ if (this->registry_.find(type_id, typeInfos) == 0)
{
- ACE_DEBUG(( LM_DEBUG,
- "unregister_factory_by_type found infos for %s", type_id
- ));
(*infos) = (*typeInfos);
}
+ else
+ {
+ ACE_ERROR(( LM_INFO,
+ "Info: list_factories_by_type: unknown type %s\n", type_id
+ ));
+ }
METHOD_RETURN(FactoryRegistry_i::list_factories_by_type) infos._retn();
}
@@ -465,14 +489,8 @@ void FactoryRegistry_i::unregister_factory_by_location (
{
METHOD_ENTRY(FactoryRegistry_i::list_factories_by_location);
::PortableGroup::FactoryInfos_var infos;
- ACE_NEW_NORETURN(infos, ::PortableGroup::FactoryInfos(this->registry_.current_size()) );
- if (infos.ptr() == 0)
- {
- ACE_ERROR(( LM_ERROR,
- "list_factories_by_location: Can't allocate infos\n"));
- ACE_THROW (CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
- }
+ ACE_NEW_THROW_EX (infos, ::PortableGroup::FactoryInfos(this->registry_.current_size()),
+ CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO));
size_t count = 0;
@@ -506,7 +524,7 @@ void FactoryRegistry_i::unregister_factory_by_location (
//////////////////////////////
// Implementation methods
-int FactoryRegistry_i::writeIOR(const char * outputFile, const char * ior)
+int FactoryRegistry_i::write_ior_file(const char * outputFile, const char * ior)
{
int result = -1;
FILE* out = ACE_OS::fopen (outputFile, "w");
diff --git a/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.h b/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.h
index 9d3a81ab9f9..ca41d740c58 100644
--- a/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.h
+++ b/TAO/orbsvcs/tests/FT_App/FactoryRegistry_i.h
@@ -138,7 +138,7 @@ private:
/**
* Write this factory's IOR to a file
*/
- int writeIOR (const char * outputFile, const char * ior);
+ int write_ior_file (const char * outputFile, const char * ior);
///////////////
// Data Members
@@ -161,7 +161,7 @@ private:
typedef ACE_Guard<ACE_Mutex> InternalGuard;
/**
- * The orb
+ * The orb
*/
CORBA::ORB_var orb_;
diff --git a/TAO/orbsvcs/tests/FT_App/StubConfig.cpp b/TAO/orbsvcs/tests/FT_App/StubConfig.cpp
new file mode 100644
index 00000000000..12b1890a0db
--- /dev/null
+++ b/TAO/orbsvcs/tests/FT_App/StubConfig.cpp
@@ -0,0 +1,322 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file StubConfig.cpp
+ *
+ * $Id$
+ *
+ * This file is part of Fault Tolerant CORBA.
+ * Simple configuration manager for a fault tolerant application.
+ *
+ * @author Dale Wilson <wilson_d@ociweb.com>
+ */
+//=============================================================================
+
+
+#include <iostream>
+#include <fstream>
+
+#include <ace/Get_Opt.h>
+#include <orbsvcs/PortableGroupC.h>
+
+class StubConfig
+{
+ public:
+ ///////////////////////////
+ // construction/destruction
+ StubConfig ();
+
+ ~StubConfig ();
+
+ /////////////////
+ // initialization
+ int parse_args (int argc, char *argv[]);
+
+ int init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL);
+
+ ////////////
+ // execution
+ int run (ACE_ENV_SINGLE_ARG_DECL);
+
+ ////////////
+ // shut down
+ int fini ();
+
+ /////////////////
+ // implementation
+private:
+ void usage (ostream & out)const;
+ int read_ior_file(const char * fileName, CORBA::String_var & ior);
+ int write_ior_file(const char * outputFile, const char * ior);
+
+ ////////////////////
+ // forbidden methods
+ private:
+ StubConfig (const StubConfig & rhs);
+ StubConfig & operator = (const StubConfig & rhs);
+
+ ////////////////
+ // Data members
+ private:
+ CORBA::ORB_var orb_;
+ const char * registry_filename_;
+ PortableGroup::FactoryRegistry_var registry_;
+ const char * type_id_;
+};
+
+
+StubConfig::StubConfig ()
+ : registry_filename_(0)
+ , registry_(0)
+ , type_id_(0)
+{
+}
+
+StubConfig::~StubConfig ()
+{
+}
+
+int
+StubConfig::parse_args (int argc, char *argv[])
+{
+ int result = 0;
+
+ ACE_Get_Opt get_opts (argc, argv, "t:f:");
+ int c;
+
+ while (result == 0 && (c = get_opts ()) != -1)
+ {
+ switch (c)
+ {
+ case 't':
+ {
+ this->type_id_ = get_opts.opt_arg ();
+ break;
+ }
+ case 'f':
+ {
+ this->registry_filename_ = get_opts.opt_arg ();
+ break;
+ }
+
+ default:
+ {
+ std::cerr << "Config: Unknown argument -" << (char) c << std::endl;
+ usage(std::cerr);
+ result = 1;
+ break;
+ }
+ case '?':
+ {
+ usage(std::cerr);
+ result = 1;
+ break;
+ }
+ }
+ }
+
+ if ( this->type_id_ == 0)
+ {
+ std::cerr << "Config: Missing required parameter: -t <type_id> " << std::endl;
+ usage (std::cerr);
+ result = -1;
+ }
+
+ if ( this->registry_filename_ == 0)
+ {
+ std::cerr << "Config: Missing required parameter: -f <FactoryRegistry.ior> " << std::endl;
+ usage (std::cerr);
+ result = -1;
+ }
+
+ return result;
+}
+
+void StubConfig::usage(ostream & out)const
+{
+ out << "usage"
+ << " -t <type_id for objects to be created>"
+ << " -f <factory ior file>"
+ << std::endl;
+}
+
+
+
+int StubConfig::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
+{
+ int result = 0;
+ this->orb_ = orb;
+
+ /////////////////////////////
+ // resolve reference to factory
+ CORBA::String_var registry_ior;
+ if (read_ior_file(this->registry_filename_, registry_ior))
+ {
+ CORBA::Object_var registry_obj = this->orb_->string_to_object(registry_ior);
+ this->registry_ = PortableGroup::FactoryRegistry::_narrow(registry_obj);
+ if (CORBA::is_nil(this->registry_))
+ {
+ std::cerr << "Config: Can't resolve FactoryRegistry IOR " << this->registry_filename_ << std::endl;
+ result = -1;
+ }
+ }
+ else
+ {
+ std::cerr << "Config: Can't read FactoryRegistry IOR " << this->registry_filename_ << std::endl;
+ result = -1;
+ }
+
+ return result;
+}
+
+int StubConfig::run (ACE_ENV_SINGLE_ARG_DECL)
+{
+ int result = 0;
+
+
+ ::PortableGroup::FactoryInfos_var infos = this->registry_->list_factories_by_type (this->type_id_
+ ACE_ENV_ARG_PARAMETER)
+ ACE_CHECK;
+
+ CORBA::ULong count = infos->length();
+ std::cout << "Config: found " << count << " factories for " << this->type_id_ << std::endl;
+
+ for (CORBA::ULong nFact = 0; nFact < count; ++nFact)
+ {
+ ::PortableGroup::FactoryInfo info = infos[nFact];
+/* struct FactoryInfo {
+ GenericFactory the_factory;
+ Location the_location;
+ Criteria the_criteria;
+ };
+*/
+ const char * loc_name = info.the_location[0].id;
+ std::cout << "Config: Creating " << type_id_ << " at " << loc_name << std::endl;
+
+ PortableGroup::GenericFactory::FactoryCreationId_var factory_creation_id;
+ CORBA::Object_var obj = info.the_factory->create_object (
+ this->type_id_,
+ info.the_criteria,
+ factory_creation_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ if ( !CORBA::is_nil(obj) )
+ {
+ const char * replica_ior = orb_->object_to_string (obj ACE_ENV_ARG_PARAMETER );
+ ACE_CHECK;
+
+ ACE_CString replica_ior_filename(loc_name); // "$(location1)_$type_id.ior"
+ replica_ior_filename += "_";
+ replica_ior_filename += this->type_id_;
+ replica_ior_filename += ".ior";
+ std::cout << "Config: Writing ior for created object to " << replica_ior_filename.c_str() << std::endl;
+
+ if (write_ior_file(replica_ior_filename.c_str(), replica_ior) != 0)
+ {
+ std::cerr << "Config: Error writing ior [" << replica_ior << "] to " << replica_ior_filename.c_str() << std::endl;
+ }
+ }
+ else
+ {
+ std::cerr << "Config: create_object returned nil????" << std::endl;
+ }
+ }
+ return result;
+}
+
+
+int StubConfig::fini ()
+{
+ return 0;
+}
+
+
+
+int StubConfig::read_ior_file(const char * fileName, CORBA::String_var & ior)
+{
+ int result = 0;
+ FILE *in = ACE_OS::fopen (fileName, "r");
+ if (in != 0)
+ {
+ ACE_OS::fseek(in, 0, SEEK_END);
+ size_t fileSize = ACE_OS::ftell(in);
+ ACE_OS::fseek(in, 0, SEEK_SET);
+ char * buffer;
+ ACE_NEW_NORETURN (buffer,
+ char[fileSize+1]);
+ if (buffer != 0)
+ {
+ if( fileSize == ACE_OS::fread(buffer, 1, fileSize, in))
+ {
+ buffer[fileSize] = '\0';
+ ior = CORBA::string_dup(buffer);
+ ACE_TRY_CHECK;
+ result = 1; // success
+ }
+ delete[] buffer;
+ }
+ }
+ else
+ {
+ result = 1;
+ }
+ return result;
+}
+
+int StubConfig::write_ior_file(const char * outputFile, const char * ior)
+{
+ int result = -1;
+ FILE* out = ACE_OS::fopen (outputFile, "w");
+ if (out)
+ {
+ ACE_OS::fprintf (out, "%s", ior);
+ ACE_OS::fclose (out);
+ result = 0;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Open failed for %s\n", outputFile
+ ));
+ }
+ return result;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int result = 0;
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ StubConfig app;
+ result = app.parse_args(argc, argv);
+ if (result == 0)
+ {
+ result = app.init (orb ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ if (result == 0)
+ {
+ result = app.run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ if (result == 0)
+ {
+ result = app.fini();
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "StubConfig::main\t\n");
+ result = -1;
+ }
+ ACE_ENDTRY;
+ return result;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.cpp b/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.cpp
index ec57b9f08c9..55937693fb9 100644
--- a/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.cpp
+++ b/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.cpp
@@ -9,18 +9,18 @@
#include <iostream>
StubFaultNotifier::StubFaultNotifier ()
- : iorOutputFile_(0)
- , iorDetectorFile_(0)
- , replicaIorBuffer_(0)
- , nsName_(0)
+ : ior_output_file_(0)
+ , detector_ior_file_(0)
+ , replica_ior_buffer_(0)
+ , ns_name_(0)
{
}
StubFaultNotifier::~StubFaultNotifier ()
{
- delete [] this->replicaIorBuffer_;
- this->replicaIorBuffer_ = 0;
+ delete [] this->replica_ior_buffer_;
+ this->replica_ior_buffer_ = 0;
}
@@ -31,7 +31,7 @@ StubFaultNotifier::~StubFaultNotifier ()
PortableServer::ObjectId StubFaultNotifier::objectId()const
{
- return this->objectId_.in();
+ return this->object_id_.in();
}
@@ -49,21 +49,21 @@ int StubFaultNotifier::parse_args (int argc, char * argv[])
{
case 'r':
{
- if (this->replicaIorBuffer_ == 0)
+ if (this->replica_ior_buffer_ == 0)
{
const char * repNames = get_opts.opt_arg ();
size_t repNameLen = ACE_OS::strlen(repNames);
// make a working copy of the string
- ACE_NEW_NORETURN(this->replicaIorBuffer_,
+ ACE_NEW_NORETURN(this->replica_ior_buffer_,
char[repNameLen + 1]);
- if ( this->replicaIorBuffer_ != 0)
+ if ( this->replica_ior_buffer_ != 0)
{
- ACE_OS::memcpy(this->replicaIorBuffer_, repNames, repNameLen+1);
+ ACE_OS::memcpy(this->replica_ior_buffer_, repNames, repNameLen+1);
// tokenize the string on ','
// into iorReplicaFiles_
- char * pos = this->replicaIorBuffer_;
+ char * pos = this->replica_ior_buffer_;
while (pos != 0)
{
this->iorReplicaFiles_.push_back(pos);
@@ -96,17 +96,17 @@ int StubFaultNotifier::parse_args (int argc, char * argv[])
}
case 'd':
{
- this->iorDetectorFile_ = get_opts.opt_arg ();
+ this->detector_ior_file_ = get_opts.opt_arg ();
break;
}
case 'n':
{
- this->nsName_ = get_opts.opt_arg ();
+ this->ns_name_ = get_opts.opt_arg ();
break;
}
case 'o':
{
- this->iorOutputFile_ = get_opts.opt_arg ();
+ this->ior_output_file_ = get_opts.opt_arg ();
break;
}
@@ -121,14 +121,14 @@ int StubFaultNotifier::parse_args (int argc, char * argv[])
if(! optionError)
{
- if (0 == this->replicaIorBuffer_)
+ if (0 == this->replica_ior_buffer_)
{
ACE_ERROR ((LM_ERROR,
"-r option is required.\n"
));
optionError = -1;
}
- if (0 == this->iorDetectorFile_)
+ if (0 == this->detector_ior_file_)
{
ACE_ERROR ((LM_ERROR,
"-d option is required.\n"
@@ -157,7 +157,7 @@ int StubFaultNotifier::parse_args (int argc, char * argv[])
*/
int StubFaultNotifier::fini ()
{
- if(this->nsName_ != 0)
+ if(this->ns_name_ != 0)
{
ACE_TRY_NEW_ENV
{
@@ -177,7 +177,7 @@ int StubFaultNotifier::fini ()
CosNaming::Name this_name (1);
this_name.length (1);
- this_name[0].id = CORBA::string_dup (this->nsName_);
+ this_name[0].id = CORBA::string_dup (this->ns_name_);
naming_context->rebind (this_name, _this()
ACE_ENV_ARG_PARAMETER);
@@ -234,25 +234,25 @@ int StubFaultNotifier::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
// Register with the POA.
- this->objectId_ = this->poa_->activate_object (this ACE_ENV_ARG_PARAMETER);
+ this->object_id_ = this->poa_->activate_object (this ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
//////////////////////////////////////////
// resolve references to detector factory
- CORBA::String_var factoryIOR;
- if (read_ior_file(this->iorDetectorFile_, factoryIOR))
+ CORBA::String_var factory_ior;
+ if (read_ior_file(this->detector_ior_file_, factory_ior))
{
- CORBA::Object_var obj = this->orb_->string_to_object(factoryIOR);
+ CORBA::Object_var obj = this->orb_->string_to_object(factory_ior);
this->factory_ = ::FT::FaultDetectorFactory::_narrow(obj);
if (CORBA::is_nil(this->factory_))
{
- std::cerr << "Can't resolve Detector Factory IOR " << this->iorDetectorFile_ << std::endl;
+ std::cerr << "Can't resolve Detector Factory IOR " << this->detector_ior_file_ << std::endl;
result = -1;
}
}
else
{
- std::cerr << "Can't read " << this->iorDetectorFile_ << std::endl;
+ std::cerr << "Can't read " << this->detector_ior_file_ << std::endl;
result = -1;
}
if (result == 0)
@@ -338,23 +338,23 @@ int StubFaultNotifier::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
}
}
- if (this->iorOutputFile_ != 0)
+ if (this->ior_output_file_ != 0)
{
this->identity_ = "file:";
- this->identity_ += this->iorOutputFile_;
+ this->identity_ += this->ior_output_file_;
result = write_ior_file();
}
else
{
// if no IOR file specified,
// then always try to register with name service
- this->nsName_ = "FT_FaultNotifier";
+ this->ns_name_ = "FT_FaultNotifier";
}
- if(this->nsName_ != 0)
+ if(this->ns_name_ != 0)
{
this->identity_ = "name:";
- this->identity_ += this->nsName_;
+ this->identity_ += this->ns_name_;
CORBA::Object_var naming_obj =
this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER);
@@ -372,7 +372,7 @@ int StubFaultNotifier::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL)
CosNaming::Name this_name (1);
this_name.length (1);
- this_name[0].id = CORBA::string_dup (this->nsName_);
+ this_name[0].id = CORBA::string_dup (this->ns_name_);
naming_context->rebind (this_name, _this()
ACE_ENV_ARG_PARAMETER);
@@ -409,7 +409,7 @@ int StubFaultNotifier::read_ior_file(const char * fileName, CORBA::String_var &
int StubFaultNotifier::write_ior_file()
{
int result = -1;
- FILE* out = ACE_OS::fopen (this->iorOutputFile_, "w");
+ FILE* out = ACE_OS::fopen (this->ior_output_file_, "w");
if (out)
{
ACE_OS::fprintf (out, "%s", ACE_static_cast(const char *, this->ior_));
diff --git a/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.h b/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.h
index cf2abdf77c8..6c8f52dc538 100644
--- a/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.h
+++ b/TAO/orbsvcs/tests/FT_App/StubFaultNotifier.h
@@ -145,7 +145,7 @@ private:
/**
* The CORBA object id assigned to this object.
*/
- PortableServer::ObjectId_var objectId_;
+ PortableServer::ObjectId_var object_id_;
/**
* IOR of this object as assigned by poa
@@ -155,12 +155,12 @@ private:
/**
* A file to which the factory's IOR should be written.
*/
- const char * iorOutputFile_;
+ const char * ior_output_file_;
/**
* A file from which the detecor's IOR should be read.
*/
- const char * iorDetectorFile_;
+ const char * detector_ior_file_;
::FT::FaultDetectorFactory_var factory_;
@@ -168,13 +168,13 @@ private:
* A collection of files containing replica IORs
*/
ACE_Vector < const char * > iorReplicaFiles_;
- char * replicaIorBuffer_;
+ char * replica_ior_buffer_;
ACE_Vector < FT::PullMonitorable_var > replicas_;
/**
* A name to be used to register with the name service.
*/
- const char * nsName_;
+ const char * ns_name_;
/**
* A human-readable string to distinguish this from other Notifiers.
diff --git a/TAO/orbsvcs/tests/FT_App/run_test_detector.pl b/TAO/orbsvcs/tests/FT_App/run_test_detector.pl
index a495246bb13..df00796a28b 100755
--- a/TAO/orbsvcs/tests/FT_App/run_test_detector.pl
+++ b/TAO/orbsvcs/tests/FT_App/run_test_detector.pl
@@ -118,8 +118,8 @@ unlink #client_data
my($status) = 0;
-my($REP1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -t $replica1_ior -r 1 -q");
-my($REP2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -t $replica2_ior -r 2 -q");
+my($REP1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -t $replica1_ior -l loc1 -i type1 -q");
+my($REP2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -t $replica2_ior -l loc2 -i type1 -q");
my($DET) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Detector$build_directory/Fault_Detector", "-o $detector_ior -q");
my($NOT) = new PerlACE::Process (".$build_directory/ft_notifier", "-o $notifier_ior -q -d $detector_ior -r $replica1_ior,$replica2_ior");
my($CL);
diff --git a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl
index 12beb068146..7472c0bcde9 100755
--- a/TAO/orbsvcs/tests/FT_App/run_test_registry.pl
+++ b/TAO/orbsvcs/tests/FT_App/run_test_registry.pl
@@ -6,66 +6,54 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# -*- perl -*-
# Purpose:
-# To test the FaultNotifier
+# To test the FactoryRegistry
#
# Process being tested:
-# Fault_Notifier
-# implements FaultNotifier interface.
+# FT_Registry
+# implements PortableGroup::FactoryRegistry interface.
# Processes used in test:
-# FT_Replica
-# implements TestReplica interface.
-# implements PullMonitorable.
-# Fault_Detector
-# implements FaultDetectorFactory interface
-# implements PullMonitorable interface
+# FT_Replica * 2
+# implements GenericFactory interface to create TestReplicas
+# TestReplica implements TestReplica interface.
+# TestReplica implements PullMonitorable interface.
# FT_Client
# client for TestReplica interface.
# client for PullMonitorable.
-# StubAnalyzer
-# Subscribes to Fault_Notfier
+# StubConfiguratonManager
+# Orchestrates the test.
#
# Test Scenario (***Test: marks behavior being tested):
# Phase 1:
-# Start two FT_Replicas
-# FT_Replicas write TestReplica IORs (FR#1 and FR#2) to files
-# Start the Fault_Detector
-# Fault_Detector writes its IOR (FDF) to a file
-# Start the Fault_Notifier
-# Fault_Notifier writes its IOR (FN) to a file.
+# Start FactoryRegistry (FR)
+# FR writes IOR to file.
# Phase 2:
-# Wait for IORs: FR#1, FR#2, FDF, and FN
-# Start the StubAnalyzer giving it IORS: FR#1, FR#2 FDF, FN
-# StubAnalyzer calls FDF to create a FaultDetector
-# for each Replica.
-# StubAnalyzer subscribes to Fault_Notifier
-# StubAnalyzer writes dummy message(READY) to a file.
+# Wait for IOR: FR.
+# Start two FT_ReplicaFactories giving them FR IOR.
+# Specifying same type_id, different location.
+# ***Test: FT_ReplicaFactories register with FactoryRegistry.
+# RFs write IORs to files (used for synchronization purposes only).
# Phase 3:
-# Wait for READY
-# Start FT_Client giving it IORS: FR#1 and FR#2. [1]
-# FT_Client interacts with FR#1.
-# FT_Client asks FR#1 to fault. It does so.
-# FT_Client notices fault and switches to FR#2. [1]
-# FD#1 notices fault and notifies Fault_Notifier
-# FD#1 terminates
-# ***Test: Fault_Notifier forwards notification to StubAnalyzer
-# StubAnalyzer prints notification.
-# FT_Client interacts with FR#2.
-# FT_Client asks FR#2 to shut down.
+# Wait for IORS: RF1, RF2
+# Start StubConfiguratonManager given type_id and IORs: FR
+# ***Test: StubConfiguratonManager asks FR for factory-by-type.
+# Receives list of factories(RF1 RF2).
+# StubConfiguratonManager uses create_object for each factory to
+# create TestReplicas (TR1 and TR2).
+# StubConfiguratonManager writes TestReplica IORs (TR1 and TR2) to files
+# StubConfigurationManger exits. It's job is done!
+# Phase 4:
+# Wait for IORS: TR1 and TR2
+# Start FT_Client giving it TR1 and TR2. [1]
+# FT_Client interacts with TR1.
+# FT_Client asks TR1 to fault. It does so
+# FR1 is idle. It honors quit-on-idle option. As it exits, it unregisters from FR.
+# FT_Client notices fault and switches to TR2. [1]
+# FT_Client interacts with TR2.
+# FT_Client asks TR2 to shut down.
# FT_Client shuts down.
-# FD#2 notices FR2 is gone, interprets this
-# as a fault, and sends notification to Fault_Notifier
-# FD#2 terminates.
-# ***Test: Fault_Notifier forwards notification to StubAnalyzer
-# StubAnalyzer prints notification.
-# Phase 4: shutting down.
-# All FaultDetectors have terminated so the FaultDetectorFactory
-# honors the "quit-on-idle" option on it's command line and exits.
-# StubAnalyzer compares # fault notifications to # replicas. When
-# they match, it "knows" that the test is over, so it shuts down.
-# As it does so, it disconnects its fault consumers from the FaultNotifier.
-# FaultNotifier notices the last fault consumer disconnecting and exits because
-# the "quit-on-idle" option was specified on the command line.
-# Phase 5: housekeeping
+# FR2 notices TR2 is gone and honors it's quit-on-idle option. It unregisters from FR.
+# All factories have unregistered from FR. FR honors its quit-on-idle option.
+# Phase 7: housekeeping
# Wait for all processes to terminate.
# Check termination status.
# Delete temp files.
@@ -110,34 +98,32 @@ if ( $verbose > 1) {
print "simulated: $simulated\n";
}
+my($type_id) = "test_replica";
+my($location1) = "hither";
+my($location2) = "yon";
#define temp files
+my($registry_ior) = PerlACE::LocalFile ("registry.ior");
my($factory1_ior) = PerlACE::LocalFile ("factory1.ior");
my($factory2_ior) = PerlACE::LocalFile ("factory2.ior");
-my($replica1_ior) = PerlACE::LocalFile ("replica1.ior");
-my($replica2_ior) = PerlACE::LocalFile ("replica2.ior");
-my($detector_ior) = PerlACE::LocalFile ("detector.ior");
-my($notifier_ior) = PerlACE::LocalFile ("notifier.ior");
-my($ready_file) = PerlACE::LocalFile ("ready.file");
+my($replica1_ior) = PerlACE::LocalFile ("${location1}_$type_id.ior");
+my($replica2_ior) = PerlACE::LocalFile ("${location2}_$type_id.ior");
my($client_data) = PerlACE::LocalFile ("persistent.dat");
#discard junk from previous tests
+unlink $registry_ior;
unlink $factory1_ior;
unlink $factory2_ior;
unlink $replica1_ior;
unlink $replica2_ior;
-unlink $detector_ior;
-unlink $notifier_ior;
-unlink $ready_file;
unlink $client_data;
my($status) = 0;
-my($REP1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -t $replica1_ior -r 1 -q");
-my($REP2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -t $replica2_ior -r 2 -q");
-my($DET) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Detector$build_directory/Fault_Detector", "-o $detector_ior -q");
-my($NOT) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Notifier$build_directory/Fault_Notifier", "-o $notifier_ior -v -q");
-my($ANA) = new PerlACE::Process (".$build_directory/ft_analyzer", "-o $ready_file -n $notifier_ior -q -d $detector_ior -r $replica1_ior,$replica2_ior");
+my($REG) = new PerlACE::Process (".$build_directory/ft_registry", "-o $registry_ior -q");
+my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -f $registry_ior -l $location1 -i $type_id -q");
+my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -f $registry_ior -l $location2 -i $type_id -q");
+my($CFG) = new PerlACE::Process (".$build_directory/ft_config", "-t $type_id -f $registry_ior ");
my($CL);
if (simulated) {
@@ -147,66 +133,73 @@ if (simulated) {
$CL = new PerlACE::Process (".$build_directory/ft_client", "-f $replica1_iogr -c testscript");
}
-print "TEST: starting replica1 " . $REP1->CommandLine . "\n" if ($verbose);
-$REP1->Spawn ();
+#########
+# Phase 1
-print "TEST: waiting for replica 1's IOR\n" if ($verbose);
-if (PerlACE::waitforfile_timed ($replica1_ior, 5) == -1) {
- print STDERR "ERROR: cannot find file <$replica1_ior>\n";
- $REP1->Kill (); $REP1->TimedWait (1);
+print "\nTEST: starting registry " . $REG->CommandLine . "\n" if ($verbose);
+$REG->Spawn ();
+
+print "TEST: waiting for registry's IOR\n" if ($verbose);
+if (PerlACE::waitforfile_timed ($registry_ior, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$registry_ior>\n";
+ $REG->Kill (); $REG->TimedWait (1);
exit 1;
}
-print "\nTEST: starting replica2 " . $REP2->CommandLine . "\n" if ($verbose);
-$REP2->Spawn ();
+#########
+# Phase 2
-print "TEST: waiting for replica 2's IOR\n" if ($verbose);
-if (PerlACE::waitforfile_timed ($replica2_ior, 5) == -1) {
- print STDERR "ERROR: cannot find file <$replica2_ior>\n";
- $REP1->Kill (); $REP1->TimedWait (1);
- $REP2->Kill (); $REP2->TimedWait (1);
+print "\nTEST: starting factory 1 " . $FAC1->CommandLine . "\n" if ($verbose);
+$FAC1->Spawn ();
+
+print "TEST: waiting for factory 1's IOR\n" if ($verbose);
+if (PerlACE::waitforfile_timed ($factory1_ior, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$factory1_ior>\n";
+ $REG->Kill (); $REG->TimedWait (1);
+ $FAC1->Kill (); $FAC1->TimedWait (1);
exit 1;
}
-print "\nTEST: starting detector factory " . $DET->CommandLine . "\n" if ($verbose);
-$DET->Spawn ();
+print "\nTEST: starting factory 2 " . $FAC2->CommandLine . "\n" if ($verbose);
+$FAC2->Spawn ();
-print "TEST: waiting for detector's IOR\n" if ($verbose);
-if (PerlACE::waitforfile_timed ($detector_ior, 5) == -1) {
- print STDERR "ERROR: cannot find file <$detector_ior>\n";
- $REP1->Kill (); $REP1->TimedWait (1);
- $REP2->Kill (); $REP2->TimedWait (1);
- $DET->Kill (); $DET2->TimedWait(1);
+print "TEST: waiting for factory 2's IOR\n" if ($verbose);
+if (PerlACE::waitforfile_timed ($factory2_ior, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$factory2_ior>\n";
+ $FAC1->Kill (); $FAC1->TimedWait (1);
+ $REG->Kill (); $REG->TimedWait (1);
+ $FAC2->Kill (); $FAC2->TimedWait (1);
exit 1;
}
-print "\nTEST: starting notifier " . $NOT->CommandLine . "\n" if ($verbose);
-$NOT->Spawn ();
-print "TEST: waiting for notifier's IOR\n" if ($verbose);
-if (PerlACE::waitforfile_timed ($notifier_ior, 5) == -1) {
- print STDERR "ERROR: cannot find file <$notifier_ior>\n";
- $REP1->Kill (); $REP1->TimedWait (1);
- $REP2->Kill (); $REP2->TimedWait (1);
- $DET->Kill (); $DET2->TimedWait(1);
- $ANA->Kill (); $ANA->TimedWait(1);
+#########
+# Phase 3
+
+print "\nTEST: starting configuration manager " . $CFG->CommandLine . "\n" if ($verbose);
+$CFG->Spawn ();
+
+print "TEST: waiting for Replica 1 IOR file from configuration manager\n" if ($verbose);
+if (PerlACE::waitforfile_timed ($replica1_ior, 5) == -1){
+ print STDERR "ERROR: cannot find file <$replica1_ior>\n";
+ $FAC2->Kill (); $FAC2->TimedWait (1);
+ $FAC1->Kill (); $FAC1->TimedWait (1);
+ $REG->Kill (); $REG->TimedWait (1);
+ $CFG->Kill (); $CFG->TimedWait(1);
exit 1;
}
-
-print "\nTEST: starting analyzer " . $ANA->CommandLine . "\n" if ($verbose);
-$ANA->Spawn ();
-
-print "TEST: waiting for READY.FILE from analyzer\n" if ($verbose);
-if (PerlACE::waitforfile_timed ($ready_file, 5) == -1) {
- print STDERR "ERROR: cannot find file <$ready_file>\n";
- $REP1->Kill (); $REP1->TimedWait (1);
- $REP2->Kill (); $REP2->TimedWait (1);
- $DET->Kill (); $DET2->TimedWait(1);
- $NOT->Kill (); $NOT->TimedWait(1);
- $ANA->Kill (); $ANA->TimedWait(1);
+if (PerlACE::waitforfile_timed ($replica2_ior, 5) == -1){
+ print STDERR "ERROR: cannot find file <$replica2_ior> \n";
+ $FAC2->Kill (); $FAC2->TimedWait (1);
+ $FAC1->Kill (); $FAC1->TimedWait (1);
+ $REG->Kill (); $REG->TimedWait (1);
+ $CFG->Kill (); $CFG->TimedWait(1);
exit 1;
}
+#########
+# Phase 4
+
print "\nTEST: starting client " . $CL->CommandLine . "\n" if ($verbose);
$client = $CL->SpawnWaitKill (60);
@@ -215,49 +208,44 @@ if ($client != 0) {
$status = 1;
}
-print "\nTEST: wait for replica 1.\n" if ($verbose);
-$replica1 = $REP1->WaitKill (60);
-if ($replica1 != 0) {
- print STDERR "ERROR: replica returned $replica1\n";
- $status = 1;
-}
+#########
+# Phase 4
-print "\nTEST: wait for replica 2.\n" if ($verbose);
-$replica2 = $REP2->WaitKill (60);
-if ($replica2 != 0) {
- print STDERR "ERROR: replica returned $replica2\n";
+print "\nTEST: wait for factory 1.\n" if ($verbose);
+$factory1 = $FAC1->WaitKill (5);
+if ($factory1 != 0) {
+ print STDERR "ERROR: replica returned $factory 1\n";
$status = 1;
}
-print "\nTEST: wait for detector factory to leave.\n" if ($verbose);
-$detector = $DET->WaitKill (60);
-if ($detector != 0) {
- print STDERR "ERROR: detector returned $detector\n";
+print "\nTEST: wait for factory 2.\n" if ($verbose);
+$factory2 = $FAC2->WaitKill (5);
+if ($factory2 != 0) {
+ print STDERR "ERROR: factory 2 returned $factory2\n";
$status = 1;
}
-print "\nTEST: wait for notifier to leave.\n" if ($verbose);
-$notifier = $NOT->WaitKill (60);
-if ($notifier != 0) {
- print STDERR "ERROR: notifier returned $notifier\n";
+print "\nTEST: wait for configuration manager to leave.\n" if ($verbose);
+$config = $CFG->WaitKill (5);
+if ($config != 0) {
+ print STDERR "ERROR: configuration manager returned $config\n";
$status = 1;
}
-print "\nTEST: wait for analyzer to leave.\n" if ($verbose);
-$analyzer = $ANA->WaitKill (60);
-if ($analyzer != 0) {
- print STDERR "ERROR: analyzer returned $analyzer\n";
+print "\nTEST: wait for FactoryRegistry to leave.\n" if ($verbose);
+$registry = $REG->WaitKill (5);
+if ($registry != 0) {
+ print STDERR "ERROR: FactoryRegistry returned $registry\n";
$status = 1;
}
+
print "\nTEST: releasing scratch files.\n" if ($verbose);
+unlink $registry_ior;
+unlink $factory1_ior;
+unlink $factory2_ior;
unlink $replica1_ior;
unlink $replica2_ior;
-unlink $detector_ior;
-unlink $notifier_ior;
-unlink $ready_file;
-
-#client's work file
unlink $client_data;
exit $status;