コード例 #1
0
ファイル: AnyemClientTest.php プロジェクト: Halayem/ANYEM
 public function testGetPut()
 {
     $expected = $iteration = 2000;
     $clientConnection = ClientConnectionImpl::newClient();
     $identifier = new ResourceIdentifierImpl("anyem.com", "anyemNameSpace", "a");
     $anyemClient = new AnyemClientImpl($clientConnection, $identifier);
     $a = 0;
     for ($i = 0; $i < $iteration; $i++) {
         try {
             $responseWrapper = $anyemClient->get($a, 10, 300000);
         } catch (Exception $e) {
             print $e->getMessage() . "\n";
             continue;
         }
         $a = $responseWrapper->getResource()->getData();
         $anyemClient->put(++$a);
     }
     $this->assertEquals($expected, $a);
 }
コード例 #2
0
 public function run()
 {
     self::init();
     require_once __DIR__ . '/../anyem.client.impl/AnyemClientImpl.php';
     $anyemClient = new AnyemClientImpl(self::$_clientConnection, self::$_identifier);
     $a = 0;
     for ($i = 0; $i < TOTAL_ITERATION; $i++) {
         try {
             $responseWrapper = $anyemClient->get($a, MAX_ATTEMPT, DELAY_ATTEMPT);
         } catch (Exception $e) {
             print $e->getMessage() . "\n";
             continue;
         }
         $a = $responseWrapper->getResource()->getData();
         $anyemClient->put(++$a);
     }
 }