Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8607_icat_stests_windows'
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterParker committed Dec 12, 2013
2 parents 8228873 + 1db0923 commit 335e05c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 43 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/ICat/inc/MantidICat/ICat3/ICat3Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ namespace Mantid
// Defines the SSL authentication scheme.
void setSSLContext(ICat3::ICATPortBindingProxy& icat);

// Sets the soap-endpoint & SSL context for the proxy being returned.
ICat3::ICATPortBindingProxy getICATProxy();
// Sets the soap-endpoint & SSL context for the given ICAT proxy.
void setICATProxySettings(ICat3::ICATPortBindingProxy& icat);

/** This is a template method to save data to table workspace
* @param input :: pointer to input value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ namespace Mantid
std::string bytesToString(int64_t &fileSize);
// Helper method that formats a given timestamp.
std::string formatDateTime(const time_t &timestamp, const std::string &format);
// Sets the soap-endpoint & SSL context for the proxy being returned.
ICat4::ICATPortBindingProxy getICATProxy();
// Sets the soap-endpoint & SSL context for the given ICAT proxy.
void setICATProxySettings(ICat4::ICATPortBindingProxy& icat);

// Reference to the logger class.
Kernel::Logger& g_log;
Expand Down
55 changes: 32 additions & 23 deletions Code/Mantid/Framework/ICat/src/ICat3/ICat3Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ namespace Mantid
*/
int CICatHelper::doSearch(ICATPortBindingProxy& icat,boost::shared_ptr<ns1__searchByAdvanced>& request,ns1__searchByAdvancedResponse& response)
{
icat = getICATProxy();
setICATProxySettings(icat);

clock_t start=clock();
int ret_advsearch=icat.searchByAdvanced(request.get(),&response);
if(ret_advsearch!=0)
Expand Down Expand Up @@ -275,7 +276,8 @@ namespace Mantid
API::ITableWorkspace_sptr& responsews_sptr)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__getInvestigationIncludes request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -411,7 +413,8 @@ namespace Mantid
API::ITableWorkspace_sptr& responsews_sptr)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

// request object
ns1__getInvestigationIncludes request;
Expand Down Expand Up @@ -507,7 +510,8 @@ namespace Mantid
void CICatHelper::listInstruments(std::vector<std::string>& instruments)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__listInstruments request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -558,7 +562,8 @@ namespace Mantid
void CICatHelper::listInvestigationTypes(std::vector<std::string>& investTypes)
{
//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__listInvestigationTypes request;
//get the sessionid which is cached in session class during login
Expand Down Expand Up @@ -620,7 +625,8 @@ namespace Mantid
*/
int CICatHelper::doLogout()
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__logout request;
ns1__logoutResponse response;
Expand All @@ -642,7 +648,8 @@ namespace Mantid
*/
void CICatHelper::doMyDataSearch(API::ITableWorkspace_sptr& ws_sptr)
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__getMyInvestigationsIncludes request;
ns1__getMyInvestigationsIncludesResponse response;
Expand Down Expand Up @@ -723,8 +730,8 @@ namespace Mantid
request.startIndex = offset;
request.advancedSearchDetails = buildSearchQuery(inputs);

//ICAt proxy object
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

int result = icat.searchByAdvancedPagination(&request, &response);

Expand Down Expand Up @@ -843,7 +850,8 @@ namespace Mantid
*/
int64_t CICatHelper::getNumberOfSearchResults(const CatalogSearchParam& inputs)
{
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__searchByAdvanced request;
ns1__searchByAdvancedResponse response;
Expand Down Expand Up @@ -875,8 +883,8 @@ namespace Mantid
*/
bool CICatHelper::isvalidSession()
{

ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__isSessionValid request;
ns1__isSessionValidResponse response;
Expand All @@ -897,8 +905,11 @@ namespace Mantid
{
// Store the soap end-point in the session for use later.
ICat::Session::Instance().setSoapEndPoint(url);

// Obtain the ICAT proxy that has been securely set, including soap-endpoint.
ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

// Output the soap end-point in use for debugging purposes.
g_log.debug() << "The ICAT soap end-point is: " << icat.soap_endpoint << "\n";

Expand Down Expand Up @@ -931,8 +942,8 @@ namespace Mantid

void CICatHelper::getdownloadURL(const long long& fileId,std::string& url)
{

ICATPortBindingProxy icat = getICATProxy();
ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__downloadDatafile request;

Expand Down Expand Up @@ -963,9 +974,9 @@ namespace Mantid

void CICatHelper::getlocationString(const long long& fileid,std::string& filelocation)
{

ICATPortBindingProxy icat = getICATProxy();

ICATPortBindingProxy icat;
setICATProxySettings(icat);
ns1__getDatafile request;

boost::shared_ptr<std::string >sessionId_sptr(new std::string);
Expand All @@ -988,18 +999,16 @@ namespace Mantid
}

/**
* Sets the soap-endpoint & SSL context for the proxy being returned.
* @return ICATPortBindingProxy :: The proxy with set endpoint & SSL context.
* Sets the soap-endpoint & SSL context for the given ICAT proxy.
*/
ICat3::ICATPortBindingProxy CICatHelper::getICATProxy()
void CICatHelper::setICATProxySettings(ICat3::ICATPortBindingProxy& icat)
{
ICat3::ICATPortBindingProxy icat;
// Set the soap-endpoint of the catalog we want to use.
icat.soap_endpoint = ICat::Session::Instance().getSoapEndPoint().c_str();
// Sets SSL authentication scheme
setSSLContext(icat);
return icat;
}

/**
* Defines the SSL authentication scheme.
* @param icat :: ICATPortBindingProxy object.
Expand Down
40 changes: 24 additions & 16 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ namespace Mantid
{
// Store the soap end-point in the session for use later.
ICat::Session::Instance().setSoapEndPoint(url);
// Obtain the ICAT proxy that has been securely set, including soap-endpoint.
ICat4::ICATPortBindingProxy icat = getICATProxy();
// Securely set, including soap-endpoint.
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

// Output the soap end-point in use for debugging purposes.
g_log.debug() << "The ICAT soap end-point is: " << icat.soap_endpoint << "\n";

Expand Down Expand Up @@ -87,7 +89,8 @@ namespace Mantid
*/
void ICat4Catalog::logout()
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__logout request;
ns1__logoutResponse response;
Expand Down Expand Up @@ -257,7 +260,8 @@ namespace Mantid

g_log.debug() << "ICat4Catalog::search -> Query is: { " << query << " }" << std::endl;

ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand All @@ -284,7 +288,8 @@ namespace Mantid
*/
int64_t ICat4Catalog::getNumberOfSearchResults(const CatalogSearchParam& inputs)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -326,7 +331,8 @@ namespace Mantid
*/
void ICat4Catalog::myData(Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -431,7 +437,8 @@ namespace Mantid
*/
void ICat4Catalog::getDataSets(const long long& investigationId, Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -499,7 +506,8 @@ namespace Mantid
*/
void ICat4Catalog::getDataFiles(const long long& investigationId, Mantid::API::ITableWorkspace_sptr& outputws)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -576,7 +584,8 @@ namespace Mantid
*/
void ICat4Catalog::listInstruments(std::vector<std::string>& instruments)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -616,7 +625,8 @@ namespace Mantid
*/
void ICat4Catalog::listInvestigationTypes(std::vector<std::string>& invstTypes)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__search request;
ns1__searchResponse response;
Expand Down Expand Up @@ -657,7 +667,8 @@ namespace Mantid
*/
void ICat4Catalog::getFileLocation(const long long & fileID, std::string & fileLocation)
{
ICat4::ICATPortBindingProxy icat = getICATProxy();
ICat4::ICATPortBindingProxy icat;
setICATProxySettings(icat);

ns1__get request;
ns1__getResponse response;
Expand Down Expand Up @@ -810,17 +821,14 @@ namespace Mantid
}

/**
* Sets the soap-endpoint & SSL context for the proxy being returned.
* @return ICATPortBindingProxy :: The proxy with set endpoint & SSL context.
* Sets the soap-endpoint & SSL context for the given ICAT proxy.
*/
ICat4::ICATPortBindingProxy ICat4Catalog::getICATProxy()
void ICat4Catalog::setICATProxySettings(ICat4::ICATPortBindingProxy& icat)
{
ICat4::ICATPortBindingProxy icat;
// Set the soap-endpoint of the catalog we want to use.
icat.soap_endpoint = ICat::Session::Instance().getSoapEndPoint().c_str();
// Sets SSL authentication scheme
setSSLContext(icat);
return icat;
}
}
}

0 comments on commit 335e05c

Please sign in to comment.