You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/15 14:32:35 UTC

svn commit: r566120 - in /activemq/activemq-cpp/trunk/src/decaf/src: main/decaf/net/URI.cpp test/Makefile.am test/decaf/net/URITest.cpp test/decaf/net/URITest.h test/testRegistry.cpp

Author: tabish
Date: Wed Aug 15 05:32:34 2007
New Revision: 566120

URL: http://svn.apache.org/viewvc?view=rev&rev=566120
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Adding start of URI class

Added:
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h
Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/Makefile.am
    activemq/activemq-cpp/trunk/src/decaf/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp?view=diff&rev=566120&r1=566119&r2=566120
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp Wed Aug 15 05:32:34 2007
@@ -63,7 +63,7 @@
     }
 
     // Now hand of to the main parse function.
-    parseURI( uri );
+    this->parseURI( uri );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -142,7 +142,7 @@
         uri.append( quoteComponent( fragment, allLegal ) );
     }
 
-    parseURI( uri );
+    this->parseURI( uri );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -151,6 +151,8 @@
             throw ( URISyntaxException ) {
 
     this->uriString = NULL;
+
+    URI::URI( scheme, "", host, -1, path, "", fragment );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -159,6 +161,41 @@
           const std::string& fragment ) throw ( URISyntaxException ) {
 
     this->uriString = NULL;
+
+    if( scheme != "" && path.length() > 0 && path.at(0) != '/' ) {
+         throw URISyntaxException(
+            __FILE__, __LINE__,
+            "URI::URI - Path String %s must start with a '/'",
+            path.c_str() );
+     }
+
+     std::string uri = "";
+     if( scheme != "" ) {
+         uri.append( scheme );
+         uri.append( ":" );
+     }
+     if( authority != "" ) {
+         uri.append("//");
+         // QUOTE ILLEGAL CHARS
+         uri.append( quoteComponent( authority, "@[]" + someLegal ) );
+     }
+
+     if( path != "" ) {
+         // QUOTE ILLEGAL CHARS
+         uri.append( quoteComponent( path, "/@" + someLegal ) );
+     }
+     if( query != "" ) {
+         // QUOTE ILLEGAL CHARS
+         uri.append( "?" );
+         uri.append( quoteComponent( query, allLegal ) );
+     }
+     if( fragment != "" ) {
+         // QUOTE ILLEGAL CHARS
+         uri.append( "#" );
+         uri.append( quoteComponent( fragment, allLegal ) );
+     }
+
+     this->parseURI( uri );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -174,8 +211,6 @@
             "URI::praseURI - URI String %s invalid.",
             uri.c_str() );
     }
-
-
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/Makefile.am?view=diff&rev=566120&r1=566119&r2=566120
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/Makefile.am Wed Aug 15 05:32:34 2007
@@ -36,6 +36,7 @@
   decaf/io/DataOutputStreamTest.cpp \
   decaf/net/SocketFactoryTest.cpp \
   decaf/net/SocketTest.cpp \
+  decaf/net/URITest.cpp \
   decaf/util/StringTokenizerTest.cpp \
   decaf/util/Endian.cpp \
   decaf/util/DateTest.cpp \
@@ -71,6 +72,7 @@
   decaf/io/DataOutputStreamTest.h \
   decaf/net/SocketFactoryTest.h \
   decaf/net/SocketTest.h \
+  decaf/net/URITest.h \
   decaf/util/StringTokenizerTest.h \
   decaf/util/Endian.h \
   decaf/util/DateTest.h \

Added: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp?view=auto&rev=566120
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp Wed Aug 15 05:32:34 2007
@@ -0,0 +1,35 @@
+/*
+ * 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 "URITest.h"
+
+#include <decaf/net/URI.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::net;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+URITest::URITest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URITest::test() {
+
+}

Added: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h?view=auto&rev=566120
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h Wed Aug 15 05:32:34 2007
@@ -0,0 +1,44 @@
+/*
+ * 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 _DECAF_NET_URITEST_H_
+#define _DECAF_NET_URITEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace net{
+
+    class URITest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( URITest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        URITest();
+        virtual ~URITest() {}
+
+        void test();
+
+    };
+
+}}
+
+#endif /*_DECAF_NET_URITEST_H_*/

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/testRegistry.cpp?view=diff&rev=566120&r1=566119&r2=566120
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/testRegistry.cpp Wed Aug 15 05:32:34 2007
@@ -53,13 +53,15 @@
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ExceptionTest );
 //#include <decaf/lang/ThreadTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ThreadTest );
-#include <decaf/lang/SystemTest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::SystemTest );
+//#include <decaf/lang/SystemTest.h>
+//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::SystemTest );
 //
 //#include <decaf/net/SocketFactoryTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketFactoryTest );
 //#include <decaf/net/SocketTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketTest );
+#include <decaf/net/URITest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::URITest );
 //
 //#include <decaf/util/concurrent/CountDownLatchTest.h>
 //CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::CountDownLatchTest );