packages feed

sednaDBXML 0.1.1 → 0.1.2.3

raw patch · 6 files changed

+235/−242 lines, 6 files

Files

sednaDBXML.cabal view
@@ -1,5 +1,5 @@ Name:                   sednaDBXML-Version:                0.1.1+Version:                0.1.2.3 License:                GPL-3 Cabal-Version:          >= 1.10.0 License-File:           LICENSE@@ -7,23 +7,9 @@ Build-Type:             Simple Maintainer:             Eric Jones (ericclaudejones at gmail.com) Stability:              alpha-Synopsis:               Sedna Native XML Binding--Description:            Sedna is a free native XML developed by the Institute for-                        System Programming RAS database. Sedna-                        provides a full range of core database-                        services - persistent storage, ACID-                        transactions, security, indices, hot-                        backup. Flexible XML processing facilities-                        include W3C XQuery implementation, tight-                        integration of XQuery with full-text search-                        facilities and a node-level update-                        language. This package provides language-                        bindings and (will) provide a clean, sensible-                        monadic interface to the (established)-                        underlying C library.+Synopsis:               Sedna C API XML Binding -                        Sedna Home Page:+Description:            Sedna native XML database bindings.                         http://www.sedna.org/  Category:               Database, FFI@@ -60,8 +46,6 @@   Include-Dirs:           include   Includes:               libsedna.h,                           sp_defs.h--  Extra-Libraries:        sedna    Ghc-Options:            -Wall 
src/Database/SednaDB/Internal/SednaCBindings.hsc view
@@ -84,15 +84,15 @@ #ccall SEnext, Ptr <SednaConnection>  -> IO CInt  ---------------------------------------------------------------------------------#ccall SEgetLastErrorCode, Ptr <SednaConnection>  -> IO CInt-#ccall SEgetLastErrorMsg , Ptr <SednaConnection>  -> IO CInt+#ccall SEgetLastErrorCode, Ptr <SednaConnection> -> IO CInt+#ccall SEgetLastErrorMsg,   Ptr <SednaConnection> -> IO CString  -------------------------------------------------------------------------------- #ccall SEconnectionStatus,  Ptr <SednaConnection>  -> IO CInt #ccall SEtransactionStatus, Ptr <SednaConnection>  -> IO CInt  ---------------------------------------------------------------------------------#ccall SEshowTime , Ptr <SednaConnection>  -> IO CInt+#ccall SEshowTime , Ptr <SednaConnection>  -> IO CString  -------------------------------------------------------------------------------- #ccall SEsetConnectionAttr, Ptr <SednaConnection> -> CUInt -> Ptr () -> CInt -> IO CInt 
src/Database/SednaDB/SednaBindings.hs view
@@ -1,3 +1,5 @@++ module Database.SednaDB.SednaBindings     ( sednaBegin     , sednaCloseConnection@@ -11,7 +13,6 @@     , sednaGetLastErrorCode     , sednaGetLastErrorMsg     , sednaGetResultString-    , sednaLoadData     , sednaNext     , sednaResetAllConnectionAttr     , sednaRollBack@@ -19,6 +20,7 @@     , sednaShowTime     , sednaTransactionStatus     , sednaLoadFile+    , sednaLoadData     ) where  --------------------------------------------------------------------------------@@ -29,7 +31,7 @@ import Foreign.C.Types import Prelude hiding             (replicate,concat) import qualified Data.Map as DM   (fromList, lookup)-import Data.Iteratee as I hiding (mapM_, peek)+import Data.Iteratee as I hiding  (mapM_, peek) import Data.Iteratee.IO import Control.Monad.Trans import Data.ByteString.Char8 as C@@ -46,7 +48,7 @@              -> DBName              -> UserName              -> Password-             -> IO (SednaResponseCode, SednaConnection)+             -> IO SednaConnection sednaConnect url dbname login password =   do     conn      <- malloc@@ -61,58 +63,71 @@                              cPassword      mapM_ free [cUrl,cDbname,cLogin,cPassword]-    return (fromCConstant status, conn)-----------------------------------------------------------------------------------withSednaConnection :: (SednaConnection ->  IO CInt)-                       -> SednaConnection-                       -> IO SednaResponseCode-withSednaConnection sednaAction conn =-  do-    response <- sednaAction $ conn-    return  $ fromCConstant response-+   +    case fromCConstant status of +      SessionOpen           -> return $ conn+      OpenSessionFailed     -> free conn >> throw SednaOpenSessionFailedException+      AuthenticationFailed  -> free conn >> throw SednaAuthenticationFailedException+      _                     -> free conn >> throw SednaFailedException +     ---------------------------------------------------------------------------------sednaCloseConnection :: SednaConnection -> IO SednaResponseCode-sednaCloseConnection = withSednaConnection c'SEclose-+sednaCloseConnection :: SednaConnection -> IO ()+sednaCloseConnection conn = do +  resultCode <- c'SEclose conn  +  free conn+  case fromCConstant resultCode of +    SessionClosed      -> return ()+    CloseSessionFailed -> throw SednaCloseSessionFailedException+    _                  -> throw SednaFailedException+     ---------------------------------------------------------------------------------sednaBegin :: SednaConnection -> IO SednaResponseCode-sednaBegin = withSednaConnection c'SEbegin+sednaBegin :: SednaConnection -> IO ()+sednaBegin conn = do+  resultCode <- c'SEbegin conn+  case fromCConstant resultCode of+    BeginTransactionSucceeded -> return ()+    BeginTransactionFailed    -> throw SednaBeginTransactionFailedException+    _                         -> throw SednaFailedException  ---------------------------------------------------------------------------------sednaRollBack :: SednaConnection -> IO SednaResponseCode-sednaRollBack = withSednaConnection c'SErollback-+sednaRollBack :: SednaConnection -> IO ()+sednaRollBack conn = do+  resultCode <- c'SErollback conn+  case fromCConstant resultCode of+    RollBackTansactionSucceeded -> return ()+    RollBackTransactionFailed   -> throw SednaRollBackTransactionFailedException+    _                           -> throw SednaFailedException +                 ---------------------------------------------------------------------------------sednaCommit :: SednaConnection -> IO SednaResponseCode-sednaCommit = withSednaConnection c'SEcommit+sednaCommit :: SednaConnection -> IO ()+sednaCommit conn = do+  resultCode <- c'SEcommit conn+  case fromCConstant resultCode of+    CommitTransactionSucceeded -> return ()+    CommitTransactionFailed    -> throw SednaCommitTransactionFailedException+    _                          -> throw SednaFailedException  -------------------------------------------------------------------------------- sednaExecuteAction :: (SednaConnection -> CString -> IO CInt)                    -> SednaConnection                    -> Query-                   -> IO SednaResponseCode+                   -> IO () sednaExecuteAction sednaQueryAction conn query = do   resultCode <- withCString query $ sednaQueryAction conn-  return $ fromCConstant resultCode+  case fromCConstant resultCode of+    QuerySucceeded -> return ()+    QueryFailed    -> throw SednaQueryFailedException+    _              -> throw SednaFailedException  ---------------------------------------------------------------------------------sednaExecuteLong :: SednaConnection -> Query -> IO SednaResponseCode+sednaExecuteLong :: SednaConnection -> Query -> IO () sednaExecuteLong = sednaExecuteAction c'SEexecuteLong  ---------------------------------------------------------------------------------sednaExecute :: SednaConnection -> Query -> IO SednaResponseCode+sednaExecute :: SednaConnection -> Query -> IO () sednaExecute = sednaExecuteAction c'SEexecute  ----------------------------------------------------------------------------------- SednaGetData deals with an underlying c function c'SEgetData which--- has heterogeneous response types. To remedy this, SednaGetData--- returns an OperationSucceeded response on success when receiving--- the number of bytes read from the underlying c function. This is--- why you see this function returning its own response code instead--- of simply encoding values from the response of c'SEgetData.- sednaGetData :: SednaConnection -> Int -> IO (SednaResponseCode, ByteString) sednaGetData conn size = useAsCStringLen (BS.replicate size 0) loadData   where@@ -126,18 +141,18 @@        return $ (response, bytes)         where-          getResponse num buffSize | num > buffSize         = SednaError-                                   | num < 0                = fromCConstant num-                                   | num == 0               = ResultEnd-                                   | num > 0                = OperationSucceeded-                                   | otherwise              = SednaError+          getResponse num buffSize | num > buffSize = SednaError+                                   | num < 0        = fromCConstant num+                                   | num == 0       = ResultEnd+                                   | num > 0        = OperationSucceeded+                                   | otherwise      = SednaError  -------------------------------------------------------------------------------- sednaLoadData :: SednaConnection               -> ByteString               -> Document               -> Collection-              -> IO SednaResponseCode+              -> IO () sednaLoadData conn buff docName colName = do   useAsCStringLen buff loadData       where@@ -148,31 +163,43 @@           cColName <- newCString colName           response <- c'SEloadData conn buff' bytes cDocName cColName           mapM_ free [cDocName, cColName]-          return $ fromCConstant response+          case fromCConstant response of+            DataChunkLoaded -> return ()+            _               -> throw SednaFailedException  ---------------------------------------------------------------------------------sednaEndLoadData :: SednaConnection -> IO SednaResponseCode-sednaEndLoadData = withSednaConnection c'SEendLoadData+sednaEndLoadData :: SednaConnection -> IO ()+sednaEndLoadData conn = do+    resultCode <- c'SEendLoadData conn +    case fromCConstant resultCode of+         BulkLoadSucceeded -> return ()+         _                 -> throw SednaFailedException+             -------------------------------------------------------------------------------- sednaNext :: SednaConnection -> IO SednaResponseCode-sednaNext = withSednaConnection c'SEnext-+sednaNext conn = do+  resultCode <- c'SEnext conn+  return $ fromCConstant resultCode+            -------------------------------------------------------------------------------- sednaGetLastErrorCode :: SednaConnection -> IO SednaResponseCode-sednaGetLastErrorCode = withSednaConnection c'SEgetLastErrorCode+sednaGetLastErrorCode conn = do+  resultCode <- c'SEgetLastErrorCode conn+  return $ fromCConstant resultCode  ---------------------------------------------------------------------------------sednaGetLastErrorMsg :: SednaConnection -> IO SednaResponseCode-sednaGetLastErrorMsg = withSednaConnection c'SEgetLastErrorMsg+sednaGetLastErrorMsg :: SednaConnection -> IO String +sednaGetLastErrorMsg conn = peekCAString  =<< c'SEgetLastErrorMsg conn   -------------------------------------------------------------------------------- sednaTransactionStatus :: SednaConnection -> IO SednaResponseCode-sednaTransactionStatus = withSednaConnection c'SEtransactionStatus+sednaTransactionStatus conn = do resultCode <- c'SEtransactionStatus conn+                                 return $ fromCConstant resultCode  ---------------------------------------------------------------------------------sednaShowTime :: SednaConnection -> IO SednaResponseCode-sednaShowTime = withSednaConnection c'SEshowTime+sednaShowTime :: SednaConnection -> IO String+sednaShowTime conn = peekCAString =<< c'SEshowTime conn  -------------------------------------------------------------------------------- sednaConnectionAttributeMap :: SednaConnAttrValue -> Maybe SednaConnectionAttr@@ -194,40 +221,49 @@ -------------------------------------------------------------------------------- sednaSetConnectionAttr :: SednaConnection                        -> SednaConnAttrValue-                       -> IO SednaResponseCode+                       -> IO () sednaSetConnectionAttr conn attrVal =   alloca (\ptrAttrVal -> do-             let connAttr = fromIntegral        $-                            sednaConnectionAttr $-                            fromJust (sednaConnectionAttributeMap attrVal)-             let attr     = sednaConnAttrValue attrVal-             let size     = fromIntegral $ sizeOf attr-             poke ptrAttrVal attr-             response <- c'SEsetConnectionAttr-                         conn-                         connAttr-                         (castPtr ptrAttrVal)-                         size-             return $ fromCConstant response)+            let connAttr = fromIntegral        $+                           sednaConnectionAttr $+                           fromJust (sednaConnectionAttributeMap attrVal)+            let attr     = sednaConnAttrValue attrVal+            let size     = fromIntegral $ sizeOf attr+            poke ptrAttrVal attr+            response <- c'SEsetConnectionAttr+                        conn+                        connAttr+                        (castPtr ptrAttrVal)+                        size+            case fromCConstant response of+              SetAttributeSucceeded  -> return ()+              _                      -> throw SednaFailedException)  -------------------------------------------------------------------------------- sednaGetConnectionAttr :: SednaConnection-                          -> SednaConnectionAttr-                          -> IO (SednaResponseCode, SednaConnAttrValue)+                       -> SednaConnectionAttr+                       -> IO SednaConnAttrValue sednaGetConnectionAttr conn connAttr =-  alloca (\sizePtr -> do-             let attr = fromIntegral $ sednaConnectionAttr connAttr-             resultPtr  <- malloc :: IO (Ptr CInt)-             resultCode <- c'SEgetConnectionAttr conn-                                                 attr-                                                 (castPtr resultPtr)-                                                 sizePtr-             response   <- peek (castPtr resultPtr)-             return (fromCConstant resultCode, SednaConnAttrValue response))+    alloca (\sizePtr -> do+              let attr = fromIntegral $ sednaConnectionAttr connAttr+              responsePtr <- malloc :: IO (Ptr CInt)+              resultCode  <- c'SEgetConnectionAttr conn+                                                   attr+                                                   (castPtr responsePtr)+                                                   sizePtr+              response <- peek (castPtr responsePtr)         +                           +              case fromCConstant resultCode of+                GetAttributeSucceeded -> return (SednaConnAttrValue response)+                _                     -> throw SednaFailedException)       ---------------------------------------------------------------------------------sednaResetAllConnectionAttr :: SednaConnection -> IO SednaResponseCode-sednaResetAllConnectionAttr = withSednaConnection c'SEresetAllConnectionAttr+sednaResetAllConnectionAttr :: SednaConnection -> IO ()+sednaResetAllConnectionAttr conn = do+  resultCode <- c'SEresetAllConnectionAttr conn+  case fromCConstant resultCode of+    ResetAttributeSucceeded -> return ()+    _                       -> throw SednaFailedException  -------------------------------------------------------------------------------- sednaGetResultString :: SednaConnection -> IO QueryResult@@ -279,17 +315,15 @@             -> Iteratee ByteString m () loadXMLBytes conn doc coll =  liftIO (sednaBegin conn) >> liftI step   where-    step s@(I.Chunk xs)+    step (I.Chunk xs)       | xs == (C.pack "") = liftI step       | otherwise = do-        response <- liftIO $ sednaLoadData conn xs doc coll-        if response == DataChunkLoaded-          then liftIO (print s) >>  liftI step-          else throw SednaFailedException-+                     liftIO $ sednaLoadData conn xs doc coll+                     liftI step+              step stream = do-      response <- liftIO $ sednaEndLoadData conn-      case response of+      response <- liftIO $ c'SEendLoadData conn+      case fromCConstant response of          BulkLoadSucceeded -> liftIO  (sednaCommit conn) >> idone () stream          BulkLoadFailed    -> throw SednaBulkLoadFailedException          _                 -> throw SednaFailedException
test/runTests.sh view
@@ -11,7 +11,7 @@ if [ ! -f $SUITE ]; then     cat <<EOF Testsuite executable not found, please run:-    cabal configure -ftest+    cabal configure then     cabal build EOF
test/sedna-testsuite.cabal view
@@ -13,7 +13,7 @@                         test-framework-hunit >= 0.2.5 && < 0.3,                         process,                         bytestring,-                        SednaDB+                        sednaDBXML        Ghc-Options:          -Wall -fwarn-tabs -funbox-strict-fields -threaded                         -fno-warn-unused-do-bind
test/suite/Integration/SednaBindingTests.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE ScopedTypeVariables #-}  module Integration.SednaBindingTests (integrationTests) where  ---------------------------------------------------------------------------------import Control.Exception       (bracket)+import Prelude hiding          (catch)+import Control.Exception import Data.ByteString.Char8   (pack, unpack) import Foreign                 (free) import System.Process          (readProcess)@@ -16,38 +18,50 @@ import Database.SednaDB.SednaTypes import Database.SednaDB.SednaBindings import Database.SednaDB.Internal.SednaConnectionAttributes-import Database.SednaDB.Internal.SednaResponseCodes+import Database.SednaDB.SednaExceptions  -------------------------------------------------------------------------------- type TestMsg = String  ---------------------------------------------------------------------------------dbName :: [Char]-dbName = "SednaDBXMLTestDB"+testDBName :: [Char]+testDBName = "SednaDBXMLTestDB" +testCollName = "'testCollection'"+ -------------------------------------------------------------------------------- bringUpDB :: IO String-bringUpDB = do readProcess "se_cdb"[dbName] "/dev/null"-               readProcess "se_sm" [dbName] "/dev/null"+bringUpDB = do readProcess "se_cdb"[testDBName] "/dev/null"+               readProcess "se_sm" [testDBName] "/dev/null"+               readProcess "se_term" [ "-query"+                                     ,"CREATE COLLECTION " ++ testCollName+                                     , testDBName+                                     ]+                                     "/dev/null"  -------------------------------------------------------------------------------- bringDownDB :: IO String-bringDownDB = do readProcess "se_smsd" [dbName] "/dev/null"-                 readProcess "se_ddb"  [dbName] "/dev/null"+bringDownDB = do readProcess "se_smsd" [testDBName] "/dev/null"+                 readProcess "se_ddb"  [testDBName] "/dev/null"  ---------------------------------------------------------------------------------setup :: IO (SednaResponseCode, SednaConnection)+setup :: IO SednaConnection setup = do+         let url       = "localhost"+         let dbname    = testDBName+         let login     = "SYSTEM"+         let password  = "MANAGER"+          bringUpDB-         sednaConnect "localhost" dbName "SYSTEM" "MANAGER"+         onException (sednaConnect url dbname login password)+                     (bringDownDB) -tearDown :: (t, SednaConnection) -> IO String-tearDown = \(_, conn) ->+tearDown :: SednaConnection -> IO String+tearDown = \conn ->   do-    free conn+    sednaCloseConnection conn     bringDownDB - -------------------------------------------------------------------------------- formatMsg :: String -> String formatMsg rawMsg = printf "%-60s" rawMsg@@ -57,166 +71,127 @@ testCaseFMsg = testCase . formatMsg  ---------------------------------------------------------------------------------sednaDBTest  :: ((SednaResponseCode, SednaConnection) -> IO c) -> IO c+sednaDBTest  :: (SednaConnection -> IO c) -> IO c sednaDBTest = bracket setup tearDown ------------------------------------------------------------------------------------ connectionTest is a helper funtion that encapsulates the simple case of a--- a sedna function that accepts a connection and returns a value to be checked--- against a succes value.--connectionTest :: (Show a, Eq a) => (SednaConnection -> IO a) -> String -> a -> Test-connectionTest connFun msg succVal = testCaseFMsg msg $ sednaDBTest $-    (\(_ , conn) -> do-       result <- connFun $ conn-       assertEqual msg succVal result)+----------------------------------------------------------------------------------+connectionTest :: (SednaConnection -> IO ()) -> String -> Test+connectionTest connFun msg =+    testCaseFMsg msg $+    catch (sednaDBTest connFun)+          (\(e :: SednaException) -> assertFailure $ show e)  -------------------------------------------------------------------------------- testOpenConnection :: Test-testOpenConnection = testCaseFMsg "Test connection initialization" $-                     do-                       (status, conn) <- setup-                       result         <- assertEqual-                                           "Test opening of connection"-                                           SessionOpen-                                           status-                       tearDown(status, conn)-                       return result+testOpenConnection = testCaseFMsg "Testing connection initialization" openTest ----------------------------------------------------------------------------------testCloseConnection :: Test-testCloseConnection =  connectionTest sednaCloseConnection-                                      "Test connection termination"-                                       SessionClosed+openTest :: IO ()+openTest = do+  bracketOnError (bringUpDB)+                 (\_ -> bringDownDB >> assertFailure "Open Connection Failed")+                 (\_ -> sednaConnect "localhost" testDBName "SYSTEM" "MANAGER" >>= free)+  bringDownDB+  return ()  --------------------------------------------------------------------------------+--testCloseConnection :: Test+--testCloseConnection =  connectionTest sednaCloseConnection+--                                      "Test connection termination"++ -------------------------------------------------------------------------------- testBeginTransaction :: Test testBeginTransaction = connectionTest sednaBegin                                       "Test transaction initialization"-                                      BeginTransactionSucceeded ---------------------------------------------------------------------------------+--------------------------------------------------------------------------------- testSetConnectionAttr :: Test testSetConnectionAttr =-  testCaseFMsg "Test setting of connection attributes" $ sednaDBTest-               (\(_,conn) ->-                 do-                   result <- sednaSetConnectionAttr conn autoCommitOff-                   assertEqual "Testing set attriubute value funtionality"-                                SetAttributeSucceeded-                                result)+    connectionTest (\conn -> sednaSetConnectionAttr conn autoCommitOff)+                   "Testing modification of connection attributes" ---------------------------------------------------------------------------------+--------------------------------------------------------------------------------- testGetConnectionAttr :: Test testGetConnectionAttr =-  testCaseFMsg "Test retrieval of connection attributes" $ sednaDBTest-   (\(_,conn) ->-     do-       (resultCode, result) <- sednaGetConnectionAttr conn attrAutoCommit-       assertEqual "Get attribute succeeded"-                   GetAttributeSucceeded-                   resultCode-       assertEqual "Testing attribute value response."-                   autoCommitOff-                   result)+ connectionTest (\conn -> do+                   result <- sednaGetConnectionAttr conn attrAutoCommit+                   assertEqual "Testing attribute value response."+                                autoCommitOff+                                result)+                "Testing inspection of connection attributes" ---------------------------------------------------------------------------------+--------------------------------------------------------------------------------- testLoadData :: Test testLoadData =- testCaseFMsg "Test loading of XML Data" $ sednaDBTest-   (\(_,conn) -> do-      sednaBegin conn-      resultCode <- sednaLoadData conn-                    (pack "<?xml version=\"1.0\" standalone=\"yes\"?>")-                    "testdoc"-                    "testcollection"-      sednaEndLoadData conn-      assertEqual "Testing proper loading of chunk data"-                  DataChunkLoaded-                  resultCode)+    connectionTest (\conn ->  do+                      sednaBegin conn+                      sednaLoadData conn+                                    (pack "<Message>Hello World!!!</Message>")+                                    "testDoc"+                                    "testCollection"+                      sednaEndLoadData conn+                      sednaCommit conn)+                   "Testing proper loading of chunk data"  ----------------------------------------------------------------------------------- testLoadFile = sednaDBTest $---                (\(_,conn) -> do---                   loadXMLFile conn---                              "test/fixtures/baseballleague.xml"---                              "testdoc3"---                              "testcollection")+testLoadFile :: Test+testLoadFile = +    let testFile = "fixtures/baseballleague.xml" in+    connectionTest (\conn -> do+                      sednaLoadFile testFile+                                    conn+                                    "testdoc3"+                                    "testCollection")+    "Test loading of XML file"  -------------------------------------------------------------------------------- testExecuteQuery :: Test-testExecuteQuery = testCaseFMsg "Test execution of query" $ sednaDBTest $-                 (\(_,conn) -> do-                   sednaBegin conn--                   queryExecutionStatus <- sednaExecute conn "doc('$documents')"-                   assertion <- assertEqual "Testing proper execution of valid query"-                                queryExecutionStatus-                                QuerySucceeded-                   sednaCommit conn-                   return assertion)+testExecuteQuery = +    connectionTest (\conn -> do+                      sednaBegin conn                                 +                      queryExecutionStatus <- sednaExecute conn "doc('$documents')"+                      sednaCommit conn)+                  "Testing Proper Execution of valid query"  -------------------------------------------------------------------------------- testLoadRetrieveData :: Test testLoadRetrieveData =-    testCaseFMsg "Test loading and retrieval of XML data"$ sednaDBTest $-                 (\(_,conn) -> do-                    let xmlData = pack "<?xml version=\"1.0\" standalone=\"yes\"?><note>Test must have Failed :-( </note>"--                    beginTransactionStatus <- sednaBegin conn-                    assertEqual "Test begin transaction"-                                BeginTransactionSucceeded-                                beginTransactionStatus--                    createCollectionStatus <- sednaExecute conn "CREATE COLLECTION 'testCollection'"-                    assertEqual "Test query and create collection"-                                 UpdateSucceeded-                                 createCollectionStatus--                    loadDataStatus <- sednaLoadData conn xmlData "testdoc" "testCollection"-                    assertEqual "TestLoadData"-                                DataChunkLoaded-                                loadDataStatus--                    endloadStatus <- sednaEndLoadData conn-                    assertEqual "TestLoadData"-                                BulkLoadSucceeded-                                endloadStatus--                    queryExecutionStatus <- sednaExecute conn "doc('testdoc','testCollection')"-                    assertEqual "Test query"-                                QuerySucceeded-                                queryExecutionStatus--                    queryResult <- sednaGetResultString conn-                    assertEqual "Testing proper retrieval of query results"-                                (unpack xmlData)-                                (concat.lines $ queryResult)+    let xmlData = pack "<note>And the world alright with me!</note>" in+    connectionTest (\conn -> do+                      sednaBegin conn+                      sednaLoadData conn xmlData "testdoc" "testCollection"+                      sednaEndLoadData conn+                      sednaExecute conn "doc('testdoc','testCollection')/note" -                    commitStatus <- sednaCommit conn-                    assertEqual "Testing transaction commit"-                                CommitTransactionSucceeded-                                commitStatus)+                      queryResult <- sednaGetResultString conn+                      assertEqual "Testing proper retrieval of query results"+                                  (unpack xmlData)+                                  (concat.lines $ queryResult)+                      sednaCommit conn)+                   "Test loading and retrieval of data." ---------------------------------------------------------------------------------+----------------------------------------------------------------------------------- connectionTests :: Test-connectionTests = testGroup "Connection Tests" [testOpenConnection, testCloseConnection]+connectionTests = testGroup "Connection Tests" [ testOpenConnection+                                               ]  -------------------------------------------------------------------------------- controlTests :: Test-controlTests = testGroup "Control Tests" [testGetConnectionAttr, testSetConnectionAttr]+controlTests = testGroup "Control Tests" [ testGetConnectionAttr+                                         , testSetConnectionAttr+                                         ] ---------------------------------------------------------------------------------+-- -------------------------------------------------------------------------------- transactionTests :: Test transactionTests = testGroup "Transaction Tests" [ testBeginTransaction                                                  , testLoadData+                                                 , testLoadFile                                                  , testExecuteQuery                                                  , testLoadRetrieveData                                                  ]  -------------------------------------------------------------------------------- integrationTests :: Test-integrationTests = testGroup "Integration Tests" [ connectionTests-                                                 , controlTests-                                                 , transactionTests-                                                 ]+integrationTests = testGroup "Sedna C API Integration Tests" [ connectionTests+                                                             , controlTests+                                                             , transactionTests+                                                             ]