Difference between revisions of "CCAPITestScript"

From ADF Docs
Jump to: navigation, search
Line 2: Line 2:
  
 
<nowiki>
 
<nowiki>
<!---<br/>
+
<!---
 
Use: To test that the CCAPI configuration is working correctly.
 
Use: To test that the CCAPI configuration is working correctly.
 
Requirements: The CCAPI.xml file also reflects the next cfscript block and the ADF has been reset.
 
Requirements: The CCAPI.xml file also reflects the next cfscript block and the ADF has been reset.

Revision as of 17:22, 6 October 2010

This script goes into the individual subsite's customcf folder and is ran directly.

<!--- Use: To test that the CCAPI configuration is working correctly. Requirements: The CCAPI.xml file also reflects the next cfscript block and the ADF has been reset. To reset the adf: Log in as an administrator. Add ?resetSiteADF=1&resetServerADF=1 to the end of your url ----> <cfscript> userid = "admin-commonspot"; password = "password"; webserviceURL = "http://myserver/commonspot/webservice/cs_service.cfc?wsdl"; site = "http://myserver/sitename"; datadir = ""; // the full path to the location of your source uploaded documents/images (requires trailiing slash) </cfscript> <!--- The following should not need to be modified. ---> <cfoutput><p>Time at beginning of CCAPI login process: #now()#</p></cfoutput> <!--- // create object for Web service call ---> <cfobject webservice="#webserviceURL#" name = "ws"> <!--- // invoke the login API call ---> <cfinvoke webservice = "#ws#" method ="cslogin" site = "#site#" csuserid="#userid#" cspassword="#password#" subsiteid="1" subsiteurl="/" returnVariable="loginResult"> <!--- // verify that the user was successfully logged in ---> <cfif ListFirst(loginResult, ":") is "Error"> <cfoutput>Login Failed - #loginResult#</cfoutput> <cfexit> </cfif> <!--- // set the ssid which is used for the remainder of the calls to the API ---> <cfset ssid = ListRest(loginResult, ":")> <cfoutput>Original Method Login -- #ssid#<br /></cfoutput> <!--- <cfscript> // create new structure to hold data for new subsite s = StructNew(); s.name = "sfstest10"; s.description="sfstest10"; s.displayname="sfstest10"; </cfscript> <cfdump var="#s#" label="s structure for new subsite" expand="yes"> ---> <!--- // invoke the createSubSite API call <cfinvoke webservice="#ws#" method="createSubSite" ssid="#ssid#" returnVariable="subSiteMaker"> <cfinvokeargument name="sparams" value="#s#"> </cfinvoke> ---> <!--- // render results from the Web service <CFOUTPUT>CreateSubSite -- #subSiteMaker#<br /></CFOUTPUT> ---> <!--- // invoke the logout API call ---> <cfinvoke webservice="#ws#" method="cslogout" ssid="#ssid#" returnVariable="finalLogoutResult"> <CFOUTPUT>Original Method Logout -- #finalLogoutResult#<br /></CFOUTPUT> <cfoutput><p>Time at end of CCAPI test: #now()#</p></cfoutput> <!--- -------------------------------- ---> <cfoutput> <p>ADF.CCAPI method</p> <cfset myInitResult = application.adf.ccapi.initccapi()> <p>I think I initalized the CCAPI.</p> <cfset myLoginResult = application.adf.ccapi.login(1)> <p>myLoginResult:</p> <cfdump var="#myLoginResult#" label="myLoginResult" expand="no"> <cfset AmLoggedIn = application.adf.ccapi.loggedin()> <p>Did I login to the site?: #AmLoggedIn#</p> <!--- <cfset newSubsiteData = application.ptImport.SubsiteMapDAO.getSubsiteMapData()> <cfdump var="#newSubsiteData#" label="subsitemapdata" expand="no"> <cfloop from="1" to="#arrayLen(newSubsiteData)#" index="itm"> <p>Attempting to make a subsite called #newSubsiteData[itm].newsubsiteurl#</p> <cfset subsiteCreateTest = application.adf.cssubsite.BUILDSUBSITESFROMPATH(newSubsiteData[itm].newsubsiteurl)> <p>Subsite create result: #subsiteCreateTest#</p> </cfloop> ---> <cfset AmLoggedOut = application.adf.ccapi.logout()> <p>Did I logout of the site?: #AmLoggedOut#</p> </cfoutput>