public Builder mergeFrom(com.google.containeranalysis.v1beta1.ScanConfig other) { if (other == com.google.containeranalysis.v1beta1.ScanConfig.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getDescription().isEmpty()) { description_ = other.description_; onChanged(); } if (other.getEnabled() != false) { setEnabled(other.getEnabled()); } if (other.hasCreateTime()) { mergeCreateTime(other.getCreateTime()); } if (other.hasUpdateTime()) { mergeUpdateTime(other.getUpdateTime()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void getScanConfigTest() { ScanConfigName name2 = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); String description = "description-1724546052"; boolean enabled = false; ScanConfig expectedResponse = ScanConfig.newBuilder() .setName(name2.toString()) .setDescription(description) .setEnabled(enabled) .build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig actualResponse = client.getScanConfig(name); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetScanConfigRequest actualRequest = (GetScanConfigRequest) actualRequests.get(0); Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void updateScanConfigTest() { ScanConfigName name2 = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); String description = "description-1724546052"; boolean enabled = false; ScanConfig expectedResponse = ScanConfig.newBuilder() .setName(name2.toString()) .setDescription(description) .setEnabled(enabled) .build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); ScanConfig actualResponse = client.updateScanConfig(name, scanConfig); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateScanConfigRequest actualRequest = (UpdateScanConfigRequest) actualRequests.get(0); Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName())); Assert.assertEquals(scanConfig, actualRequest.getScanConfig()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
public Builder mergeFrom(com.google.containeranalysis.v1beta1.ScanConfig other) { if (other == com.google.containeranalysis.v1beta1.ScanConfig.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getDescription().isEmpty()) { description_ = other.description_; onChanged(); } if (other.getEnabled() != false) { setEnabled(other.getEnabled()); } if (other.hasCreateTime()) { mergeCreateTime(other.getCreateTime()); } if (other.hasUpdateTime()) { mergeUpdateTime(other.getUpdateTime()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }