You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/08/02 15:28:52 UTC
svn commit: r1368466 - in /incubator/etch/trunk/binding-cpp/runtime:
include/common/ include/serialization/ include/transport/
lib/capu/modules/capu/include/capu/ lib/capu/modules/capu/include/capu/os/
lib/capu/modules/capu/include/capu/util/ src/main/...
Author: veithm
Date: Thu Aug 2 13:28:50 2012
New Revision: 1368466
URL: http://svn.apache.org/viewvc?rev=1368466&view=rev
Log:
ETCH-181 Implementation Messagizer
EtchMessagizer implementation and testing
Change-Id: I42cd4e73b834a24719d0207938e505932f2299e2
Added:
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchFormat.h
- copied, changed from r1368460, incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessagizer.h
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchFormat.cpp
- copied, changed from r1368460, incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchMessagizerTest.cpp
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/common/EtchError.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataInput.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataOutput.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataInput.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchPacketizer.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpConnection.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransport.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportMessage.h
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportPacket.h
incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h
incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h
incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h
incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataInput.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchPacketizerTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp
Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchError.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchError.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchError.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchError.h Thu Aug 2 13:28:50 2012
@@ -41,10 +41,10 @@ enum {
ETCH_TIMEOUT = 12,
ETCH_ENOT_EXIST = 13,
ETCH_ENOT_SUPPORTED = 14,
- ETCH_EIO = 15
-
- //RANGE BETWEEN 0XFFFF TO OXFFFFFFF ARE ERROR CODES FOR ONLY ETCH
+ ETCH_EIO = 15,
+ //RANGE BETWEEN 0X10000 TO OXFFFFFFF ARE ERROR CODES FOR ONLY ETCH
+ ETCH_UNWANTED_MESSAGE = 0X10000
};
#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataInput.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataInput.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataInput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataInput.h Thu Aug 2 13:28:50 2012
@@ -47,23 +47,23 @@ public:
/////////////////////////////
//overriden method
- status_t readMessage(EtchFlexBuffer *buf, EtchMessage *&message);
+ status_t readMessage(capu::SmartPointer<EtchFlexBuffer> buf, capu::SmartPointer<EtchMessage> &message);
private:
- EtchFlexBuffer *mBuffer;
+ capu::SmartPointer<EtchFlexBuffer> mBuffer;
capu::int32_t mLengthBudget;
capu::SmartPointer<EtchValidator> mIntOrStrValidator;
capu::SmartPointer<EtchValidator> mIntValidator;
- status_t readStruct(EtchStructValue*& result);
+ status_t readStruct(capu::SmartPointer<EtchStructValue> &result);
status_t readArray(capu::SmartPointer<EtchValidator> v, EtchArrayValue *& result);
- status_t readKeysAndValues(EtchStructValue* sv);
+ status_t readKeysAndValues(capu::SmartPointer<EtchStructValue> sv);
status_t readValues(EtchArrayValue *av, capu::SmartPointer<EtchValidator> v);
- status_t startMessage(EtchMessage *& result);
- status_t endMessage(EtchMessage* msg);
- status_t startStruct(EtchStructValue *& result);
- status_t endStruct(EtchStructValue * result);
+ status_t startMessage(capu::SmartPointer<EtchMessage> &result);
+ status_t endMessage(capu::SmartPointer<EtchMessage> msg);
+ status_t startStruct(capu::SmartPointer<EtchStructValue> &result);
+ status_t endStruct(capu::SmartPointer<EtchStructValue> result);
status_t startArray(EtchArrayValue *& result);
status_t endArray(EtchArrayValue *array);
status_t readType(EtchType *&type);
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataOutput.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataOutput.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataOutput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchBinaryTaggedDataOutput.h Thu Aug 2 13:28:50 2012
@@ -53,29 +53,29 @@ public:
// TaggedDataOutput methods //
//////////////////////////////
//overriden method
- status_t writeMessage(EtchMessage* msg, EtchFlexBuffer *buf);
+ status_t writeMessage(capu::SmartPointer<EtchMessage> msg, capu::SmartPointer<EtchFlexBuffer> buf);
private:
- EtchFlexBuffer* mBuffer;
+ capu::SmartPointer<EtchFlexBuffer> mBuffer;
EtchLevel mLevel;
capu::bool_t mStringTypeAndField;
capu::SmartPointer<EtchValidator> mIntValidator;
capu::SmartPointer<EtchValidator> mStringValidator;
capu::SmartPointer<EtchValidator> mNoneValidator;
- status_t writeStruct(EtchStructValue* sv);
+ status_t writeStruct(capu::SmartPointer<EtchStructValue> sv);
status_t writeArray(EtchArrayValue* av, EtchValidator* v);
- status_t writeKeysAndValues(EtchStructValue* sv);
+ status_t writeKeysAndValues(capu::SmartPointer<EtchStructValue> sv);
status_t writeValues(EtchArrayValue* av, EtchValidator* v);
/////////////////////////
// Main output methods //
/////////////////////////
- status_t startMessage(EtchMessage* msg);
- status_t endMessage(EtchMessage* msg);
- status_t startStruct(EtchStructValue* _struct);
- status_t endStruct(EtchStructValue* _struct);
+ status_t startMessage(capu::SmartPointer<EtchMessage> msg);
+ status_t endMessage(capu::SmartPointer<EtchMessage> msg);
+ status_t startStruct(capu::SmartPointer<EtchStructValue> _struct);
+ status_t endStruct(capu::SmartPointer<EtchStructValue> _struct);
status_t startArray(EtchArrayValue* array);
status_t endArray(EtchArrayValue* array);
status_t writeType(EtchType* type);
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataInput.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataInput.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataInput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataInput.h Thu Aug 2 13:28:50 2012
@@ -30,7 +30,7 @@ public:
* @param buf the flex buffer containing the message.
* @param a message read from the buf.
*/
- virtual status_t readMessage(EtchFlexBuffer *buf, EtchMessage *&message) = 0;
+ virtual status_t readMessage(capu::SmartPointer<EtchFlexBuffer> buf, capu::SmartPointer<EtchMessage> &message) = 0;
virtual ~EtchTaggedDataInput() {
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h Thu Aug 2 13:28:50 2012
@@ -30,7 +30,7 @@ public:
* @param msg the message to be written.
* @param buf the buffer to write to.
*/
- virtual status_t writeMessage(EtchMessage* msg, EtchFlexBuffer* buf) = 0;
+ virtual status_t writeMessage(capu::SmartPointer<EtchMessage> msg, capu::SmartPointer<EtchFlexBuffer> buf) = 0;
virtual ~EtchTaggedDataOutput() {
Copied: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchFormat.h (from r1368460, incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchFormat.h?p2=incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchFormat.h&p1=incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h&r1=1368460&r2=1368466&rev=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchFormat.h Thu Aug 2 13:28:50 2012
@@ -16,28 +16,16 @@
* limitations under the License.
*/
+#ifndef __ETCHFORMAT_H__
+#define __ETCHFORMAT_H__
+#include "common/EtchString.h"
-#ifndef __ETCHTAGGEDDATAOUTPUT_H__
-#define __ETCHTAGGEDDATAOUTPUT_H__
-#include "transport/EtchFlexBuffer.h"
-#include "transport/EtchMessage.h"
-
-class EtchTaggedDataOutput {
+class EtchFormat
+{
public:
-
- /**
- * Writes the message to the buf.
- * @param msg the message to be written.
- * @param buf the buffer to write to.
- */
- virtual status_t writeMessage(EtchMessage* msg, EtchFlexBuffer* buf) = 0;
-
- virtual ~EtchTaggedDataOutput() {
-
- }
-
+ const static EtchString BINARY;
+ const static EtchString XML;
};
-
-#endif /* ETCHTAGGEDDATAOUTPUT_H */
+#endif /* ETCHFORMAT_H */
Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessagizer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessagizer.h?rev=1368466&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessagizer.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessagizer.h Thu Aug 2 13:28:50 2012
@@ -0,0 +1,129 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHMESSAGIZER_H__
+#define __ETCHMESSAGIZER_H__
+
+#include "capu/util/SmartPointer.h"
+#include "capu/os/Mutex.h"
+#include "common/EtchException.h"
+#include "serialization/EtchTaggedDataInput.h"
+#include "serialization/EtchTaggedDataOutput.h"
+#include "serialization/EtchBinaryTaggedData.h"
+#include "serialization/EtchBinaryTaggedDataInput.h"
+#include "serialization/EtchBinaryTaggedDataOutput.h"
+#include "transport/EtchFormat.h"
+#include "transport/EtchSessionPacket.h"
+#include "transport/EtchSessionMessage.h"
+#include "transport/EtchTransportMessage.h"
+#include "transport/EtchTransportPacket.h"
+#include "util/EtchResources.h"
+#include "util/EtchURL.h"
+
+
+class EtchMessagizer : public EtchSessionPacket, public EtchTransportMessage {
+public:
+
+ /**
+ * Name of format name in uri or resources. The value is "Messagizer.format".
+ * The result of looking up this name should be a String.
+ *
+ * @see #Messagizer(TransportPacket, String, Resources)
+ */
+ static const EtchString FORMAT;
+
+ /**
+ * Constructs the Messagizer with null handler and tagged data format
+ * constructed from the format factory.
+ * @param transport used to deliver packets to the peer
+ * @param uri the uri being used to configure the transport stack.
+ * @param resources the associated set of resources for this service.
+ */
+ EtchMessagizer(EtchTransportPacket* transport, EtchURL* uri, EtchResources* resources);
+
+ /**
+ * Destructor
+ */
+ virtual ~EtchMessagizer();
+
+ /**
+ * @return Transport layer for messagizer
+ */
+ EtchTransportPacket* getTransport();
+
+ /**
+ * @return Session layer for messagizer
+ */
+ EtchSessionMessage* getSession();
+
+ /**
+ * sets the session layer used in messagizer
+ */
+ void setSession(EtchSessionMessage* session);
+
+ /**
+ * @see EtchTransport
+ */
+ status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
+
+ /**
+ * @see EtchTransport
+ */
+ status_t transportControl(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value);
+
+ /**
+ * @see EtchTransport
+ */
+ status_t transportNotify(capu::SmartPointer<EtchObject> event);
+
+ /**
+ * @see EtchSession
+ */
+ status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
+
+ /**
+ * @see EtchSession
+ */
+ status_t sessionControl(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value);
+
+ /**
+ * @see EtchSession
+ */
+ status_t sessionNotify(capu::SmartPointer<EtchObject> event);
+
+ /**
+ * @see EtchTransportMessage
+ */
+ status_t transportMessage(capu::SmartPointer<EtchWho> recipient, capu::SmartPointer<EtchMessage> message);
+
+ /**
+ * @see EtchSessionPacket
+ */
+ status_t sessionPacket(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchFlexBuffer> buf);
+
+private:
+ static capu::Mutex mutex;
+ EtchTransportPacket* mTransport;
+ EtchTaggedDataInput* mTdi;
+ EtchTaggedDataOutput* mTdo;
+ EtchSessionMessage* mSession;
+
+};
+
+#endif
+
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchPacketizer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchPacketizer.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchPacketizer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchPacketizer.h Thu Aug 2 13:28:50 2012
@@ -92,7 +92,7 @@ public:
/**
* @see EtchTransport
*/
- status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result);
+ status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
/**
* @see EtchTransport
@@ -122,7 +122,7 @@ public:
/**
* @see EtchSession
*/
- status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result);
+ status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
/**
* @see EtchSession
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h Thu Aug 2 13:28:50 2012
@@ -18,10 +18,11 @@
#ifndef __ETCHSESSION_H__
#define __ETCHSESSION_H__
+
+#include "capu/util/SmartPointer.h"
#include "common/EtchObject.h"
#include "common/EtchString.h"
#include "common/EtchError.h"
-#include "capu/util/SmartPointer.h"
class EtchSession {
public:
@@ -42,7 +43,7 @@ public:
* @return ETCH_OK if requested operational value is successfully get
* ETCH_ERROR otherwise
*/
- virtual status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) = 0;
+ virtual status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) = 0;
/**
* Sets a configuration or operational value in the session. The
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h Thu Aug 2 13:28:50 2012
@@ -18,8 +18,9 @@
#ifndef __ETCHSESSIONDATA_H__
#define __ETCHSESSIONDATA_H__
-#include "common/EtchError.h"
+
#include "capu/util/SmartPointer.h"
+#include "common/EtchError.h"
#include "transport/EtchFlexBuffer.h"
#include "transport/EtchSession.h"
#include "transport/EtchWho.h"
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h Thu Aug 2 13:28:50 2012
@@ -18,9 +18,11 @@
#ifndef __ETCHSESSIONLISTENER_H__
#define __ETCHSESSIONLISTENER_H__
+
#include "capu/util/SmartPointer.h"
-#include "transport/EtchSession.h"
#include "common/EtchError.h"
+#include "transport/EtchSession.h"
+
template <class T>
class EtchSessionListener : public virtual EtchSession {
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h Thu Aug 2 13:28:50 2012
@@ -19,9 +19,9 @@
#ifndef __ETCHSESSIONMESSAGE_H__
#define __ETCHSESSIONMESSAGE_H__
-#include "transport/EtchSession.h"
-#include "common/EtchError.h"
#include "capu/util/SmartPointer.h"
+#include "common/EtchError.h"
+#include "transport/EtchSession.h"
#include "transport/EtchWho.h"
#include "transport/EtchMessage.h"
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h Thu Aug 2 13:28:50 2012
@@ -18,9 +18,10 @@
#ifndef __ETCHSESSIONPACKET_H__
#define __ETCHSESSIONPACKET_H__
+
+#include "capu/util/SmartPointer.h"
#include "transport/EtchSession.h"
#include "transport/EtchFlexBuffer.h"
-#include "capu/util/SmartPointer.h"
#include "transport/EtchWho.h"
class EtchSessionPacket : public EtchSession {
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpConnection.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpConnection.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpConnection.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpConnection.h Thu Aug 2 13:28:50 2012
@@ -69,7 +69,7 @@ public:
/**
* @see TransportData
*/
- virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result);
+ virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
/**
* @return Session
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h Thu Aug 2 13:28:50 2012
@@ -67,7 +67,7 @@ public:
/**
* @see TransportData
*/
- virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result);
+ virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result);
/**
* @return Session
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransport.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransport.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransport.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransport.h Thu Aug 2 13:28:50 2012
@@ -18,10 +18,11 @@
#ifndef __ETCHTRANSPORT_H__
#define __ETCHTRANSPORT_H__
-#include "common/EtchObject.h"
-#include "common/EtchString.h"
+
#include "capu/util/SmartPointer.h"
#include "common/EtchError.h"
+#include "common/EtchObject.h"
+#include "common/EtchString.h"
/**
* Out-of-band query, control, and notification interface for transports.
@@ -64,7 +65,7 @@ public:
* @return ETCH_EUNIMPL if unimplemented
*
*/
- virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) = 0;
+ virtual status_t transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) = 0;
/**
* Sets a configuration or operational value in the transport. The
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportMessage.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportMessage.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportMessage.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportMessage.h Thu Aug 2 13:28:50 2012
@@ -19,8 +19,8 @@
#ifndef __ETCHTRANSPORTMESSAGE_H__
#define __ETCHTRANSPORTMESSAGE_H__
-#include "transport/EtchTransport.h"
#include "common/EtchError.h"
+#include "transport/EtchTransport.h"
#include "transport/EtchSessionMessage.h"
#include "transport/EtchMessage.h"
#include "transport/EtchWho.h"
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportPacket.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportPacket.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportPacket.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchTransportPacket.h Thu Aug 2 13:28:50 2012
@@ -18,9 +18,10 @@
#ifndef __ETCHTRANSPORTPACKET_H__
#define __ETCHTRANSPORTPACKET_H__
+
+#include "capu/util/SmartPointer.h"
#include "transport/EtchSessionPacket.h"
#include "transport/EtchTransport.h"
-#include "capu/util/SmartPointer.h"
#include "transport/EtchFlexBuffer.h"
#include "transport/EtchWho.h"
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h Thu Aug 2 13:28:50 2012
@@ -39,7 +39,8 @@ namespace capu {
CAPU_ENO_MEMORY = 11,
CAPU_TIMEOUT = 12,
CAPU_ENOT_EXIST = 13,
- CAPU_ENOT_SUPPORTED = 14
+ CAPU_ENOT_SUPPORTED = 14,
+ CAPU_EIO = 15
};
}
#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h Thu Aug 2 13:28:50 2012
@@ -19,11 +19,13 @@
#ifndef __MUTEX_H__
#define __MUTEX_H__
+#include "capu/Error.h"
+
#define MUTEX_INC_HEADER
#include "arch/Mutex.inc"
#undef MUTEX_INC_HEADER
-#include "capu/Error.h"
+
namespace capu
{
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h Thu Aug 2 13:28:50 2012
@@ -164,7 +164,7 @@ namespace capu {
template<class X>
inline
SmartPointer<T>::SmartPointer(const SmartPointer<X>& smartPointer)
- : mData(static_cast<X*>(smartPointer.mData))
+ : mData(smartPointer.mData)
, mReferenceCount(smartPointer.mReferenceCount)
{
incRefCount();
@@ -225,7 +225,7 @@ namespace capu {
SmartPointer<T>& SmartPointer<T>::operator= (const SmartPointer<X>& smartPointer) {
if (*this != smartPointer) {
decRefCount();
- mData = static_cast<X*> (smartPointer.mData);
+ mData = smartPointer.mData;
mReferenceCount = smartPointer.mReferenceCount;
incRefCount();
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Thu Aug 2 13:28:50 2012
@@ -103,6 +103,8 @@ SET(MAIN_INCLUDES
${PROJECT_SOURCE_DIR}/include/serialization/EtchBinaryTaggedData.h
${PROJECT_SOURCE_DIR}/include/serialization/EtchBinaryTaggedDataInput.h
${PROJECT_SOURCE_DIR}/include/serialization/EtchBinaryTaggedDataOutput.h
+ ${PROJECT_SOURCE_DIR}/include/transport/EtchMessagizer.h
+ ${PROJECT_SOURCE_DIR}/include/transport/EtchFormat.h
${PROJECT_SOURCE_DIR}/include/util/EtchUtil.h
)
@@ -167,6 +169,8 @@ SET(MAIN_SOURCES
serialization/EtchBinaryTaggedData.cpp
serialization/EtchBinaryTaggedDataInput.cpp
serialization/EtchBinaryTaggedDataOutput.cpp
+ transport/EtchMessagizer.cpp
+ transport/EtchFormat.cpp
util/EtchUtil.cpp
)
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataInput.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataInput.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataInput.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataInput.cpp Thu Aug 2 13:28:50 2012
@@ -34,7 +34,7 @@ EtchBinaryTaggedDataInput::EtchBinaryTag
EtchBinaryTaggedDataInput::~EtchBinaryTaggedDataInput() {
}
-status_t EtchBinaryTaggedDataInput::readMessage(EtchFlexBuffer *buf, EtchMessage *&message) {
+status_t EtchBinaryTaggedDataInput::readMessage(capu::SmartPointer<EtchFlexBuffer> buf, capu::SmartPointer<EtchMessage> &message) {
mBuffer = buf;
status_t ret;
@@ -74,7 +74,7 @@ status_t EtchBinaryTaggedDataInput::read
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::readStruct(EtchStructValue *&result) {
+status_t EtchBinaryTaggedDataInput::readStruct(capu::SmartPointer<EtchStructValue> &result) {
status_t ret;
ret = startStruct(result);
@@ -115,7 +115,7 @@ status_t EtchBinaryTaggedDataInput::read
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::readKeysAndValues(EtchStructValue* sv) {
+status_t EtchBinaryTaggedDataInput::readKeysAndValues(capu::SmartPointer<EtchStructValue> sv) {
status_t ret;
EtchType* t = sv->getType();
while (true) {
@@ -157,7 +157,7 @@ status_t EtchBinaryTaggedDataInput::read
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::startMessage(EtchMessage *& result) {
+status_t EtchBinaryTaggedDataInput::startMessage(capu::SmartPointer<EtchMessage> &result) {
capu::int8_t version = 0;
mBuffer->getByte(version);
@@ -177,11 +177,11 @@ status_t EtchBinaryTaggedDataInput::star
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::endMessage(EtchMessage* msg) {
+status_t EtchBinaryTaggedDataInput::endMessage(capu::SmartPointer<EtchMessage> msg) {
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::startStruct(EtchStructValue *& result) {
+status_t EtchBinaryTaggedDataInput::startStruct(capu::SmartPointer<EtchStructValue> &result) {
EtchType* t = NULL;
if (readType(t) != ETCH_OK) {
return ETCH_ERROR;
@@ -196,7 +196,7 @@ status_t EtchBinaryTaggedDataInput::star
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataInput::endStruct(EtchStructValue * result) {
+status_t EtchBinaryTaggedDataInput::endStruct(capu::SmartPointer<EtchStructValue> result) {
return ETCH_OK;
}
@@ -581,19 +581,16 @@ status_t EtchBinaryTaggedDataInput::read
case EtchTypeCode::STRUCT:
case EtchTypeCode::CUSTOM:
{
- EtchStructValue *sv = NULL;
+ capu::SmartPointer<EtchStructValue> sv;
if (readStruct(sv) != ETCH_OK) {
return ETCH_ERROR;
}
capu::SmartPointer<EtchObject> obj;
- if (mVf->importCustomValue(sv, obj) != ETCH_OK) {
- delete sv;
+ if (mVf->importCustomValue(sv.get(), obj) != ETCH_OK) {
return ETCH_ERROR;
}
- delete sv;
-
if (validateValue(v, obj, result) != ETCH_OK) {
return ETCH_ERROR;
} else {
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp Thu Aug 2 13:28:50 2012
@@ -37,8 +37,8 @@ EtchBinaryTaggedDataOutput::~EtchBinaryT
}
-status_t EtchBinaryTaggedDataOutput::writeMessage(EtchMessage* msg, EtchFlexBuffer *buf) {
- if ((buf == NULL) || (msg == NULL)) {
+status_t EtchBinaryTaggedDataOutput::writeMessage(capu::SmartPointer<EtchMessage> msg, capu::SmartPointer<EtchFlexBuffer> buf) {
+ if ((buf.get() == NULL) || (msg.get() == NULL)) {
return ETCH_EINVAL;
}
@@ -63,7 +63,7 @@ status_t EtchBinaryTaggedDataOutput::wri
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataOutput::writeStruct(EtchStructValue* sv) {
+status_t EtchBinaryTaggedDataOutput::writeStruct(capu::SmartPointer<EtchStructValue> sv) {
status_t ret;
ret = startStruct(sv);
@@ -81,7 +81,6 @@ status_t EtchBinaryTaggedDataOutput::wri
return ETCH_ERROR;
}
- delete sv;
return ETCH_OK;
}
@@ -107,8 +106,8 @@ status_t EtchBinaryTaggedDataOutput::wri
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataOutput::writeKeysAndValues(EtchStructValue* sv) {
- if (sv == NULL) {
+status_t EtchBinaryTaggedDataOutput::writeKeysAndValues(capu::SmartPointer<EtchStructValue> sv) {
+ if (sv.get() == NULL) {
return ETCH_EINVAL;
}
@@ -162,7 +161,7 @@ status_t EtchBinaryTaggedDataOutput::wri
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataOutput::startMessage(EtchMessage* msg) {
+status_t EtchBinaryTaggedDataOutput::startMessage(capu::SmartPointer<EtchMessage> msg) {
// since message is top-level, no type code is written to
// indicate a message is starting. we do write a version
// number to indicate this version of the binary tagged
@@ -171,11 +170,11 @@ status_t EtchBinaryTaggedDataOutput::sta
return startStruct(msg);
}
-status_t EtchBinaryTaggedDataOutput::endMessage(EtchMessage* msg) {
+status_t EtchBinaryTaggedDataOutput::endMessage(capu::SmartPointer<EtchMessage> msg) {
return endStruct(msg);
}
-status_t EtchBinaryTaggedDataOutput::startStruct(EtchStructValue* _struct) {
+status_t EtchBinaryTaggedDataOutput::startStruct(capu::SmartPointer<EtchStructValue> _struct) {
// the caller has already written a type code to indicate a
// struct is starting. this code is shared by startMessage().
if (writeType(_struct->getType()) != ETCH_OK)
@@ -185,7 +184,7 @@ status_t EtchBinaryTaggedDataOutput::sta
return ETCH_OK;
}
-status_t EtchBinaryTaggedDataOutput::endStruct(EtchStructValue* _struct) {
+status_t EtchBinaryTaggedDataOutput::endStruct(capu::SmartPointer<EtchStructValue> _struct) {
// this code is shared by endMessage.
return writeNoneValue();
}
Copied: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchFormat.cpp (from r1368460, incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchFormat.cpp?p2=incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchFormat.cpp&p1=incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h&r1=1368460&r2=1368466&rev=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchTaggedDataOutput.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchFormat.cpp Thu Aug 2 13:28:50 2012
@@ -15,29 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "transport/EtchFormat.h"
+const EtchString EtchFormat::BINARY("binary");
-#ifndef __ETCHTAGGEDDATAOUTPUT_H__
-#define __ETCHTAGGEDDATAOUTPUT_H__
-#include "transport/EtchFlexBuffer.h"
-#include "transport/EtchMessage.h"
-
-class EtchTaggedDataOutput {
-public:
-
- /**
- * Writes the message to the buf.
- * @param msg the message to be written.
- * @param buf the buffer to write to.
- */
- virtual status_t writeMessage(EtchMessage* msg, EtchFlexBuffer* buf) = 0;
-
- virtual ~EtchTaggedDataOutput() {
-
- }
-
-};
-
-
-#endif /* ETCHTAGGEDDATAOUTPUT_H */
-
+const EtchString EtchFormat::XML("xml");
\ No newline at end of file
Added: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp?rev=1368466&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp Thu Aug 2 13:28:50 2012
@@ -0,0 +1,130 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "transport/EtchMessagizer.h"
+
+const EtchString EtchMessagizer::FORMAT("Messagizer.format");
+capu::Mutex EtchMessagizer::mutex;
+
+EtchMessagizer::EtchMessagizer(EtchTransportPacket* transport, EtchURL* uri, EtchResources* resources)
+: mTransport(transport) {
+ EtchString format;
+ EtchObject * val;
+ resources->get((EtchString &) EtchTransport<EtchSessionMessage>::VALUE_FACTORY, val);
+
+ if (uri->getTerms().get((EtchString &) FORMAT, &format) == ETCH_OK) {
+
+ if (format.equals(&EtchFormat::BINARY)) {
+ mTdi = new EtchBinaryTaggedDataInput((EtchValueFactory *) val);
+ mTdo = new EtchBinaryTaggedDataOutput((EtchValueFactory *) val, uri);
+ } else if (format.equals(&EtchFormat::XML)) {
+ //we dont need serialization via xml currently
+ }
+ } else {
+ mTdi = new EtchBinaryTaggedDataInput((EtchValueFactory *) val);
+ mTdo = new EtchBinaryTaggedDataOutput((EtchValueFactory *) val, uri);
+ }
+ transport->setSession(this);
+}
+
+EtchMessagizer::~EtchMessagizer() {
+ mTransport->setSession(NULL);
+ if (mTdi != NULL)
+ delete mTdi;
+ if (mTdo != NULL)
+ delete mTdo;
+}
+
+EtchTransportPacket* EtchMessagizer::getTransport() {
+ return mTransport;
+}
+
+EtchSessionMessage* EtchMessagizer::getSession() {
+ return mSession;
+}
+
+void EtchMessagizer::setSession(EtchSessionMessage* session) {
+ mSession = session;
+}
+
+status_t EtchMessagizer::transportControl(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value) {
+ return mTransport->transportControl(control, value);
+}
+
+status_t EtchMessagizer::transportNotify(capu::SmartPointer<EtchObject> event) {
+ return mTransport->transportNotify(event);
+}
+
+status_t EtchMessagizer::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
+ return mTransport->transportQuery(query, result);
+}
+
+status_t EtchMessagizer::sessionControl(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value) {
+ return mSession->sessionControl(control, value);
+}
+
+status_t EtchMessagizer::sessionNotify(capu::SmartPointer<EtchObject> event) {
+ return mSession->sessionNotify(event);
+}
+
+status_t EtchMessagizer::sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
+ return mSession->sessionQuery(query, result);
+}
+
+status_t EtchMessagizer::sessionPacket(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchFlexBuffer> buf) {
+ status_t result;
+ capu::SmartPointer<EtchMessage> message;
+ result = mTdi->readMessage(buf, message);
+ if (result != ETCH_OK) {
+ return result;
+ }
+ result = mSession->sessionMessage(sender, message);
+ if (result != ETCH_OK)
+ {
+ EtchString errmsg("Unwanted Message");
+ mSession->sessionNotify(new EtchException(errmsg, ETCH_UNWANTED_MESSAGE, EtchException::EXCPTYPE_BUILTIN));
+ }
+ return ETCH_OK;
+
+}
+
+status_t EtchMessagizer::transportMessage(capu::SmartPointer<EtchWho> recipient, capu::SmartPointer<EtchMessage> message) {
+ mutex.lock();
+ capu::SmartPointer<EtchFlexBuffer> msgBuf = new EtchFlexBuffer();
+ status_t result;
+
+ // packetize the message.
+ // leave space for the packet header
+ result = msgBuf->setIndex(mTransport->getHeaderSize());
+ if (result != ETCH_OK) {
+ mutex.unlock();
+ return result;
+ }
+ result = mTdo->writeMessage(message, msgBuf);
+ if (result != ETCH_OK){
+ mutex.unlock();
+ return result;
+ }
+ msgBuf->setIndex(0);
+ result = mTransport->transportPacket(recipient, msgBuf);
+ if (result != ETCH_OK) {
+ mutex.unlock();
+ return result;
+ }
+ mutex.unlock();
+ return ETCH_OK;
+}
\ No newline at end of file
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp Thu Aug 2 13:28:50 2012
@@ -80,7 +80,7 @@ status_t EtchPacketizer::transportNotify
return mTransport->transportNotify(event);
}
-status_t EtchPacketizer::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) {
+status_t EtchPacketizer::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
return mTransport->transportQuery(query, result);
}
@@ -100,7 +100,7 @@ status_t EtchPacketizer::sessionNotify(c
return mSession->sessionNotify(event);
}
-status_t EtchPacketizer::sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) {
+status_t EtchPacketizer::sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
return mSession->sessionQuery(query, result);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp Thu Aug 2 13:28:50 2012
@@ -137,7 +137,7 @@ status_t EtchTcpConnection::transportNot
return ETCH_OK;
}
-status_t EtchTcpConnection::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) {
+status_t EtchTcpConnection::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
//Nothing to do
return ETCH_EUNIMPL;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp Thu Aug 2 13:28:50 2012
@@ -170,7 +170,7 @@ status_t EtchTcpListener::transportNotif
return ETCH_OK;
}
-status_t EtchTcpListener::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) {
+status_t EtchTcpListener::transportQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result) {
//Nothing to do
return ETCH_EUNIMPL;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Thu Aug 2 13:28:50 2012
@@ -80,6 +80,7 @@ add_executable (etch-cpp-test
serialization/EtchDefaultValueFactoryTest.cpp
serialization/EtchValidatorStructValueTest.cpp
serialization/EtchBinaryTaggedDataInputOutputTest.cpp
+ transport/EtchMessagizerTest.cpp
util/EtchUtilTest.cpp
${GTEST}/src/gtest-all.cc
${GMOCK}/src/gmock-all.cc
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp Thu Aug 2 13:28:50 2012
@@ -143,14 +143,14 @@ public:
vf.factory->getType(foo, mt_foo);
mt_foo->putValidator(mf_x, v);
- EtchMessage msg(mt_foo, vf.factory);
- msg.put(mf_x, x);
+ capu::SmartPointer<EtchMessage> msg = new EtchMessage(mt_foo, vf.factory);
+ msg->put(mf_x, x);
capu::uint32_t length;
capu::int8_t * buffer;
//SERIALIZE DATA INTO FLEX BUFFER
- msg2bytes(&msg, stringTypeAndField, length, buffer, vf);
- EtchMessage *msg2;
+ msg2bytes(msg, stringTypeAndField, length, buffer, vf);
+ capu::SmartPointer<EtchMessage> msg2;
//DESERIALIZE DATA FROM FLEX BYTE ARRAY
bytes2msg(buffer, length, msg2, vf);
//TYPE CHECK
@@ -160,7 +160,6 @@ public:
EXPECT_TRUE(msg2->get(mf_x, &result) == ETCH_OK);
//check result of serialization
check_equal(result.get(), x.get());
- delete msg2;
}
static void check_equal(EtchObject* first, EtchObject* second) {
@@ -193,34 +192,33 @@ public:
}
}
- static void msg2bytes(EtchMessage * msg, capu::bool_t stringTypeAndField, capu::uint32_t &size, capu::int8_t *&buffer, MyValueFactory &vf) {
- EtchFlexBuffer buf;
+ static void msg2bytes(capu::SmartPointer<EtchMessage> msg, capu::bool_t stringTypeAndField, capu::uint32_t &size, capu::int8_t *&buffer, MyValueFactory &vf) {
+ capu::SmartPointer<EtchFlexBuffer> buf = new EtchFlexBuffer();
EtchURL u("none:");
// u.addTerm((EtchString &) EtchBinaryTaggedDataOutput::STRING_TYPE_AND_FIELD, stringTypeAndField);
EtchBinaryTaggedDataOutput btdo(vf.factory, &u);
- EXPECT_TRUE(btdo.writeMessage(msg, &buf) == ETCH_OK);
- buf.setIndex(0);
- size = buf.getAvailableBytes();
+ EXPECT_TRUE(btdo.writeMessage(msg, buf) == ETCH_OK);
+ buf->setIndex(0);
+ size = buf->getAvailableBytes();
buffer = new capu::int8_t[size];
capu::uint32_t len;
- EXPECT_TRUE(buf.get(buffer, 0, size, len) == ETCH_OK);
+ EXPECT_TRUE(buf->get(buffer, 0, size, len) == ETCH_OK);
return;
}
- static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, EtchMessage*& msg, MyValueFactory &vf) {
+ static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, capu::SmartPointer<EtchMessage> &msg, MyValueFactory &vf) {
return bytes2msg(buf, length, msg, LEVEL_FULL, vf);
}
- static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, EtchMessage*& msg, EtchLevel level, MyValueFactory &vf) {
+ static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, capu::SmartPointer<EtchMessage> &msg, EtchLevel level, MyValueFactory &vf) {
EtchLevel oldLevel = vf.factory->setLevel(level);
EtchBinaryTaggedDataInput btdi(vf.factory);
- EtchFlexBuffer *buffer = new EtchFlexBuffer(buf, length);
+ capu::SmartPointer<EtchFlexBuffer> buffer = new EtchFlexBuffer(buf, length);
buffer->setIndex(0);
EXPECT_TRUE(btdi.readMessage(buffer, msg) == ETCH_OK);
vf.factory->setLevel(oldLevel);
- delete buffer;
}
static void test_bto_write(capu::SmartPointer<EtchObject> x, capu::int8_t *compare_buffer, capu::SmartPointer<EtchValidator> v) {
@@ -232,19 +230,18 @@ public:
EtchField f(2, field);
t.putValidator(f, v);
- EtchMessage msg(&t, vf.factory);
- msg.put(f, x);
- // System.out.println( "msg = "+msg );
+ capu::SmartPointer<EtchMessage> msg = new EtchMessage(&t, vf.factory);
+ msg->put(f, x);
EtchURL u("none:");
EtchBinaryTaggedDataOutput btdo(vf.factory, &u);
- EtchFlexBuffer buf;
- buf.setByteRepresentation(ETCH_BIG_ENDIAN);
- EXPECT_TRUE(btdo.writeMessage(&msg, &buf) == ETCH_OK);
- buf.setIndex(0);
- capu::int32_t size = buf.getAvailableBytes();
+ capu::SmartPointer<EtchFlexBuffer> buf = new EtchFlexBuffer();
+ buf->setByteRepresentation(ETCH_BIG_ENDIAN);
+ EXPECT_TRUE(btdo.writeMessage(msg, buf) == ETCH_OK);
+ buf->setIndex(0);
+ capu::int32_t size = buf->getAvailableBytes();
capu::int8_t* buffer = new capu::int8_t[size];
capu::uint32_t len;
- EXPECT_TRUE(buf.get(buffer, 0, size, len) == ETCH_OK);
+ EXPECT_TRUE(buf->get(buffer, 0, size, len) == ETCH_OK);
EXPECT_TRUE(memcmp(buffer, compare_buffer, len) == 0);
delete [] buffer;
Added: incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchMessagizerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchMessagizerTest.cpp?rev=1368466&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchMessagizerTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchMessagizerTest.cpp Thu Aug 2 13:28:50 2012
@@ -0,0 +1,222 @@
+/* $Id$
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "serialization/EtchDefaultValueFactory.h"
+#include "serialization/EtchBinaryTaggedData.h"
+#include "serialization/EtchBinaryTaggedDataInput.h"
+#include "serialization/EtchValidatorShort.h"
+#include "transport/EtchMessagizer.h"
+#include "transport/EtchTcpConnection.h"
+#include "transport/EtchPacketizer.h"
+#include "transport/EtchSessionListener.h"
+#include "transport/EtchTcpListener.h"
+
+
+class MockListener11 : public virtual EtchSessionListener<EtchSocket> {
+public:
+
+ //This method is called
+
+ status_t sessionAccepted(EtchSocket* connection) {
+ delete connection;
+ return ETCH_OK;
+ }
+
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
+
+ MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
+
+ MOCK_METHOD1(sessionNotify, status_t(capu::SmartPointer<EtchObject> event));
+};
+
+class MockMailboxManager : public EtchSessionMessage {
+public:
+
+ status_t sessionMessage(capu::SmartPointer<EtchWho> receipent, capu::SmartPointer<EtchMessage> buf) {
+ EXPECT_TRUE(buf->count() == 1);
+ return ETCH_OK;
+ }
+
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
+
+ MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
+
+ MOCK_METHOD1(sessionNotify, status_t(capu::SmartPointer<EtchObject> event));
+};
+
+TEST(EtchMessagizerTest, constructorTest) {
+ EtchTypeMap types;
+ EtchClass2TypeMap class2type;
+ EtchDefaultValueFactory * factory;
+ EtchDefaultValueFactory::Init(&types, &class2type);
+ EtchString uri("tcp://127.0.0.1:4001");
+ factory = new EtchDefaultValueFactory(uri, &types, &class2type);
+ //created value factory
+ EtchURL u("tcp://127.0.0.1:4001");
+ EtchResources r;
+ EtchObject *out;
+ r.put((EtchString &) EtchTransport<EtchSessionMessage>::VALUE_FACTORY, factory, out);
+ EtchTransportData* conn = new EtchTcpConnection(NULL, &u);
+ EtchTransportPacket* pac = new EtchPacketizer(conn, &u);
+ EtchSessionPacket* mes = new EtchMessagizer(pac, &u, &r);
+ //Created stack
+ delete mes;
+ delete pac;
+ delete conn;
+ delete factory;
+ types.clear();
+}
+
+TEST(EtchMessagizerTest, TransportControlTest) {
+ EtchTypeMap types;
+ EtchClass2TypeMap class2type;
+ EtchDefaultValueFactory * factory;
+ EtchDefaultValueFactory::Init(&types, &class2type);
+ EtchString uri("tcp://127.0.0.1:4001");
+ factory = new EtchDefaultValueFactory(uri, &types, &class2type);
+ //created value factory
+ EtchURL u("tcp://127.0.0.1:4001");
+ EtchResources r;
+ EtchObject *out;
+ r.put((EtchString &) EtchTransport<EtchSessionMessage>::VALUE_FACTORY, factory, out);
+ EtchTransportData* conn = new EtchTcpConnection(NULL, &u);
+ EtchPacketizer* pac = new EtchPacketizer(conn, &u);
+ EtchMessagizer* mess = new EtchMessagizer(pac, &u, &r);
+
+ EtchSessionListener<EtchSocket>* mSessionListener = new MockListener11();
+ EtchTcpListener* listener = new EtchTcpListener(&u);
+ //Start the mock listener
+ listener->setSession(mSessionListener);
+ listener->transportControl(new EtchString(EtchTcpListener::START_AND_WAIT_UP), new EtchInt32(1000));
+ mess->transportControl(new EtchString(EtchPacketizer::START_AND_WAIT_UP), new EtchInt32(1000));
+ //test transport commands
+ mess->transportControl(new EtchString(EtchPacketizer::STOP_AND_WAIT_DOWN), new EtchInt32(1000));
+ listener->transportControl(new EtchString(EtchTcpListener::STOP_AND_WAIT_DOWN), new EtchInt32(1000));
+ listener->setSession(mSessionListener);
+
+ delete mSessionListener;
+ delete mess;
+ delete pac;
+ delete conn;
+ delete listener;
+ delete factory;
+ types.clear();
+}
+
+TEST(EtchMessagizerTest, TransportMessageTest) {
+ EtchTypeMap types;
+ EtchClass2TypeMap class2type;
+ EtchDefaultValueFactory * factory;
+ EtchDefaultValueFactory::Init(&types, &class2type);
+ EtchString uri("tcp://127.0.0.1:4001");
+ factory = new EtchDefaultValueFactory(uri, &types, &class2type);
+ //default value factory
+ EtchURL u("tcp://127.0.0.1:4001");
+ EtchResources r;
+ EtchObject *out;
+ //add to the resource
+ r.put((EtchString &) EtchTransport<EtchSessionMessage>::VALUE_FACTORY, factory, out);
+ EtchTransportData* conn = new EtchTcpConnection(NULL, &u);
+ EtchPacketizer* pac = new EtchPacketizer(conn, &u);
+ EtchMessagizer* mess = new EtchMessagizer(pac, &u, &r);
+
+ //creation of example message which will be serialized
+ EtchType *mt_foo = NULL;
+ EtchField mf_x("x");
+ EtchString str("foo");
+ factory->getType(str, mt_foo);
+ capu::SmartPointer<EtchValidator> v;
+ EtchValidatorShort::Get(0, v);
+ mt_foo->putValidator(mf_x, v);
+ capu::SmartPointer<EtchShort> data = new EtchShort(10000);
+ capu::SmartPointer<EtchMessage> msg = new EtchMessage(mt_foo, factory);
+ msg->put(mf_x, data);
+
+ EXPECT_TRUE(mess->transportMessage(NULL, msg) == ETCH_EINVAL);
+
+ delete mess;
+ delete pac;
+ delete conn;
+ delete factory;
+ types.clear();
+}
+
+TEST(EtchMessagizerTest, SessionDataTest) {
+ //creation of an example message to compare the deserialized messageMyValueFactory vf("tcp:");
+ EtchTypeMap types;
+ EtchClass2TypeMap class2type;
+ EtchString name1("a");
+ EtchString name2("b");
+ EtchType *mt_foo = new EtchType(1, name1);
+ EtchField mf_x(2, name2);
+ capu::SmartPointer<EtchValidator> v;
+ EtchValidatorShort::Get(0, v);
+ mt_foo->putValidator(mf_x, v);
+ types.add(mt_foo);
+ capu::SmartPointer<EtchShort> data = new EtchShort(10000);
+ //default value factory
+ EtchDefaultValueFactory * factory;
+ EtchDefaultValueFactory::Init(&types, &class2type);
+ EtchString uri("tcp://127.0.0.1:4001");
+
+
+ factory = new EtchDefaultValueFactory(uri, &types, &class2type);
+ capu::SmartPointer<EtchMessage> msg = new EtchMessage(mt_foo, factory);
+ msg->put(mf_x, data);
+
+
+ EtchURL u(uri);
+ EtchResources r;
+ EtchObject *out;
+ //add the value factory to the resources
+ r.put((EtchString &) EtchTransport<EtchSessionMessage>::VALUE_FACTORY, factory, out);
+ //create stack
+ EtchTransportData* conn = new EtchTcpConnection(NULL, &u);
+ EtchPacketizer* pac = new EtchPacketizer(conn, &u);
+ EtchMessagizer* mess = new EtchMessagizer(pac, &u, &r);
+ capu::SmartPointer<EtchFlexBuffer> buffer = new EtchFlexBuffer();
+
+ //A packet is created
+ capu::int8_t byte_pos[] = {3, 1, 1, 2, -123, 39, 16, -127};
+ buffer->setByteRepresentation(ETCH_BIG_ENDIAN);
+ buffer->put((capu::int8_t *)"_header_", pac->getHeaderSize());
+ buffer->put((capu::int8_t *)byte_pos, 8);
+ buffer->setIndex(0);
+ capu::int32_t pktsize = buffer->getLength() - pac->getHeaderSize();
+ buffer->put((capu::int8_t *) & pac->SIG, sizeof (capu::int32_t));
+ buffer->put((capu::int8_t *) & pktsize, sizeof (capu::int32_t));
+ buffer->setIndex(pac->getHeaderSize());
+ EXPECT_TRUE(buffer->getLength() == 16);
+
+ //Simulate call with fake package
+ EtchSessionMessage* mMailboxManager = new MockMailboxManager();
+ mess->setSession(mMailboxManager);
+ EXPECT_TRUE(mess->sessionPacket(NULL, buffer) == ETCH_OK);
+
+ mess->setSession(NULL);
+ types.clear();
+ delete mMailboxManager;
+ delete mess;
+ delete pac;
+ delete conn;
+ delete factory;
+}
+
+
+
+
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchPacketizerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchPacketizerTest.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchPacketizerTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchPacketizerTest.cpp Thu Aug 2 13:28:50 2012
@@ -38,7 +38,7 @@ public:
return ETCH_OK;
}
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
@@ -50,7 +50,7 @@ public:
MOCK_METHOD2(sessionPacket, status_t(capu::SmartPointer<EtchWho> receipent, capu::SmartPointer<EtchFlexBuffer> buf));
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp Thu Aug 2 13:28:50 2012
@@ -38,7 +38,7 @@ public:
return ETCH_OK;
}
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
@@ -63,7 +63,7 @@ public:
return ETCH_OK;
}
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp?rev=1368466&r1=1368465&r2=1368466&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp Thu Aug 2 13:28:50 2012
@@ -36,7 +36,7 @@ public:
return ETCH_OK;
}
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));
@@ -57,7 +57,7 @@ public:
return ETCH_OK;
}
- MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result));
+ MOCK_METHOD2(sessionQuery, status_t(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> &result));
MOCK_METHOD2(sessionControl, status_t(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value));