• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.cloud.channel.v1;
18 
19 import com.google.api.core.BetaApi;
20 import com.google.cloud.channel.v1.CloudChannelServiceGrpc.CloudChannelServiceImplBase;
21 import com.google.longrunning.Operation;
22 import com.google.protobuf.AbstractMessage;
23 import com.google.protobuf.Empty;
24 import io.grpc.stub.StreamObserver;
25 import java.util.ArrayList;
26 import java.util.LinkedList;
27 import java.util.List;
28 import java.util.Queue;
29 import javax.annotation.Generated;
30 
31 @BetaApi
32 @Generated("by gapic-generator-java")
33 public class MockCloudChannelServiceImpl extends CloudChannelServiceImplBase {
34   private List<AbstractMessage> requests;
35   private Queue<Object> responses;
36 
MockCloudChannelServiceImpl()37   public MockCloudChannelServiceImpl() {
38     requests = new ArrayList<>();
39     responses = new LinkedList<>();
40   }
41 
getRequests()42   public List<AbstractMessage> getRequests() {
43     return requests;
44   }
45 
addResponse(AbstractMessage response)46   public void addResponse(AbstractMessage response) {
47     responses.add(response);
48   }
49 
setResponses(List<AbstractMessage> responses)50   public void setResponses(List<AbstractMessage> responses) {
51     this.responses = new LinkedList<Object>(responses);
52   }
53 
addException(Exception exception)54   public void addException(Exception exception) {
55     responses.add(exception);
56   }
57 
reset()58   public void reset() {
59     requests = new ArrayList<>();
60     responses = new LinkedList<>();
61   }
62 
63   @Override
listCustomers( ListCustomersRequest request, StreamObserver<ListCustomersResponse> responseObserver)64   public void listCustomers(
65       ListCustomersRequest request, StreamObserver<ListCustomersResponse> responseObserver) {
66     Object response = responses.poll();
67     if (response instanceof ListCustomersResponse) {
68       requests.add(request);
69       responseObserver.onNext(((ListCustomersResponse) response));
70       responseObserver.onCompleted();
71     } else if (response instanceof Exception) {
72       responseObserver.onError(((Exception) response));
73     } else {
74       responseObserver.onError(
75           new IllegalArgumentException(
76               String.format(
77                   "Unrecognized response type %s for method ListCustomers, expected %s or %s",
78                   response == null ? "null" : response.getClass().getName(),
79                   ListCustomersResponse.class.getName(),
80                   Exception.class.getName())));
81     }
82   }
83 
84   @Override
getCustomer(GetCustomerRequest request, StreamObserver<Customer> responseObserver)85   public void getCustomer(GetCustomerRequest request, StreamObserver<Customer> responseObserver) {
86     Object response = responses.poll();
87     if (response instanceof Customer) {
88       requests.add(request);
89       responseObserver.onNext(((Customer) response));
90       responseObserver.onCompleted();
91     } else if (response instanceof Exception) {
92       responseObserver.onError(((Exception) response));
93     } else {
94       responseObserver.onError(
95           new IllegalArgumentException(
96               String.format(
97                   "Unrecognized response type %s for method GetCustomer, expected %s or %s",
98                   response == null ? "null" : response.getClass().getName(),
99                   Customer.class.getName(),
100                   Exception.class.getName())));
101     }
102   }
103 
104   @Override
checkCloudIdentityAccountsExist( CheckCloudIdentityAccountsExistRequest request, StreamObserver<CheckCloudIdentityAccountsExistResponse> responseObserver)105   public void checkCloudIdentityAccountsExist(
106       CheckCloudIdentityAccountsExistRequest request,
107       StreamObserver<CheckCloudIdentityAccountsExistResponse> responseObserver) {
108     Object response = responses.poll();
109     if (response instanceof CheckCloudIdentityAccountsExistResponse) {
110       requests.add(request);
111       responseObserver.onNext(((CheckCloudIdentityAccountsExistResponse) response));
112       responseObserver.onCompleted();
113     } else if (response instanceof Exception) {
114       responseObserver.onError(((Exception) response));
115     } else {
116       responseObserver.onError(
117           new IllegalArgumentException(
118               String.format(
119                   "Unrecognized response type %s for method CheckCloudIdentityAccountsExist, expected %s or %s",
120                   response == null ? "null" : response.getClass().getName(),
121                   CheckCloudIdentityAccountsExistResponse.class.getName(),
122                   Exception.class.getName())));
123     }
124   }
125 
126   @Override
createCustomer( CreateCustomerRequest request, StreamObserver<Customer> responseObserver)127   public void createCustomer(
128       CreateCustomerRequest request, StreamObserver<Customer> responseObserver) {
129     Object response = responses.poll();
130     if (response instanceof Customer) {
131       requests.add(request);
132       responseObserver.onNext(((Customer) response));
133       responseObserver.onCompleted();
134     } else if (response instanceof Exception) {
135       responseObserver.onError(((Exception) response));
136     } else {
137       responseObserver.onError(
138           new IllegalArgumentException(
139               String.format(
140                   "Unrecognized response type %s for method CreateCustomer, expected %s or %s",
141                   response == null ? "null" : response.getClass().getName(),
142                   Customer.class.getName(),
143                   Exception.class.getName())));
144     }
145   }
146 
147   @Override
updateCustomer( UpdateCustomerRequest request, StreamObserver<Customer> responseObserver)148   public void updateCustomer(
149       UpdateCustomerRequest request, StreamObserver<Customer> responseObserver) {
150     Object response = responses.poll();
151     if (response instanceof Customer) {
152       requests.add(request);
153       responseObserver.onNext(((Customer) response));
154       responseObserver.onCompleted();
155     } else if (response instanceof Exception) {
156       responseObserver.onError(((Exception) response));
157     } else {
158       responseObserver.onError(
159           new IllegalArgumentException(
160               String.format(
161                   "Unrecognized response type %s for method UpdateCustomer, expected %s or %s",
162                   response == null ? "null" : response.getClass().getName(),
163                   Customer.class.getName(),
164                   Exception.class.getName())));
165     }
166   }
167 
168   @Override
deleteCustomer( DeleteCustomerRequest request, StreamObserver<Empty> responseObserver)169   public void deleteCustomer(
170       DeleteCustomerRequest request, StreamObserver<Empty> responseObserver) {
171     Object response = responses.poll();
172     if (response instanceof Empty) {
173       requests.add(request);
174       responseObserver.onNext(((Empty) response));
175       responseObserver.onCompleted();
176     } else if (response instanceof Exception) {
177       responseObserver.onError(((Exception) response));
178     } else {
179       responseObserver.onError(
180           new IllegalArgumentException(
181               String.format(
182                   "Unrecognized response type %s for method DeleteCustomer, expected %s or %s",
183                   response == null ? "null" : response.getClass().getName(),
184                   Empty.class.getName(),
185                   Exception.class.getName())));
186     }
187   }
188 
189   @Override
importCustomer( ImportCustomerRequest request, StreamObserver<Customer> responseObserver)190   public void importCustomer(
191       ImportCustomerRequest request, StreamObserver<Customer> responseObserver) {
192     Object response = responses.poll();
193     if (response instanceof Customer) {
194       requests.add(request);
195       responseObserver.onNext(((Customer) response));
196       responseObserver.onCompleted();
197     } else if (response instanceof Exception) {
198       responseObserver.onError(((Exception) response));
199     } else {
200       responseObserver.onError(
201           new IllegalArgumentException(
202               String.format(
203                   "Unrecognized response type %s for method ImportCustomer, expected %s or %s",
204                   response == null ? "null" : response.getClass().getName(),
205                   Customer.class.getName(),
206                   Exception.class.getName())));
207     }
208   }
209 
210   @Override
provisionCloudIdentity( ProvisionCloudIdentityRequest request, StreamObserver<Operation> responseObserver)211   public void provisionCloudIdentity(
212       ProvisionCloudIdentityRequest request, StreamObserver<Operation> responseObserver) {
213     Object response = responses.poll();
214     if (response instanceof Operation) {
215       requests.add(request);
216       responseObserver.onNext(((Operation) response));
217       responseObserver.onCompleted();
218     } else if (response instanceof Exception) {
219       responseObserver.onError(((Exception) response));
220     } else {
221       responseObserver.onError(
222           new IllegalArgumentException(
223               String.format(
224                   "Unrecognized response type %s for method ProvisionCloudIdentity, expected %s or %s",
225                   response == null ? "null" : response.getClass().getName(),
226                   Operation.class.getName(),
227                   Exception.class.getName())));
228     }
229   }
230 
231   @Override
listEntitlements( ListEntitlementsRequest request, StreamObserver<ListEntitlementsResponse> responseObserver)232   public void listEntitlements(
233       ListEntitlementsRequest request, StreamObserver<ListEntitlementsResponse> responseObserver) {
234     Object response = responses.poll();
235     if (response instanceof ListEntitlementsResponse) {
236       requests.add(request);
237       responseObserver.onNext(((ListEntitlementsResponse) response));
238       responseObserver.onCompleted();
239     } else if (response instanceof Exception) {
240       responseObserver.onError(((Exception) response));
241     } else {
242       responseObserver.onError(
243           new IllegalArgumentException(
244               String.format(
245                   "Unrecognized response type %s for method ListEntitlements, expected %s or %s",
246                   response == null ? "null" : response.getClass().getName(),
247                   ListEntitlementsResponse.class.getName(),
248                   Exception.class.getName())));
249     }
250   }
251 
252   @Override
listTransferableSkus( ListTransferableSkusRequest request, StreamObserver<ListTransferableSkusResponse> responseObserver)253   public void listTransferableSkus(
254       ListTransferableSkusRequest request,
255       StreamObserver<ListTransferableSkusResponse> responseObserver) {
256     Object response = responses.poll();
257     if (response instanceof ListTransferableSkusResponse) {
258       requests.add(request);
259       responseObserver.onNext(((ListTransferableSkusResponse) response));
260       responseObserver.onCompleted();
261     } else if (response instanceof Exception) {
262       responseObserver.onError(((Exception) response));
263     } else {
264       responseObserver.onError(
265           new IllegalArgumentException(
266               String.format(
267                   "Unrecognized response type %s for method ListTransferableSkus, expected %s or %s",
268                   response == null ? "null" : response.getClass().getName(),
269                   ListTransferableSkusResponse.class.getName(),
270                   Exception.class.getName())));
271     }
272   }
273 
274   @Override
listTransferableOffers( ListTransferableOffersRequest request, StreamObserver<ListTransferableOffersResponse> responseObserver)275   public void listTransferableOffers(
276       ListTransferableOffersRequest request,
277       StreamObserver<ListTransferableOffersResponse> responseObserver) {
278     Object response = responses.poll();
279     if (response instanceof ListTransferableOffersResponse) {
280       requests.add(request);
281       responseObserver.onNext(((ListTransferableOffersResponse) response));
282       responseObserver.onCompleted();
283     } else if (response instanceof Exception) {
284       responseObserver.onError(((Exception) response));
285     } else {
286       responseObserver.onError(
287           new IllegalArgumentException(
288               String.format(
289                   "Unrecognized response type %s for method ListTransferableOffers, expected %s or %s",
290                   response == null ? "null" : response.getClass().getName(),
291                   ListTransferableOffersResponse.class.getName(),
292                   Exception.class.getName())));
293     }
294   }
295 
296   @Override
getEntitlement( GetEntitlementRequest request, StreamObserver<Entitlement> responseObserver)297   public void getEntitlement(
298       GetEntitlementRequest request, StreamObserver<Entitlement> responseObserver) {
299     Object response = responses.poll();
300     if (response instanceof Entitlement) {
301       requests.add(request);
302       responseObserver.onNext(((Entitlement) response));
303       responseObserver.onCompleted();
304     } else if (response instanceof Exception) {
305       responseObserver.onError(((Exception) response));
306     } else {
307       responseObserver.onError(
308           new IllegalArgumentException(
309               String.format(
310                   "Unrecognized response type %s for method GetEntitlement, expected %s or %s",
311                   response == null ? "null" : response.getClass().getName(),
312                   Entitlement.class.getName(),
313                   Exception.class.getName())));
314     }
315   }
316 
317   @Override
createEntitlement( CreateEntitlementRequest request, StreamObserver<Operation> responseObserver)318   public void createEntitlement(
319       CreateEntitlementRequest request, StreamObserver<Operation> responseObserver) {
320     Object response = responses.poll();
321     if (response instanceof Operation) {
322       requests.add(request);
323       responseObserver.onNext(((Operation) response));
324       responseObserver.onCompleted();
325     } else if (response instanceof Exception) {
326       responseObserver.onError(((Exception) response));
327     } else {
328       responseObserver.onError(
329           new IllegalArgumentException(
330               String.format(
331                   "Unrecognized response type %s for method CreateEntitlement, expected %s or %s",
332                   response == null ? "null" : response.getClass().getName(),
333                   Operation.class.getName(),
334                   Exception.class.getName())));
335     }
336   }
337 
338   @Override
changeParameters( ChangeParametersRequest request, StreamObserver<Operation> responseObserver)339   public void changeParameters(
340       ChangeParametersRequest request, StreamObserver<Operation> responseObserver) {
341     Object response = responses.poll();
342     if (response instanceof Operation) {
343       requests.add(request);
344       responseObserver.onNext(((Operation) response));
345       responseObserver.onCompleted();
346     } else if (response instanceof Exception) {
347       responseObserver.onError(((Exception) response));
348     } else {
349       responseObserver.onError(
350           new IllegalArgumentException(
351               String.format(
352                   "Unrecognized response type %s for method ChangeParameters, expected %s or %s",
353                   response == null ? "null" : response.getClass().getName(),
354                   Operation.class.getName(),
355                   Exception.class.getName())));
356     }
357   }
358 
359   @Override
changeRenewalSettings( ChangeRenewalSettingsRequest request, StreamObserver<Operation> responseObserver)360   public void changeRenewalSettings(
361       ChangeRenewalSettingsRequest request, StreamObserver<Operation> responseObserver) {
362     Object response = responses.poll();
363     if (response instanceof Operation) {
364       requests.add(request);
365       responseObserver.onNext(((Operation) response));
366       responseObserver.onCompleted();
367     } else if (response instanceof Exception) {
368       responseObserver.onError(((Exception) response));
369     } else {
370       responseObserver.onError(
371           new IllegalArgumentException(
372               String.format(
373                   "Unrecognized response type %s for method ChangeRenewalSettings, expected %s or %s",
374                   response == null ? "null" : response.getClass().getName(),
375                   Operation.class.getName(),
376                   Exception.class.getName())));
377     }
378   }
379 
380   @Override
changeOffer(ChangeOfferRequest request, StreamObserver<Operation> responseObserver)381   public void changeOffer(ChangeOfferRequest request, StreamObserver<Operation> responseObserver) {
382     Object response = responses.poll();
383     if (response instanceof Operation) {
384       requests.add(request);
385       responseObserver.onNext(((Operation) response));
386       responseObserver.onCompleted();
387     } else if (response instanceof Exception) {
388       responseObserver.onError(((Exception) response));
389     } else {
390       responseObserver.onError(
391           new IllegalArgumentException(
392               String.format(
393                   "Unrecognized response type %s for method ChangeOffer, expected %s or %s",
394                   response == null ? "null" : response.getClass().getName(),
395                   Operation.class.getName(),
396                   Exception.class.getName())));
397     }
398   }
399 
400   @Override
startPaidService( StartPaidServiceRequest request, StreamObserver<Operation> responseObserver)401   public void startPaidService(
402       StartPaidServiceRequest request, StreamObserver<Operation> responseObserver) {
403     Object response = responses.poll();
404     if (response instanceof Operation) {
405       requests.add(request);
406       responseObserver.onNext(((Operation) response));
407       responseObserver.onCompleted();
408     } else if (response instanceof Exception) {
409       responseObserver.onError(((Exception) response));
410     } else {
411       responseObserver.onError(
412           new IllegalArgumentException(
413               String.format(
414                   "Unrecognized response type %s for method StartPaidService, expected %s or %s",
415                   response == null ? "null" : response.getClass().getName(),
416                   Operation.class.getName(),
417                   Exception.class.getName())));
418     }
419   }
420 
421   @Override
suspendEntitlement( SuspendEntitlementRequest request, StreamObserver<Operation> responseObserver)422   public void suspendEntitlement(
423       SuspendEntitlementRequest request, StreamObserver<Operation> responseObserver) {
424     Object response = responses.poll();
425     if (response instanceof Operation) {
426       requests.add(request);
427       responseObserver.onNext(((Operation) response));
428       responseObserver.onCompleted();
429     } else if (response instanceof Exception) {
430       responseObserver.onError(((Exception) response));
431     } else {
432       responseObserver.onError(
433           new IllegalArgumentException(
434               String.format(
435                   "Unrecognized response type %s for method SuspendEntitlement, expected %s or %s",
436                   response == null ? "null" : response.getClass().getName(),
437                   Operation.class.getName(),
438                   Exception.class.getName())));
439     }
440   }
441 
442   @Override
cancelEntitlement( CancelEntitlementRequest request, StreamObserver<Operation> responseObserver)443   public void cancelEntitlement(
444       CancelEntitlementRequest request, StreamObserver<Operation> responseObserver) {
445     Object response = responses.poll();
446     if (response instanceof Operation) {
447       requests.add(request);
448       responseObserver.onNext(((Operation) response));
449       responseObserver.onCompleted();
450     } else if (response instanceof Exception) {
451       responseObserver.onError(((Exception) response));
452     } else {
453       responseObserver.onError(
454           new IllegalArgumentException(
455               String.format(
456                   "Unrecognized response type %s for method CancelEntitlement, expected %s or %s",
457                   response == null ? "null" : response.getClass().getName(),
458                   Operation.class.getName(),
459                   Exception.class.getName())));
460     }
461   }
462 
463   @Override
activateEntitlement( ActivateEntitlementRequest request, StreamObserver<Operation> responseObserver)464   public void activateEntitlement(
465       ActivateEntitlementRequest request, StreamObserver<Operation> responseObserver) {
466     Object response = responses.poll();
467     if (response instanceof Operation) {
468       requests.add(request);
469       responseObserver.onNext(((Operation) response));
470       responseObserver.onCompleted();
471     } else if (response instanceof Exception) {
472       responseObserver.onError(((Exception) response));
473     } else {
474       responseObserver.onError(
475           new IllegalArgumentException(
476               String.format(
477                   "Unrecognized response type %s for method ActivateEntitlement, expected %s or %s",
478                   response == null ? "null" : response.getClass().getName(),
479                   Operation.class.getName(),
480                   Exception.class.getName())));
481     }
482   }
483 
484   @Override
transferEntitlements( TransferEntitlementsRequest request, StreamObserver<Operation> responseObserver)485   public void transferEntitlements(
486       TransferEntitlementsRequest request, StreamObserver<Operation> responseObserver) {
487     Object response = responses.poll();
488     if (response instanceof Operation) {
489       requests.add(request);
490       responseObserver.onNext(((Operation) response));
491       responseObserver.onCompleted();
492     } else if (response instanceof Exception) {
493       responseObserver.onError(((Exception) response));
494     } else {
495       responseObserver.onError(
496           new IllegalArgumentException(
497               String.format(
498                   "Unrecognized response type %s for method TransferEntitlements, expected %s or %s",
499                   response == null ? "null" : response.getClass().getName(),
500                   Operation.class.getName(),
501                   Exception.class.getName())));
502     }
503   }
504 
505   @Override
transferEntitlementsToGoogle( TransferEntitlementsToGoogleRequest request, StreamObserver<Operation> responseObserver)506   public void transferEntitlementsToGoogle(
507       TransferEntitlementsToGoogleRequest request, StreamObserver<Operation> responseObserver) {
508     Object response = responses.poll();
509     if (response instanceof Operation) {
510       requests.add(request);
511       responseObserver.onNext(((Operation) response));
512       responseObserver.onCompleted();
513     } else if (response instanceof Exception) {
514       responseObserver.onError(((Exception) response));
515     } else {
516       responseObserver.onError(
517           new IllegalArgumentException(
518               String.format(
519                   "Unrecognized response type %s for method TransferEntitlementsToGoogle, expected %s or %s",
520                   response == null ? "null" : response.getClass().getName(),
521                   Operation.class.getName(),
522                   Exception.class.getName())));
523     }
524   }
525 
526   @Override
listChannelPartnerLinks( ListChannelPartnerLinksRequest request, StreamObserver<ListChannelPartnerLinksResponse> responseObserver)527   public void listChannelPartnerLinks(
528       ListChannelPartnerLinksRequest request,
529       StreamObserver<ListChannelPartnerLinksResponse> responseObserver) {
530     Object response = responses.poll();
531     if (response instanceof ListChannelPartnerLinksResponse) {
532       requests.add(request);
533       responseObserver.onNext(((ListChannelPartnerLinksResponse) response));
534       responseObserver.onCompleted();
535     } else if (response instanceof Exception) {
536       responseObserver.onError(((Exception) response));
537     } else {
538       responseObserver.onError(
539           new IllegalArgumentException(
540               String.format(
541                   "Unrecognized response type %s for method ListChannelPartnerLinks, expected %s or %s",
542                   response == null ? "null" : response.getClass().getName(),
543                   ListChannelPartnerLinksResponse.class.getName(),
544                   Exception.class.getName())));
545     }
546   }
547 
548   @Override
getChannelPartnerLink( GetChannelPartnerLinkRequest request, StreamObserver<ChannelPartnerLink> responseObserver)549   public void getChannelPartnerLink(
550       GetChannelPartnerLinkRequest request, StreamObserver<ChannelPartnerLink> responseObserver) {
551     Object response = responses.poll();
552     if (response instanceof ChannelPartnerLink) {
553       requests.add(request);
554       responseObserver.onNext(((ChannelPartnerLink) response));
555       responseObserver.onCompleted();
556     } else if (response instanceof Exception) {
557       responseObserver.onError(((Exception) response));
558     } else {
559       responseObserver.onError(
560           new IllegalArgumentException(
561               String.format(
562                   "Unrecognized response type %s for method GetChannelPartnerLink, expected %s or %s",
563                   response == null ? "null" : response.getClass().getName(),
564                   ChannelPartnerLink.class.getName(),
565                   Exception.class.getName())));
566     }
567   }
568 
569   @Override
createChannelPartnerLink( CreateChannelPartnerLinkRequest request, StreamObserver<ChannelPartnerLink> responseObserver)570   public void createChannelPartnerLink(
571       CreateChannelPartnerLinkRequest request,
572       StreamObserver<ChannelPartnerLink> responseObserver) {
573     Object response = responses.poll();
574     if (response instanceof ChannelPartnerLink) {
575       requests.add(request);
576       responseObserver.onNext(((ChannelPartnerLink) response));
577       responseObserver.onCompleted();
578     } else if (response instanceof Exception) {
579       responseObserver.onError(((Exception) response));
580     } else {
581       responseObserver.onError(
582           new IllegalArgumentException(
583               String.format(
584                   "Unrecognized response type %s for method CreateChannelPartnerLink, expected %s or %s",
585                   response == null ? "null" : response.getClass().getName(),
586                   ChannelPartnerLink.class.getName(),
587                   Exception.class.getName())));
588     }
589   }
590 
591   @Override
updateChannelPartnerLink( UpdateChannelPartnerLinkRequest request, StreamObserver<ChannelPartnerLink> responseObserver)592   public void updateChannelPartnerLink(
593       UpdateChannelPartnerLinkRequest request,
594       StreamObserver<ChannelPartnerLink> responseObserver) {
595     Object response = responses.poll();
596     if (response instanceof ChannelPartnerLink) {
597       requests.add(request);
598       responseObserver.onNext(((ChannelPartnerLink) response));
599       responseObserver.onCompleted();
600     } else if (response instanceof Exception) {
601       responseObserver.onError(((Exception) response));
602     } else {
603       responseObserver.onError(
604           new IllegalArgumentException(
605               String.format(
606                   "Unrecognized response type %s for method UpdateChannelPartnerLink, expected %s or %s",
607                   response == null ? "null" : response.getClass().getName(),
608                   ChannelPartnerLink.class.getName(),
609                   Exception.class.getName())));
610     }
611   }
612 
613   @Override
getCustomerRepricingConfig( GetCustomerRepricingConfigRequest request, StreamObserver<CustomerRepricingConfig> responseObserver)614   public void getCustomerRepricingConfig(
615       GetCustomerRepricingConfigRequest request,
616       StreamObserver<CustomerRepricingConfig> responseObserver) {
617     Object response = responses.poll();
618     if (response instanceof CustomerRepricingConfig) {
619       requests.add(request);
620       responseObserver.onNext(((CustomerRepricingConfig) response));
621       responseObserver.onCompleted();
622     } else if (response instanceof Exception) {
623       responseObserver.onError(((Exception) response));
624     } else {
625       responseObserver.onError(
626           new IllegalArgumentException(
627               String.format(
628                   "Unrecognized response type %s for method GetCustomerRepricingConfig, expected %s or %s",
629                   response == null ? "null" : response.getClass().getName(),
630                   CustomerRepricingConfig.class.getName(),
631                   Exception.class.getName())));
632     }
633   }
634 
635   @Override
listCustomerRepricingConfigs( ListCustomerRepricingConfigsRequest request, StreamObserver<ListCustomerRepricingConfigsResponse> responseObserver)636   public void listCustomerRepricingConfigs(
637       ListCustomerRepricingConfigsRequest request,
638       StreamObserver<ListCustomerRepricingConfigsResponse> responseObserver) {
639     Object response = responses.poll();
640     if (response instanceof ListCustomerRepricingConfigsResponse) {
641       requests.add(request);
642       responseObserver.onNext(((ListCustomerRepricingConfigsResponse) response));
643       responseObserver.onCompleted();
644     } else if (response instanceof Exception) {
645       responseObserver.onError(((Exception) response));
646     } else {
647       responseObserver.onError(
648           new IllegalArgumentException(
649               String.format(
650                   "Unrecognized response type %s for method ListCustomerRepricingConfigs, expected %s or %s",
651                   response == null ? "null" : response.getClass().getName(),
652                   ListCustomerRepricingConfigsResponse.class.getName(),
653                   Exception.class.getName())));
654     }
655   }
656 
657   @Override
createCustomerRepricingConfig( CreateCustomerRepricingConfigRequest request, StreamObserver<CustomerRepricingConfig> responseObserver)658   public void createCustomerRepricingConfig(
659       CreateCustomerRepricingConfigRequest request,
660       StreamObserver<CustomerRepricingConfig> responseObserver) {
661     Object response = responses.poll();
662     if (response instanceof CustomerRepricingConfig) {
663       requests.add(request);
664       responseObserver.onNext(((CustomerRepricingConfig) response));
665       responseObserver.onCompleted();
666     } else if (response instanceof Exception) {
667       responseObserver.onError(((Exception) response));
668     } else {
669       responseObserver.onError(
670           new IllegalArgumentException(
671               String.format(
672                   "Unrecognized response type %s for method CreateCustomerRepricingConfig, expected %s or %s",
673                   response == null ? "null" : response.getClass().getName(),
674                   CustomerRepricingConfig.class.getName(),
675                   Exception.class.getName())));
676     }
677   }
678 
679   @Override
updateCustomerRepricingConfig( UpdateCustomerRepricingConfigRequest request, StreamObserver<CustomerRepricingConfig> responseObserver)680   public void updateCustomerRepricingConfig(
681       UpdateCustomerRepricingConfigRequest request,
682       StreamObserver<CustomerRepricingConfig> responseObserver) {
683     Object response = responses.poll();
684     if (response instanceof CustomerRepricingConfig) {
685       requests.add(request);
686       responseObserver.onNext(((CustomerRepricingConfig) response));
687       responseObserver.onCompleted();
688     } else if (response instanceof Exception) {
689       responseObserver.onError(((Exception) response));
690     } else {
691       responseObserver.onError(
692           new IllegalArgumentException(
693               String.format(
694                   "Unrecognized response type %s for method UpdateCustomerRepricingConfig, expected %s or %s",
695                   response == null ? "null" : response.getClass().getName(),
696                   CustomerRepricingConfig.class.getName(),
697                   Exception.class.getName())));
698     }
699   }
700 
701   @Override
deleteCustomerRepricingConfig( DeleteCustomerRepricingConfigRequest request, StreamObserver<Empty> responseObserver)702   public void deleteCustomerRepricingConfig(
703       DeleteCustomerRepricingConfigRequest request, StreamObserver<Empty> responseObserver) {
704     Object response = responses.poll();
705     if (response instanceof Empty) {
706       requests.add(request);
707       responseObserver.onNext(((Empty) response));
708       responseObserver.onCompleted();
709     } else if (response instanceof Exception) {
710       responseObserver.onError(((Exception) response));
711     } else {
712       responseObserver.onError(
713           new IllegalArgumentException(
714               String.format(
715                   "Unrecognized response type %s for method DeleteCustomerRepricingConfig, expected %s or %s",
716                   response == null ? "null" : response.getClass().getName(),
717                   Empty.class.getName(),
718                   Exception.class.getName())));
719     }
720   }
721 
722   @Override
getChannelPartnerRepricingConfig( GetChannelPartnerRepricingConfigRequest request, StreamObserver<ChannelPartnerRepricingConfig> responseObserver)723   public void getChannelPartnerRepricingConfig(
724       GetChannelPartnerRepricingConfigRequest request,
725       StreamObserver<ChannelPartnerRepricingConfig> responseObserver) {
726     Object response = responses.poll();
727     if (response instanceof ChannelPartnerRepricingConfig) {
728       requests.add(request);
729       responseObserver.onNext(((ChannelPartnerRepricingConfig) response));
730       responseObserver.onCompleted();
731     } else if (response instanceof Exception) {
732       responseObserver.onError(((Exception) response));
733     } else {
734       responseObserver.onError(
735           new IllegalArgumentException(
736               String.format(
737                   "Unrecognized response type %s for method GetChannelPartnerRepricingConfig, expected %s or %s",
738                   response == null ? "null" : response.getClass().getName(),
739                   ChannelPartnerRepricingConfig.class.getName(),
740                   Exception.class.getName())));
741     }
742   }
743 
744   @Override
listChannelPartnerRepricingConfigs( ListChannelPartnerRepricingConfigsRequest request, StreamObserver<ListChannelPartnerRepricingConfigsResponse> responseObserver)745   public void listChannelPartnerRepricingConfigs(
746       ListChannelPartnerRepricingConfigsRequest request,
747       StreamObserver<ListChannelPartnerRepricingConfigsResponse> responseObserver) {
748     Object response = responses.poll();
749     if (response instanceof ListChannelPartnerRepricingConfigsResponse) {
750       requests.add(request);
751       responseObserver.onNext(((ListChannelPartnerRepricingConfigsResponse) response));
752       responseObserver.onCompleted();
753     } else if (response instanceof Exception) {
754       responseObserver.onError(((Exception) response));
755     } else {
756       responseObserver.onError(
757           new IllegalArgumentException(
758               String.format(
759                   "Unrecognized response type %s for method ListChannelPartnerRepricingConfigs, expected %s or %s",
760                   response == null ? "null" : response.getClass().getName(),
761                   ListChannelPartnerRepricingConfigsResponse.class.getName(),
762                   Exception.class.getName())));
763     }
764   }
765 
766   @Override
createChannelPartnerRepricingConfig( CreateChannelPartnerRepricingConfigRequest request, StreamObserver<ChannelPartnerRepricingConfig> responseObserver)767   public void createChannelPartnerRepricingConfig(
768       CreateChannelPartnerRepricingConfigRequest request,
769       StreamObserver<ChannelPartnerRepricingConfig> responseObserver) {
770     Object response = responses.poll();
771     if (response instanceof ChannelPartnerRepricingConfig) {
772       requests.add(request);
773       responseObserver.onNext(((ChannelPartnerRepricingConfig) response));
774       responseObserver.onCompleted();
775     } else if (response instanceof Exception) {
776       responseObserver.onError(((Exception) response));
777     } else {
778       responseObserver.onError(
779           new IllegalArgumentException(
780               String.format(
781                   "Unrecognized response type %s for method CreateChannelPartnerRepricingConfig, expected %s or %s",
782                   response == null ? "null" : response.getClass().getName(),
783                   ChannelPartnerRepricingConfig.class.getName(),
784                   Exception.class.getName())));
785     }
786   }
787 
788   @Override
updateChannelPartnerRepricingConfig( UpdateChannelPartnerRepricingConfigRequest request, StreamObserver<ChannelPartnerRepricingConfig> responseObserver)789   public void updateChannelPartnerRepricingConfig(
790       UpdateChannelPartnerRepricingConfigRequest request,
791       StreamObserver<ChannelPartnerRepricingConfig> responseObserver) {
792     Object response = responses.poll();
793     if (response instanceof ChannelPartnerRepricingConfig) {
794       requests.add(request);
795       responseObserver.onNext(((ChannelPartnerRepricingConfig) response));
796       responseObserver.onCompleted();
797     } else if (response instanceof Exception) {
798       responseObserver.onError(((Exception) response));
799     } else {
800       responseObserver.onError(
801           new IllegalArgumentException(
802               String.format(
803                   "Unrecognized response type %s for method UpdateChannelPartnerRepricingConfig, expected %s or %s",
804                   response == null ? "null" : response.getClass().getName(),
805                   ChannelPartnerRepricingConfig.class.getName(),
806                   Exception.class.getName())));
807     }
808   }
809 
810   @Override
deleteChannelPartnerRepricingConfig( DeleteChannelPartnerRepricingConfigRequest request, StreamObserver<Empty> responseObserver)811   public void deleteChannelPartnerRepricingConfig(
812       DeleteChannelPartnerRepricingConfigRequest request, StreamObserver<Empty> responseObserver) {
813     Object response = responses.poll();
814     if (response instanceof Empty) {
815       requests.add(request);
816       responseObserver.onNext(((Empty) response));
817       responseObserver.onCompleted();
818     } else if (response instanceof Exception) {
819       responseObserver.onError(((Exception) response));
820     } else {
821       responseObserver.onError(
822           new IllegalArgumentException(
823               String.format(
824                   "Unrecognized response type %s for method DeleteChannelPartnerRepricingConfig, expected %s or %s",
825                   response == null ? "null" : response.getClass().getName(),
826                   Empty.class.getName(),
827                   Exception.class.getName())));
828     }
829   }
830 
831   @Override
lookupOffer(LookupOfferRequest request, StreamObserver<Offer> responseObserver)832   public void lookupOffer(LookupOfferRequest request, StreamObserver<Offer> responseObserver) {
833     Object response = responses.poll();
834     if (response instanceof Offer) {
835       requests.add(request);
836       responseObserver.onNext(((Offer) response));
837       responseObserver.onCompleted();
838     } else if (response instanceof Exception) {
839       responseObserver.onError(((Exception) response));
840     } else {
841       responseObserver.onError(
842           new IllegalArgumentException(
843               String.format(
844                   "Unrecognized response type %s for method LookupOffer, expected %s or %s",
845                   response == null ? "null" : response.getClass().getName(),
846                   Offer.class.getName(),
847                   Exception.class.getName())));
848     }
849   }
850 
851   @Override
listProducts( ListProductsRequest request, StreamObserver<ListProductsResponse> responseObserver)852   public void listProducts(
853       ListProductsRequest request, StreamObserver<ListProductsResponse> responseObserver) {
854     Object response = responses.poll();
855     if (response instanceof ListProductsResponse) {
856       requests.add(request);
857       responseObserver.onNext(((ListProductsResponse) response));
858       responseObserver.onCompleted();
859     } else if (response instanceof Exception) {
860       responseObserver.onError(((Exception) response));
861     } else {
862       responseObserver.onError(
863           new IllegalArgumentException(
864               String.format(
865                   "Unrecognized response type %s for method ListProducts, expected %s or %s",
866                   response == null ? "null" : response.getClass().getName(),
867                   ListProductsResponse.class.getName(),
868                   Exception.class.getName())));
869     }
870   }
871 
872   @Override
listSkus(ListSkusRequest request, StreamObserver<ListSkusResponse> responseObserver)873   public void listSkus(ListSkusRequest request, StreamObserver<ListSkusResponse> responseObserver) {
874     Object response = responses.poll();
875     if (response instanceof ListSkusResponse) {
876       requests.add(request);
877       responseObserver.onNext(((ListSkusResponse) response));
878       responseObserver.onCompleted();
879     } else if (response instanceof Exception) {
880       responseObserver.onError(((Exception) response));
881     } else {
882       responseObserver.onError(
883           new IllegalArgumentException(
884               String.format(
885                   "Unrecognized response type %s for method ListSkus, expected %s or %s",
886                   response == null ? "null" : response.getClass().getName(),
887                   ListSkusResponse.class.getName(),
888                   Exception.class.getName())));
889     }
890   }
891 
892   @Override
listOffers( ListOffersRequest request, StreamObserver<ListOffersResponse> responseObserver)893   public void listOffers(
894       ListOffersRequest request, StreamObserver<ListOffersResponse> responseObserver) {
895     Object response = responses.poll();
896     if (response instanceof ListOffersResponse) {
897       requests.add(request);
898       responseObserver.onNext(((ListOffersResponse) response));
899       responseObserver.onCompleted();
900     } else if (response instanceof Exception) {
901       responseObserver.onError(((Exception) response));
902     } else {
903       responseObserver.onError(
904           new IllegalArgumentException(
905               String.format(
906                   "Unrecognized response type %s for method ListOffers, expected %s or %s",
907                   response == null ? "null" : response.getClass().getName(),
908                   ListOffersResponse.class.getName(),
909                   Exception.class.getName())));
910     }
911   }
912 
913   @Override
listPurchasableSkus( ListPurchasableSkusRequest request, StreamObserver<ListPurchasableSkusResponse> responseObserver)914   public void listPurchasableSkus(
915       ListPurchasableSkusRequest request,
916       StreamObserver<ListPurchasableSkusResponse> responseObserver) {
917     Object response = responses.poll();
918     if (response instanceof ListPurchasableSkusResponse) {
919       requests.add(request);
920       responseObserver.onNext(((ListPurchasableSkusResponse) response));
921       responseObserver.onCompleted();
922     } else if (response instanceof Exception) {
923       responseObserver.onError(((Exception) response));
924     } else {
925       responseObserver.onError(
926           new IllegalArgumentException(
927               String.format(
928                   "Unrecognized response type %s for method ListPurchasableSkus, expected %s or %s",
929                   response == null ? "null" : response.getClass().getName(),
930                   ListPurchasableSkusResponse.class.getName(),
931                   Exception.class.getName())));
932     }
933   }
934 
935   @Override
listPurchasableOffers( ListPurchasableOffersRequest request, StreamObserver<ListPurchasableOffersResponse> responseObserver)936   public void listPurchasableOffers(
937       ListPurchasableOffersRequest request,
938       StreamObserver<ListPurchasableOffersResponse> responseObserver) {
939     Object response = responses.poll();
940     if (response instanceof ListPurchasableOffersResponse) {
941       requests.add(request);
942       responseObserver.onNext(((ListPurchasableOffersResponse) response));
943       responseObserver.onCompleted();
944     } else if (response instanceof Exception) {
945       responseObserver.onError(((Exception) response));
946     } else {
947       responseObserver.onError(
948           new IllegalArgumentException(
949               String.format(
950                   "Unrecognized response type %s for method ListPurchasableOffers, expected %s or %s",
951                   response == null ? "null" : response.getClass().getName(),
952                   ListPurchasableOffersResponse.class.getName(),
953                   Exception.class.getName())));
954     }
955   }
956 
957   @Override
registerSubscriber( RegisterSubscriberRequest request, StreamObserver<RegisterSubscriberResponse> responseObserver)958   public void registerSubscriber(
959       RegisterSubscriberRequest request,
960       StreamObserver<RegisterSubscriberResponse> responseObserver) {
961     Object response = responses.poll();
962     if (response instanceof RegisterSubscriberResponse) {
963       requests.add(request);
964       responseObserver.onNext(((RegisterSubscriberResponse) response));
965       responseObserver.onCompleted();
966     } else if (response instanceof Exception) {
967       responseObserver.onError(((Exception) response));
968     } else {
969       responseObserver.onError(
970           new IllegalArgumentException(
971               String.format(
972                   "Unrecognized response type %s for method RegisterSubscriber, expected %s or %s",
973                   response == null ? "null" : response.getClass().getName(),
974                   RegisterSubscriberResponse.class.getName(),
975                   Exception.class.getName())));
976     }
977   }
978 
979   @Override
unregisterSubscriber( UnregisterSubscriberRequest request, StreamObserver<UnregisterSubscriberResponse> responseObserver)980   public void unregisterSubscriber(
981       UnregisterSubscriberRequest request,
982       StreamObserver<UnregisterSubscriberResponse> responseObserver) {
983     Object response = responses.poll();
984     if (response instanceof UnregisterSubscriberResponse) {
985       requests.add(request);
986       responseObserver.onNext(((UnregisterSubscriberResponse) response));
987       responseObserver.onCompleted();
988     } else if (response instanceof Exception) {
989       responseObserver.onError(((Exception) response));
990     } else {
991       responseObserver.onError(
992           new IllegalArgumentException(
993               String.format(
994                   "Unrecognized response type %s for method UnregisterSubscriber, expected %s or %s",
995                   response == null ? "null" : response.getClass().getName(),
996                   UnregisterSubscriberResponse.class.getName(),
997                   Exception.class.getName())));
998     }
999   }
1000 
1001   @Override
listSubscribers( ListSubscribersRequest request, StreamObserver<ListSubscribersResponse> responseObserver)1002   public void listSubscribers(
1003       ListSubscribersRequest request, StreamObserver<ListSubscribersResponse> responseObserver) {
1004     Object response = responses.poll();
1005     if (response instanceof ListSubscribersResponse) {
1006       requests.add(request);
1007       responseObserver.onNext(((ListSubscribersResponse) response));
1008       responseObserver.onCompleted();
1009     } else if (response instanceof Exception) {
1010       responseObserver.onError(((Exception) response));
1011     } else {
1012       responseObserver.onError(
1013           new IllegalArgumentException(
1014               String.format(
1015                   "Unrecognized response type %s for method ListSubscribers, expected %s or %s",
1016                   response == null ? "null" : response.getClass().getName(),
1017                   ListSubscribersResponse.class.getName(),
1018                   Exception.class.getName())));
1019     }
1020   }
1021 
1022   @Override
listEntitlementChanges( ListEntitlementChangesRequest request, StreamObserver<ListEntitlementChangesResponse> responseObserver)1023   public void listEntitlementChanges(
1024       ListEntitlementChangesRequest request,
1025       StreamObserver<ListEntitlementChangesResponse> responseObserver) {
1026     Object response = responses.poll();
1027     if (response instanceof ListEntitlementChangesResponse) {
1028       requests.add(request);
1029       responseObserver.onNext(((ListEntitlementChangesResponse) response));
1030       responseObserver.onCompleted();
1031     } else if (response instanceof Exception) {
1032       responseObserver.onError(((Exception) response));
1033     } else {
1034       responseObserver.onError(
1035           new IllegalArgumentException(
1036               String.format(
1037                   "Unrecognized response type %s for method ListEntitlementChanges, expected %s or %s",
1038                   response == null ? "null" : response.getClass().getName(),
1039                   ListEntitlementChangesResponse.class.getName(),
1040                   Exception.class.getName())));
1041     }
1042   }
1043 }
1044