Date   

[PATCH 50/50] [unittest] Adding C Unit Tests

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>


Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/src/gunittest/c/Makefile.am | 10 +-
mama/c_cpp/src/gunittest/c/datetimetest.cpp | 133 ++++++++++
mama/c_cpp/src/gunittest/c/openclose.c | 51 ----
mama/c_cpp/src/gunittest/c/openclosetest.cpp | 152 ++++++++++++
mama/c_cpp/src/gunittest/c/pricetest.cpp | 295 +++++++++++++++++++++++
mama/c_cpp/src/gunittest/c/subscriptiontest.cpp | 181 ++++++++++++++
mama/c_cpp/src/gunittest/c/timertest.cpp | 258 ++++++++++++++++++++
7 files changed, 1027 insertions(+), 53 deletions(-)
create mode 100644 mama/c_cpp/src/gunittest/c/datetimetest.cpp
delete mode 100644 mama/c_cpp/src/gunittest/c/openclose.c
create mode 100644 mama/c_cpp/src/gunittest/c/openclosetest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/pricetest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/timertest.cpp

diff --git a/mama/c_cpp/src/gunittest/c/Makefile.am b/mama/c_cpp/src/gunittest/c/Makefile.am
index 13b5915..e968bce 100644
--- a/mama/c_cpp/src/gunittest/c/Makefile.am
+++ b/mama/c_cpp/src/gunittest/c/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.2.4.1.16.5 2011/09/13 16:01:26 ianbell Exp $
+# $Id$
#
# OpenMAMA: The open middleware agnostic messaging API
# Copyright (C) 2011 NYSE Inc.
@@ -39,10 +39,16 @@ LDFLAGS += -L${srcdir}/../../c \
-L${srcdir}/../../../../../common/c_cpp/src/c

LIBS = -lmama -lwombatcommon -lgtest
+LDADD = -lgtest_main -ldl

bin_PROGRAMS = MainUnitTestC

nodist_MainUnitTestC_SOURCES = MainUnitTestC.cpp \
msgtests.cpp \
- iteration.cpp
+ iteration.cpp \
+ openclosetest.cpp \
+ datetimetest.cpp \
+ subscriptiontest.cpp \
+ pricetest.cpp \
+ timertest.cpp

diff --git a/mama/c_cpp/src/gunittest/c/datetimetest.cpp b/mama/c_cpp/src/gunittest/c/datetimetest.cpp
new file mode 100644
index 0000000..a3c7393
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/datetimetest.cpp
@@ -0,0 +1,133 @@
+/* Text editors: this is -*-C-*- code. */
+/*----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ * Copyright (c) 1999-2007 Wombat Financial Software Inc., of Incline
+ * Village, NV. All rights reserved.
+ *
+ * This software and documentation constitute an unpublished work and
+ * contain valuable trade secrets and proprietary information belonging
+ * to Wombat. None of this material may be copied, duplicated or
+ * disclosed without the express written permission of Wombat.
+ *
+ * WOMBAT EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
+ * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF
+ * MERCHANTABILITY AND/OR FITNESS FOR ANY PARTICULAR PURPOSE, AND
+ * WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE
+ * FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER
+ * EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR
+ * DOCUMENTATION.
+ *
+ * Under no circumstances shall Wombat be liable for incidental, special,
+ * indirect, direct or consequential damages or loss of profits,
+ * interruption of business, or related expenses which may arise from use
+ * of software or documentation, including but not limited to those
+ * resulting from defects in software and/or documentation, or loss or
+ * inaccuracy of data of any kind.
+ *
+ *--------------------------------------------------------------------------*/
+
+#include "gtest/gtest.h"
+#include "mama/mama.h"
+#include "mama/status.h"
+#include "MainUnitTestC.h"
+#include "mama/types.h"
+#include "mama/datetime.h"
+
+class MamaDateTimeTestC : public ::testing::Test
+{
+protected:
+ // This C date time will be used for testing
+ mamaDateTime m_DateTime;
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaDateTimeTestC *m_this;
+
+ MamaDateTimeTestC(void);
+ virtual ~MamaDateTimeTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+
+};
+
+MamaDateTimeTestC::MamaDateTimeTestC(void)
+{
+ m_DateTime = NULL;
+}
+
+MamaDateTimeTestC::~MamaDateTimeTestC(void)
+{
+}
+
+void MamaDateTimeTestC::SetUp(void)
+{
+ ASSERT_EQ(mamaDateTime_create(&m_DateTime), MAMA_STATUS_OK);
+}
+
+void MamaDateTimeTestC::TearDown(void)
+{
+ ASSERT_EQ(mamaDateTime_destroy(m_DateTime), MAMA_STATUS_OK);
+}
+
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* */
+
+TEST_F(MamaDateTimeTestC, NullArguments)
+{
+ // Call with a NULL date time
+ mama_f64_t seconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(NULL, &seconds), MAMA_STATUS_NULL_ARG);
+
+ // NULL seconds
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_DateTime, NULL), MAMA_STATUS_NULL_ARG);
+
+ // NULL for both
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(NULL, NULL), MAMA_STATUS_NULL_ARG);
+}
+
+TEST_F(MamaDateTimeTestC, CompareDates)
+{
+ // Get todays date in a date time
+ mamaDateTime today = NULL;
+
+ ASSERT_EQ(mamaDateTime_create(&today), MAMA_STATUS_OK);
+ ASSERT_EQ(mamaDateTime_setToNow(today), MAMA_STATUS_OK);
+
+ // Get the string representation of the data
+ char stringDate[100] = "";
+ ASSERT_EQ(mamaDateTime_getAsFormattedString(today, stringDate, 100, "%Y-%m-%d"), MAMA_STATUS_OK);
+
+ // Destroy the date
+ ASSERT_EQ(mamaDateTime_destroy(today), MAMA_STATUS_OK);
+
+ // Format a string using today's date and a time, this should be as "2010-07-04 10:00:00.000"
+ const char *time = "10:00:00.000000";
+ char completeDateTime[100] = "";
+ mamaDateTime m_cDateTime;
+ sprintf(completeDateTime, "%s %s", stringDate, time);
+
+ // Set the date from this string
+ ASSERT_EQ(mamaDateTime_setFromString(m_cDateTime, completeDateTime), MAMA_STATUS_OK);
+
+ // Get the number of seconds
+ mama_f64_t completeDateSeconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_cDateTime, &completeDateSeconds), MAMA_STATUS_OK);
+
+ // Set the date using just the time string
+ ASSERT_EQ(mamaDateTime_clear(m_cDateTime), MAMA_STATUS_OK);
+
+ ASSERT_EQ(mamaDateTime_setFromString(m_cDateTime, time), MAMA_STATUS_OK);
+
+ // Get the number of seconds from this
+ mama_f64_t timeSeconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_cDateTime, &timeSeconds), MAMA_STATUS_OK);
+
+ // These must be the same
+ ASSERT_EQ(completeDateSeconds, timeSeconds);
+}
+
diff --git a/mama/c_cpp/src/gunittest/c/openclose.c b/mama/c_cpp/src/gunittest/c/openclose.c
deleted file mode 100644
index 23adcef..0000000
--- a/mama/c_cpp/src/gunittest/c/openclose.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id: openclose.c,v 1.2.22.2 2011/08/10 14:53:30 nicholasmarriott Exp $
- *
- * OpenMAMA: The open middleware agnostic messaging API
- * Copyright (C) 2011 NYSE Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <gtest/gtest.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-
-
-TEST(ExampleTest, LogicExampleHello) {
- printf("simple example test\n");
-}
-
-
-TEST(ExampleTest, LogicExampleHello2) {
- printf("simple example test 2\n");
-
-}
-
-
-/**
- * *VERY* Simple example
-
-TEST(OpenCloseTest, BasicOpenClose) {
- printf("BasicOpenClose test\n");
-}
-
-
-TEST(OpenCloseTest, RepeatedOpenClose) {
- printf("RepeatedOpenClose\n");
-
-}
-*/
diff --git a/mama/c_cpp/src/gunittest/c/openclosetest.cpp b/mama/c_cpp/src/gunittest/c/openclosetest.cpp
new file mode 100644
index 0000000..25e51b3
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/openclosetest.cpp
@@ -0,0 +1,152 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <gtest/gtest.h>
+#include "mama/mama.h"
+#include "mama/status.h"
+#include "MainUnitTestC.h"
+
+class MamaOpenCloseTestC : public ::testing::Test
+{
+protected:
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaOpenCloseTestC *m_this;
+
+ MamaOpenCloseTestC(void);
+ virtual ~MamaOpenCloseTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+
+
+};
+
+MamaOpenCloseTestC::MamaOpenCloseTestC(void)
+{
+}
+
+MamaOpenCloseTestC::~MamaOpenCloseTestC(void)
+{
+}
+
+void MamaOpenCloseTestC::SetUp(void)
+{
+ m_this = this;
+}
+
+void MamaOpenCloseTestC::TearDown(void)
+{
+ m_this = NULL;
+}
+
+static void MAMACALLTYPE startCallback(mama_status status)
+{
+ printf("In start in background callback\n");
+}
+
+
+/* ************************************************************************* */
+/* Tests */
+/* ************************************************************************* */
+TEST_F(MamaOpenCloseTestC, OpenClose)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ mama_close();
+}
+
+TEST_F(MamaOpenCloseTestC, NestedOpenClose)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ printf("Attempt first open\n");
+ mama_open();
+
+ printf("Attempt second open\n");
+ mama_open();
+
+ printf("Attempt first close\n");
+ mama_close();
+
+ printf("Attempt second close\n");
+ mama_close();
+
+ printf("Finished nested testing\n");
+}
+
+TEST_F(MamaOpenCloseTestC, OpenCloseReopenSameBridge)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ mama_close();
+
+ ASSERT_EQ(MAMA_STATUS_OK, mama_open());
+
+ return;
+
+ // If we get here there is a problem
+ ASSERT_TRUE(1);
+}
+
+TEST_F(MamaOpenCloseTestC, OpenCloseReopenNewBridge)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, "wmw");
+
+ mama_open();
+
+ mama_close();
+
+ mama_loadBridge(&mBridge, "lbm");
+
+ mama_open();
+
+ mama_close();
+}
+
+TEST_F(MamaOpenCloseTestC, StartStopDifferentThreads)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ // Start mama in the background so it uses a different thread
+ ASSERT_EQ(MAMA_STATUS_OK, mama_startBackground(mBridge, startCallback));
+
+ // Sleep to allow the other thread to complete startup
+ sleep(2);
+
+ mama_stop(mBridge);
+
+ mama_close();
+}
+
diff --git a/mama/c_cpp/src/gunittest/c/pricetest.cpp b/mama/c_cpp/src/gunittest/c/pricetest.cpp
new file mode 100644
index 0000000..8bcc7c8
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/pricetest.cpp
@@ -0,0 +1,295 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/*
+ * Description : This test will check the mamaPrice type to ensure that the
+ * setting the precision will not cause the price value to be
+ * truncated.
+ */
+
+#include "gtest/gtest.h"
+#include "MainUnitTestC.h"
+#include "mama/price.h"
+
+#ifdef WIN32
+#define WMPRICE_LARGE_INT32_FORMAT_SPECIFIER "%I32d"
+#define WMPRICE_LARGE_INT64_FORMAT_SPECIFIER "%I64d"
+#else
+#define WMPRICE_LARGE_INT32_FORMAT_SPECIFIER "%ld"
+#define WMPRICE_LARGE_INT64_FORMAT_SPECIFIER "%lld"
+#endif
+
+class MamaPriceTestC : public ::testing::Test
+{
+protected:
+
+ mamaPrice m_price;
+
+protected:
+
+ MamaPriceTestC(void);
+ virtual ~MamaPriceTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+};
+
+
+MamaPriceTestC::MamaPriceTestC(void)
+{
+ m_price = NULL;
+}
+
+MamaPriceTestC::~MamaPriceTestC(void)
+{
+}
+
+
+void MamaPriceTestC::SetUp(void)
+{
+ // Create a new mama price
+ ASSERT_EQ(mamaPrice_create(&m_price), MAMA_STATUS_OK);
+
+ // Set the value of the price
+ ASSERT_EQ(mamaPrice_setValue(m_price, 4000000000), MAMA_STATUS_OK);
+}
+
+void MamaPriceTestC::TearDown(void)
+{
+ // Delete the price
+ if(m_price != NULL)
+ {
+ ASSERT_EQ(mamaPrice_destroy(m_price), MAMA_STATUS_OK);
+ }
+}
+
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* +*/
+TEST_F(MamaPriceTestC, SetPrecisionInt)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_INT), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv2)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_2), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv4)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_4), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv8)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_8), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv16)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_16), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv32)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_32), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv64)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_64), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv128)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_128), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv256)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_256), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv512)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_512), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
diff --git a/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp b/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
new file mode 100644
index 0000000..ea631dc
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
@@ -0,0 +1,181 @@
+/*----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ * Copyright (c) 1999-2007 Wombat Financial Software Inc., of Incline
+ * Village, NV. All rights reserved.
+ *
+ * This software and documentation constitute an unpublished work and
+ * contain valuable trade secrets and proprietary information belonging
+ * to Wombat. None of this material may be copied, duplicated or
+ * disclosed without the express written permission of Wombat.
+ *
+ * WOMBAT EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
+ * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF
+ * MERCHANTABILITY AND/OR FITNESS FOR ANY PARTICULAR PURPOSE, AND
+ * WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE
+ * FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER
+ * EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR
+ * DOCUMENTATION.
+ *
+ * Under no circumstances shall Wombat be liable for incidental, special,
+ * indirect, direct or consequential damages or loss of profits,
+ * interruption of business, or related expenses which may arise from use
+ * of software or documentation, including but not limited to those
+ * resulting from defects in software and/or documentation, or loss or
+ * inaccuracy of data of any kind.
+ *
+ *--------------------------------------------------------------------------*/
+
+#include "gtest/gtest.h"
+#include "mama/mama.h"
+#include "MainUnitTestC.h"
+#include "mama/subscription.h"
+#include "mama/source.h"
+#include "mama/types.h"
+
+//using namespace Wombat;
+
+class MamaSubscriptionTest : public ::testing::Test
+{
+public:
+ mamaBridge m_bridge;
+protected:
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaSubscriptionTest *m_this;
+
+ mamaQueue m_defaultQueue;
+
+ mamaMsgCallbacks simpleCallback;
+
+ mamaSubscription subscription;
+
+ mamaTransport m_transport;
+ char transportName[10];
+
+protected:
+
+ MamaSubscriptionTest(void);
+ virtual ~MamaSubscriptionTest(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+};
+
+static void MAMACALLTYPE onSimpleCallbackCreate(mamaSubscription sub, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackDestroy(mamaSubscription sub, void* closure)
+{
+ MamaSubscriptionTest* mamaSubscriptionTest = (MamaSubscriptionTest*) closure;
+ mama_stop(mamaSubscriptionTest->m_bridge);
+}
+
+static void MAMACALLTYPE onSimpleCallbackMsg(mamaSubscription sub, mamaMsg msg, void* closure, void* itemClosure)
+{
+ MamaSubscriptionTest* mamaSubscriptionTest = (MamaSubscriptionTest*) closure;
+ mama_stop(mamaSubscriptionTest->m_bridge);
+}
+
+static void MAMACALLTYPE onSimpleCallbackRecapRequest(mamaSubscription sub, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackQuality(mamaSubscription sub, mamaQuality quality, const char* symbol, short cause, const void* platformInfo, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackGap(mamaSubscription sub, void* closure)
+{
+}
+
+MamaSubscriptionTest::MamaSubscriptionTest(void)
+{
+ m_bridge = NULL;
+ m_transport = NULL;
+ m_defaultQueue = NULL;
+
+ memset(&simpleCallback, 0, sizeof(simpleCallback));
+ simpleCallback.onCreate = onSimpleCallbackCreate;
+ simpleCallback.onDestroy = onSimpleCallbackDestroy;
+ simpleCallback.onMsg = onSimpleCallbackMsg;
+ simpleCallback.onQuality = onSimpleCallbackQuality;
+ simpleCallback.onGap = onSimpleCallbackGap;
+ simpleCallback.onRecapRequest = onSimpleCallbackRecapRequest;
+
+ subscription = NULL;
+
+ //recreateOnMsgCallback = ;
+ //recreateOnDestroyCallback = NULL;
+}
+
+MamaSubscriptionTest::~MamaSubscriptionTest(void)
+{
+}
+
+
+void MamaSubscriptionTest::SetUp(void)
+{
+ // Save the this pointer in the member variable to get around gtest problems
+ m_this = this;
+
+ mama_loadBridge(&m_bridge, getMiddleware());
+
+ mama_open();
+
+ transportName[0] = '\0';
+ strncat(transportName, "sub_", 5);
+ strncat(transportName, getMiddleware(), 4);
+
+ mamaTransport_allocate(&m_transport);
+ mamaTransport_create(m_transport, transportName, m_bridge);
+}
+
+void MamaSubscriptionTest::TearDown(void)
+{
+ m_transport = NULL;
+
+ mama_close();
+
+ m_this = NULL;
+}
+
+
+
+/* ************************************************************************* */
+/* Test Functions - Basic Subscription */
+/* ************************************************************************* */
+
+TEST_F(MamaSubscriptionTest, BasicSubscription)
+{
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_allocate(&subscription));
+ if(NULL != subscription)
+ {
+ // Get the default queue
+ mama_getDefaultEventQueue(m_bridge, &m_defaultQueue);
+
+ //create a test source
+ mamaSource testSource = NULL;
+ mamaSource_create(&testSource);
+ mamaSource_setId(testSource, "TestSource");
+ mamaSource_setTransport(testSource, m_transport);
+ mamaSource_setSymbolNamespace(testSource, "WOMBAT");
+ printf("Note: as there is no real source, this test should hang\n");
+
+ // Create the subscription
+ ASSERT_EQ( MAMA_STATUS_OK,
+ mamaSubscription_create(subscription, m_defaultQueue, &simpleCallback, testSource, "TEST_SYMBOL", m_this));
+
+ mama_start(m_bridge);
+
+ // Destroy the subscription
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_destroy(subscription));
+
+ // Delete the basic subscription
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_deallocate(subscription));
+ }
+}
diff --git a/mama/c_cpp/src/gunittest/c/timertest.cpp b/mama/c_cpp/src/gunittest/c/timertest.cpp
new file mode 100644
index 0000000..2604fe7
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/timertest.cpp
@@ -0,0 +1,258 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/*
+ * Description : This test harness will cover MAMA issue 3418 which includes
+ * several timer tests. See the function header for each
+ * fixture for more information. Note that this test should
+ * be run against different versions of LBM including 3.5.2
+ * and an earlier version.
+ */
+
+#include <gtest/gtest.h>
+#include "MainUnitTestC.h"
+#include "wombat/wConfig.h"
+#include "mama/types.h"
+#include "mama/timer.h"
+#include "mama/queue.h"
+#include <cstring>
+#include <cstdio>
+#include <cstdlib>
+
+
+class MamaTimerTestC : public ::testing::Test
+{
+protected:
+ MamaTimerTestC();
+ virtual ~MamaTimerTestC();
+
+ virtual void SetUp();
+ virtual void TearDown ();
+public:
+ // Initialise all member variables
+ int m_numberForCallbacks;
+ int m_numberForTimers;
+ int m_numberRecursiveCallbacks;
+ double m_timerInterval;
+ mamaBridge m_bridge;
+ mamaQueue m_defaultQueue;
+ mamaTransport m_transport;
+
+ mamaTimer mtarray[1000];
+
+ MamaTimerTestC *m_this;
+ char transportName[10];
+
+ mamaTimer shortTimer;
+ mamaTimer longTimer;
+ mamaTimer stopperTimer;
+ mamaTimer recursiveTimer;
+
+ mamaTimerCb m_TickCallback;
+ mamaTimerCb m_DestroyCallback;
+
+};
+
+MamaTimerTestC::MamaTimerTestC()
+{
+ m_numberForCallbacks = 0;
+ m_numberForTimers = 10;
+ m_numberRecursiveCallbacks = 0;
+ m_timerInterval = 0.0001;
+ m_bridge = NULL;
+ m_defaultQueue = NULL;
+ m_transport = NULL;
+ shortTimer = NULL;
+ longTimer = NULL;
+ stopperTimer = NULL;
+ recursiveTimer = NULL;
+
+ m_TickCallback = NULL;
+ m_DestroyCallback = NULL;
+ m_this = NULL;
+}
+
+MamaTimerTestC::~MamaTimerTestC()
+{
+}
+
+void MamaTimerTestC::SetUp(void)
+{
+ // Save the this pointer in the member variable to get around gtest problems
+ m_this = this;
+
+ mama_loadBridge(&m_bridge, getMiddleware());
+
+ mama_open();
+
+ mama_getDefaultEventQueue(m_bridge, &m_defaultQueue);
+
+ transportName[0] = '\0';
+ strncat(transportName, "sub_", 5);
+ strncat(transportName, getMiddleware(), 4);
+
+ mamaTransport_allocate(&m_transport);
+ mamaTransport_create(m_transport, transportName, m_bridge);
+}
+
+void MamaTimerTestC::TearDown(void)
+{
+ m_this = NULL;
+}
+
+static void MAMACALLTYPE onTimerTick(mamaTimer timer, void* closure)
+{
+ printf("Timer ticking....\n");
+ mamaTimer_destroy(timer);
+}
+
+static void MAMACALLTYPE onTimerDestroy(mamaTimer timer, void* closure)
+{
+ printf("Timer destroying...\n");
+ MamaTimerTestC *fixture = (MamaTimerTestC *)closure;
+ fixture->m_numberForCallbacks ++;
+ printf("m_numberForCallbacks = %i\n", fixture->m_numberForCallbacks);
+
+ // If all the timers have been destroyed then quit out
+ if(fixture->m_numberForCallbacks == fixture->m_numberForTimers)
+ {
+ printf("Stopping timer\n");
+ mama_stop(fixture->m_bridge);
+ }
+}
+
+static void MAMACALLTYPE onStopDispatchingTimerTick(mamaTimer timer, void* closure)
+{
+ mamaTimer_destroy(timer);
+}
+
+static void MAMACALLTYPE onStopDispatchingTimerDestroy(mamaTimer timer, void* closure)
+{
+ printf("Stopping Two Timers ticking\n");
+ MamaTimerTestC* fixture = (MamaTimerTestC *)closure;
+ mama_stop(fixture->m_bridge);
+
+ mamaTimer_destroy(fixture->shortTimer);
+ mamaTimer_destroy(fixture->longTimer);
+}
+
+
+static void MAMACALLTYPE onRecursiveTimerTick(mamaTimer timer, void* closure)
+{
+ MamaTimerTestC *fixture = (MamaTimerTestC*) closure;
+ EXPECT_EQ(mamaTimer_destroy(timer), MAMA_STATUS_OK);
+ fixture->recursiveTimer = NULL;
+}
+
+
+static void MAMACALLTYPE onRecursiveTimerDestroy(mamaTimer timer, void* closure)
+{
+ // Cast the closure to a test fixture
+ printf("in recursive onDestroy\n");
+ MamaTimerTestC *fixture = (MamaTimerTestC *)closure;
+
+ // Increment the number of times this function has been called
+ fixture->m_numberRecursiveCallbacks ++;
+
+ // If this is the 10th pass then quit out
+ if(fixture->m_numberRecursiveCallbacks == 10)
+ {
+ //EXPECT_EQ(mama_stop(fixture->m_init->bridge), MAMA_STATUS_OK);
+ mama_stop(fixture->m_bridge);
+ }
+ else
+ {
+ mamaTimer_create2(&fixture->recursiveTimer, fixture->m_defaultQueue, onRecursiveTimerTick, onRecursiveTimerDestroy, fixture->m_timerInterval, fixture->m_this);
+ }
+}
+
+
+static void MAMACALLTYPE onTwoTimerTick(mamaTimer timer, void* closure)
+{
+ printf("In TwoTimer Tick\n");
+
+}
+
+static void MAMACALLTYPE onTwoTimerDestroy(mamaTimer timer, void * closure)
+{
+ // Cast the closure to a test fixture
+ printf("In TwoTimer Destroy\n");
+}
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* */
+
+/* Description : This test will create a large number of timers in a for loop, each one will
+ * be freed in its callback function.
+ */
+TEST_F(MamaTimerTestC, ForTimer)
+{
+ // Create a whole lot of timers
+ for(int counter=0; counter<m_numberForTimers; counter++)
+ {
+ printf("Creating new timer\n");
+ m_timerInterval = (counter + 1)/100;
+ mamaTimer_create2(&mtarray[counter], m_defaultQueue, onTimerTick, onTimerDestroy, m_timerInterval, m_this);
+ }
+
+ ASSERT_EQ(MAMA_STATUS_OK, mama_start(m_bridge));
+
+}
+
+
+/* Description : This function will create a timer which will create another timer
+ * in its callback function, (the first timer will be destroyed).
+ */
+
+TEST_F(MamaTimerTestC, RecursiveTimer)
+{
+ //Store the call
+ mamaTimer_create2(&recursiveTimer, m_defaultQueue, onRecursiveTimerTick, onRecursiveTimerDestroy, m_timerInterval, m_this);
+
+ // Start processing messages, after 10 timers have been created this will stop blocking
+ mama_start(m_bridge);
+}
+
+
+/* Description : This test will create 2 timers, the first will constantly reset itself
+ * while the second will continue to reset the first timer as well.
+ * The whole test will run for 3 seconds.
+ */
+TEST_F(MamaTimerTestC, TwoTimer)
+{
+
+ double interval = 0.1;
+ double testDuration = 3.0;
+
+ mamaTimer_create2(&shortTimer, m_defaultQueue, onTwoTimerTick, onTwoTimerDestroy, interval, m_this);
+ mamaTimer_create2(&longTimer, m_defaultQueue, onTwoTimerTick, onTwoTimerDestroy, interval*2.0, m_this); //use same callback
+
+ mamaTimer_create2( &stopperTimer,
+ m_defaultQueue,
+ onStopDispatchingTimerTick,
+ onStopDispatchingTimerDestroy,
+ testDuration,
+ m_this);
+
+ mama_start(m_bridge);
+
+}
+
--
1.7.7.6


Bridge devel process

William Henry <whenry@...>
 

Mike or someone,

Would you mind posting a link to the "dummies guide" to OpenMAMA bridge development?

Best
William


OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

Mark Spielman
 

I’ve cloned the OpenMAMA 2.1 release git repository.  When I try to configure the environment with --wIth-avis, the output from the configure script has a bunch of warnings of the following:

 

configure: WARNING: unrecognized options: --with-avis

 

After debugging, these seem to be benign.  Can the build environment be enhanced to remove these warnings?

 

Cheers,

Mark

 

 

Mark Spielman

Development Lead, Solace Systems Professional Services
+1-613-271-1010 x1021

mark.spielman@...

www.solacesystems.com

 

 


Fedora build issues

William Henry <whenry@...>
 

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().

This appears to be the cause of no makefile being build in mama/c_cpp and so that never builds.

William


Re: Bridge devel process

Mike Schonberg <mschonberg@...>
 

-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org [mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Wednesday, May 02, 2012 4:44 PM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Bridge devel process

Mike or someone,

Would you mind posting a link to the "dummies guide" to OpenMAMA bridge
development?
The current bridge documentation, which we will post soon, does not include a
"dummies guide". We want to add a "getting started" guide before
sending it out for review.

In the mean time, we will post a summary of first steps for writing a bridge
to help you get started.

I also think it makes sense to write a well documented NULL template bridge to
facilitate testing and bridge development.

Regards,
-Mike

Best
William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Re: Fedora build issues

Mike Schonberg <mschonberg@...>
 

-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org [mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


[PATCH] [mama] Add libpthread to library list for sem_timedwait

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

configure.ac needs to search for sem_timedwait in both librt and libpthread.
On OS's like certain Solaris versions that do not support sem_timedwait(),
OpenMAMA provides an implentation.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mama/c_cpp/configure.ac b/mama/c_cpp/configure.ac
index e70e918..0ff4380 100644
--- a/mama/c_cpp/configure.ac
+++ b/mama/c_cpp/configure.ac
@@ -106,7 +106,7 @@ AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,gethostbyname)

# SOLARIS 8 does not have sem_timedwait
-AC_SEARCH_LIBS(sem_timedwait, rt,
+AC_SEARCH_LIBS(sem_timedwait, rt pthread,
[
echo "Found sem_timedwait()."
],
--
1.7.7.6


[PATCH] [mamda] Add patch for -lmama for news and orderbook examples

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

The news and orderbook examples were not building because the linker could not
find libmama. This patch adjusts the link flags to include the path to the mama
c libraries.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mamda/c_cpp/src/examples/news/Makefile.am | 1 +
mamda/c_cpp/src/examples/orderbooks/Makefile.am | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mamda/c_cpp/src/examples/news/Makefile.am b/mamda/c_cpp/src/examples/news/Makefile.am
index 5cf0964..751cedf 100644
--- a/mamda/c_cpp/src/examples/news/Makefile.am
+++ b/mamda/c_cpp/src/examples/news/Makefile.am
@@ -33,6 +33,7 @@ CPPFLAGS +=-I$(srcdir)/../../cpp \

LDFLAGS += -L${srcdir}/../../cpp \
-L$(srcdir)/../../cpp/news \
+ -L$(srcdir)/../../../../../mama/c_cpp/src/c \
-L$(srcdir)/../../../../../mama/c_cpp/src/cpp

LIBS += -lmamdanews -lmamda -lmamacpp -lmama -lpthread -lnsl -ldl -lm
diff --git a/mamda/c_cpp/src/examples/orderbooks/Makefile.am b/mamda/c_cpp/src/examples/orderbooks/Makefile.am
index 92568b1..36685d6 100644
--- a/mamda/c_cpp/src/examples/orderbooks/Makefile.am
+++ b/mamda/c_cpp/src/examples/orderbooks/Makefile.am
@@ -35,6 +35,7 @@ CPPFLAGS += -I$(srcdir)/../../cpp \

LDFLAGS += -L${srcdir}/../../cpp \
-L$(srcdir)/../../cpp/orderbooks \
+ -L$(srcdir)/../../../../../mama/c_cpp/src/c \
-L$(srcdir)/../../../../../mama/c_cpp/src/cpp

if USE_GCC_FLAGS
--
1.7.7.6


Re: OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

Mike Schonberg <mschonberg@...>
 

Mark,

 

The current top level configure script is fairly simplistic and passes all of the configure arguments to all the lower level configure scripts. If the option is not supported by the lower level configure, it emits a warning. These are, as you mention, harmless. At some point we should make the higher level script more sophisticated. It might make sense to even use autoconf rather than a simple shell script.

 

At the moment this is fairly low priority, but we should get to it when we have time.

 

Regards,

-Mike

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Mark Spielman
Sent: Thursday, May 03, 2012 9:28 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

 

I’ve cloned the OpenMAMA 2.1 release git repository.  When I try to configure the environment with --wIth-avis, the output from the configure script has a bunch of warnings of the following:

 

configure: WARNING: unrecognized options: --with-avis

 

After debugging, these seem to be benign.  Can the build environment be enhanced to remove these warnings?

 

Cheers,

Mark

 

 

Mark Spielman

Development Lead, Solace Systems Professional Services
+1-613-271-1010 x1021

mark.spielman@...

www.solacesystems.com

 

 


Please consider the environment before printing this email.

Visit our website at http://www.nyse.com
*****************************************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Re: Fedora build issues

William Henry <whenry@...>
 

I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org [mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment
to it is privileged, confidential and protected from disclosure. If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message, and
please delete it from your system. Thank you. NYSE Euronext.


Re: Fedora build issues

William Henry <whenry@...>
 

Got the build at least going now with the avis stuff installed.

But I'm hitting:
bridge.c:22:24: fatal error: avis/elvin.h: No such file or directory
compilation terminated.
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

William

----- Original Message -----
I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org
[mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current
code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment
to it is privileged, confidential and protected from disclosure.
If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message,
and
please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev


Re: Fedora build issues

William Henry <whenry@...>
 

Okay so here's what's wrong now and what I did to get to wrong and what I'm doing to fix it.

The ./configure flags the avis_client_config.h file.

So after svn co the avis source. I copied this file (well one of them - there are four but no "linux") to /usr/local/include/avis.

That got me by the ./configure

However it seems that more .h files are needed in this directory for the build. So I'll copy them over one by one. Later: actually I just copied the entire directory over.

Now I'm getting:
bridge.c: In function 'avisBridge_getVersion':
bridge.c:65:30: error: 'VERSION' undeclared (first use in this function)
bridge.c:65:30: note: each undeclared identifier is reported only once for each function it appears in
bridge.c:66:1: warning: control reaches end of non-void function [-Wreturn-type]
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

I wonder if I have the correct .h file versions.

William

----- Original Message -----
Got the build at least going now with the avis stuff installed.

But I'm hitting:
bridge.c:22:24: fatal error: avis/elvin.h: No such file or directory
compilation terminated.
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

William

----- Original Message -----
I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org
[mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current
code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any
attachment
to it is privileged, confidential and protected from disclosure.
If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any
dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message,
and
please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev


Re: Fedora build issues

Mike Schonberg <mschonberg@...>
 

-----Original Message-----
From: William Henry [mailto:whenry@redhat.com]
Sent: Friday, May 04, 2012 12:15 PM
To: Mike Schonberg
Cc: openmama-dev@lists.openmama.org
Subject: Re: [Openmama-dev] Fedora build issues

Okay so here's what's wrong now and what I did to get to wrong and what
I'm doing to fix it.

The ./configure flags the avis_client_config.h file.
This file needs to be copied over manually. I believe the README file
documents this.


So after svn co the avis source. I copied this file (well one of them -
there are four but no "linux") to /usr/local/include/avis.

That got me by the ./configure

However it seems that more .h files are needed in this directory for
the build. So I'll copy them over one by one. Later: actually I just
copied the entire directory over.

Now I'm getting:
bridge.c: In function 'avisBridge_getVersion':
bridge.c:65:30: error: 'VERSION' undeclared (first use in this
function)
bridge.c:65:30: note: each undeclared identifier is reported only once
for each function it appears in
bridge.c:66:1: warning: control reaches end of non-void function [-
Wreturn-type]
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-
1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-
1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-
1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-
1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-
1.1/mama/c_cpp'

I wonder if I have the correct .h file versions.
We usually download the Avis archives rather than pulling from SVN.
It is possible that the SVN version is different.

-Mike

William

----- Original Message -----
Got the build at least going now with the avis stuff installed.

But I'm hitting:
bridge.c:22:24: fatal error: avis/elvin.h: No such file or directory
compilation terminated.
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

William

----- Original Message -----
I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org
[mailto:openmama-dev-
bounces@lists.openmama.org] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current
code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any
attachment
to it is privileged, confidential and protected from disclosure.
If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any
dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message,
and
please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Re: Why are bridges in the general build

Michael Schonberg
 

On Sat, May 5, 2012 at 11:05 AM, Leslie Spiro <lspiro@dotrtt.com> wrote:

Reading the difficulties that William is having getting the Avis bridge to
build, wouldn't it make sense to split the build into open mama core
(possibly including a null bridge as an example for bridge and payload
writers), and then have separate bridge builds ?
Les,

You can configure with --without-middleware-bridge and no bridge will be
built. Likewise you can specify --without-payload-bridge to build
without a payload
bridge.

I definitely like the idea of a NULL bridge for testing and as a
documented template for writing
new bridges.

I am not sure that separate bridge builds make sense. When I download
source, I expect to run
configure, make, make install and build something useful. I prefer to
make the configure scripts
smart enough to build build painlessly. One option is for the default
behavior to
automatically build bridges if all the required packages (middleware,
tools, etc.) are found in
the default locations. Updating configure.ac can be painful, but you
usually only have to do
it once.

Currently, I think we need to make the avis configuration more sophisticated.

Regards,
-Mike

Also as the number of bridges increase we don't want to keep changing the
build as each new bridge is released.

Les Spiro
Tick42

_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev


Why are bridges in the general build

Leslie Spiro <lspiro@...>
 

Reading the difficulties that William is having getting the Avis bridge to build, wouldn't it make sense to split the build into open mama core (possibly including a null bridge as an example for bridge and payload writers), and then have separate bridge builds ?

Also as the number of bridges increase we don't want to keep changing the build as each new bridge is released.

Les Spiro
Tick42


Re: Why are bridges in the general build

Pavel Patarinski
 

I can build all of the projects under OpenMAMA 2.1 solution (Windows 7, VS 2010).

Requirements:
  1. flex - http://gnuwin32.sourceforge.net/packages/flex.htm
  2. avis-client - http://avis.sourceforge.net/downloads.html

Environment variables:
  1. add AVIS_HOME variable with path to avis-client as value.
  2. append path to flex executable to system "Path" variable

Fix paths in solution:
  1. for all of the projects which depends on avis-client lib, remove Debug after AVIS_HOME.

Regards
Pavel

On  5.05.2012 21:05, Leslie Spiro wrote:
Reading the difficulties that William is having getting the Avis bridge to build, wouldn't it make sense to split the build into open mama core (possibly including a null bridge as an example for bridge and payload writers), and then have separate bridge builds ?

Also as the number of bridges increase we don't want to keep changing the build as each new bridge is released.

Les Spiro
Tick42


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev


General MAMA feature / project questions

Noah Zucker <NZucker@...>
 

Greetings all. I'm getting started with OpenMAMA here at NYSE and had the below questions. Mike suggested that I send them to this list for the benefit of anyone else who had similar questions:


1) mama.properties

1a) What component / function provides the parsed values from mama.properties?

1b) How does my bridge access configuration in mama.properties?

1c) Do I have to parse the strings myself, or can I provide just the components I need such as the final token that identifies the actual setting I need?

1d) How / where do I define the configuration parameters that are settable in mama.properties?


2) Message Format / Encoding

2a) Does OpenMAMA come with an out-of-the-box encoding for message payload, or is this supposed to be provided by the bridge?

2b) If it comes with payload encoding(s), what are the format(s)?


3) MAMA engine

3a) Does OpenMAMA come with the messaging engine that manages the event loop, queues, queue monitoring, quality of service detection, etc. or does that all (or some of it) have to be provided by the bridge implementation?


4) Build

4a) How do I clean the build? I noticed that there are object files all over the place next to my source files. How do I get rid of these? (Perhaps this is a n00bish question since I'm new to automake).

4b) Have we considered separating bridges from the OpenMAMA project? Related: how do we configure OpenMAMA to build with multiple bridges, or one bridge but not another?



Regards,

Noah Zucker
NYSE Technologies

Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Re: General MAMA feature / project questions

Mike Schonberg <mschonberg@...>
 

On Wed, 9 May 2012, Noah Zucker wrote:

Greetings all. I'm getting started with OpenMAMA here at NYSE and had the
below questions. Mike suggested that I send them to this list for the benefit
of anyone else who had similar questions:


1) mama.properties

1a) What component / function provides the parsed values from mama.properties?
mama_open() by default attempts to load properties from
$WOMBAT_PATH/mama.properties.

mama_openWithProperties(path, filename) initializes OpenMAMA reading the
properties from path/filename rather than $WOMBAT_PATH/mama.properties.

mama_getProperty(const char* name) returns the property value given the property
name.

mama_setProperty(...) alows applications to set/modify properties
prgramatically.

mama_setPropertiesFromFile(path, filename) loads additional properties from the
specfied file.

common/c_cpp/src/c/property.h defines the low level interface for manipulating
property files. It uses the flex grammar defined in common/.../c/properties.l to
parse properties files.


1b) How does my bridge access configuration in mama.properties?
Bridges should use mama_getProperty() to access properties. Bridges should
prefix all properties with "mama.<bridge_name>". The canonical form is
"mama.<bridge_name>.<category>.[<name>].property". The optional name allows for
multiple "named" configurations. For example,
mama.some_middleware.transport.my_transport.broker_address=127.0.0.1 defines the
broker address for a transported named "my_transport" on some_middleware.

1c) Do I have to parse the strings myself, or can I provide just the
components I need such as the final token that identifies the actual setting I
need?
The properties parser only knows how to parse the file into name value pairs so
bridges need to interpret the resulting value strings. There are a few helper
functions like strtobool() in common/.../c/wombat/strutils.h; however it might
be nice to start building a well defined library of property parsers/validators
standard types (IP addresses, integers, comma delimited lists, etc.).

1d) How / where do I define the configuration parameters that are settable in
mama.properties?
I suggest that you create properties.h file for your bridge with macros for
all your properties and a properties.c file with functions to read and interpret
them.



2) Message Format / Encoding

2a) Does OpenMAMA come with an out-of-the-box encoding for message payload, or
is this supposed to be provided by the bridge?
Currently the Avis message payload is the only open source payload. Since
payloads are not dependent on middleware, it should be possible to use the Avis
payload with other middleware bridges.

We are currently investigating other potential FOSS payload implementations. One
interesting possibility is Google Protocol Buffers.


2b) If it comes with payload encoding(s), what are the format(s)?


3) MAMA engine

3a) Does OpenMAMA come with the messaging engine that manages the event loop,
queues, queue monitoring, quality of service detection, etc. or does that all
(or some of it) have to be provided by the bridge implementation?
MAMA currently contains default implementations for queues and timers. I would
like to see a default implemenatation for IO Events as well. Since most
applications do not use IO Events, implementing them is optional.


4) Build

4a) How do I clean the build? I noticed that there are object files all over
the place next to my source files. How do I get rid of these? (Perhaps this
is a n00bish question since I'm new to automake).
"make clean" should get rid of most of them.

I also find "git clean -d -f" useful (WARNING: THIS WILL DELETE ALL UNTRACKED
FILES SO MAKE SURE THAT YOU HAVE STASHED, OR ADDED ALL NEW SOURCE FILES FIRST).

We should also get out of tree builds working as this minimizing the noise in
the source directory.




4b) Have we considered separating bridges from the OpenMAMA project? Related:
how do we configure OpenMAMA to build with multiple bridges, or one bridge but
not another?
Configure.ac takes care of this.

In general you run "configure --with-<middlware_name>" to indicate which
bridge(s) you want to build. In the future, I would like to add an option that
builds all middlewares for which configure can locate valid libraries.

You can configure with --without-middleware-bridge and no bridge will be built.
Likewise you can specify --without-payload-bridge to build without a payload
bridge.


Regards,
-Mike


Regards,

Noah Zucker
NYSE Technologies

Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


FYI erroneous log messages

William Henry <whenry@...>
 

Hi,

Got some time today to look through the avis bridge code to try and understand the flow more.

Not a biggie: I found that avisBridgeMamaTransport_destroy() logs two avisBridgeMamaTransport_create traces.

William


[PATCH] [avis-bridge] Fix code style and incorrect logging

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

Two log statements in avisBridgeMamaTransport_destroy() incorrectly logged
"create".

Cleaned up most of the file to adhere more closely to the dominant coding
convention. Wide lines reduced to 80 columns and C++ style single line comments
converted to C comments. Moved {'s to their own lines for conditionals.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/src/c/bridge/avis/transportbridge.c | 138 ++++++++++++++++--------
1 files changed, 94 insertions(+), 44 deletions(-)

diff --git a/mama/c_cpp/src/c/bridge/avis/transportbridge.c b/mama/c_cpp/src/c/bridge/avis/transportbridge.c
index de10b61..5b8d32d 100755
--- a/mama/c_cpp/src/c/bridge/avis/transportbridge.c
+++ b/mama/c_cpp/src/c/bridge/avis/transportbridge.c
@@ -40,10 +40,10 @@

#define avisTransport(transport) ((avisTransportBridge*) transport)
#define CHECK_TRANSPORT(transport) \
- do { \
- if (avisTransport(transport) == 0) return MAMA_STATUS_NULL_ARG; \
- if (avisTransport(transport)->mAvis == 0) return MAMA_STATUS_INVALID_ARG; \
- } while(0)
+ do { \
+ if (avisTransport(transport) == 0) return MAMA_STATUS_NULL_ARG; \
+ if (avisTransport(transport)->mAvis == 0) return MAMA_STATUS_INVALID_ARG;\
+ } while(0)



@@ -55,26 +55,45 @@ void* avisDispatchThread(void* closure);

void log_avis_error(MamaLogLevel logLevel, Elvin* avis)
{
- mama_log (logLevel, "avis error code=%d, error msg=%s", avis->error.code, avis->error.message);
+ mama_log (logLevel, "avis error code=%d, error msg=%s", avis->error.code,
+ avis->error.message);
}

-void closeListener(Elvin* avis, CloseReason reason, const char* message, void* closure)
+void closeListener(Elvin* avis,
+ CloseReason reason,
+ const char* message,
+ void* closure)
{
const char* errMsg;
- if (avisBridge(closure) == NULL) {
- mama_log (MAMA_LOG_LEVEL_FINE, "Avis closeListener: could not get Avis bridge");
+ if (avisBridge(closure) == NULL)
+ {
+ mama_log (MAMA_LOG_LEVEL_FINE,
+ "Avis closeListener: could not get Avis bridge");
return;
}

switch( reason )
{
- case REASON_CLIENT_SHUTDOWN: errMsg = "Avis client shutdown"; break;
- case REASON_ROUTER_SHUTDOWN: errMsg = "Avis router shutdown"; break;
- case REASON_PROTOCOL_VIOLATION: errMsg = "Avis protocol violation"; break;
- case REASON_ROUTER_STOPPED_RESPONDING: errMsg = "Avis router stopped responding"; break;
- default: errMsg = "Unknown Avis error";
+ case REASON_CLIENT_SHUTDOWN:
+ errMsg = "Avis client shutdown";
+ break;
+ case REASON_ROUTER_SHUTDOWN:
+ errMsg = "Avis router shutdown";
+ break;
+ case REASON_PROTOCOL_VIOLATION:
+ errMsg = "Avis protocol violation";
+ break;
+ case REASON_ROUTER_STOPPED_RESPONDING:
+ errMsg = "Avis router stopped responding";
+ break;
+ default:
+ errMsg = "Unknown Avis error";
}
- mamaTransportImpl_disconnect(avisBridge(closure)->mTransportBridge->mTransport, MAMA_TRANSPORT_DISCONNECT, NULL, NULL);
+ mamaTransportImpl_disconnect(
+ avisBridge(closure)->mTransportBridge->mTransport,
+ MAMA_TRANSPORT_DISCONNECT,
+ NULL,
+ NULL);
mama_log (MAMA_LOG_LEVEL_FINE, "%s : %s", errMsg, message);
}

@@ -98,7 +117,7 @@ getURL( const char *name )
return DEFAULT_URL;

mama_log (MAMA_LOG_LEVEL_FINER,
- "Avis transport (%s) main connection: %s", name, property);
+ "Avis transport (%s) main connection: %s", name, property);
return property;
}

@@ -106,7 +125,10 @@ getURL( const char *name )
Elvin* getAvis(mamaTransport transport)
{
avisTransportBridge* pTransportBridge;
- mama_status status = mamaTransport_getBridgeTransport (transport, (void*) &pTransportBridge);
+ mama_status status;
+
+ status = mamaTransport_getBridgeTransport (transport,
+ (void*) &pTransportBridge);
if ((status != MAMA_STATUS_OK) || (pTransportBridge == NULL))
return NULL;

@@ -125,12 +147,14 @@ void* avisDispatchThread(void* closure)

mama_status avisTransportBridge_start(avisTransportBridge* transportBridge)
{
- // stop Avis event loop
+ /* stop Avis event loop */
wthread_t tid;
int rc;
CHECK_TRANSPORT(transportBridge);

- if (0 != (rc = wthread_create(&tid, NULL, avisDispatchThread, transportBridge))) {
+ rc = wthread_create(&tid, NULL, avisDispatchThread, transportBridge);
+ if (0 != rc)
+ {
mama_log (MAMA_LOG_LEVEL_ERROR, "wthread_create returned %d", rc);
return MAMA_STATUS_SYSTEM_ERROR;
}
@@ -144,13 +168,16 @@ mama_status avisTransportBridge_stop(avisTransportBridge* transportBridge)
{
CHECK_TRANSPORT(transportBridge);

- // stop Avis event loop
+ /* stop Avis event loop */
elvin_remove_close_listener(transportBridge->mAvis, closeListener);
- if (!elvin_invoke_close(transportBridge->mAvis)) {
- // there appears to be a race condition in Avis libs where router socket can sometimes be closed before
- // we receive the disconnect reply -- log it, and continue
+ if (!elvin_invoke_close(transportBridge->mAvis))
+ {
+ /* there appears to be a race condition in Avis libs where router socket
+ * can sometimes be closed before we receive the disconnect reply -- log
+ * it, and continue */
log_avis_error(MAMA_LOG_LEVEL_FINE, transportBridge->mAvis);
}
+
while (-1 == wsem_wait(&transportBridge->mAvisDispatchSem))
{
if (errno != EINTR) return MAMA_STATUS_SYSTEM_ERROR;
@@ -192,8 +219,8 @@ avisBridgeMamaTransport_getLoadBalanceScheme (

mama_status
avisBridgeMamaTransport_create (transportBridge* result,
- const char* name,
- mamaTransport mamaTport )
+ const char* name,
+ mamaTransport mamaTport )
{
mama_status status;
avisBridgeImpl* avisBridge = NULL;
@@ -201,45 +228,60 @@ avisBridgeMamaTransport_create (transportBridge* result,
mamaBridgeImpl* bridgeImpl = NULL;
const char* url = NULL;

- transport = (avisTransportBridge*)calloc( 1, sizeof( avisTransportBridge ) );
+ transport = (avisTransportBridge*)calloc( 1, sizeof( avisTransportBridge ));
if (transport == NULL)
return MAMA_STATUS_NOMEM;

transport->mTransport = (mamaTransport) mamaTport;

bridgeImpl = mamaTransportImpl_getBridgeImpl(mamaTport);
- if (!bridgeImpl) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaTransport_create(): Could not get bridge");
+ if (!bridgeImpl)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridgeMamaTransport_create(): Could not get bridge");
free(transport);
return MAMA_STATUS_PLATFORM;
}
- if (MAMA_STATUS_OK != (status = mamaBridgeImpl_getClosure((mamaBridge) bridgeImpl, (void**) &avisBridge))) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaTransport_create(): Could not get Avis bridge object");
+
+ status = mamaBridgeImpl_getClosure((mamaBridge) bridgeImpl,
+ (void**) &avisBridge);
+ if (MAMA_STATUS_OK != status)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridgeMamaTransport_create(): Could not get Avis bridge object");
free(transport);
return status;
}
- if (avisBridge->mTransportBridge != NULL) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaTransport_create(): Avis already connected");
+ if (avisBridge->mTransportBridge != NULL)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridgeMamaTransport_create(): Avis already connected");
free(transport);
return MAMA_STATUS_PLATFORM;
}

- // create the Elvin object
+ /* create the Elvin object */
transport->mAvis = (Elvin*)calloc (1, sizeof (Elvin));
- if (transport->mAvis == NULL) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridge_createImpl(): Could not create Elvin object");
+ if (transport->mAvis == NULL)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridge_createImpl(): Could not create Elvin object");
free(transport);
return MAMA_STATUS_PLATFORM;
}

- // open the server connection
+ /* open the server connection */
url = getURL(name);
- if (url == NULL) {
- mama_log (MAMA_LOG_LEVEL_NORMAL, "No %s property defined for transport : %s", TPORT_PARAM, name);
+ if (url == NULL)
+ {
+ mama_log (MAMA_LOG_LEVEL_NORMAL,
+ "No %s property defined for transport : %s", TPORT_PARAM, name);
return MAMA_STATUS_INVALID_ARG;
}
- if (!elvin_open(transport->mAvis, url)) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "open failed for %s: %s", TPORT_PARAM, name);
+ if (!elvin_open(transport->mAvis, url))
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "open failed for %s: %s", TPORT_PARAM, name);
log_avis_error(MAMA_LOG_LEVEL_ERROR, transport->mAvis);
avisBridgeMamaTransport_destroy((transportBridge)transport);
return MAMA_STATUS_PLATFORM;
@@ -262,14 +304,22 @@ avisBridgeMamaTransport_destroy (transportBridge transport)
mamaBridgeImpl* bridgeImpl = NULL;


- bridgeImpl = mamaTransportImpl_getBridgeImpl(avisTransport(transport)->mTransport);
- if (!bridgeImpl) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaTransport_create(): Could not get bridge");
+ bridgeImpl = mamaTransportImpl_getBridgeImpl(
+ avisTransport(transport)->mTransport);
+ if (!bridgeImpl)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridgeMamaTransport_destroy(): Could not get bridge");
free(transport);
return MAMA_STATUS_PLATFORM;
}
- if (MAMA_STATUS_OK != (status = mamaBridgeImpl_getClosure((mamaBridge) bridgeImpl, (void**) &avisBridge))) {
- mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaTransport_create(): Could not get Avis bridge object");
+
+ status = mamaBridgeImpl_getClosure((mamaBridge) bridgeImpl,
+ (void**) &avisBridge);
+ if (MAMA_STATUS_OK != status)
+ {
+ mama_log (MAMA_LOG_LEVEL_ERROR,
+ "avisBridgeMamaTransport_destroy(): Could not get Avis bridge object");
free(transport);
return status;
}
--
1.7.7.6

161 - 180 of 2305