Salome HOME
Improve build procedure
[tools/simanio.git] / src / TestCreateConfigFile.cpp
index 50ff3229e321bc42a96613c72252b28bf2d9e34c..a3c40b1b42c7803e8f24689425e2d711141214df 100644 (file)
@@ -1,3 +1,22 @@
+// Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.
+//
+// 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 #include "CreateConfigFile.h"
 #include "CreateConfigFileResponse.h"
 #include "GetFile.h"
@@ -6,9 +25,9 @@
 #include "PutFileResponse.h"
 #include "SimanSalomeServiceStub.h"
 #include <Environment.h>
+#include <ServiceClient.h>
 #include <iostream>
 #include <fstream>
-#include <ServiceClient.h>
 
 #include <axiom.h>
 #include <axis2_util.h>
@@ -16,8 +35,6 @@
 #include <axis2_client.h>
 #include <axutil_uuid_gen.h>
 
-
-using namespace std;
 using namespace org_splat_ws_server_service_salome;
 using namespace wso2wsf;
 
@@ -27,14 +44,14 @@ int main(int argc, char *argv[])
        
        char * ttest = getenv("SIMAN_WS_HOS");
        if (ttest == NULL)
-           cout<<"expected\n";
+         std::cout<<"expected\n";
        else
-           cout<<"unexpected\n";
+         std::cout<<"unexpected\n";
        
-       string aSimanWSHost(getenv("SIMAN_WS_HOST"));
-       string endpointUriTT = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
+       std::string aSimanWSHost(getenv("SIMAN_WS_HOST"));
+       std::string endpointUriTT = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
        
-       cout<<"enpoint uri" << endpointUriTT << "\n";
+       std::cout<<"enpoint uri" << endpointUriTT << "\n";
 
        Environment::initialize("SimanSalomeService.log",AXIS2_LOG_LEVEL_DEBUG);
 
@@ -61,7 +78,7 @@ int main(int argc, char *argv[])
        long long studyId = 1000;
        long long scenarioId = 1001;
        long long userId = 8;
-       string newUserId = "8";
+       std::string newUserId = "8";
 
        aRequest->setArgs0(studyId);
        aRequest->setArgs1(scenarioId);
@@ -71,12 +88,12 @@ int main(int argc, char *argv[])
 
        aResponse = aStub->createConfigFile(aRequest);
 
-       cout<< "Response:: "<<aResponse->get_return()<<endl;
+       std::cout<< "Response:: "<<aResponse->get_return()<<std::endl;
        
        //Parse the response and get the filename
        std::string aResponseFilePath = aResponse->get_return();
        std::string aResponseFileName = aResponseFilePath.substr(aResponseFilePath.find_last_of("/\\")+1);
-       cout << aResponseFileName << "\n";
+       std::cout << aResponseFileName << "\n";
        
        //Set options
        axis2_options_set_action(axis2options, Environment::getEnv(), "urn:getFile");
@@ -89,11 +106,11 @@ int main(int argc, char *argv[])
        std::ofstream outputStream;
        std::string aClientFilePath = "/dn24/SIMAN/siman_temp/download/" + aResponseFileName;
        
-       outputStream.open(aClientFilePath.c_str(), ofstream::binary);
+       outputStream.open(aClientFilePath.c_str(), std::ofstream::binary);
        
        int aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
        
-       cout<<aBufferSize<<"\n";
+       std::cout<<aBufferSize<<"\n";
        int* aBufSize = new int[aBufferSize];
        unsigned char* aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
        //char* aCopyBuf = aCopyBuf;
@@ -105,13 +122,13 @@ int main(int argc, char *argv[])
        outputStream.close();
        
        //Second test
-       /*string aSourceLoc = "W:\\testvideo\\Darvin.avi";
+       /*std::string aSourceLoc = "W:\\testvideo\\Darvin.avi";
        aGetFileRequest->setArgs0(aSourceLoc);
        aGetFileResponse = aStub->getFile(aGetFileRequest);
        
-       outputStream.open("/dn24/SIMAN/siman_temp/download/Darvin.avi", ofstream::binary);
+       outputStream.open("/dn24/SIMAN/siman_temp/download/Darvin.avi", std::ofstream::binary);
        aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
-       cout<<aBufferSize<<"\n";
+       std::cout<<aBufferSize<<"\n";
        
        aBufSize = new int[aBufferSize];
        aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
@@ -122,7 +139,7 @@ int main(int argc, char *argv[])
        outputStream.close();
        */
        //End second test
-       cout << "See file on path" << aClientFilePath << "\n";
+       std::cout << "See file on path" << aClientFilePath << "\n";
        
        //Upload test
        axis2_options_set_action(axis2options, Environment::getEnv(), "urn:putFile");
@@ -131,10 +148,10 @@ int main(int argc, char *argv[])
        //char* aSourceFile = "/dn24/SIMAN/siman_temp/download/Mesh_1.med";
        
        //get size of the input file
-       ifstream infile ("/dn24/SIMAN/siman_temp/download/Mesh_1.med",ifstream::binary);
-       infile.seekg(0,ifstream::end);
+       std::ifstream infile ("/dn24/SIMAN/siman_temp/download/Mesh_1.med",std::ifstream::binary);
+       infile.seekg(0,std::ifstream::end);
        int aSize = infile.tellg();
-       cout << "Size of the input file is: " << aSize << "\n";
+       std::cout << "Size of the input file is: " << aSize << "\n";
        infile.seekg(0);
        
        char * inBuffer;
@@ -151,12 +168,12 @@ int main(int argc, char *argv[])
        aPutFileRequest->setArgs1("Mesh_1.med");
        aPutFileRequest->setArgs2(userId);
        
-       cout << "test" <<"\n";
+       std::cout << "test" <<"\n";
        
        PutFileResponse* aPutFileResponse = new PutFileResponse();
        aPutFileResponse = aStub->putFile(aPutFileRequest);
        
-       cout<< "Response:: "<<aPutFileResponse->get_return()<<endl;
+       std::cout<< "Response:: "<<aPutFileResponse->get_return()<<std::endl;
        
        delete aResponse;
        delete aRequest;
@@ -165,4 +182,4 @@ int main(int argc, char *argv[])
        delete aPutFileResponse;
        delete aPutFileRequest;
        delete aStub;
-}
\ No newline at end of file
+}