text:
<?php

/*
 * GENERATED CODE WARNING
 * This file was automatically generated - do not edit!
 */

namespace Google\Cloud\BigQuery\Reservation\Tests\Unit\V1;

use Google\ApiCore\ApiException;

use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\Testing\GeneratedTest;
use Google\ApiCore\Testing\MockTransport;

use Google\Cloud\BigQuery\Reservation\V1\Assignment;
use Google\Cloud\BigQuery\Reservation\V1\BiReservation;
use Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment;
use Google\Cloud\BigQuery\Reservation\V1\ListAssignmentsResponse;
use Google\Cloud\BigQuery\Reservation\V1\ListCapacityCommitmentsResponse;
use Google\Cloud\BigQuery\Reservation\V1\ListReservationsResponse;
use Google\Cloud\BigQuery\Reservation\V1\Reservation;
use Google\Cloud\BigQuery\Reservation\V1\ReservationServiceClient;
use Google\Cloud\BigQuery\Reservation\V1\SearchAllAssignmentsResponse;
use Google\Cloud\BigQuery\Reservation\V1\SearchAssignmentsResponse;
use Google\Cloud\BigQuery\Reservation\V1\SplitCapacityCommitmentResponse;
use Google\Protobuf\GPBEmpty;
use Google\Rpc\Code;
use stdClass;

/**
 * @group bigqueryreservation
 *
 * @group gapic
 */
class ReservationServiceClientTest extends GeneratedTest
{
    /**
     * @return TransportInterface
     */
    private function createTransport($deserialize = null)
    {
        return new MockTransport($deserialize);
    }

    /**
     * @return CredentialsWrapper
     */
    private function createCredentials()
    {
        return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
    }

    /**
     * @return ReservationServiceClient
     */
    private function createClient(array $options = [])
    {
        $options += [
            'credentials' => $this->createCredentials(),
        ];
        return new ReservationServiceClient($options);
    }

    /**
     * @test
     */
    public function createAssignmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $assignee = 'assignee-369881649';
        $expectedResponse = new Assignment();
        $expectedResponse->setName($name);
        $expectedResponse->setAssignee($assignee);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        $response = $gapicClient->createAssignment($formattedParent);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/CreateAssignment', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function createAssignmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        try {
            $gapicClient->createAssignment($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function createCapacityCommitmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $slotCount = 191518834;
        $multiRegionAuxiliary = false;
        $expectedResponse = new CapacityCommitment();
        $expectedResponse->setName($name);
        $expectedResponse->setSlotCount($slotCount);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->createCapacityCommitment($formattedParent);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/CreateCapacityCommitment', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function createCapacityCommitmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->createCapacityCommitment($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function createReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $slotCapacity = 1516717605;
        $ignoreIdleSlots = false;
        $concurrency = 1476186003;
        $multiRegionAuxiliary = false;
        $expectedResponse = new Reservation();
        $expectedResponse->setName($name);
        $expectedResponse->setSlotCapacity($slotCapacity);
        $expectedResponse->setIgnoreIdleSlots($ignoreIdleSlots);
        $expectedResponse->setConcurrency($concurrency);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->createReservation($formattedParent);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/CreateReservation', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function createReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->createReservation($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteAssignmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $expectedResponse = new GPBEmpty();
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->assignmentName('[PROJECT]', '[LOCATION]', '[RESERVATION]', '[ASSIGNMENT]');
        $gapicClient->deleteAssignment($formattedName);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/DeleteAssignment', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteAssignmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->assignmentName('[PROJECT]', '[LOCATION]', '[RESERVATION]', '[ASSIGNMENT]');
        try {
            $gapicClient->deleteAssignment($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteCapacityCommitmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $expectedResponse = new GPBEmpty();
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        $gapicClient->deleteCapacityCommitment($formattedName);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/DeleteCapacityCommitment', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteCapacityCommitmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        try {
            $gapicClient->deleteCapacityCommitment($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $expectedResponse = new GPBEmpty();
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        $gapicClient->deleteReservation($formattedName);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/DeleteReservation', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        try {
            $gapicClient->deleteReservation($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getBiReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name2 = 'name2-1052831874';
        $size = 3530753;
        $expectedResponse = new BiReservation();
        $expectedResponse->setName($name2);
        $expectedResponse->setSize($size);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->biReservationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->getBiReservation($formattedName);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/GetBiReservation', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getBiReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->biReservationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->getBiReservation($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getCapacityCommitmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name2 = 'name2-1052831874';
        $slotCount = 191518834;
        $multiRegionAuxiliary = false;
        $expectedResponse = new CapacityCommitment();
        $expectedResponse->setName($name2);
        $expectedResponse->setSlotCount($slotCount);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        $response = $gapicClient->getCapacityCommitment($formattedName);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/GetCapacityCommitment', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getCapacityCommitmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        try {
            $gapicClient->getCapacityCommitment($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name2 = 'name2-1052831874';
        $slotCapacity = 1516717605;
        $ignoreIdleSlots = false;
        $concurrency = 1476186003;
        $multiRegionAuxiliary = false;
        $expectedResponse = new Reservation();
        $expectedResponse->setName($name2);
        $expectedResponse->setSlotCapacity($slotCapacity);
        $expectedResponse->setIgnoreIdleSlots($ignoreIdleSlots);
        $expectedResponse->setConcurrency($concurrency);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        $response = $gapicClient->getReservation($formattedName);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/GetReservation', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        try {
            $gapicClient->getReservation($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listAssignmentsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $assignmentsElement = new Assignment();
        $assignments = [
            $assignmentsElement,
        ];
        $expectedResponse = new ListAssignmentsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setAssignments($assignments);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        $response = $gapicClient->listAssignments($formattedParent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getAssignments()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/ListAssignments', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listAssignmentsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->reservationName('[PROJECT]', '[LOCATION]', '[RESERVATION]');
        try {
            $gapicClient->listAssignments($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listCapacityCommitmentsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $capacityCommitmentsElement = new CapacityCommitment();
        $capacityCommitments = [
            $capacityCommitmentsElement,
        ];
        $expectedResponse = new ListCapacityCommitmentsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setCapacityCommitments($capacityCommitments);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->listCapacityCommitments($formattedParent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getCapacityCommitments()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/ListCapacityCommitments', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listCapacityCommitmentsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->listCapacityCommitments($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listReservationsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $reservationsElement = new Reservation();
        $reservations = [
            $reservationsElement,
        ];
        $expectedResponse = new ListReservationsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setReservations($reservations);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->listReservations($formattedParent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getReservations()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/ListReservations', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listReservationsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->listReservations($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function mergeCapacityCommitmentsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $slotCount = 191518834;
        $multiRegionAuxiliary = false;
        $expectedResponse = new CapacityCommitment();
        $expectedResponse->setName($name);
        $expectedResponse->setSlotCount($slotCount);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        $response = $gapicClient->mergeCapacityCommitments();
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/MergeCapacityCommitments', $actualFuncCall);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function mergeCapacityCommitmentsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        try {
            $gapicClient->mergeCapacityCommitments();
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function moveAssignmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name2 = 'name2-1052831874';
        $assignee = 'assignee-369881649';
        $expectedResponse = new Assignment();
        $expectedResponse->setName($name2);
        $expectedResponse->setAssignee($assignee);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->assignmentName('[PROJECT]', '[LOCATION]', '[RESERVATION]', '[ASSIGNMENT]');
        $response = $gapicClient->moveAssignment($formattedName);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/MoveAssignment', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function moveAssignmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->assignmentName('[PROJECT]', '[LOCATION]', '[RESERVATION]', '[ASSIGNMENT]');
        try {
            $gapicClient->moveAssignment($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function searchAllAssignmentsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $assignmentsElement = new Assignment();
        $assignments = [
            $assignmentsElement,
        ];
        $expectedResponse = new SearchAllAssignmentsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setAssignments($assignments);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->searchAllAssignments($formattedParent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getAssignments()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/SearchAllAssignments', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function searchAllAssignmentsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->searchAllAssignments($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function searchAssignmentsTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $assignmentsElement = new Assignment();
        $assignments = [
            $assignmentsElement,
        ];
        $expectedResponse = new SearchAssignmentsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setAssignments($assignments);
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        $response = $gapicClient->searchAssignments($formattedParent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getAssignments()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/SearchAssignments', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($formattedParent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function searchAssignmentsExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
        try {
            $gapicClient->searchAssignments($formattedParent);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function splitCapacityCommitmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $expectedResponse = new SplitCapacityCommitmentResponse();
        $transport->addResponse($expectedResponse);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        $response = $gapicClient->splitCapacityCommitment($formattedName);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/SplitCapacityCommitment', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($formattedName, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function splitCapacityCommitmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $formattedName = $gapicClient->capacityCommitmentName('[PROJECT]', '[LOCATION]', '[CAPACITY_COMMITMENT]');
        try {
            $gapicClient->splitCapacityCommitment($formattedName);
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateAssignmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $assignee = 'assignee-369881649';
        $expectedResponse = new Assignment();
        $expectedResponse->setName($name);
        $expectedResponse->setAssignee($assignee);
        $transport->addResponse($expectedResponse);
        $response = $gapicClient->updateAssignment();
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/UpdateAssignment', $actualFuncCall);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateAssignmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        try {
            $gapicClient->updateAssignment();
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateBiReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $size = 3530753;
        $expectedResponse = new BiReservation();
        $expectedResponse->setName($name);
        $expectedResponse->setSize($size);
        $transport->addResponse($expectedResponse);
        $response = $gapicClient->updateBiReservation();
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/UpdateBiReservation', $actualFuncCall);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateBiReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        try {
            $gapicClient->updateBiReservation();
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateCapacityCommitmentTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $slotCount = 191518834;
        $multiRegionAuxiliary = false;
        $expectedResponse = new CapacityCommitment();
        $expectedResponse->setName($name);
        $expectedResponse->setSlotCount($slotCount);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        $response = $gapicClient->updateCapacityCommitment();
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/UpdateCapacityCommitment', $actualFuncCall);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateCapacityCommitmentExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        try {
            $gapicClient->updateCapacityCommitment();
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateReservationTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name = 'name3373707';
        $slotCapacity = 1516717605;
        $ignoreIdleSlots = false;
        $concurrency = 1476186003;
        $multiRegionAuxiliary = false;
        $expectedResponse = new Reservation();
        $expectedResponse->setName($name);
        $expectedResponse->setSlotCapacity($slotCapacity);
        $expectedResponse->setIgnoreIdleSlots($ignoreIdleSlots);
        $expectedResponse->setConcurrency($concurrency);
        $expectedResponse->setMultiRegionAuxiliary($multiRegionAuxiliary);
        $transport->addResponse($expectedResponse);
        $response = $gapicClient->updateReservation();
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.bigquery.reservation.v1.ReservationService/UpdateReservation', $actualFuncCall);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function updateReservationExceptionTest()
    {
        $transport = $this->createTransport();
        $gapicClient = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        try {
            $gapicClient->updateReservation();
            // If the $gapicClient method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }
}


text:
title: PowerApps
inshort: Šifra bez mobilnih aplikacija (& obrasce)
translator: Microsoft Cognitive Services
---

Pretvoriti tvoje znanje poslovnih rešenja sa lakoćom. Daj ljudima šta treba da vozi rezultate.

-Povezivanje sa svoje sisteme i kreirate nove podatke

-Izgradnju apps bez pisanja koda

-Objaviti i koristiti na web i mobilne

## Biste brzo započeli
Nadjite inspiraciju sa prethodno izgrađenih predloške ili početi iz početka. Već imate sve što je potrebno da bi počeli sa pravljenjem aplikacija koje misle ozbiljno.

Učini više sa podacima
Povezivanje sa uslugama, već koristite kao Excel, SharePoint, Dynamics 365 i više da automatski generišete apps ili koristite uobičajene usluga podataka za hvatanje nove podatke.

## Pretvoriti tvoje znanje apps
Razumem poslovni problem? Sada možete da napravite rešenje. Radim u vizualni dizajner za prilagođavanje u potpunosti funkcionalne aplikacije — bez potrebe za pisanjem koda.

## Usluge na napredne podataka izgradili pravo u
Uobičajenih podataka usluga je sigurnu poslovnu platformu podataka ugrađen u PowerApps. To dolazi sa stotinama standardni poslovni entiteti već definisana, što znači da to sada svih vaših aplikacija mogu da dele istu definiciju "kupac", "proizvod", "vodi" i slično. Servis obuhvata i toka posla za automatizaciju Microsoft Flow.

## Usluge na napredne podataka izgradili pravo u
Uobičajenih podataka usluga je sigurnu poslovnu platformu podataka ugrađen u PowerApps. To dolazi sa stotinama standardni poslovni entiteti već definisana, što znači da to sada svih vaših aplikacija mogu da dele istu definiciju "kupac", "proizvod", "vodi" i slično. Servis obuhvata i toka posla za automatizaciju Microsoft Flow.

redpajama_set_name: RedPajamaGithub


text:
<title>Docs For Class PHPExcel_Writer_Excel2007</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">

    PHPExcel_Writer_Excel2007

                              		  [ class tree: PHPExcel_Writer_Excel2007 ]
		  [ index: PHPExcel_Writer_Excel2007 ]
		  	    [ all elements ]

Todo List

      Packages:

              PHPExcel

              com-tecnick-tcpdf

              JAMA

              Math_Stats

              PHPExcel_CachedObjectStorage

              PHPExcel_Calculation

              PHPExcel_Cell

              PHPExcel_Reader

              PHPExcel_Reader_Excel5

              PHPExcel_Reader_Excel2007

              PHPExcel_RichText

              PHPExcel_Settings

              PHPExcel_Shared

              PHPExcel_Shared_Best_Fit

              PHPExcel_Shared_Escher

              PHPExcel_Shared_OLE

              PHPExcel_Shared_ZipArchive

              PHPExcel_Style

              PHPExcel_Worksheet

              PHPExcel_Worksheet_Drawing

              PHPExcel_Writer

              PHPExcel_Writer_Excel5

              PHPExcel_Writer_Excel2007

                        Files:

					Comments.php

					ContentTypes.php

					DocProps.php

					Drawing.php

					Excel2007.php

					Rels.php

					StringTable.php

					Style.php

					Theme.php

					Workbook.php

					Worksheet.php

					WriterPart.php

            Classes:

		    		PHPExcel_Writer_Excel2007

	    		PHPExcel_Writer_Excel2007_Comments

	    		PHPExcel_Writer_Excel2007_ContentTypes

	    		PHPExcel_Writer_Excel2007_DocProps

	    		PHPExcel_Writer_Excel2007_Drawing

	    		PHPExcel_Writer_Excel2007_Rels

	    		PHPExcel_Writer_Excel2007_StringTable

	    		PHPExcel_Writer_Excel2007_Style

	    		PHPExcel_Writer_Excel2007_Theme

	    		PHPExcel_Writer_Excel2007_Workbook

	    		PHPExcel_Writer_Excel2007_Worksheet

	    		PHPExcel_Writer_Excel2007_WriterPart

Class: PHPExcel_Writer_Excel2007

Source Location: /PHPExcel/Writer/Excel2007.php

Class Overview

PHPExcel_Writer_Excel2007

Author(s):

Copyright:

Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)

            Implements interfaces:

PHPExcel_Writer_IWriter

Methods

__construct

getBordersHashTable

getDiskCachingDirectory

getDrawingHashTable

getFillHashTable

getFontHashTable

getNumFmtHashTable

getOffice2003Compatibility

getPHPExcel

getPreCalculateFormulas

getStringTable

getStylesConditionalHashTable

getUseDiskCaching

getWriterPart

save

setOffice2003Compatibility

setPHPExcel

setPreCalculateFormulas

setUseDiskCaching

Class Details

[line 36]

PHPExcel_Writer_Excel2007

Tags:

    copyright:  	Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)

[ Top ]

Class Methods

constructor __construct [line 134]

		PHPExcel_Writer_Excel2007 __construct(
[
$pPHPExcel = null])

		Create a new PHPExcel_Writer_Excel2007

Tags:

    access:  	public

Parameters:

        PHPExcel
        $pPHPExcel

[ Top ]

method getBordersHashTable [line 428]

		PHPExcel_HashTable getBordersHashTable(
)

		Get PHPExcel_Style_Borders HashTable

Tags:

    access:  	public

[ Top ]

method getDiskCachingDirectory [line 523]

		string getDiskCachingDirectory(
)

		Get disk caching directory

Tags:

    access:  	public

[ Top ]

method getDrawingHashTable [line 446]

		PHPExcel_HashTable getDrawingHashTable(
)

		Get PHPExcel_Worksheet_BaseDrawing HashTable

Tags:

    access:  	public

[ Top ]

method getFillHashTable [line 410]

		PHPExcel_HashTable getFillHashTable(
)

		Get PHPExcel_Style_Fill HashTable

Tags:

    access:  	public

[ Top ]

method getFontHashTable [line 419]

		PHPExcel_HashTable getFontHashTable(
)

		Get PHPExcel_Style_Font HashTable

Tags:

    access:  	public

[ Top ]

method getNumFmtHashTable [line 437]

		PHPExcel_HashTable getNumFmtHashTable(
)

		Get PHPExcel_Style_NumberFormat HashTable

Tags:

    access:  	public

[ Top ]

method getOffice2003Compatibility [line 473]

		boolean getOffice2003Compatibility(
)

		Get Office2003 compatibility

Tags:

    access:  	public

[ Top ]

method getPHPExcel [line 367]

		PHPExcel getPHPExcel(
)

		Get PHPExcel object

Tags:

    throws:  	Exception

    access:  	public

[ Top ]

method getPreCalculateFormulas [line 455]

		boolean getPreCalculateFormulas(
)

		Get Pre-Calculate Formulas

Tags:

    access:  	public

[ Top ]

method getStringTable [line 392]

		string[] getStringTable(
)

		Get string table

Tags:

    access:  	public

[ Top ]

method getStylesConditionalHashTable [line 401]

		PHPExcel_HashTable getStylesConditionalHashTable(
)

		Get PHPExcel_Style_Conditional HashTable

Tags:

    access:  	public

[ Top ]

method getUseDiskCaching [line 493]

		boolean getUseDiskCaching(
)

		Get use disk caching where possible?

Tags:

    access:  	public

[ Top ]

method getWriterPart [line 173]

		PHPExcel_Writer_Excel2007_WriterPart getWriterPart(
[string
$pPartName = ''])

		Get writer part

Tags:

    access:  	public

Parameters:

        string
        $pPartName
        Writer part name

[ Top ]

method save [line 187]

		void save(
[
$pFilename = null], string
$pFileName)

		Save PHPExcel to file

Tags:

    throws:  	Exception

    access:  	public

Parameters:

        string
        $pFileName

        $pFilename

[ Top ]

method setOffice2003Compatibility [line 483]

		PHPExcel_Writer_Excel2007 setOffice2003Compatibility(
[boolean
$pValue = false])

		Set Pre-Calculate Formulas

Tags:

    access:  	public

Parameters:

        boolean
        $pValue
        Office2003 compatibility?

[ Top ]

method setPHPExcel [line 382]

		PHPExcel_Writer_Excel2007 setPHPExcel(
[
$pPHPExcel = null])

		Set PHPExcel object

Tags:

    throws:  	Exception

    access:  	public

Parameters:

        PHPExcel
        $pPHPExcel
        PHPExcel object

[ Top ]

method setPreCalculateFormulas [line 464]

		void setPreCalculateFormulas(
[boolean
$pValue = true])

		Set Pre-Calculate Formulas

Tags:

    access:  	public

Parameters:

        boolean
        $pValue
        Pre-Calculate Formulas?

[ Top ]

method setUseDiskCaching [line 505]

		PHPExcel_Writer_Excel2007 setUseDiskCaching(
[boolean
$pValue = false], [string
$pDirectory = null])

		Set use disk caching where possible?

Tags:

    throws:  	Exception    Exception when directory does not exist

    access:  	public

Parameters:

        boolean
        $pValue

        string
        $pDirectory
        Disk caching directory

[ Top ]

		    Documentation generated on Sun, 27 Feb 2011 16:31:29 -0800 by phpDocumentor 1.4.3


text:
{{define "content"}}

站点全局信息设置

	首页顶部Tab子Tab管理

	<form method="POST" action="/admin/setting/index_tab/children" class="stdform_q">
		<input type="hidden" id="id" name="id" value="{{.setting.Id}}" />
		<input type="hidden" id="tab" name="tab" value="{{.tab}}" />

首页 {{.name}} TAB 子 TAB 管理

				子 TAB 管理

							<button class="index-nav-add">增加</button>

					{{range .setting.IndexNavs}}
						{{if eq .Tab $.tab}}
							{{range .Children}}

								Uri:<input type="text" name="index_uri" value="{{.Uri}}">
								名称:<input type="text" name="index_name" value="{{.Name}}">

<button class="index-nav-minus">删除</button>

							{{end}}
						{{end}}
					{{end}}

操作

				<input type="submit" class="submit radius2" value="提交" />

	</form>

{{end}}

{{define "css"}}
<link href="/static/css/libs/jquery.cftoaster.1.0.1.css" media="screen" rel="stylesheet" type="text/css">
<link href="/static/css/Huploadify.css" media="screen" rel="stylesheet" type="text/css">
{{end}}

{{define "js"}}

{{end}}


text:
#define VER_MAJOR 5
#define VER_MINOR 5
extern char datestamp[];

/*
 * Return major version number...
 */
int
mswin_majorver()
{
    return(VER_MAJOR);
}

/*
 * Return minor version number...
 */
int
mswin_minorver()
{
    return(VER_MINOR);
}

/*
 * Return compilation number...
 */
char *
mswin_compilation_date()
{
    return(datestamp);
}

/*
 * Return special remarks...
 */
char *
mswin_compilation_remarks()
{
    return("");
}

/*
 * Return specific windows version...
 */
char *
mswin_specific_winver()
{
    return("");
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**configuration_value_string** | **str** |  | [optional]
**value_object** | **bool, date, datetime, dict, float, int, list, str** |  | [optional]
**type_tag** | **str** |  | [optional]
**bt_type** | **str** |  | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH.'/libraries/REST_Controller.php';
class Calendar extends REST_Controller {
	function Calendar() {
		parent::__construct();
		$this->load->model('usecase/calendar_uc','cus',TRUE);
	}

	public function index_get()
	{
		$this->load->view('common/header');
		$this->load->view('common/sidemenu');
		$this->load->view('pages/calendar');
		//$this->load->view('pages/tab');
		$this->load->view('common/footer');
	}
	public function second_get()
	{
		$this->load->view('common/header');
		$this->load->view('common/sidemenu');
		$this->load->view('pages/tab');
		$this->load->view('common/footer');
	}
	public function third_get()
	{
		$this->load->view('common/header');
		$this->load->view('common/sidemenu');
		$this->load->view('pages/photo');
		$this->load->view('common/footer');
	}
	public function appointment_post()
	{
		$response = $this->cus->appointment();
		print $response;
	}
}
?>


text:
var expect = require('chai').expect
    , assert = require('chai').assert
    , sinon = require('sinon')
    , RefService = require('../../../server/service/RefService')
    , RefController = require('../../../server/controllers/RefController');

describe('Reference Data Controller', function() {

    var req = { }
        , res = {}
        , sandbox = sinon.sandbox.create();

    describe('getQcers', function() {

	    beforeEach(function() {
	    });

	    afterEach(function() {
	        sandbox.restore();
	    });

    	it('Returns a 200 with Qcer results from Reference Service', function(done) {

    		var qcers = [{"qcer_id": 1, "qcer_name": "Q1"}, {"qcer_id": 2, "qcer_name": "Q2"}];
    		var serviceStub = sandbox.stub(RefService, "getQcers", function(callback) {
                callback(null, qcers, null);
            });

            res.json = function(httpStatus, result) {
                expect(httpStatus).to.equal(200);
                expect(result).to.equal(qcers);

                assert.isTrue(serviceStub.calledOnce);
                done();
            };

            RefController.getQcers(req, res);
    	});

    	it('Returns a 500 with message if Reference Service calls back with error', function(done) {

    		var error = new Error("something went wrong");
    		var refMessage = "Unable to retrieve qcers";
    		var serviceStub = sandbox.stub(RefService, "getQcers", function(callback) {
                callback(error, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(500);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.calledOnce);
                done();
            };

            RefController.getQcers(req, res);
    	});

    	it('Returns a 404 with message if Reference Service calls back with no results', function(done) {

    		var refMessage = "No qcers found";
    		var serviceStub = sandbox.stub(RefService, "getQcers", function(callback) {
                callback(null, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(404);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.calledOnce);
                done();
            };

            RefController.getQcers(req, res);
    	});

    });

	describe('getScopesMatching', function() {

		beforeEach(function() {
	    });

	    afterEach(function() {
	        sandbox.restore();
	    });

	    it('Returns a 200 with Scope results from Reference Service', function(done) {

	    	var partial = 'To';
    		req.params = {partial: partial};

	    	var scopes = [{"name":"Lesson"},{"name":"Lezione"}];
    		var serviceStub = sandbox.stub(RefService, "getScopesMatching", function(partial, callback) {
                callback(null, scopes, null);
            });

            res.json = function(httpStatus, result) {
                expect(httpStatus).to.equal(200);
                expect(result).to.equal(scopes);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getScopesMatching(req, res);
	    });

	    it('Returns a 500 with message if Reference Service calls back with error', function(done) {

	    	var partial = 'To';
    		req.params = {partial: partial};

    		var error = new Error("something went wrong");
    		var refMessage = "Unable to retrieve scopes";
    		var serviceStub = sandbox.stub(RefService, "getScopesMatching", function(partial, callback) {
                callback(error, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(500);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getScopesMatching(req, res);
    	});
	});

	describe('getSubjectsMatching', function() {

		beforeEach(function() {
	    });

	    afterEach(function() {
	        sandbox.restore();
	    });

	    it('Returns a 200 with Subject results from Reference Service', function(done) {

	    	var partial = 'To';
    		req.params = {partial: partial};

	    	var subjects = [{"name":"Topic 1"},{"name":"Topic 2"}];
    		var serviceStub = sandbox.stub(RefService, "getSubjectsMatching", function(partial, callback) {
                callback(null, subjects, null);
            });

            res.json = function(httpStatus, result) {
                expect(httpStatus).to.equal(200);
                expect(result).to.equal(subjects);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getSubjectsMatching(req, res);
	    });

	    it('Returns a 500 with message if Reference Service calls back with error', function(done) {

	    	var partial = 'To';
    		req.params = {partial: partial};

    		var error = new Error("something went wrong");
    		var refMessage = "Unable to retrieve subjects";
    		var serviceStub = sandbox.stub(RefService, "getSubjectsMatching", function(partial, callback) {
                callback(error, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(500);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getSubjectsMatching(req, res);
    	});
	});

	describe('getObjectivessMatching', function() {

		beforeEach(function() {
	    });

	    afterEach(function() {
	        sandbox.restore();
	    });

	    it('Returns a 200 with Objective results from Reference Service', function(done) {

	    	var partial = 'Obj';
    		req.params = {partial: partial};

	    	var objectives = [{"descr": "Objective 1"},{"descr": "Objective 2"}];
    		var serviceStub = sandbox.stub(RefService, "getObjectivesMatching", function(partial, callback) {
                callback(null, objectives, null);
            });

            res.json = function(httpStatus, result) {
                expect(httpStatus).to.equal(200);
                expect(result).to.equal(objectives);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getObjectivesMatching(req, res);
	    });

	    it('Returns a 500 with message if Reference Service calls back with error', function(done) {

	    	var partial = 'Obj';
    		req.params = {partial: partial};

    		var error = new Error("something went wrong");
    		var refMessage = "Unable to retrieve objectives";
    		var serviceStub = sandbox.stub(RefService, "getObjectivesMatching", function(partial, callback) {
                callback(error, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(500);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getObjectivesMatching(req, res);
    	});

	});

	describe('getTechnologiesMatching', function() {

		beforeEach(function() {
	    });

	    afterEach(function() {
	        sandbox.restore();
	    });

	    it('Returns a 200 with Technology results from Reference Service', function(done) {

	    	var partial = 'et';
    		req.params = {partial: partial};

	    	var technologies = [{"name":"Internet"},{"name":"Tablet"}];
    		var serviceStub = sandbox.stub(RefService, "getTechnologiesMatching", function(partial, callback) {
                callback(null, technologies, null);
            });

            res.json = function(httpStatus, result) {
                expect(httpStatus).to.equal(200);
                expect(result).to.equal(technologies);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getTechnologiesMatching(req, res);
	    });

	    it('Returns a 500 with message if Reference Service calls back with error', function(done) {

	    	var partial = 'et';
    		req.params = {partial: partial};

    		var error = new Error("something went wrong");
    		var refMessage = "Unable to retrieve scopes";
    		var serviceStub = sandbox.stub(RefService, "getTechnologiesMatching", function(partial, callback) {
                callback(error, null, refMessage);
            });

            res.send = function(httpStatus, message) {
                expect(httpStatus).to.equal(500);
                expect(message).to.equal(refMessage);

                assert.isTrue(serviceStub.withArgs(partial).calledOnce);
                done();
            };

            RefController.getTechnologiesMatching(req, res);
    	});
	});

});


text:
package org.twak.viewTrace;

import javax.vecmath.Point2d;

import org.twak.utils.Line;

class SupportPoint {

	Point2d pt;
	Line line;
	double support;

	public SupportPoint(Line l, Point2d pt) {
		this.line = l;
		this.pt = pt;
	}
}


text:
package org.python.indexer.ast;

import org.python.indexer.Scope;
import org.python.indexer.types.NDictType;
import org.python.indexer.types.NType;
import org.python.indexer.types.NUnionType;
import org.python.indexer.types.NUnknownType;

import java.util.List;

public class NDict extends NNode {

    static final long serialVersionUID = 318144953740238374L;

    public List<NNode> keys;
    public List<NNode> values;

    public NDict(List<NNode> keys, List<NNode> values) {
        this(keys, values, 0, 1);
    }

    public NDict(List<NNode> keys, List<NNode> values, int start, int end) {
        super(start, end);
        this.keys = keys;
        this.values = values;
        addChildren(keys);
        addChildren(values);
    }

    @Override
    public NType resolve(Scope s) throws Exception {
        NType keyType = resolveListAsUnion(keys, s);
        NType valType = resolveListAsUnion(values, s);
        return setType(new NDictType(keyType, valType));
    }

    @Override
    public String toString() {
        return "<Dict>";
    }

    @Override
    public void visit(NNodeVisitor v) {
        if (v.visit(this)) {
            // XXX:  should visit in alternating order
            visitNodeList(keys, v);
            visitNodeList(values, v);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@drawable/background"
        android:tileMode="repeat">
    <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/LogoTextView"

            android:src="@drawable/logo"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="48dp"/>
    <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:ems="10"
            android:id="@+id/LoginNameText"

            android:textColor="@color/white"
            android:layout_below="@+id/LogoTextView"
            android:layout_alignParentLeft="true"
            android:layout_marginTop="48dp"/>
    <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:ems="10"
            android:id="@+id/LoginPasswordText"

            android:textColor="@color/white"
            android:layout_below="@id/LoginNameText"/>
    <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/login"
            android:id="@+id/LoginButton"

            android:layout_below="@id/LoginPasswordText"
            android:textColor="@android:color/holo_red_light"/>
    <!--TODO: сделать согласно шаблону-->
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/question"
            android:id="@+id/QuestionTextView"

            android:layout_below="@+id/LoginButton"
            android:layout_alignParentLeft="true"/>
    <!--TODO: добавить ссылку-->
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/sign_up"
            android:id="@+id/SignUpTextView"

            android:layout_below="@+id/LoginButton"
            android:layout_alignParentRight="true"/>
    <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/anonymous_button"
            android:id="@+id/anonymousButton"

            android:textColor="@android:color/holo_red_light"
            android:layout_alignParentBottom="true"/>
    <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Google"
            android:id="@+id/signGoogle"
            android:layout_below="@+id/QuestionTextView" android:layout_alignParentLeft="true"/>

    <!--FIXME: Убрать нахуй-->
</RelativeLayout>


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('basicviz', '0072_auto_20180831_1202'),
    ]

    operations = [
        migrations.AlterField(
            model_name='experiment',
            name='csv_mz_column',
            field=models.CharField(blank=True, max_length=128, null=True),
        ),
        migrations.AlterField(
            model_name='experiment',
            name='csv_rt_column',
            field=models.CharField(blank=True, max_length=128, null=True),
        ),
    ]


text:
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import { translate } from 'react-i18next'
import { withRouter } from 'react-router'

import './index.css'

class Menu extends Component {

	componentDidMount() {
		const { users, history } = this.props
		if (!users.accounts) {
			history.push('/login')
		}
	}

	render () {
		const { currentAccount } = this.props
		return

				<Link to="/main/home">
					reorder
				</Link>
				<Link to="/main/public">
					people
				</Link>
				<Link to="/main/federated">
					public
				</Link>
				<Link to="/login">
					add_box
				</Link>

	}
}

const mapStateToProps = (state) => {
	return {
		currentAccount: state.users.accounts[state.users.selected],
		users: state.users
	}
}

const translated = translate()(Menu)
const connected = connect(mapStateToProps)(translated)
const routed = withRouter(connected)

export default routed


text:
.. -*- coding: utf-8; mode: rst -*-

.. _VIDIOC_G_OUTPUT:

**************************************
ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT
**************************************

Name
====

VIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output

Synopsis
========

.. c:function:: int ioctl( int fd, VIDIOC_G_OUTPUT, int *argp )
    :name: VIDIOC_G_OUTPUT

.. c:function:: int ioctl( int fd, VIDIOC_S_OUTPUT, int *argp )
    :name: VIDIOC_S_OUTPUT

Arguments
=========

``fd``
    File descriptor returned by :ref:`open() <func-open>`.

``argp``
    Pointer to an integer with output index.

Description
===========

To query the current video output applications call the
:ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a pointer to an integer where the driver
stores the number of the output, as in the struct
:c:type:`v4l2_output` ``index`` field. This ioctl will
fail only when there are no video outputs, returning the ``EINVAL`` error
code.

To select a video output applications store the number of the desired
output in an integer and call the :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a
pointer to this integer. Side effects are possible. For example outputs
may support different video standards, so the driver may implicitly
switch the current standard. standard. Because of these possible side
effects applications must select an output before querying or
negotiating any other parameters.

Information about video outputs is available using the
:ref:`VIDIOC_ENUMOUTPUT` ioctl.

Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EINVAL
    The number of the video output is out of bounds, or there are no
    video outputs at all.


text:
<?php

use Sami\Sami;
use Sami\RemoteRepository\GitHubRemoteRepository;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;

$dir = __DIR__ . '/src';

$iterator = Finder::create()
    ->files()
    ->name('*.php')
    ->in($dir)
;

// List the branches to build documentation for here.  We will use the
// multi-version documentation structure from the beginning, even when
// we have but one branch, so that our documentation links do not change
// when we add a second branch.
$versions = GitVersionCollection::create($dir)
    ->add('master', 'master branch')
;

return new Sami($iterator, array(
    'theme'                => 'default',
    'versions'             => $versions,
    'title'                => 'LCache API',
    'build_dir'            => __DIR__.'/docs/api/%version%',
    'cache_dir'            => __DIR__.'/.sami-cache/%version%',
    'remote_repository'    => new GitHubRemoteRepository('lcache/lcache', __DIR__),
    'default_opened_level' => 2,
));


text:
'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var React = require('react');
var assign = require('object-assign');
var Scroller = require('react-virtual-scroller');

function emptyFn() {}

module.exports = React.createClass({

    displayName: 'ReactDataGrid.Wrapper',

    propTypes: {
        scrollLeft: React.PropTypes.number,
        scrollTop: React.PropTypes.number,
        scrollbarSize: React.PropTypes.number,
        rowHeight: React.PropTypes.any,
        renderCount: React.PropTypes.number
    },

    getDefaultProps: function getDefaultProps() {
        return {
            scrollLeft: 0,
            scrollTop: 0
        };
    },

    onMount: function onMount(scroller) {
        ;(this.props.onMount || emptyFn)(this, scroller);
    },

    render: function render() {

        var props = this.prepareProps(this.props);
        var rowsCount = props.renderCount;

        var groupsCount = 0;
        if (props.groupData) {
            groupsCount = props.groupData.groupsCount;
        }

        rowsCount += groupsCount;

        // var loadersSize = props.loadersSize
        var verticalScrollerSize = (props.totalLength + groupsCount) * props.rowHeight; // + loadersSize

        var content = props.empty ? React.createElement(
            'div',
            { className: 'z-empty-text', style: props.emptyTextStyle },
            props.emptyText
        ) : React.createElement('div', _extends({}, props.tableProps, { ref: 'table' }));

        return React.createElement(
            Scroller,
            {
                onMount: this.onMount,
                preventDefaultHorizontal: true,

                loadMask: !props.loadMaskOverHeader,
                loading: props.loading,

                scrollbarSize: props.scrollbarSize,

                minVerticalScrollStep: props.rowHeight,
                scrollTop: props.scrollTop,
                scrollLeft: props.scrollLeft,

                scrollHeight: verticalScrollerSize,
                scrollWidth: props.minRowWidth,

                onVerticalScroll: this.onVerticalScroll,
                onHorizontalScroll: this.onHorizontalScroll
            },
            content
        );
    },

    onVerticalScrollOverflow: function onVerticalScrollOverflow() {},

    onHorizontalScrollOverflow: function onHorizontalScrollOverflow() {},

    onHorizontalScroll: function onHorizontalScroll(scrollLeft) {
        this.props.onScrollLeft(scrollLeft);
    },

    onVerticalScroll: function onVerticalScroll(pos) {
        this.props.onScrollTop(pos);
    },

    prepareProps: function prepareProps(thisProps) {
        var props = {};

        assign(props, thisProps);

        return props;
    }
});


text:
package debop4s.core.jodatime

import org.joda.time.{Chronology, DateTime, Duration, ReadableInterval}

import scala.annotation.tailrec

class JodaRichReadableInterval(val self: ReadableInterval) extends AnyVal {

  def chronology: Chronology = self.getChronology

  def start: DateTime = self.getStart

  def end: DateTime = self.getEnd

  def duration: Duration = self.toDuration

  def millis: Long = self.toDuration.getMillis

  def days: List[DateTime] = {
    val from = start
    val to = end

    @tailrec
    def recur(acc: List[DateTime], curr: DateTime, target: DateTime): List[DateTime] = {
      if (curr.withTimeAtStartOfDay() == target.withTimeAtStartOfDay()) acc
      else recur(acc :+ curr, curr.plusDays(1), target)
    }

    recur(List(), from, to)
  }
}


text:
FOUNDATION_EXPORT double Pods_NSString_SurrogatePair_ExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_NSString_SurrogatePair_ExampleVersionString[];


text:
using System.Management.Automation;
using PrtgAPI.Parameters;

namespace PrtgAPI.PowerShell.Cmdlets
{
    ///
    /// <para type="synopsis">Creates a new set of device parameters for creating a brand new device under a group or probe.</para>
    ///
    /// <para type="description">The New-DeviceParameters cmdlet creates a set of parameters for adding a brand
    /// new device to PRTG. Device parameter objects returned from New-DeviceParameters allow specifying
    /// a variety of device specific configuration details including Internet Protocol version and auto-discovery
    /// settings at the time of object creation.</para>
    ///
    /// <para type="description">All devices must have a <see cref="Name"/> and <see cref="Host"/> property specified. If a <see cref="Host"/> (IP Address/HostName)
    /// is not specified in the call to New-DeviceParameters, PrtgAPI will automatically use the <see cref="Name"/> </para>
    /// as the hostname/IP Address.
    ///
    /// <para type="description">Note that not all device parameters (such as settings that can be inherited from the parent group)
    /// can be specified with PrtgAPI at the time of object creation. If you wish to modify such properties, this can be achieved
    /// after the device has been created via the Set-ObjectProperty cmdlet.</para>
    ///
    /// <example>
    ///
    ///         C:\> $params = New-DeviceParameters dc-1
    ///
    ///         C:\> Get-Probe contoso | Add-Device $params
    ///
    ///     <para>Create a new device named "dc-1" with hostname "dc-1" under the Contoso probe.</para>
    ///     <para/>
    /// </example>
    /// <example>
    ///
    ///         C:\> $params = New-DeviceParameters exch-1 "2001:db8::ff00:42:8329"
    ///         C:\> $params.IPVersion = "IPv6"
    ///
    ///         C:\> Get-Probe contoso | Add-Device $params
    ///
    ///     <para>Create a new device named "dc-2" with an IPv6 address, specifying the Internet Protocol as IPv6.</para>
    ///     <para/>
    /// </example>
    /// <example>
    ///
    ///         C:\> $params = New-DeviceParameters dc-1
    ///         C:\> $params.AutoDiscoveryMode = "AutomaticTemplate"
    ///         C:\> $params.DeviceTemplates = Get-DeviceTemplate *wmi*
    ///
    ///         C:\> Get-Probe contoso | Add-Device $params
    ///
    ///     <para>Create a new device named "dc-1" that performs an auto-discovery for WMI sensors only.</para>
    ///     <para/>
    /// </example>
    /// <example>
    ///
    ///         C:\> $params = New-DeviceParameters dc-1
    ///
    ///         C:\> Get-Probe contoso | Add-Device $params -PassThru | Set-ObjectProperty Location "23 Fleet Street"
    ///
    ///     <para>Create a new device named "dc-1" and then set its location.</para>
    /// </example>
    ///
    /// <para type="link" uri="https://github.com/lordmilko/PrtgAPI/wiki/Object-Creation#device-creation-1">Online version:</para>
    /// <para type="link">Add-Device</para>
    /// <para type="link">Get-DeviceTemplate</para>
    /// <para type="link">Set-ObjectProperty</para>
    /// <para type="link">Get-Group</para>
    /// <para type="link">Get-Probe</para>
    ///
    ///
    [Cmdlet(VerbsCommon.New, "DeviceParameters")]
    public class NewDeviceParametersCommand : PSCmdlet
    {
        ///
        /// <para type="description">The name to give the new device.</para>
        ///
        [Parameter(Mandatory = true, Position = 0)]
        public string Name { get; set; }

        ///
        /// <para type="description">The hostname or IP Address to use for the new device. If no value is specified, the name will be used.</para>
        ///
        [Parameter(Mandatory = false, Position = 1)]
        public new string Host { get; set; }

        ///
        /// Performs record-by-record processing functionality for the cmdlet.
        ///
        protected override void ProcessRecord()
        {
            WriteObject(new NewDeviceParameters(Name, string.IsNullOrEmpty(Host) ? Name : Host));
        }
    }
}


text:
int main (void)
{
    void *context = zmq_init (1);

    //  Socket to talk to server
    void *requester = zmq_socket (context, ZMQ_REQ);
    zmq_connect (requester, "tcp://localhost:5559");

    int request_nbr;
    for (request_nbr = 0; request_nbr != 10; request_nbr++) {
        s_send (requester, "Hello");
        char *string = s_recv (requester);
        printf ("Received reply %d [%s]\n", request_nbr, string);
        free (string);
    }
    zmq_close (requester);
    zmq_term (context);
    return 0;
}