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 17:37:11 UTC
svn commit: r1368547 - in /incubator/etch/trunk/binding-cpp/runtime:
include/transport/EtchWho.h src/main/CMakeLists.txt
src/main/transport/EtchWho.cpp src/test/CMakeLists.txt
src/test/transport/EtchWhoTest.cpp
Author: veithm
Date: Thu Aug 2 15:37:10 2012
New Revision: 1368547
URL: http://svn.apache.org/viewvc?rev=1368547&view=rev
Log:
ETCH-149 Added EtchWho
Change-Id: I34d9ab88cead566de995c4ec7e8e0966e6307c37
Added:
incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchWho.cpp
- copied, changed from r1368546, incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchWhoTest.cpp
- copied, changed from r1368546, incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
Modified: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h?rev=1368547&r1=1368546&r2=1368547&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h Thu Aug 2 15:37:10 2012
@@ -18,14 +18,42 @@
#ifndef __ETCHWHO_H__
#define __ETCHWHO_H__
+#include "common/EtchString.h"
class EtchWho {
-
public:
- virtual ~EtchWho() {
-
- }
+ /**
+ * @param addr
+ * @param port
+ */
+ EtchWho(EtchString addr, capu::int32_t port);
+
+ /**
+ * Destructor
+ */
+ virtual ~EtchWho();
+
+ /**
+ * @return the address of who.
+ */
+ EtchString getInetAddress();
+
+ /**
+ * @return the port of who.
+ */
+ capu::int32_t getPort();
+
+ /**
+ * @param addr
+ * @param port
+ * @return true if the specified addr and port match this who.
+ */
+ capu::bool_t matches(const EtchString &addr, capu::int32_t port);
+
+private:
+ EtchString mAddr;
+ capu::int32_t mPort;
};
#endif
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=1368547&r1=1368546&r2=1368547&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 15:37:10 2012
@@ -76,6 +76,7 @@ SET(MAIN_INCLUDES
${PROJECT_SOURCE_DIR}/include/transport/EtchMessage.h
${PROJECT_SOURCE_DIR}/include/transport/EtchMailboxManager.h
${PROJECT_SOURCE_DIR}/include/transport/EtchPlainMailboxManager.h
+ ${PROJECT_SOURCE_DIR}/include/transport/EtchWho.h
${PROJECT_SOURCE_DIR}/include/serialization/EtchValidator.h
${PROJECT_SOURCE_DIR}/include/serialization/EtchAsyncMode.h
${PROJECT_SOURCE_DIR}/include/serialization/EtchDirection.h
@@ -177,6 +178,7 @@ SET(MAIN_SOURCES
transport/EtchPlainMailboxManager.cpp
transport/EtchTransportFactory.cpp
transport/EtchTcpTransportFactory.cpp
+ transport/EtchWho.cpp
serialization/EtchTypeValidator.cpp
serialization/EtchValidatorBoolean.cpp
serialization/EtchValidatorByte.cpp
Copied: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchWho.cpp (from r1368546, incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchWho.cpp?p2=incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchWho.cpp&p1=incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h&r1=1368546&r2=1368547&rev=1368547&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchWho.cpp Thu Aug 2 15:37:10 2012
@@ -15,19 +15,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "transport/EtchWho.h"
-#ifndef __ETCHWHO_H__
-#define __ETCHWHO_H__
+EtchWho::EtchWho(EtchString inetAddr, capu::int32_t port)
+: mAddr(inetAddr), mPort(port) {
-class EtchWho {
+}
-public:
+EtchWho::~EtchWho() {
- virtual ~EtchWho() {
+}
- }
-};
-
-#endif
+EtchString EtchWho::getInetAddress() {
+ return mAddr;
+}
+capu::int32_t EtchWho::getPort() {
+ return mPort;
+}
+capu::bool_t EtchWho::matches(const EtchString &addr, capu::int32_t port) {
+ return mAddr.equals(&addr) && mPort == port;
+}
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=1368547&r1=1368546&r2=1368547&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 15:37:10 2012
@@ -59,6 +59,7 @@ add_executable (etch-cpp-test
transport/EtchMessagizerTest.cpp
transport/EtchPlainMailboxManagerTest.cpp
transport/EtchDefaultDeliveryServiceTest.cpp
+ transport/EtchWhoTest.cpp
serialization/EtchValidatorBooleanTest.cpp
serialization/EtchValidatorByteTest.cpp
serialization/EtchValidatorIntTest.cpp
Copied: incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchWhoTest.cpp (from r1368546, incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchWhoTest.cpp?p2=incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchWhoTest.cpp&p1=incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h&r1=1368546&r2=1368547&rev=1368547&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/transport/EtchWhoTest.cpp Thu Aug 2 15:37:10 2012
@@ -16,18 +16,15 @@
* limitations under the License.
*/
-#ifndef __ETCHWHO_H__
-#define __ETCHWHO_H__
-
-class EtchWho {
-
-public:
-
- virtual ~EtchWho() {
-
- }
-};
-
-#endif
-
+#include <gtest/gtest.h>
+#include "transport/EtchWho.h"
+TEST(EtchWhoTest, testAll) {
+ EtchWho who1("127.0.0.1", 3003);
+ EtchWho who2("127.0.0.1", 3003);
+ EtchWho who3("192.168.100.1", 3003);
+
+ EXPECT_TRUE(who1.matches(who2.getInetAddress(), who2.getPort()));
+ EXPECT_FALSE(who1.matches(who3.getInetAddress(), who3.getPort()));
+
+}