@Override public Iterable<CryptoKeyVersion> extractResources( ListCryptoKeyVersionsResponse payload) { return payload.getCryptoKeyVersionsList() != null ? payload.getCryptoKeyVersionsList() : ImmutableList.<CryptoKeyVersion>of(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse other = (com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) obj; boolean result = true; result = result && getCryptoKeyVersionsList().equals(other.getCryptoKeyVersionsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && (getTotalSize() == other.getTotalSize()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getCryptoKeyVersionsCount() > 0) { hash = (37 * hash) + CRYPTO_KEY_VERSIONS_FIELD_NUMBER; hash = (53 * hash) + getCryptoKeyVersionsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER; hash = (53 * hash) + getTotalSize(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Test @SuppressWarnings("all") public void listCryptoKeyVersionsTest() { String nextPageToken = ""; int totalSize = 705419236; CryptoKeyVersion cryptoKeyVersionsElement = CryptoKeyVersion.newBuilder().build(); List<CryptoKeyVersion> cryptoKeyVersions = Arrays.asList(cryptoKeyVersionsElement); ListCryptoKeyVersionsResponse expectedResponse = ListCryptoKeyVersionsResponse.newBuilder() .setNextPageToken(nextPageToken) .setTotalSize(totalSize) .addAllCryptoKeyVersions(cryptoKeyVersions) .build(); mockKeyManagementService.addResponse(expectedResponse); CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); ListCryptoKeyVersionsPagedResponse pagedListResponse = client.listCryptoKeyVersions(parent); List<CryptoKeyVersion> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getCryptoKeyVersionsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockKeyManagementService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListCryptoKeyVersionsRequest actualRequest = (ListCryptoKeyVersionsRequest) actualRequests.get(0); Assert.assertEquals(parent, CryptoKeyName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<CryptoKeyVersion> extractResources( ListCryptoKeyVersionsResponse payload) { return payload.getCryptoKeyVersionsList() != null ? payload.getCryptoKeyVersionsList() : ImmutableList.<CryptoKeyVersion>of(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse)) { return super.equals(obj); } com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse other = (com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) obj; boolean result = true; result = result && getCryptoKeyVersionsList().equals(other.getCryptoKeyVersionsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && (getTotalSize() == other.getTotalSize()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getCryptoKeyVersionsCount() > 0) { hash = (37 * hash) + CRYPTO_KEY_VERSIONS_FIELD_NUMBER; hash = (53 * hash) + getCryptoKeyVersionsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER; hash = (53 * hash) + getTotalSize(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }