static bool do_local_process_test(const Omega::string_t& strPrefix) { output(" %-43s ",("'" + strPrefix + "/' registry key").c_str()); // Test the simplest case OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest(Omega::TestSuite::OID_TestProcess,Omega::Activation::Process); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Kill the running version try { ptrSimpleTest->Abort(); } catch (Omega::Remoting::IChannelClosedException* pE) { add_success(); pE->Release(); } ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Process"); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Kill the running version try { ptrSimpleTest->Abort(); } catch (Omega::Remoting::IChannelClosedException* pE) { add_success(); pE->Release(); } // Test unregistering TEST(unregister_process(strPrefix)); // Check its gone try { ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Process"); } catch (Omega::INotFoundException* pE) { add_success(); pE->Release(); } return true; }
int main( ) { interface_tests( ); silent_drop( ); correctness_check( ); ordering_conflict( ); empty_post( ); printf("The tests end.\n"); return 0; /* must return 0 for rake test to succeed */ }
static bool do_process_test(const Omega::string_t& strModulePath, const char* pszEndpoint, bool& bSkipped) { output(" %-45s ",strModulePath.c_str()); // Register the exe TEST(register_process("/Local User",strModulePath,bSkipped)); if (bSkipped) return true; OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest("Test.Process@" + Omega::string_t(pszEndpoint)); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); TEST(unregister_process("/Local User")); return true; }
static bool do_library_test(const Omega::string_t& strLibName, const char* pszEndpoint, bool& bSkipped) { // Register the library ready for local loopback stuff output(" %-45s ",strLibName.c_str()); // Register the library TEST(register_library("/Local User",strLibName,bSkipped)); if (bSkipped) return true; OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest("Test.Library@" + Omega::string_t(pszEndpoint)); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); TEST(unregister_library("/Local User")); return true; }
static bool do_local_library_test(const Omega::string_t& strPrefix) { output(" %-43s ",("'" + strPrefix + "/' registry key").c_str()); // Test the simplest case OTL::ObjectPtr<Omega::TestSuite::ISimpleTest> ptrSimpleTest(Omega::TestSuite::OID_TestLibrary,Omega::Activation::Library); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test for local activation ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>(Omega::TestSuite::OID_TestLibrary.ToString()); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test for local activation ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Library"); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test for local activation with '@local' ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Library@local"); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test for local activation with '@local' ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>(Omega::TestSuite::OID_TestLibrary.ToString() + "@local"); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test redirecting the registration OTL::ObjectPtr<Omega::Registry::IKey> ptrKey("/Local User/Objects",Omega::Registry::IKey::OpenCreate); OTL::ObjectPtr<Omega::Registry::IKey> ptrSubKey = ptrKey->OpenKey("MyLittleTest",Omega::Registry::IKey::OpenCreate); ptrSubKey->SetValue("CurrentVersion","Test.Library"); ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("MyLittleTest@local"); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); // Test it has gone ptrKey->DeleteSubKey("MyLittleTest"); try { ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("MyLittleTest"); } catch (Omega::INotFoundException* pE) { add_success(); pE->Release(); } // Test for surrogate activation ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>(Omega::TestSuite::OID_TestLibrary,Omega::Activation::Process); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); ptrSimpleTest.Release(); // Test unregistering TEST(unregister_library(strPrefix)); try { ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>("Test.Library"); } catch (Omega::INotFoundException* pE) { add_success(); pE->Release(); } try { ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>(Omega::TestSuite::OID_TestLibrary); } catch (Omega::INotFoundException* pE) { add_success(); pE->Release(); } // Now test the sand-box surrogate activation /* // Register the library TEST(register_library("/System/Sandbox",strLibName,bSkipped)); if (bSkipped) return true; // Test for surrogate activation ptrSimpleTest = OTL::ObjectPtr<Omega::TestSuite::ISimpleTest>(Omega::TestSuite::OID_TestLibrary,Omega::Activation::Sandbox); TEST(ptrSimpleTest); interface_tests(ptrSimpleTest); TEST(unregister_library("/System/Sandbox"));*/ return true; }