activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r951033 [2/2] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/core/ main/activemq/core/policies/ main/activemq/util/ main/cms/ main/decaf/net/ test/ test/activemq/util/ test/decaf/net/
Date Thu, 03 Jun 2010 15:27:51 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h?rev=951033&r1=951032&r2=951033&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h Thu Jun  3 15:27:50
2010
@@ -80,7 +80,7 @@ namespace net {
          *
          * @returns the name of the host associated with this set IP Address.
          */
-        virtual std::string getHostname() const;
+        virtual std::string getHostName() const;
 
         /**
          * Returns a string representation of the InetAddress in the form 'hostname / ipaddress'

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=951033&r1=951032&r2=951033&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Thu Jun  3 15:27:50 2010
@@ -52,6 +52,7 @@ cc_sources = \
     activemq/transport/failover/FailoverTransportTest.cpp \
     activemq/transport/inactivity/InactivityMonitorTest.cpp \
     activemq/transport/mock/MockTransportFactoryTest.cpp \
+    activemq/util/IdGeneratorTest.cpp \
     activemq/util/LongSequenceGeneratorTest.cpp \
     activemq/util/MarshallingSupportTest.cpp \
     activemq/util/MemoryUsageTest.cpp \
@@ -204,6 +205,7 @@ h_sources = \
     activemq/transport/failover/FailoverTransportTest.h \
     activemq/transport/inactivity/InactivityMonitorTest.h \
     activemq/transport/mock/MockTransportFactoryTest.h \
+    activemq/util/IdGeneratorTest.h \
     activemq/util/LongSequenceGeneratorTest.h \
     activemq/util/MarshallingSupportTest.h \
     activemq/util/MemoryUsageTest.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.cpp?rev=951033&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.cpp Thu
Jun  3 15:27:50 2010
@@ -0,0 +1,64 @@
+/*
+ * 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 "IdGeneratorTest.h"
+
+#include <activemq/util/IdGenerator.h>
+
+using namespace activemq;
+using namespace activemq::util;
+
+////////////////////////////////////////////////////////////////////////////////
+IdGeneratorTest::IdGeneratorTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+IdGeneratorTest::~IdGeneratorTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void IdGeneratorTest::testConstructor1() {
+
+    IdGenerator idGen;
+
+    CPPUNIT_ASSERT( idGen.generateId() != "" );
+    CPPUNIT_ASSERT( idGen.generateId() != "" );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void IdGeneratorTest::testConstructor2() {
+
+    IdGenerator idGen( "TEST-PREFIX" );
+
+    std::string id = idGen.generateId();
+    std::size_t pos = id.find( "TEST-PREFIX" );
+
+    CPPUNIT_ASSERT( pos != std::string::npos );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void IdGeneratorTest::testCompare() {
+
+    IdGenerator idGen;
+
+    std::string id1 = idGen.generateId();
+    std::string id2 = idGen.generateId();
+
+    CPPUNIT_ASSERT( IdGenerator::compare( id1, id1 ) == 0 );
+    CPPUNIT_ASSERT( IdGenerator::compare( id1, id2 ) < 0 );
+    CPPUNIT_ASSERT( IdGenerator::compare( id2, id1 ) > 0 );
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.h?rev=951033&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.h Thu
Jun  3 15:27:50 2010
@@ -0,0 +1,48 @@
+/*
+ * 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 _ACTIVEMQ_UTIL_IDGENERATORTEST_H_
+#define _ACTIVEMQ_UTIL_IDGENERATORTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace activemq {
+namespace util {
+
+    class IdGeneratorTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( IdGeneratorTest );
+        CPPUNIT_TEST( testConstructor1 );
+        CPPUNIT_TEST( testConstructor2 );
+        CPPUNIT_TEST( testCompare );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        IdGeneratorTest();
+        virtual ~IdGeneratorTest();
+
+        void testConstructor1();
+        void testConstructor2();
+        void testCompare();
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_UTIL_IDGENERATORTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/IdGeneratorTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.cpp?rev=951033&r1=951032&r2=951033&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.cpp Thu Jun
 3 15:27:50 2010
@@ -61,3 +61,11 @@ void InetAddressTest::testGetHostAddress
     InetAddress address = InetAddress::getByAddress( bytes, 4 );
     CPPUNIT_ASSERT_EQUAL( std::string( "127.0.0.1" ), address.getHostAddress() );
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void InetAddressTest::testGetLocalHost() {
+
+    InetAddress address = InetAddress::getLocalHost();
+    CPPUNIT_ASSERT( address.getHostName() != "" );
+    CPPUNIT_ASSERT( address.getHostAddress() != "" );
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.h?rev=951033&r1=951032&r2=951033&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/InetAddressTest.h Thu Jun
 3 15:27:50 2010
@@ -29,6 +29,7 @@ namespace net {
         CPPUNIT_TEST_SUITE( InetAddressTest );
         CPPUNIT_TEST( testGetByAddress );
         CPPUNIT_TEST( testGetHostAddress );
+        CPPUNIT_TEST( testGetLocalHost );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -38,6 +39,7 @@ namespace net {
 
         void testGetByAddress();
         void testGetHostAddress();
+        void testGetLocalHost();
 
     };
 



Mime
View raw message