diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-11-08 15:56:06 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-11-08 15:56:06 +0000 |
commit | 84fbc32d1fb29dc7fdc09291eff23aea38b4755e (patch) | |
tree | a6b50d88ce45dbb92bdef02e7b8e70f7aa46fea9 /TAO/interop-tests | |
parent | bd63a92060da2cae1fe54ea4b433265ba667b63c (diff) | |
download | ATCD-84fbc32d1fb29dc7fdc09291eff23aea38b4755e.tar.gz |
Fri Nov 8 15:33:29 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
* interop-tests/CdrOutArg/orbix/README:
* interop-tests/CdrOutArg/orbix/Server_ORBInitializer.h:
* interop-tests/CdrOutArg/orbix/Server_ORBInitializer.cxx:
* interop-tests/CdrOutArg/orbix/cxx_demo.mk:
* interop-tests/CdrOutArg/orbix/demo.mk:
* interop-tests/CdrOutArg/orbix/makefile:
* interop-tests/CdrOutArg/orbix/server.cxx:
* interop-tests/CdrOutArg/orbix/server_interceptor.h:
* interop-tests/CdrOutArg/orbix/server_interceptor.cxx:
* interop-tests/CdrOutArg/orbix/test_i.h:
* interop-tests/CdrOutArg/orbix/test_i.cxx:
Companion test to be built using Orbix 6.2. *UNSUPPORTED*
The DOC group can only support the TAO portion of the test.
Diffstat (limited to 'TAO/interop-tests')
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/README | 10 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.cxx | 32 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.h | 26 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/cxx_demo.mk | 66 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/demo.mk | 21 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/makefile | 32 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/server.cxx | 83 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/server_interceptor.cxx | 88 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/server_interceptor.h | 42 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/test_i.cxx | 20 | ||||
-rw-r--r-- | TAO/interop-tests/CdrOutArg/orbix/test_i.h | 42 |
11 files changed, 462 insertions, 0 deletions
diff --git a/TAO/interop-tests/CdrOutArg/orbix/README b/TAO/interop-tests/CdrOutArg/orbix/README new file mode 100644 index 00000000000..60bd9e4f81b --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/README @@ -0,0 +1,10 @@ +$Id$ + +This is the Orbix companion for the CDR OUT Arg test. In order to build, you must +have Orbix 6.2 installed on your system. Local editing of the supplied makefiles +may be required. The DOC group cannot support this code as it does not havve the +licenses to do so. + +After building, run the server with no arguments, the IOR will be written to the +file ./test.ior. Provide that to the TAO client. A successful test will exit with +no error, a failure will yield a MARSHAL exception. diff --git a/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.cxx b/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.cxx new file mode 100644 index 00000000000..aad975ae413 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.cxx @@ -0,0 +1,32 @@ +// -*- C++ -*- +// +// $Id$ +// + +#include "Server_ORBInitializer.h" +#include "server_interceptor.h" + +Server_ORBInitializer::Server_ORBInitializer (void) +{ +} + +void +Server_ORBInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + /* Orbix 6 requires interceptor to be registered during pre_init, + * otherwise interceptor's interception points do not get called. + * mcknerney, 11/07/2013 + */ + PortableInterceptor::ServerRequestInterceptor_var + server_interceptor = new Echo_Server_Request_Interceptor(); + + info->add_server_request_interceptor (server_interceptor.in ()); +} + +void +Server_ORBInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ +} + diff --git a/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.h b/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.h new file mode 100644 index 00000000000..1fb820fe210 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/Server_ORBInitializer.h @@ -0,0 +1,26 @@ +// -*- C++ -*- +// +// $Id$ +// + +#ifndef TAO_SERVER_ORB_INITIALIZER_H +#define TAO_SERVER_ORB_INITIALIZER_H + +#include <omg/PortableInterceptor.hh> +#include <orbix/corba.hh> + +/// Server ORB initializer. +class Server_ORBInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ +public: + /// Constructor + Server_ORBInitializer (void); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#endif /* TAO_SERVER_ORB_INITIALIZER_H */ diff --git a/TAO/interop-tests/CdrOutArg/orbix/cxx_demo.mk b/TAO/interop-tests/CdrOutArg/orbix/cxx_demo.mk new file mode 100644 index 00000000000..85db56bcedc --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/cxx_demo.mk @@ -0,0 +1,66 @@ +#$Id$ +################################################################################# +# +# Copyright (c) 1993-2009 Progress Software Corporation and/or +# its affiliates or subsidiaries. +# All Rights Reserved. +# +################################################################################# + + + +ART_LIB_DIR= $(IT_PRODUCT_DIR)/asp/$(IT_PRODUCT_VER)/lib +ART_CXX_INCLUDE_DIR= $(IT_PRODUCT_DIR)/asp/$(IT_PRODUCT_VER)/include + +IT_PRODUCT_SHLIB_DIR= $(IT_PRODUCT_DIR)/shlib +IT_PRODUCT_DEF_SHLIB_DIR= $(IT_PRODUCT_DIR)/shlib/default + + +CXX= g++ + +CXXFLAGS= -I$(ART_CXX_INCLUDE_DIR)\ + -g3 -m32 -mtune=pentium3 -march=i586 -pipe -Wno-ctor-dtor-privacy -D_REENTRANT\ + $(EXTRA_CXXFLAGS)\ + $(CXXLOCAL_DEFINES) + +CXXLDFLAGS= $(CXXFLAGS) -rdynamic -L/usr/local/lib -Wl,-t -lpthread -lrt + + +CLEAN_TEMPL_REPOSITORY= + +CXXSHLIBFLAGS= $(CXXFLAGS) -fPIC + +SHLIB_CXX_COMPILER_ID= gcc34 + +SHLIBSUFFIX= so + +DEMO_SHLIB_FILE_NAME= + +SHLIBLDFLAGS= -rdynamic -Wl,-Bdynamic -Wl,-export-dynamic -shared -rdynamic -L/usr/local/lib -Wl,-t -lpthread -lrt + +LDLIBS= -L$(ART_LIB_DIR)\ + -L$(IT_PRODUCT_SHLIB_DIR)\ + -L$(IT_PRODUCT_DEF_SHLIB_DIR) $(EXTRA_LIB_PATH)\ + $(LINK_WITH) + +ORACLE_BIN_DIR= $(ORACLE_HOME)/bin +ORACLE_LIB_DIR= $(ORACLE_HOME)/lib +ORACLE_INCLUDES= -I$(ORACLE_HOME)/precomp/public +PRO_CXX_FLAGS= -fpermissive +PROC_INCLUDES= include=/usr/include include=$(ART_CXX_INCLUDE_DIR) + + +OBJS= $(SOURCES:.cxx=.o) + +.SUFFIXES: .pc .cxx + +# These demo makefiles do not support clearmake parallel builds +# .NOTPARALLEL: + +.pc.cxx: + $(ORACLE_BIN_DIR)/proc $< code=cpp lines=yes parse=partial cpp_suffix=cxx threads=no define=IT_PROC $(PROC_INCLUDES) + +.cxx.o: + $(RM) $@ + $(CXX) -c $(CXXFLAGS) -o $@ $< + diff --git a/TAO/interop-tests/CdrOutArg/orbix/demo.mk b/TAO/interop-tests/CdrOutArg/orbix/demo.mk new file mode 100644 index 00000000000..9391e205e13 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/demo.mk @@ -0,0 +1,21 @@ +#$Id$ +################################################################################# +# +# Copyright (c) 1993-2009 Progress Software Corporation and/or +# its affiliates or subsidiaries. +# All Rights Reserved. +# +################################################################################# + + +RM= rm -f +RMDIR= rm -rf + +IT_PRODUCT_VER= 6.3 + +ART_IDL_INCLUDE_DIR= $(IT_PRODUCT_DIR)/asp/$(IT_PRODUCT_VER)/idl + +ART_BIN_DIR= $(IT_PRODUCT_DIR)/asp/$(IT_PRODUCT_VER)/bin + +IDL= $(ART_BIN_DIR)/idl +ITADMIN= $(ART_BIN_DIR)/itadmin diff --git a/TAO/interop-tests/CdrOutArg/orbix/makefile b/TAO/interop-tests/CdrOutArg/orbix/makefile new file mode 100644 index 00000000000..05132c66657 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/makefile @@ -0,0 +1,32 @@ +# $Id$ +# mcknerney, 11/7/2013 + +CXXLOCAL_DEFINES= + +include demo.mk +include cxx_demo.mk + +LINK_WITH= -lit_poa -lit_art -lit_ifc -lit_portable_interceptor + +SOURCES= server.cxx test_i.cxx server_interceptor.cxx Server_ORBInitializer.cxx testC.cxx testS.cxx + +all: server + +server: $(SOURCES) $(OBJS) + $(RM) $@ + $(CXX) -o $@ $(CXXLDFLAGS) $(OBJS) $(LDLIBS) + $(ITADMIN) scope create taodemo + $(ITADMIN) variable create -scope taodemo -type list -value "Echo_Server_Interceptor, " binding:server_binding_list + $(ITADMIN) variable create -scope taodemo -type list -value "local_log_stream,iiop_profile,giop,iiop,portable_interceptor" orb_plugins +# @see: +# http://community.microfocus.com/microfocus/corba/orbix/w/knowledge_base/22500.marshalexception-when-using-a-tao-based-application-to-obtain-a-consumeradmin-reference-for-the-orbix-notification-service.aspx +# $(ITADMIN) variable create -scope taodemo -type bool -value true policies:giop:interop_policy:ignore_message_not_consumed + +$(SOURCES): test.hh + +test.hh: ../idl/test.idl + $(IDL) -base -poa -I$(ART_IDL_INCLUDE_DIR) ../idl/test.idl + +clean: + $(RM) server *.o core test.hh testS.hh testC.cxx testS.cxx test.ior + $(ITADMIN) scope remove taodemo diff --git a/TAO/interop-tests/CdrOutArg/orbix/server.cxx b/TAO/interop-tests/CdrOutArg/orbix/server.cxx new file mode 100644 index 00000000000..f4ed538daf4 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/server.cxx @@ -0,0 +1,83 @@ +// $Id$ + +#include <stdio.h> +#include <iostream> +#include <omg/PortableServer.hh> +#include "test_i.h" +#include "Server_ORBInitializer.h" + +const char* ior_output_file = "test.ior"; + +//FUZZ: disable check_for_improper_main_declaration +int +main(int argc, char* argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var initializer = new Server_ORBInitializer(); + + PortableInterceptor::register_orb_initializer (initializer.in ()); + + // Now we can create the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "taodemo"); + + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA"); + + assert(!CORBA::is_nil (poa_object.in ())); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + poa_manager->activate (); + + CDR_Out_Arg_i server_impl(orb.in ()); + + PortableServer::ObjectId_var id = + root_poa->activate_object (&server_impl); + + CORBA::Object_var test_obj = + root_poa->id_to_reference (id.in ()); + + Interop::CDR_Out_Arg_var server = + Interop::CDR_Out_Arg::_narrow (test_obj.in ()); + + CORBA::String_var ior = + orb->object_to_string (server.in ()); + + printf("Interop::CDR_Out_Arg: <%s>\n", + ior.in ()); + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= fopen (ior_output_file, "w"); + if (output_file == 0) { + printf("Cannot open output file for writing IOR: %s\n", + ior_output_file); + return 1; + } + fprintf (output_file, "%s", ior.in ()); + fclose (output_file); + } + + orb->run (); + + printf("event loop finished\n"); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + std::cerr << "Caught exception in server:" << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.cxx b/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.cxx new file mode 100644 index 00000000000..718757bd1a0 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.cxx @@ -0,0 +1,88 @@ +// $Id$ + +#include <stdio.h> +#include "server_interceptor.h" + +const IOP::ServiceId service_id = 0xdeadbeef; +const char *request_msg = "12345678"; + + +Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) + : myname_ ("Echo_Server_Interceptor") +{ +} + +Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor (void) +{ +} + +char * +Echo_Server_Request_Interceptor::name (void) +{ + return CORBA::string_dup (this->myname_); +} + +void +Echo_Server_Request_Interceptor::destroy (void) +{ +} + +void +Echo_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + + CORBA::String_var operation = ri->operation (); + + printf("%s.receive_request_service_contexts from " + "\"%s\"\n", + this->myname_, + operation.in ()); + + IOP::ServiceId id = ::service_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id); + + const char *buf = + reinterpret_cast<const char *> (sc->context_data.get_buffer ()); +#if 0 + ACE_DEBUG ((LM_DEBUG, + " Received service context: %C\n", + buf)); +#endif /*if 0*/ + + if (strcmp (buf, request_msg) != 0) + { + printf("ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: " + "Expected request service context to be: %s\n", + request_msg); + _exit(1); + } + +} + + +void +Echo_Server_Request_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr) +{ + // Do nothing +} + +void +Echo_Server_Request_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ) +{ +} + +void +Echo_Server_Request_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ) +{ +} + +void +Echo_Server_Request_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr) +{ +} diff --git a/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.h b/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.h new file mode 100644 index 00000000000..dcb7768c7a9 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/server_interceptor.h @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H + +#include <omg/PortableInterceptor.hh> + +class Echo_Server_Request_Interceptor + : public virtual PortableInterceptor::ServerRequestInterceptor, + public virtual ::CORBA::LocalObject +{ + // = Server-side echo interceptor. For checking interceptor visually only. +public: + Echo_Server_Request_Interceptor (void); + // cotr. + + ~Echo_Server_Request_Interceptor (); + // dotr. + + virtual char * name (void); + // Canonical name of the interceptor. + + virtual void destroy (void); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr); + +private: + const char *myname_; +}; + +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/interop-tests/CdrOutArg/orbix/test_i.cxx b/TAO/interop-tests/CdrOutArg/orbix/test_i.cxx new file mode 100644 index 00000000000..60d70ea0710 --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/test_i.cxx @@ -0,0 +1,20 @@ +// $Id$ + +#include "test_i.h" + +CDR_Out_Arg_i::CDR_Out_Arg_i (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +void +CDR_Out_Arg_i::get_out (CORBA::Long_out arg) IT_THROW_DECL((CORBA::SystemException)) +{ + arg = 100; +} + +void +CDR_Out_Arg_i::shutdown (void) IT_THROW_DECL((CORBA::SystemException)) +{ + this->orb_->shutdown (0); +} diff --git a/TAO/interop-tests/CdrOutArg/orbix/test_i.h b/TAO/interop-tests/CdrOutArg/orbix/test_i.h new file mode 100644 index 00000000000..3e23599559e --- /dev/null +++ b/TAO/interop-tests/CdrOutArg/orbix/test_i.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file test_i.h + * + * $Id$ + * + * @author Phil Mesnier + */ +//============================================================================= + + +#ifndef CDR_OUT_ARG_TEST_I_H +#define CDR_OUT_ARG_TEST_I_H + +#include "testS.hh" + +/** + * @class CDR_Out_Arg_i + * + * Implements the CDR_Out_Arg interface + */ +class CDR_Out_Arg_i : public POA_Interop::CDR_Out_Arg +{ + +public: + + CDR_Out_Arg_i (CORBA::ORB_ptr orb); + + void get_out (CORBA::Long_out arg) IT_THROW_DECL((CORBA::SystemException)); + + void shutdown (void) IT_THROW_DECL((CORBA::SystemException)); + +private: + + /// The ORB pseudo-reference (for shutdown). + CORBA::ORB_var orb_; + +}; + +#endif /* TAO_INTERCEPTOR_TEST_I_H */ |