diff --git a/core/test.class.inc.php b/core/test.class.inc.php index c7c97686b..34455dde8 100644 --- a/core/test.class.inc.php +++ b/core/test.class.inc.php @@ -252,7 +252,15 @@ abstract class TestWebServices extends TestHandler $fp = @fopen($sUrl, 'rb', false, $ctx); if (!$fp) { - throw new Exception("Problem with $sUrl, $php_errormsg"); + global $php_errormsg; + if (isset($php_errormsg)) + { + throw new Exception("Problem with $sUrl, $php_errormsg"); + } + else + { + throw new Exception("Problem with $sUrl"); + } } $response = @stream_get_contents($fp); if ($response === false) diff --git a/pages/testlist.inc.php b/pages/testlist.inc.php index 1ce7b6b99..eec5181e4 100644 --- a/pages/testlist.inc.php +++ b/pages/testlist.inc.php @@ -1206,7 +1206,7 @@ class TestImportREST extends TestWebServices static public function GetDescription() { - return 'Bulk load in the background'; + return 'Test various options and fonctionality of import.php'; } protected function DoExecSingleLoad($aLoadSpec) @@ -1230,12 +1230,21 @@ class TestImportREST extends TestWebServices $sArguments = implode('
', $aGetParamReport); + if (strlen($sCsvData) > 5000) + { + $sCsvDataViewable = 'INPUT TOO LONG TO BE DISPLAYED ('.strlen($sCsvData).")\n".substr($sCsvData, 0, 500)."\n... TO BE CONTINUED"; + } + else + { + $sCsvDataViewable = $sCsvData; + } + echo "
\n"; - echo "
\n"; + echo "
\n"; echo " $sArguments\n"; echo "
\n"; - echo "
\n"; - echo "
$sCsvData
\n"; + echo "
\n"; + echo "
$sCsvDataViewable
\n"; echo "
\n"; echo "
\n"; @@ -1495,6 +1504,45 @@ class TestImportREST extends TestWebServices } } +/////////////////////////////////////////////////////////////////////////// +// Test massive data load +/////////////////////////////////////////////////////////////////////////// + +class TestImportRESTMassive extends TestImportREST +{ + static public function GetName() + { + return 'CSV import (REST) - HUGE data set (20000 PCs)'; + } + + static public function GetDescription() + { + return 'Stress import.php'; + } + + protected function DoExecute() + { + $aLoadSpec = array( + 'desc' => 'Missing class', + 'args' => array( + 'class' => 'PC', + 'output' => 'summary', + ), + 'csvdata' => "name;org_id;brand\n", + ); + $iMaxPC = 20000; + for($i = 0 ; $i <= $iMaxPC ; $i++) + { + $aLoadSpec['csvdata'] .= "pc.import.$i;2;Combodo\n"; + } + $this->DoExecSingleLoad($aLoadSpec); + } +} + + +/////////////////////////////////////////////////////////////////////////// +// Test SOAP services +/////////////////////////////////////////////////////////////////////////// $aWebServices = array( array(