1));
$auth = array('username' => "admin",
'password' => "admin");
//$auth->username = "admin";
//$auth->password = "admin";
$initStamp = time();
cleanup();
checkSetup();
runTests();
//cleanup();
echo $log;
echo "Time elapsed: " . (time() - $initStamp) . "seconds
";
//echo "Total operations $operationCounter
";
echo "Total tests: $testCounter
";
echo "Failures: " . ($testCounter - $successCounter);
function runTests() {
global $log;
$log .= "***RUNNING WSDL TESTS***
";
testMetadataSetContainer();//tested
testMetadataSet();//tested
testFolders();//tested
testXMLBlock();//tested
testTextBlock();//tested
testXHTMLBlock();//tested
testFeedBlock();//tested
testIndexBlock();//tested
testFile();//tested
testTarget();//tested
testTemplate();//tested
testStructuredDataDefinitionContainer();//tested
testStructuredDataDefinition();//tested
testWorkflowDefinitionContainer();//tested
testWorkflowDefinition();//tested
testTransports();//tested
testDestination();//waiting on destination read by path to be enabled
testPublishSetContainer();//tested
testPublishSet();//tested
testPageConfigurationSetContainer();//tested
testPageConfigurationSet();//tested
testPage();//tested
//testReference();//disabled because it breaks everything--CMS bug involving deletion :/
testAssetFactoryContainer();//tested
testAssetFactory();//tested
testSymlink();//tested
testStylesheet();//tested
testGroup();//tested
testUser();//tested
}
function CreateAsset( $asset, $type )
{
global $log;
global $auth;
global $service;
global $testCounter;
global $successCounter;
$testCounter++;
$params = array( 'authentication' => $auth,
'asset' => $asset );
try {
$out = $service->create($params);
if ( $out->createReturn->success != 'true' )
//if (substr_count($service->__getLastResponse(), "false") > 0)
{
$log .= "Failed to create asset of type $type.
";
$log .= $out->createReturn->message . "
";
/*$log .= $service->__getLastRequest() . "
";
$log .= $service->__getLastResponse() . "
";*/
}
else
{
$log .= "Successful creation of asset of type $type.
";
$successCounter++;
}
}
catch (Exception $e) {
$log .= "WSDL creation error on asset of type $type:
";
/*$log .= $service->__getLastRequest() . "
";
$log .= $service->__getLastResponse() . "
";*/
$log .= $e->getMessage() . "
";
}
}
function ReadAsset( $id, $type )
{
global $log;
global $auth;
global $service;
global $testCounter;
global $successCounter;
$testCounter++;
$params = array( 'authentication' => $auth,
'identifier' => $id );
try {
$out = $service->read($params);
if ( $out->readReturn->success != 'true' )
{
//if (substr_count($service->__getLastResponse(), "false") > 0) {
$log .= "Failed to read asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$log .= $out->readReturn->message . "
";
//$log .= $service->__getLastRequest() . "
";
//$log .= $service->__getLastResponse() . "
";
}
else
{
$log .= "Successful read of asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$successCounter++;
}
}
catch (Exception $e) {
$log .= "WSDL read error on asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$log .= $e->getMessage() . "
";
}
}
function CheckAsset( $id, $type )
{
global $log;
global $auth;
global $service;
$params = array( 'authentication' => $auth,
'identifier' => $id );
try {
$out = $service->read($params);
if ( $out->readReturn->success == 'true' )
{
//if (substr_count($service->__getLastResponse(), "false") == 0) {
/*log .= "Failed to read asset of type $type with ID ".$id['id'].":
";
log .= $service->__getLastRequest() . "
";
log .= $service->__getLastResponse() . "
";*/
$log .= "Found asset of type $type with name ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ". Asset must be deleted first.
";
return false;
}
else
return true;
/*else
{
log .= "Successful read of asset of type $type with ID ".$id['id'].".
";
successCounter++;
}*/
}
catch (Exception $e) {
$log .= "WSDL read error on asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$log .= $e->getMessage() . "
";
return false;
}
}
function DeleteAsset( $id, $type )
{
global $log;
global $auth;
global $service;
$params = array( 'authentication' => $auth,
'identifier' => $id );
try {
$out = $service->read( $params );
if ( $out->readReturn->success == 'true' )
//if (substr_count($service->__getLastResponse(), "false") == 0)
{
try {
$out = $service->delete($params);
if ( $out->deleteReturn->success != 'true' )
{
//if (substr_count($service->__getLastResponse(), "false") > 0) {
/*log .= "Failed to read asset of type $type with ID ".$id['id'].":
";
log .= $service->__getLastRequest() . "
";
log .= $service->__getLastResponse() . "
";*/
$log .= "Failed to delete asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .=".
";
return false;
}
else
{
$log .= "Successful deletion of asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
return true;
}
}
catch (Exception $e) {
$log .= "WSDL delete error on asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$log .= $e->getMessage() . "
";
return false;
}
}
else
return true;
}
catch (Exception $e) {
$log .= "WSDL read error on asset of type $type with ID ";
if ( isset($id['path']) && $id['path'] != '' )
$log .= $id['path'];
else
$log .= $id['id'];
$log .= ".
";
$log .= $e->getMessage() . "
";
return false;
}
}
function testUser() {
global $rootLoc;
//global $auth;
//global $service;
//$user = new user;
//$asset = new asset;
$asset = array( 'user' => array (
'role' => 'contributor',
'username' => "$rootLoc user",
'fullName' => $rootLoc,
'email' => $rootLoc,
'authType' => 'normal',
'groups' => 'Administrator',
'password' => $rootLoc,
'enabled' => true));
/*$params = array ('authentication' => $auth,
'asset' => $asset);*/
CreateAsset( $asset, 'User' );
$id = array( 'type' => 'user',
'id' => "$rootLoc user",
'path' => '');
ReadAsset( $id, 'User' );
}
/* try {
$service->create($params);
}
catch {
print_r($service->__getLastRequest());
print_r($service->__getLastResponse());
}
if($response->editReturn->success != "true")
{
print_r($service->__getLastRequest());
print_r($service->__getLastResponse());
//$mesg = $config->get_var("strings.edit_error");
return FALSE;
}
/*$asset->user = $user;
$user->role = "contributor";
$user->username = "$rootLoc user";
$user->fullName = $rootLoc;
$user->email = $rootLoc;
$user->authType = "normal";
$user->groups = "analysts";
$user->roles = "Administrator";
$user->password = $rootLoc;
$user->enabled = true;
$service->create($auth, $asset);
$user->password = null;
assertEquals($service->success, true, "user creation failed");
$id = new identifier;
$id->type = "user";
$id->id = "$rootLoc user";
$service->read($auth, $id);
assertEquals($service->success, true, "user read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "user content changed");
}*/
function testGroup() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'group' => array (
'role' => 'contributor',
'groupName' => "$rootLoc group",
'wysiwygAllowViewSource' => $rootLoc));
/*$group = new group;
$asset = new asset;
$asset->group = $group;
$group->role = "contributor";
$group->groupName = "$rootLoc group";
$group->wysiwygAllowViewSource = true;
$service->create($auth, $asset);
assertEquals($service->success, true, "group creation failed");*/
CreateAsset( $asset, 'Group' );
$id = array( 'type' => 'group',
'id' => "$rootLoc group");
ReadAsset( $id, 'Group' );
/*$id = new identifier;
$id->type = "group";
$id->id = "$rootLoc group";
$service->read($auth, $id);
assertEquals($service->success, true, "group read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "group content changed");*/
}
function testWorkflowDefinition() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'workflowDefinition' => array (
'parentContainerPath' => $rootLoc,
'name' => 'def',
'applicableGroups' => 'analysts',
'namingBehavior' => 'auto-name',
'copy' => true,
'xml' => "a"));
CreateAsset( $asset, 'Workflow Definition' );
$id = array( 'type' => 'workflowdefinition',
'path' => "$rootLoc/def");
ReadAsset( $id, 'Workflow Definition' );
/*$def = new workflowDefinition;
$asset = new asset;
$asset->workflowDefinition = $def;
$def->parentContainerPath = $rootLoc;
$def->name = "def";
$def->applicableGroups = "analysts";
$def->namingBehavior = "auto-name";
$def->copy = true;
$def->xml = "a";
$service->create($auth, $asset);
$def->path = "$rootLoc/def";
assertEquals($service->success, true, "workflowDefinition creation failed");
$id = new identifier;
$id->type = "workflowdefinition";
$id->path = "$rootLoc/def";
$service->read($auth, $id);
assertEquals($service->success, true, "workflowDefinition read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "workflowDefinition content changed");*/
}
function testWorkflowDefinitionContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'workflowDefinitionContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc));
CreateAsset( $asset, 'Workflow Container' );
$id = array( 'type' => 'workflowdefinitioncontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Workflow Container' );
/*$container = new workflowDefinitionContainer;
$asset = new asset;
$asset->workflowDefinitionContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$service->create($auth, $asset);
assertEquals($service->success, true, "mworkflowDefinitionContainer creation failed");
$id = new identifier;
$id->type = "workflowdefinitioncontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "workflowDefinitionContainer read failed");*/
}
function testAssetFactory() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'assetFactory' => array (
'parentContainerPath' => $rootLoc,
'name' => 'assetFactory',
'applicableGroups' => 'analysts',
'assetType' => 'page',
'workflowMode' => 'none'));
CreateAsset( $asset, 'Asset Factory' );
$id = array( 'type' => 'assetfactory',
'path' => "$rootLoc/assetFactory");
ReadAsset( $id, 'Asset Factory' );
/*$factory = new assetFactory;
$asset = new asset;
$asset->assetFactory = $factory;
$factory->parentContainerPath = "$rootLoc";
$factory->name = "assetFactory";
$factory->applicableGroups = "analysts";
$factory->assetType = "page";
$factory->workflowMode = "none";
$service->create($auth, $asset);
$factory->path = "$rootLoc/assetFactory";
assertEquals($service->success, true, "assetFactory creation failed");
$id = new identifier;
$id->type = "assetfactory";
$id->path = "$rootLoc/assetFactory";
$service->read($auth, $id);
assertEquals($service->success, true, "assetFactory read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "assetFactory contents changed");*/
}
function testAssetFactoryContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'assetFactoryContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc,
'applicableGroups' => 'analysts'));
CreateAsset( $asset, 'Asset Factory Container' );
$id = array( 'type' => 'assetfactorycontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Asset Factory Container' );
/*$container = new assetFactoryContainer;
$asset = new asset;
$asset->assetFactoryContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$container->applicableGroups = "analysts";
$service->create($auth, $asset);
assertEquals($service->success, true, "assetFactoryContainer creation failed");
$id = new identifier;
$id->type = "assetfactorycontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "assetFactoryContainer read failed");*/
}
function testMetadataSet() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'metadataSet' => array (
'parentContainerPath' => $rootLoc,
'name' => 'set',
'authorFieldRequired' => true,
'descriptionFieldRequired' => false,
'authorFieldVisibility' => "visible",
'descriptionFieldVisibility' => "hidden",
'displayNameFieldVisibility' => "inline",
'dynamicFields' => array(
'dynamicMetadataFieldDefinition' => array(
array( 'name' => "test1",
'fieldType' => 'text',
'required' => true,
'visibility' => 'visible'),
array( 'name' => 'test2',
'fieldType' => 'dropdown',
'required' => false,
'visibility' => 'hidden',
'configurationXML' => "
- choice1
- choice2
"),
array( 'name' => 'test3',
'fieldType' => 'radio',
'required' => false,
'visibility' => 'inline',
'configurationXML' => "
- stuff1
- stuff2
- stuff3
")))));
CreateAsset( $asset, 'Metadata Set' );
$id = array( 'type' => 'metadataset',
'path' => $rootLoc ."/set");
ReadAsset( $id, 'Metadata Set' );
/*$set = new metadataSet;
$asset = new asset;
$asset->metadataSet = $set;
$set->parentContainerPath = "$rootLoc";
$set->name = "set";
$set->authorFieldRequired = true;
$set->descriptionFieldRequired = false;
$set->authorFieldVisibility = "visible";
$set->descriptionFieldVisibility = "hidden";
$set->displayNameFieldVisibility = "inline";
$fields = new dynamicFields;
$set->dynamicFields = $fields;
$fields->dynamicMetadataFieldDefinition = array();
$field1 = new dynamicMetadataFieldDefinition;
$field2 = new dynamicMetadataFieldDefinition;
$field3 = new dynamicMetadataFieldDefinition;
$fields->dynamicMetadataFieldDefinition[] = $field1;
$fields->dynamicMetadataFieldDefinition[] = $field2;
$fields->dynamicMetadataFieldDefinition[] = $field3;
$field1->name = "test1";
$field1->fieldType = "text";
$field1->required = true;
$field1->visibility = "visible";
$field2->name = "test2";
$field2->fieldType = "dropdown";
$field2->required = false;
$field2->visibility = "hidden";
$field2->configurationXML = "
- choice1
- choice2
";
$field3->name = "test3";
$field3->fieldType = "radio";
$field3->required = true;
$field3->visibility = "inline";
$field3->configurationXML = "
- stuff1
- stuff2
- stuff3
";
$service->create($auth, $asset);
assertEquals($service->success, true, "metadataSet creation failed");
$id = new identifier;
$id->type = "metadataset";
$id->path = "$rootLoc/set";
$service->read($auth, $id);
assertEquals($service->success, true, "metadataSet read failed");
assertEquals($service->asset->metadataSet->authorFieldRequired, true, "metadataSet authorFieldRequired check failed");
assertEquals($service->asset->metadataSet->descriptionFieldRequired, false, "metadataSet descriptionFieldRequired check failed");
assertEquals($service->asset->metadataSet->authorFieldVisibility, "visible", "metadataSet authorFieldVisibility check failed");
assertEquals($service->asset->metadataSet->descriptionFieldVisibility, "hidden", "metadataSet descriptionFieldVisibility check failed");
assertEquals($service->asset->metadataSet->displayNameFieldVisibility, "inline", "metadataSet displayNameFieldVisibility check failed");
assertEquals($service->asset->metadataSet->dynamicFields->serialize(), $fields->serialize(), "metadataSet dynamic fields check failed");*/
}
function testMetadataSetContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'metadataSetContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc));
CreateAsset( $asset, 'Metadata Set Container' );
$id = array( 'type' => 'metadatasetcontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Metadata Set Container' );
/*$container = new metadataSetContainer;
$asset = new asset;
$asset->metadataSetContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$service->create($auth, $asset);
assertEquals($service->success, true, "metadataSetContainer creation failed");
$id = new identifier;
$id->type = "metadatasetcontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "metadataSetContainer read failed");*/
}
function testPageConfigurationSet() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'pageConfigurationSet' => array (
'parentContainerPath' => $rootLoc,
'name' => "set",
'pageConfigurations' => array(
'pageConfiguration' => array(
array( 'name' => 'html',
'defaultConfiguration' => true,
'templatePath' => "$rootLoc/template")))));
CreateAsset( $asset, 'Page Configuration Set' );
$id = array( 'type' => 'pageconfigurationset',
'path' => "$rootLoc/set");
ReadAsset( $id, 'Page Configuration Set' );
/*$set = new pageConfigurationSet;
$asset = new asset;
$asset->pageConfigurationSet = $set;
$set->parentContainerPath = "$rootLoc";
$set->name = "set";
$set->pageConfigurations = new pageConfigurations;
$config = array();
$set->pageConfigurations->pageConfiguration = $config;
$config[] = new pageConfiguration;
$config[0]->name = "html";
$config[0]->defaultConfiguration = true;
$config[0]->templatePath = "$rootLoc/template";
$set->pageConfigurations->pageConfiguration = $config;
$service->create($auth, $asset);
$set->path = "$rootLoc/set";
assertEquals($service->success, true, "pageConfigurationSet creation failed");
$id = new identifier;
$id->type = "pageconfigurationset";
$id->path = "$rootLoc/set";
$service->read($auth, $id);
$service->asset->pageConfigurationSet->pageConfigurations->pageConfiguration[0]->pageRegions = null;
assertEquals($service->success, true, "pageConfigurationSet read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "pageConfigurationSet content changed");*/
}
function testPageConfigurationSetContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'pageConfigurationSetContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc));
CreateAsset( $asset, 'Page Configuration Set Container' );
$id = array( 'type' => 'pageconfigurationsetcontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Page Configuration Set Container' );
/*$container = new pageConfigurationSetContainer;
$asset = new asset;
$asset->pageConfigurationSetContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$service->create($auth, $asset);
assertEquals($service->success, true, "pageConfigurationSetContainer creation failed");
$id = new identifier;
$id->type = "pageconfigurationsetcontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "pageConfigurationSetContainer read failed");*/
}
function testPublishSet() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'publishSet' => array (
'parentContainerPath' => $rootLoc,
'name' => 'set',
'usesScheduledPublishing' => false,
'timeToPublish' => "00:00:00.0000"));
CreateAsset( $asset, 'Publish Set' );
$id = array( 'type' => 'publishset',
'path' => "$rootLoc/set");
ReadAsset( $id, 'Publish Set' );
/*$set = new publishSet;
$asset = new asset;
$asset->publishSet = $set;
$set->parentContainerPath = "$rootLoc";
$set->name = "set";
$set->usesScheduledPublishing = false;
$set->timeToPublish = "00:00:00.0000";
$service->create($auth, $asset);
$set->publishInterval = "0";
assertEquals($service->success, true, "publishSet creation failed");
$set->path = "$rootLoc/set";
$id = new identifier;
$id->type = "publishset";
$id->path = "$rootLoc/set";
$service->read($auth, $id);
assertEquals($service->success, true, "publishSet read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "publishSet content changed");*/
}
function testPublishSetContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'publishSetContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc));
CreateAsset( $asset, 'Publish Set Container' );
$id = array( 'type' => 'publishsetcontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Publish Set Container' );
/*$container = new publishSetContainer;
$asset = new asset;
$asset->publishSetContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$service->create($auth, $asset);
assertEquals($service->success, true, "publishSetContainer creation failed");
$id = new identifier;
$id->type = "publishsetcontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "publishSetContainer read failed");*/
}
function testStructuredDataDefinition() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'structuredDataDefinition' => array (
'parentContainerPath' => $rootLoc,
'name' => 'definition2',
'xml' => ""));
CreateAsset( $asset, 'Structured Data Definition' );
$id = array( 'type' => 'structureddatadefinition',
'path' => "$rootLoc/definition2");
ReadAsset( $id, 'Structured Data Definition' );
/*$def = new structuredDataDefinition;
$asset = new asset;
$asset->structuredDataDefinition = $def;
$def->parentContainerPath = $rootLoc;
$def->name = "definition2";
$def->xml="";
$def->xml = "a";
$service->create($auth, $asset);
$def->path = "$rootLoc/definition2";
assertEquals($service->success, true, "structuredDataDefinition creation failed");
$id = new identifier;
$id->type = "structureddatadefinition";
$id->path = "$rootLoc/definition2";
$service->read($auth, $id);
assertEquals($service->success, true, "structuredDataDefinition read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "structuredDataDefinition content changed");*/
}
function testStructuredDataDefinitionContainer() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'structuredDataDefinitionContainer' => array (
'parentContainerPath' => '/',
'name' => $rootLoc));
CreateAsset( $asset, 'Structured Data Definition Container' );
$id = array( 'type' => 'structureddatadefinitioncontainer',
'path' => $rootLoc);
ReadAsset( $id, 'Structured Data Definition Container' );
/*$container = new structuredDataDefinitionContainer;
$asset = new asset;
$asset->structuredDataDefinitionContainer = $container;
$container->parentContainerPath = "/";
$container->name = $rootLoc;
$service->create($auth, $asset);
assertEquals($service->success, true, "structuredDataDefinitionContainer creation failed");
$id = new identifier;
$id->type = "structureddatadefinitioncontainer";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "structuredDataDefinitionContainer read failed");*/
}
function testTransports() {
testFTPTransport();//tested
testfileSystemTransport();
}
function testFTPTransport() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'ftpTransport' => array (
'name' => $rootLoc,
'hostName' => 'hannonhill.com',
'port' => '4444',
'username' => 'admin',
'password' => 'nimda',
'directory' => 'asdf',
'doSFTP' => true,
'doPASV' => true));
CreateAsset( $asset, 'FTP Transport' );
$id = array( 'type' => 'transport',
'path' => 'FTP and SFTP/'.$rootLoc);
ReadAsset( $id, 'FTP Transport' );
/*$transport = new FTPTransport;
$asset = new asset;
$asset->ftpTransport = $transport;
$transport->name = $rootLoc;
$transport->hostName = "hannonhill.com";
$transport->port = "4444";
$transport->username = "admin";
$transport->password = "nimda";
$transport->directory = "asdf";
$transport->doSFTP = true;
$transport->doPASV = true;
$service->create($auth, $asset);
$transport->path = "FTP and SFTP/$rootLoc";
$transport->password = null;
assertEquals($service->success, true, "filesystem transport creation failed");
$id = new identifier;
$id->type = "transport";
$id->path = "FTP and SFTP/".$rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "FTP transport read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "FTP transport content changed");*/
}
function testfileSystemTransport() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'fileSystemTransport' => array (
'name' => $rootLoc,
'directory' => $rootLoc,
'outputZip' => true));
CreateAsset( $asset, 'Filesystem Transport' );
$id = array( 'type' => 'transport',
'path' => 'Filesystem/'.$rootLoc);
ReadAsset( $id, 'Filesystem Transport' );
/*$transport = new FileSystemTransport;
$asset = new asset;
$asset->fileSystemTransport = $transport;
$transport->name = $rootLoc;
$transport->directory = $rootLoc;
$transport->outputZip = true;
$service->create($auth, $asset);
$transport->path = "Filesystem/$rootLoc";
assertEquals($service->success, true, "filesystem transport creation failed");
$id = new identifier;
$id->type = "transport";
$id->path = "Filesystem/".$rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "filesystem transport read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "filesystem transport content changed");*/
}
function testStylesheet() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'stylesheet' => array (
'parentFolderPath' => $rootLoc,
'name' => 'stylesheet',
'xml' => ""));
CreateAsset( $asset, 'Stylesheet' );
$id = array( 'type' => 'stylesheet',
'path' => $rootLoc.'/stylesheet');
ReadAsset( $id, 'Stylesheet' );
/*$stylesheet = new stylesheet;
$asset = new asset;
$asset->stylesheet = $stylesheet;
$stylesheet->parentFolderPath = $rootLoc;
$stylesheet->name = "stylesheet";
$stylesheet->xml = "
";
$service->create($auth, $asset);
$stylesheet->path = "$rootLoc/stylesheet";
assertEquals($service->success, true, "stylesheet creation failed");
$id = new identifier;
$id->type = "stylesheet";
$id->path = $rootLoc . "/stylesheet";
$service->read($auth, $id);
assertEquals($service->success, true, "stylesheet read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "stylesheet content changed");*/
}
function testTarget() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'target' => array (
'parentTargetPath' => '/',
'name' => $rootLoc,
'cssClasses' => "$rootLoc.css",
'baseFolderPath' => $rootLoc,
'outputExtension' => '.php',
'serializationType' => 'HTML',
'includeXMLDeclaration' => false,
'includeTargetPath' => false,
'removeBaseFolder' => true,
'usesScheduledPublishing' => false,
'cssFilePath' => "$rootLoc/file.php",
'publishInterval' => '0'));
CreateAsset( $asset, 'Target' );
$id = array( 'type' => 'target',
'path' => $rootLoc);
ReadAsset( $id, 'Target' );
/*$target = new target;
$asset = new asset;
$asset->target = $target;
$target->cssClasses = "$rootLoc.css";
$target->parentTargetPath = "/";
$target->name = $rootLoc;
$target->baseFolderPath = $rootLoc;
$target->outputExtension = ".php";
$target->serializationType = "HTML";
$target->includeXMLDeclaration = false;
$target->includeTargetPath = false;
$target->removeBaseFolder = true;
$target->usesScheduledPublishing = false;
$target->cssFilePath = "$rootLoc/file.php";
$target->publishInterval = "0";
$service->create($auth, $asset);
$target->path = $rootLoc;
assertEquals($service->success, true, "target creation failed");
$id = new identifier;
$id->type = "target";
$id->path = $rootLoc;
$service->read($auth, $id);
$service->asset->target->timeToPublish = null;
assertEquals($service->success, true, "target read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "target content changed");*/
}
function testDestination() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'destination' => array (
'parentTargetPath' => $rootLoc,
'transportPath' => 'Filesystem/'.$rootLoc,
'name' => 'dest',
'usesScheduledPublishing' => false,
'enabled' => true,
'publishASCII' => true));
CreateAsset( $asset, 'Destination' );
$id = array( 'type' => 'destination',
'path' => $rootLoc.'/dest');
ReadAsset( $id, 'Destination' );
/*$destination = new destination;
$asset = new asset;
$asset->destination = $destination;
$destination->transportPath = "Filesystem/" . $rootLoc;
$destination->name = "destination";
$destination->parentTargetPath = $rootLoc;
$destination->enabled = true;
$destination->publishASCII = true;
$destination->usesScheduledPublishing = false;
$service->create($auth, $asset);
assertEquals($service->success, true, "destination creation failed");
$id = new identifier;
$id->type = "destination";
$id->path = $rootLoc."/destination";
$service->read($auth, $id);
assertEquals($service->success, true, "destination read failed");*/
}
function testTemplate() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'template' => array (
'parentFolderPath' => $rootLoc,
'targetPath' => $rootLoc,
'name' => 'template',
'xml' => "",
'pageRegions' => array(
'pageRegion' => array(
array('name' => 'DEFAULT',
'blockPath' => "$rootLoc/block0"),
array('name' => 'DEFAULT2',
'blockPath' => "$rootLoc/block1")))));
CreateAsset( $asset, 'Template' );
$id = array( 'type' => 'template',
'path' => $rootLoc.'/template');
ReadAsset( $id, 'Template' );
/*$template = new template;
$asset = new asset;
$asset->template = $template;
$template->parentFolderPath = $rootLoc;
$template->name = "template";
$template->targetPath = $rootLoc;
$template->xml = "";
$template->pageRegions = new pageRegions;
$region1 = new pageRegion;
$region1->name = "DEFAULT";
$region1->blockPath = "$rootLoc/block0";
$region2 = new pageRegion;
$region2->name = "DEFAULT2";
$region2->blockPath = "$rootLoc/block1";
$template->pageRegions->pageRegion[] = $region1;
$template->pageRegions->pageRegion[] = $region2;
$service->create($auth, $asset);
$template->path = "$rootLoc/template";
assertEquals($service->success, true, "template creation failed");
$id = new identifier;
$id->type = "template";
$id->path = $rootLoc . "/template";
$service->read($auth, $id);
assertEquals($service->success, true, "template read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "template contnet changed");*/
}
function testSymlink() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'symlink' => array (
'parentFolderPath' => $rootLoc,
'linkURL' => 'http://www.google.com',
'name' => 'ref2',
'metadata' => array(
'author' => $rootLoc),
'metadataSetPath' => "$rootLoc/set"));
CreateAsset( $asset, 'Symlink' );
$id = array( 'type' => 'symlink',
'path' => $rootLoc.'/ref2');
ReadAsset( $id, 'Symlink' );
/*$symlink = new symlink;
$asset = new asset;
$asset->symlink = $symlink;
$symlink->parentFolderPath = $rootLoc;
$symlink->name = "ref2";
$symlink->linkURL = "http://www.google.com";
$symlink->metadata = new metadata;
$symlink->metadata->author = $rootLoc;
$symlink->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$symlink->path = "$rootLoc/ref2";
assertEquals($service->success, true, "symlink creation failed");
$id = new identifier;
$id->type = "symlink";
$id->path = $rootLoc . "/ref2";
$service->read($auth, $id);
assertEquals($service->success, true, "symlink read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "symlink content changed");*/
}
function testReference() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'reference' => array (
'parentFolderPath' => $rootLoc,
'referencedAssetPath' => $rootLoc.'/page',
'name' => 'ref',
'referencedAssetType' => 'page'));
CreateAsset( $asset, 'Reference' );
$id = array( 'type' => 'reference',
'path' => $rootLoc.'/ref');
ReadAsset( $id, 'Reference' );
/*$reference = new reference;
$asset = new asset;
$asset->reference = $reference;
$reference->parentFolderPath = $rootLoc;
$reference->name = "ref";
$reference->referencedAssetPath = $rootLoc."/page";
$reference->referencedAssetType = "page";
$service->create($auth, $asset);
assertEquals($service->success, true, "reference creation failed");
$id = new identifier;
$id->type = "reference";
$id->path = $rootLoc . "/ref";
$service->read($auth, $id);
assertEquals($service->success, true, "reference read failed");*/
}
function testPage() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'page' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => 'Default',
'expirationFolderPath' => $rootLoc,
'shouldBePublished' => true,
'shouldBeIndexed' => true,
'configurationSetPath' => 'General/Simple XML',
'name' => 'page',
'xhtml' => 'stuff',
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'Page' );
$id = array( 'type' => 'page',
'path' => $rootLoc.'/page');
ReadAsset( $id, 'Page' );
/*$page = new page;
$asset = new asset;
$asset->page = $page;
$page->parentFolderPath = $rootLoc;
$page->name = "page";
$page->metadataSetPath = "Default";
$page->expirationFolderPath = $rootLoc;
$page->shouldBePublished = true;
$page->shouldBeIndexed = true;
$page->configurationSetPath = "General/Simple XML";
$page->xhtml = "stuff";
$page->metadata = new metadata;
$page->metadata->author = $rootLoc;
$page->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$page->path = "$rootLoc/page";
assertEquals($service->success, true, "page creation failed");
$id = new identifier;
$id->type = "page";
$id->path = $rootLoc . "/page";
$service->read($auth, $id);
assertEquals($service->success, true, "page read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "page content changed");*/
}
function testFile() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'file' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'expirationFolderPath' => $rootLoc,
'shouldBePublished' => true,
'shouldBeIndexed' => true,
'name' => 'file.php',
'text' => 'http://rss.slashdot.org/Slashdot/slashdot',
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'File' );
$id = array( 'type' => 'file',
'path' => $rootLoc.'/file.php');
ReadAsset( $id, 'File' );
/*$file = new file;
$asset = new asset;
$asset->file = $file;
$file->text = "http://rss.slashdot.org/Slashdot/slashdot";
$file->parentFolderPath = $rootLoc;
$file->name = "file.php";
$file->shouldBePublished = false;
$file->shouldBeIndexed = true;
$file->metadata = new metadata;
$file->metadata->author = $rootLoc;
$file->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$file->path = "$rootLoc/file.php";
assertEquals($service->success, true, "text file creation failed");
$id = new identifier;
$id->type = "file";
$id->path = $rootLoc . "/file.php";
$service->read($auth, $id);
$service->asset->file->data = null;
assertEquals($service->success, true, "text file read failed");
assertEquals($service->asset->serialize(), $asset->serialize(), "text file content changed");
$file->text = null;
$file->path = "";
$file->data = "asdf";
$file->name = "file2.php";
$service->create($auth, $asset);
$file->path = "$rootLoc/file2.php";
assertEquals($service->success, true, "data file creation failed");
$id = new identifier;
$id->type = "file";
$id->path = $rootLoc . "/file2.php";
$service->read($auth, $id);
assertEquals($service->success, true, "data file read failed");
assertEquals($service->asset->file->data, $asset->file->data, "data file content changed");*/
}
function testFeedBlock() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'feedBlock' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'name' => 'block2',
'feedURL' => 'http://rss.slashdot.org/Slashdot/slashdot',
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'Feed Block' );
$id = array( 'type' => 'block',
'path' => $rootLoc.'/block2');
ReadAsset( $id, 'Feed Block' );
/*$feedBlock = new feedBlock;
$asset = new asset;
$asset->feedBlock = $feedBlock;
$feedBlock->feedURL = "http://rss.slashdot.org/Slashdot/slashdot";
$feedBlock->parentFolderPath = $rootLoc;
$feedBlock->name = "block2";
$feedBlock->metadata = new metadata;
$feedBlock->metadata->author = $rootLoc;
$feedBlock->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$feedBlock->path = "$rootLoc/block2";
assertEquals($service->success, true, "feedBlock creation failed");
$id = new identifier;
$id->type = "block";
$id->path = $rootLoc . "/block2";
$service->read($auth, $id);
assertEquals($service->success, true, "feedBlock read failed");
assertEquals($service->asset->feedBlock->serialize(), $feedBlock->serialize(), "feedBlock contents changed");*/
}
function testTextBlock() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'textBlock' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'name' => 'block3',
'text' => 'http://rss.slashdot.org/Slashdot/slashdot',
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'Text Block' );
$id = array( 'type' => 'block',
'path' => $rootLoc.'/block3');
ReadAsset( $id, 'Text Block' );
/*$textBlock = new textBlock;
$asset = new asset;
$asset->textBlock = $textBlock;
$textBlock->text = "http://rss.slashdot.org/Slashdot/slashdot";
$textBlock->parentFolderPath = $rootLoc;
$textBlock->name = "block3";
$textBlock->metadata = new metadata;
$textBlock->metadata->author = $rootLoc;
$textBlock->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$textBlock->path = "$rootLoc/block3";
assertEquals($service->success, true, "textBlock creation failed");
$id = new identifier;
$id->type = "block";
$id->path = $rootLoc . "/block3";
$service->read($auth, $id);
assertEquals($service->success, true, "textBlock read failed");
assertEquals($service->asset->textBlock->serialize(), $textBlock->serialize(), "textBlock contents changed");*/
}
function testIndexBlock() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'indexBlock' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'name' => 'block4',
'indexedFolderPath' => $rootLoc,
'expirationFolderPath' => $rootLoc,
'maxRenderedAssets' => 5,
'depthOfIndex' => 5,
'indexBlocks' => true,
'indexLinks' => true,
'indexFiles' => true,
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'Index Block' );
$id = array( 'type' => 'block',
'path' => $rootLoc.'/block4');
ReadAsset( $id, 'Index Block' );
/*$indexBlock = new indexBlock;
$asset = new asset;
$asset->indexBlock = $indexBlock;
$indexBlock->indexedFolderPath = $rootLoc;
$indexBlock->parentFolderPath = $rootLoc;
$indexBlock->name = "block4";
$indexBlock->metadataSetPath = "Default";
$indexBlock->expirationFolderPath = $rootLoc;
$indexBlock->maxRenderedAssets = "5";
$indexBlock->depthOfIndex = "5";
$indexBlock->indexBlocks = true;
$indexBlock->indexLinks = true;
$indexBlock->indexFiles = true;
$indexBlock->metadata = new metadata;
$indexBlock->metadata->author = $rootLoc;
$indexBlock->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$indexBlock->path = "$rootLoc/block4";
assertEquals($service->success, true, "indexBlock creation failed");
$id = new identifier;
$id->type = "block";
$id->path = $rootLoc . "/block4";
$service->read($auth, $id);
assertEquals($service->success, true, "indexBlock read failed");
assertEquals($service->asset->indexBlock->serialize(), $indexBlock->serialize(), "indexBlock content changed");*/
}
function testXHTMLBlock() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'xhtmlBlock' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'name' => 'block0',
'xhtml' => "asdf",
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'XHTML Block' );
$id = array( 'type' => 'block',
'path' => $rootLoc.'/block0');
ReadAsset( $id, 'XHTML Block' );
/*$xhtmlBlock = new xhtmlBlock;
$asset = new asset;
$asset->xhtmlBlock = $xhtmlBlock;
$xhtmlBlock->xhtml = "asdf";
$xhtmlBlock->parentFolderPath = $rootLoc;
$xhtmlBlock->name = "block0";
$xhtmlBlock->metadata = new metadata;
$xhtmlBlock->metadata->author = $rootLoc;
$xhtmlBlock->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$xhtmlBlock->path = "$rootLoc/block0";
assertEquals($service->success, true, "xhtmlBlock creation failed");
$id = new identifier;
$id->type = "block";
$id->path = $rootLoc . "/block0";
$service->read($auth, $id);
assertEquals($service->success, true, "xhtmlBlock read failed");
assertEquals($service->asset->xhtmlBlock->serialize(), $xhtmlBlock->serialize(), "xhtmlBlock contents changed");*/
}
function testXMLBlock() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'xmlBlock' => array (
'parentFolderPath' => $rootLoc,
'metadataSetPath' => "$rootLoc/set",
'name' => 'block1',
'xml' => "asdf",
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'XML Block' );
$id = array( 'type' => 'block',
'path' => $rootLoc.'/block1');
ReadAsset( $id, 'XML Block' );
/*$xmlBlock = new xmlBlock;
$asset = new asset;
$asset->xmlBlock = $xmlBlock;
$xmlBlock->xml = "asdf";
$xmlBlock->parentFolderPath = $rootLoc;
$xmlBlock->name = "block1";
$xmlBlock->metadata = new metadata;
$xmlBlock->metadata->author = $rootLoc;
$xmlBlock->metadataSetPath = "$rootLoc/set";
$service->create($auth, $asset);
$xmlBlock->path = "$rootLoc/block1";
assertEquals($service->success, true, "xmlBlock creation failed");
$id = new identifier;
$id->type = "block";
$id->path = $rootLoc . "/block1";
$service->read($auth, $id);
assertEquals($service->success, true, "xmlBlock read failed");
assertEquals($service->asset->xmlBlock->serialize(), $xmlBlock->serialize(), "xmlBlock contents changed");*/
}
function testFolders() {
global $rootLoc;
//global $auth;
//global $service;
$asset = array( 'folder' => array (
'parentFolderPath' => '/',
'metadataSetPath' => "$rootLoc/set",
'name' => $rootLoc,
'expirationFolderPath' => '/',
'shouldBePublished' => true,
'shouldBeIndexed' => true,
'metadata' => array(
'author' => $rootLoc)));
CreateAsset( $asset, 'Folder' );
$id = array( 'type' => 'folder',
'path' => $rootLoc);
ReadAsset( $id, 'Folder' );
/*$asset = new asset;
$folder = new folder;
$folder->shouldBePublished = true;
$folder->shouldBeIndexed = true;
$folder->parentFolderPath = "/";
$folder->expirationFolderPath = "/";
$folder->name = $rootLoc;
$folder->metadataSetPath = "$rootLoc/set";
$folder->metadata = new metadata;
$folder->metadata->author = $rootLoc;
$asset->folder = $folder;
$service->create($auth, $asset);
assertEquals($service->success, true, "folder creation failed");
$id = new identifier;
$id->type = "folder";
$id->path = $rootLoc;
$service->read($auth, $id);
assertEquals($service->success, true, "folder read failed");
assertEquals($service->asset->folder->shouldBePublished, true, "folder shouldBePublished not working");
assertEquals($service->asset->folder->shouldBeIndexed, true, "folder shouldBeIndexed not working");
assertEquals($service->asset->folder->expirationFolderPath, "/", "folder expirationFolderPath not working");
assertEquals($service->asset->folder->metadataSetPath, true, "folder metadataSetPath not working");
assertEquals($service->asset->folder->metadata->author, $rootLoc, "folder metadata not working");*/
}
function checkSetup() {
global $rootLoc;
//global $auth;
//global $service;
global $log;
$log .= "***CHECKING SETUP***
";
//$id = new identifier;
/*$id->type = "folder";
$id->path = $rootLoc;
$service->read($auth, $id);*/
$id = array( 'type' => 'folder',
'path' => $rootLoc);
if ( !CheckAsset( $id, 'Folder' ) )
die( $log );
$id['type'] = 'target';
if ( !CheckAsset( $id, 'Target' ) )
die( $log );
$id['type'] = 'metadatasetcontainer';
if ( !CheckAsset( $id, 'Metadata Set Container' ) )
die( $log );
$id['type'] = 'publishsetcontainer';
if ( !CheckAsset( $id, 'Publish Set Container' ) )
die( $log );
$id['type'] = 'assetfactorycontainer';
if ( !CheckAsset( $id, 'Asset Factory Container' ) )
die( $log );
$id['type'] = 'structureddatadefinitioncontainer';
if ( !CheckAsset( $id, 'Structured Data Definition Container' ) )
die( $log );
$id['type'] = 'workflowdefinitioncontainer';
if ( !CheckAsset( $id, 'Workflow Definition Container' ) )
die( $log );
$id['type'] = 'transport';
$id['path'] = 'Filesystem/'.$rootLoc;
if ( !CheckAsset( $id, 'Transport' ) )
die( $log );
$id['path'] = 'FTP and SFTP/'.$rootLoc;
if ( !CheckAsset( $id, 'Transport' ) )
die( $log );
$id['type'] = 'user';
$id['path'] = '';
$id['id'] = "$rootLoc user";
if ( !CheckAsset( $id, 'User' ) )
die( $log );
$id['type'] = 'group';
$id['id'] = "$rootLoc group";
if ( !CheckAsset( $id, 'Group' ) )
die( $log );
/*if (assertEquals($service->success, false, "root folder already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "target";
$service->read($auth, $id);
if (assertEquals($service->success, false, "target already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "metadatasetcontainer";
$service->read($auth, $id);
if (assertEquals($service->success, false, "metadataSetContainer already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "publishsetcontainer";
$service->read($auth, $id);
if (assertEquals($service->success, false, "publishSetContainer already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "assetfactorycontainer";
$service->read($auth, $id);
if (assertEquals($service->success, false, "publishSetContainer already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "structureddatadefinitioncontainer";
$service->read($auth, $id);
if (assertEquals($service->success, false, "structuredDataDefinitionContainer already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "workflowdefinitioncontainer";
$service->read($auth, $id);
if (assertEquals($service->success, false, "workflowDataDefinitionContainer already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}*/
/*$id->type = "transport";
$id->path = "Filesystem/".$rootLoc;
$service->read($auth, $id);
if (assertEquals($service->success, false, "FileSystemTransport already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "transport";
$id->path = "FTP and SFTP/".$rootLoc;
$service->read($auth, $id);
if (assertEquals($service->success, false, "FTPTransport already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "user";
$id->id = "$rootLoc user";
$id->path = null;
$service->read($auth, $id);
if (assertEquals($service->success, false, "FTPTransport already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}
$id->type = "group";
$id->id = "$rootLoc group";
$service->read($auth, $id);
if (assertEquals($service->success, false, "FTPTransport already exists, delete root folder \"temppmetqwertyytrewq\" and try again
") == "fail") {
die($log);
}*/
}
function cleanup() {
global $rootLoc;
/*global $auth;
global $service;
global $testCounter;
global $successCounter;*/
global $log;
$log .= "***PERFORMING CLEANUP***
";
$id = array( 'type' => 'folder',
'path' => $rootLoc);
if ( !DeleteAsset( $id, 'Folder' ) )
die( $log );
$id['type'] = 'target';
if ( !DeleteAsset( $id, 'Target' ) )
die( $log );
$id['type'] = 'metadatasetcontainer';
if ( !DeleteAsset( $id, 'Metadata Set Container' ) )
die( $log );
$id['type'] = 'publishsetcontainer';
if ( !DeleteAsset( $id, 'Publish Set Container' ) )
die( $log );
$id['type'] = 'assetfactorycontainer';
if ( !DeleteAsset( $id, 'Asset Factory Container' ) )
die( $log );
$id['type'] = 'structureddatadefinitioncontainer';
if ( !DeleteAsset( $id, 'Structured Data Definition Container' ) )
die( $log );
$id['type'] = 'workflowdefinitioncontainer';
if ( !DeleteAsset( $id, 'Workflow Definition Container' ) )
die( $log );
$id['type'] = 'pageconfigurationsetcontainer';
if ( !DeleteAsset( $id, 'Page Configuration Set Container' ) )
die( $log );
$id['type'] = 'transport';
$id['path'] = 'Filesystem/'.$rootLoc;
if ( !DeleteAsset( $id, 'Transport' ) )
die( $log );
$id['path'] = 'FTP and SFTP/'.$rootLoc;
if ( !DeleteAsset( $id, 'Transport' ) )
die( $log );
$id['type'] = 'user';
$id['path'] = '';
$id['id'] = "$rootLoc user";
if ( !DeleteAsset( $id, 'User' ) )
die( $log );
$id['type'] = 'group';
$id['id'] = "$rootLoc group";
if ( !DeleteAsset( $id, 'Group' ) )
die( $log );
/*$rootLoc = "temppmetqwertyytrewq";
$id = new identifier;
$id->type = "folder";
$id->path = $rootLoc;
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete root folder");
$id->type = "target";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete target");
$id->type = "structureddatadefinitioncontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete structuredDataDefinitionContainer");
$id->type = "workflowdefinitioncontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete workflowDefinitionContainer");
$id->type = "publishsetcontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete publishSetContainer");
$id->type = "pageconfigurationsetcontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete pageConfigurationSetContainer");
$id->type = "metadatasetcontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete metadataSetContainer");
$id->type = "assetfactorycontainer";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete assetFactoryContainer");
$id->type = "group";
$id->id = "$rootLoc group";
$id->path = null;
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete group");
$id->type = "user";
$id->id = "$rootLoc user";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete user");
$id->type = "transport";
$id->path = "Filesystem/".$rootLoc;
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete Filesystem transport");
$id->path = "FTP and SFTP/".$rootLoc;
$id->type = "transport";
$service->delete($auth, $id);
assertEquals($service->success, true, "failed to delete FTP transport");*/
}
/*function assertEquals($var1, $var2, $logMessage) {
global $successCounter;
global $testCounter;
global $log;
global $verbose;
$testCounter++;
if ($var1 == $var2) {
$successCounter++;
echo "$successCounter/$testCounter
";
} else {
echo "$successCounter/$testCounter
";
$log .= $logMessage . "
";
if ($verbose) {
global $service;
$log .= $service->message . "
";
}
flush();
return "fail";
}
flush();
}*/
?>