Author: bjohnson
Date: Mon Nov  5 08:15:42 2007
New Revision: 592062

URL: http://svn.apache.org/viewvc?rev=592062&view=rev
Log:
Adding first simple SCA WSDL test, more to come soon

Added:
    incubator/tuscany/cpp/sca/runtime/core/test/
    incubator/tuscany/cpp/sca/runtime/core/test/SCATestMacros.h
    incubator/tuscany/cpp/sca/runtime/core/test/build.xml
    incubator/tuscany/cpp/sca/runtime/core/test/main.cpp
    incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat   (with props)
    incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh   (with props)
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp   
(with props)
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h   
(with props)
    
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp   
(with props)
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h  
 (with props)
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h   (with 
props)
    incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/
    
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/simple.wsdl

Added: incubator/tuscany/cpp/sca/runtime/core/test/SCATestMacros.h
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/SCATestMacros.h?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/SCATestMacros.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/SCATestMacros.h Mon Nov  5 
08:15:42 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+/* $Rev: $ $Date: $ */
+
+#ifndef sca_tests_macros_h_
+#define sca_tests_macros_h_
+
+#include <iostream>
+
+#define TEST_ASSERT( val ) \
+    if( ! val ) { \
+      std::cerr << "Test failed in: " << __FILE__ << ": " << __LINE__ << 
std::endl; \
+      return false; \
+    }
+
+#define TEST_ASSERT_EQUALS( val1, val2 ) \
+    if( val1 != val2 ) { \
+      std::cerr << "Test failed in: " << __FILE__ << ": " << __LINE__ << 
std::endl; \
+      return false; \
+    }
+
+#define TEST_FAIL( message ) \
+    std::cerr << "Test failed in: " << __FILE__ << ": " << __LINE__ << 
std::endl; \
+    return false;
+
+// For this macro, you must have the following variables defined:
+//     int testsPassed = 0;
+//     int testsTotal = 0;
+//     bool retval = false;
+// The macro calls the test and increments the total and passed
+// tests and logs accordingly
+// 
+#define TEST(testName) \
+    ++testsTotal; \
+    try { \
+      retval = testName; \
+      std::cout << "Test " << testsTotal << ": " << #testName << " ..... "; \
+      if (retval) { \
+        std::cout << "OK" << std::endl; \
+        ++testsPassed; \
+      } \
+      else { \
+        std::cout << "FAILED" << std::endl; \
+      } \
+    } \
+    catch(const tuscany::sca::TuscanyRuntimeException &scaE) { \
+        std::cerr << "Test " << testsTotal << ": " << #testName << " ..... " \
+                  << "FAILED (unexpected SCA exception): " << 
scaE.getMessageText() << std::endl; \
+    } \
+    catch(const commonj::sdo::SDORuntimeException &sdoE) { \
+        std::cerr << "Test " << testsTotal << ": " << #testName << " ..... " \
+                  << "FAILED (unexpected SDO exception): " << 
sdoE.getMessageText() << std::endl; \
+    } \
+    catch(...) { \
+        std::cerr << "Test " << testsTotal << ": " << #testName << " ..... " \
+                  << "FAILED (unexpected unknown exception)" << std::endl; \
+    }
+
+#endif

Added: incubator/tuscany/cpp/sca/runtime/core/test/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/build.xml?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/build.xml (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/build.xml Mon Nov  5 08:15:42 
2007
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+-->
+<project name="TuscanySdoNative_test" default="all" basedir="../../..">
+
+  <import file="${basedir}/antscripts/system.xml"/>
+  <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+  <!--
+    Notice that the basedir for this project is set to the TuscanySDO root dir
+    This makes path setting in system.xml much simpler, but we'll just have to
+    set a property here to this directory.
+  -->
+  <property name="this.dir"                      
location="${basedir}/runtime/core/test"/>
+  <property name="sca.test.src.dir"              location="${this.dir}"/>
+  <property name="sca.test.build.dir"            location="${this.dir}/build"/>
+  <property name="sca.wsdl.test.src.dir"         
location="${this.dir}/wsdlTests"/>
+  <property name="sca.wsdl.test.build.dir"       
location="${this.dir}/wsdlTests/build"/>
+  <property name="sca.composite.test.src.dir"    
location="${this.dir}/compositeTests"/>
+  <property name="sca.composite.test.build.dir"  
location="${this.dir}/compositeTests/build"/>
+  <property name="sca.wsdl.test.lib"             value="sca_wsdl_test"/>
+  <property name="sca.composite.test.lib"        value="sca_composite_test"/>
+  <property name="sca.test.app"                  value="sca_test"/>
+
+  <!--
+    Public targets
+  -->
+  <target name="all" description="compile, link, and run TuscanyScaNative test 
suite">
+    <antcall target="build"/>
+    <antcall target="run"/>
+  </target>
+
+  <target name="build" description="compile and link TuscanyScaNative test 
suite">
+    <antcall target="build.wsdl.tests"/>
+    <antcall target="build.composite.tests"/>
+    <antcall target="build.main"/>
+  </target>
+
+  <target name="run" depends="build" description="Run TuscanyScaNative test 
suite">
+    <exec executable="${this.dir}/${sca.test.app}${script.ext}" 
dir="${this.dir}"/>
+  </target>
+
+  <target name="clean" description="Clean TuscanyScaNative test suite">
+    <delete dir="${sca.test.build.dir}" quiet="@{quiet}"/>
+    <delete dir="${sca.wsdl.test.build.dir}" quiet="@{quiet}"/>
+    <delete dir="${sca.composite.test.build.dir}" quiet="@{quiet}"/>
+    <delete file="${this.dir}/${sca.test.app}${exe.ext}" quiet="@{quiet}"/>
+  </target>
+
+  <!--
+    Internal targets
+    They can still be called, they're just not described, so wont show up in 
"ant -p"
+  -->
+  <target name="build.wsdl.tests">
+    <cpp-build
+        srcdir="${sca.wsdl.test.src.dir}"
+        infiles="BaseWsdlTest.cpp WSDLDefinitionTest.cpp"
+        outdir="${sca.wsdl.test.build.dir}"
+        outfile="${sca.wsdl.test.lib}">
+      <custom-build-elements>
+        <defineset if="windows" define="_MBCS"/>
+        <includepath path="${sca.test.src.dir}"/>
+        <includepath path="${sca.wsdl.test.src.dir}"/>
+      </custom-build-elements>
+    </cpp-build>
+  </target>
+
+  <target name="build.composite.tests">
+    <!-- Not implemented yet -->
+  </target>
+
+  <target name="build.main">
+    <cpp-build
+        srcdir="${sca.test.src.dir}"
+        infiles="main.cpp"
+        outdir="${sca.test.build.dir}"
+        outfile="${sca.test.app}"
+        outtype="executable">
+      <custom-build-elements>
+        <defineset if="windows" define="_MBCS"/>
+        <includepath path="${sca.test.src.dir}"/>
+        <libset dir="${sca.wsdl.test.build.dir}" libs="${sca.wsdl.test.lib}"/>
+        <!--libset dir="${sca.composite.test.build.dir}" 
libs="${sca.composite.test.lib}"/-->
+      </custom-build-elements>
+    </cpp-build>
+
+    <cpp-install-file
+        srcfile="${sca.test.app}${exe.ext}"
+        srcdir="${sca.test.build.dir}"
+        destdir="${this.dir}"/>
+  </target>
+
+</project>

Added: incubator/tuscany/cpp/sca/runtime/core/test/main.cpp
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/main.cpp?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/main.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/main.cpp Mon Nov  5 08:15:42 
2007
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+
+#include "tuscany/sca/core/Exceptions.h"
+
+#include "SCATestMacros.h"
+#include "wsdlTests/wsdlTests.h"
+//#include "compositeTests/compositeTests.h"
+
+using namespace std;
+
+extern "C"{
+
+int main (int argc, char** argv)
+{
+    // These variables are used and set by the TEST macro
+    int testsPassed = 0;
+    int testsTotal = 0;
+    bool retval = false;
+
+    try
+    {
+      WSDLDefinitionTest wsdlTest;
+      TEST ( wsdlTest.testSimple() );
+    }
+    catch(...)
+    {
+      // All exceptions should be caught by the TEST macro
+
+      cout << "Unexpected exception caught" << endl; 
+    }
+
+    cout
+      << "---------------------"
+      << "\nTest Results"
+      << "\n\tTotal tests:   " << testsTotal
+      << "\n\tTests passed:  " << testsPassed
+      << "\n\tTests failed:  " << testsTotal - testsPassed
+      << endl;
+
+    return testsTotal - testsPassed;
+}
+
+}

Added: incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat Mon Nov  5 
08:15:42 2007
@@ -0,0 +1,50 @@
[EMAIL PROTECTED] off
+
[EMAIL PROTECTED]  Licensed to the Apache Software Foundation (ASF) under one
[EMAIL PROTECTED]  or more contributor license agreements.  See the NOTICE file
[EMAIL PROTECTED]  distributed with this work for additional information
[EMAIL PROTECTED]  regarding copyright ownership.  The ASF licenses this file
[EMAIL PROTECTED]  to you under the Apache License, Version 2.0 (the
[EMAIL PROTECTED]  "License"); you may not use this file except in compliance
[EMAIL PROTECTED]  with the License.  You may obtain a copy of the License at
[EMAIL PROTECTED]  
[EMAIL PROTECTED]    http://www.apache.org/licenses/LICENSE-2.0
[EMAIL PROTECTED]    
[EMAIL PROTECTED]  Unless required by applicable law or agreed to in writing,
[EMAIL PROTECTED]  software distributed under the License is distributed on an
[EMAIL PROTECTED]  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
[EMAIL PROTECTED]  KIND, either express or implied.  See the License for the
[EMAIL PROTECTED]  specific language governing permissions and limitations
[EMAIL PROTECTED]  under the License.
+
+setlocal
+
+if "%TUSCANY_SCACPP%" == "" (
+echo "TUSCANY_SCACPP not set"
+goto end
+)
+echo Using SCA installed at %TUSCANY_SCACPP%
+
+if "%TUSCANY_SDOCPP%" == "" (
+echo "TUSCANY_SDOCPP not set"
+goto end
+)
+echo Using SDO installed at %TUSCANY_SDOCPP%
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set"
+goto end
+)
+echo Using Axis2C installed at %AXIS2C_HOME%
+
+rem Run the client
+set 
PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH%
+
+set APFULLDIR=%~d0%~p0
+set TUSCANY_SCACPP_ROOT=%~d0%~p0\..\
+set TUSCANY_SCACPP_COMPONENT=bigbank.AccountManagementComponent
+
+.\AccountClient.exe 1234
+
+:end
+endlocal

Propchange: incubator/tuscany/cpp/sca/runtime/core/test/sca_test.bat
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh Mon Nov  5 08:15:42 
2007
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  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.
+
+APFULLDIR=`pwd`
+
+if [ x$TUSCANY_SCACPP = x ]; then
+echo "TUSCANY_SCACPP not set"
+exit;
+fi
+
+if [ x$TUSCANY_SDOCPP = x ]; then
+echo "TUSCANY_SDOCPP not set"
+exit;
+fi
+
+if [ x$AXIS2C_HOME = x ]; then
+echo "AXIS2C_HOME not set"
+exit;
+fi
+
+export 
LD_LIBRARY_PATH=$TUSCANY_SCACPP/lib:$TUSCANY_SDOCPP/lib:$AXIS2C_HOME/lib:$LD_LIBRARY_PATH
+export 
LD_LIBRARY_PATH=./build:./wsdlTests/build:./compositeTests/build:$LD_LIBRARY_PATH
+
+./sca_test
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/test/sca_test.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp 
(added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp Mon 
Nov  5 08:15:42 2007
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+#include "BaseWsdlTest.h"
+
+#include <tuscany/sca/model/WSDLDefinition.h>
+#include <commonj/sdo/SDO.h>
+
+BaseWsdlTest::BaseWsdlTest()
+{
+  // TODO: Should we possibly make this an arg to this class instead?
+  char *installRootVar = getenv( "TUSCANY_SCACPP" );
+  installRoot_ = installRootVar;
+}
+
+BaseWsdlTest::~BaseWsdlTest()
+{
+}
+
+void BaseWsdlTest::loadXsdHelper()
+{
+  if( ! (xsdHelper_ == 0) )
+  {
+    return;
+  }
+
+  try
+  {
+    xsdHelper_ = commonj::sdo::HelperProvider::getXSDHelper();
+
+    std::string filename = installRoot_ + "/xsd/wsdl_11.xsd";
+    xsdHelper_->defineFile(filename.c_str());
+
+    filename = installRoot_ + "/xsd/wsdl_11_http.xsd";
+    xsdHelper_->defineFile(filename.c_str());
+
+    filename = installRoot_ + "/xsd/wsdl_11_mime.xsd";
+    xsdHelper_->defineFile(filename.c_str());
+
+    filename = installRoot_ + "/xsd/wsdl_11_soap.xsd";
+    xsdHelper_->defineFile(filename.c_str());
+
+    filename = installRoot_ + "/xsd/wsdl_11_soap12.xsd";
+    xsdHelper_->defineFile(filename.c_str());
+  }
+  catch( const commonj::sdo::SDORuntimeException &sdoE )
+  {
+    std::cerr
+      << "BaseWsdlTest::loadXsdHelper() SDO runtime Exception: "
+      << sdoE.getMessageText()
+      << std::endl;
+
+    throw;
+  }
+}
+
+void BaseWsdlTest::loadXmlHelper()
+{
+  if( ! (xmlHelper_ == 0) )
+  {
+    return;
+  }
+
+  if( xsdHelper_ == 0 )
+  {
+    loadXsdHelper();
+  }
+
+  try
+  {
+    xmlHelper_ = commonj::sdo::HelperProvider::getXMLHelper( 
xsdHelper_->getDataFactory() );
+  }
+  catch( const commonj::sdo::SDORuntimeException &sdoE )
+  {
+    std::cerr
+      << "BaseWsdlTest::loadXmlHelper() SDO runtime Exception: "
+      << sdoE.getMessageText()
+      << std::endl;
+
+    throw;
+  }
+}
+
+tuscany::sca::model::WSDLDefinition *
+BaseWsdlTest::loadWsdl( const std::string &wsdlPath )
+{
+  loadXmlHelper();
+
+  tuscany::sca::model::WSDLDefinition *wsdl = 0;
+
+  try
+  {
+    commonj::sdo::XMLDocumentPtr doc = xmlHelper_->loadFile( wsdlPath );
+    wsdl = new tuscany::sca::model::WSDLDefinition( doc->getRootDataObject() );
+//tuscany::sca::util::Utils::printDO(doc->getRootDataObject()); // TODO remove 
this
+  }
+  catch( const commonj::sdo::SDORuntimeException &sdoE )
+  {
+    std::cerr
+      << "BaseWsdlTest::loadWsdl() SDO runtime Exception: "
+      << sdoE.getMessageText()
+      << std::endl;
+
+    throw;
+  }
+
+  return wsdl;
+}
+

Propchange: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.cpp
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h Mon 
Nov  5 08:15:42 2007
@@ -0,0 +1,50 @@
+#ifndef sca_tests_wsdl_BaseWsdlTest_h_
+#define sca_tests_wsdl_BaseWsdlTest_h_
+
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+#include <string>
+
+#include <tuscany/sca/model/WSDLDefinition.h>
+#include <commonj/sdo/SDO.h>
+
+class BaseWsdlTest
+{
+  public:
+
+    BaseWsdlTest();
+    ~BaseWsdlTest();
+
+    tuscany::sca::model::WSDLDefinition *loadWsdl( const std::string &wsdlPath 
);
+
+  private:
+    void loadXmlHelper();
+    void loadXsdHelper();
+
+    std::string installRoot_;
+    commonj::sdo::XMLHelperPtr xmlHelper_;
+    commonj::sdo::XSDHelperPtr xsdHelper_;
+
+};
+
+#endif
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/BaseWsdlTest.h
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp?rev=592062&view=auto
==============================================================================
--- 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp 
(added)
+++ 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp 
Mon Nov  5 08:15:42 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+#include <iostream>
+
+#include "SCATestMacros.h"
+#include "WSDLDefinitionTest.h"
+
+WSDLDefinitionTest::WSDLDefinitionTest()
+{
+}
+
+WSDLDefinitionTest::~WSDLDefinitionTest()
+{
+}
+
+bool WSDLDefinitionTest::testSimple()
+{
+  tuscany::sca::model::WSDLDefinition *wsdl =
+    loadWsdl( "wsdlTests/wsdls_correct/simple.wsdl" );
+
+  TEST_ASSERT_EQUALS(
+      "http://www.tuscany.com/tests/simple.wsdl";,
+      wsdl->getNamespace() );
+
+  // Get the operation based on portType, operName
+  tuscany::sca::model::WSDLOperation wsdlOp1 =
+    wsdl->findOperation( "simplePortType", "simpleOperation" );
+  TEST_ASSERT_EQUALS( "simpleOperation", wsdlOp1.getOperationName() );
+
+  // Get the operation based on service, portName, operName
+  tuscany::sca::model::WSDLOperation wsdlOp2 =
+    wsdl->findOperation( "simpleService", "simplePort", "simpleOperation" );
+  TEST_ASSERT_EQUALS( "simpleOperation", wsdlOp2.getOperationName() );
+
+  // Check the operation names
+  std::list<std::string> operNames = wsdl->getOperations( "simplePortType" );
+  TEST_ASSERT_EQUALS( 1, operNames.size() );
+  TEST_ASSERT_EQUALS( "simpleOperation", operNames.front() );
+
+  // Check the port type names
+  std::list<std::string> portTypeNames = wsdl->getPortTypes();
+  TEST_ASSERT_EQUALS( 1, portTypeNames.size() );
+  TEST_ASSERT_EQUALS( "simplePortType", portTypeNames.front() );
+
+  // Everything passed
+  return true;
+}
+

Propchange: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.cpp
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h 
(added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h 
Mon Nov  5 08:15:42 2007
@@ -0,0 +1,40 @@
+#ifndef sca_tests_wsdl_WSDLDefinitionTest_h_
+#define sca_tests_wsdl_WSDLDefinitionTest_h_
+
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+#include "BaseWsdlTest.h"
+
+class WSDLDefinitionTest : public BaseWsdlTest
+{
+
+  public:
+
+    WSDLDefinitionTest();
+    ~WSDLDefinitionTest();
+
+    bool testSimple();
+
+};
+
+#endif
+

Propchange: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/WSDLDefinitionTest.h
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h?rev=592062&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h Mon Nov  
5 08:15:42 2007
@@ -0,0 +1,33 @@
+#ifndef sca_tests_wsdl_wsdlTests_h_
+#define sca_tests_wsdl_wsdlTests_h_
+
+/*
+ * 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.
+ */
+
+/* $Rev: 583039 $ $Date: 2007-10-08 20:49:57 -0700 (Mon, 08 Oct 2007) $ */
+
+// This file is included by the main test program
+// it just includes all the necessary wsdl headers,
+// so the main doesnt have to know about all of them
+
+#include "wsdlTests/BaseWsdlTest.h"
+#include "wsdlTests/WSDLDefinitionTest.h"
+
+#endif
+

Propchange: incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdlTests.h
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/simple.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/simple.wsdl?rev=592062&view=auto
==============================================================================
--- 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/simple.wsdl 
(added)
+++ 
incubator/tuscany/cpp/sca/runtime/core/test/wsdlTests/wsdls_correct/simple.wsdl 
Mon Nov  5 08:15:42 2007
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+-->
+
+<definitions
+  xmlns="http://schemas.xmlsoap.org/wsdl/";
+  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+  xmlns:tns="http://www.tuscany.com/tests/simple.wsdl";
+  targetNamespace="http://www.tuscany.com/tests/simple.wsdl";
+  name="simple">
+
+  <message name="request">
+    <part name="zipcode" type="xsd:string"/>
+  </message>
+
+  <message name="response">
+    <part name="host" type="xsd:string"/>
+    <part name="port" type="xsd:string"/>
+  </message>
+
+  <portType name="simplePortType">
+    <operation name="simpleOperation">
+      <input message="tns:request"/>
+      <output message="tns:response"/>
+    </operation>
+  </portType>
+
+  <binding name="simpleBinding" type="tns:simplePortType">
+    <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+    <!--soap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/-->
+    <operation name="simpleOperation">
+      <soap:operation 
soapAction="http://www.tuscany.com/test/simpleOperation"/>
+
+      <input>
+        <soap:body use="literal"/>
+        <!-- this is a bug in SDO or the wsdl schemas: it parses incorrectly
+        <soap:body use="encoded"
+           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
+           namespace="http://www.tuscany.com/tests"/>
+        -->
+      </input>
+
+      <output>
+        <soap:body use="literal"/>
+      </output>
+
+    </operation>
+  </binding>
+
+  <service name="simpleService">
+    <port name="simplePort" binding="tns:simpleBinding">
+      <soap:address location="http://localhost/sca/tests"/>
+    </port>
+  </service>
+
+</definitions>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to