use of com.vmware.flowgate.common.model.IntegrationStatus.Status in project flowgate by vmware.
the class FacilitySoftwareControllerTest method updateAnFacilitySoftware.
@Test
public void updateAnFacilitySoftware() throws Exception {
NlyteAuth nlyteAuth = Mockito.mock(NlyteAuth.class);
Mockito.doReturn(false).when(nlyteAuth).auth(Mockito.any(FacilitySoftwareConfig.class));
Mockito.doReturn(nlyteAuth).when(serverValidationService).createNlyteAuth();
FacilitySoftwareConfig facilitySoftware = createFacilitySoftware();
facilitySoftware.setPassword(EncryptionGuard.encode(facilitySoftware.getPassword()));
facilitySoftwareRepository.save(facilitySoftware);
facilitySoftware.setDescription("for generalUser");
facilitySoftware.setUserName("generalUser");
facilitySoftware.setPassword("generalUserPassword");
try {
this.mockMvc.perform(put("/v1/facilitysoftware").contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsString(facilitySoftware))).andDo(document("facilitySoftware-update-example", requestFields(fieldWithPath("id").description("ID of the facilitySoftware, created by flowgate"), fieldWithPath("name").description("The facilitySoftware name."), fieldWithPath("description").description("The facilitySoftware description."), fieldWithPath("serverURL").description("The server's address, it can be an IP or FQDN."), fieldWithPath("userName").description("An username used to obtain authorization"), fieldWithPath("password").description(" A password used to obtain authorization."), fieldWithPath("type").description("A type for facilitySoftware,forExample Nlyte,PowerIQ,Device42,OtherDCIM or OtherCMDB").type(AssetSubCategory.class).optional(), fieldWithPath("userId").description("userId"), fieldWithPath("subCategory").description("subCategory"), fieldWithPath("verifyCert").description("Whether to verify the certificate when accessing the serverURL."), fieldWithPath("advanceSetting").description("advanceSetting"), fieldWithPath("integrationStatus.status").type(IntegrationStatus.Status.class).description("The status of integration.").optional(), fieldWithPath("integrationStatus.detail").type(String.class).description("If the status is error, it means error message").optional(), fieldWithPath("integrationStatus.retryCounter").type(JsonFieldType.NUMBER).description("Retry counter").optional())));
facilitySoftware.setPassword(null);
this.mockMvc.perform(put("/v1/facilitysoftware").contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsString(facilitySoftware))).andDo(document("facilitySoftware-update-example", requestFields(fieldWithPath("id").description("ID of the facilitySoftware, created by flowgate"), fieldWithPath("name").description("The facilitySoftware name."), fieldWithPath("description").description("The facilitySoftware description."), fieldWithPath("serverURL").description("The server's address, it can be an IP or FQDN."), fieldWithPath("userName").description("An username used to obtain authorization"), fieldWithPath("password").description(" A password used to obtain authorization."), fieldWithPath("type").description("A type for facilitySoftware,forExample Nlyte,PowerIQ,Device42,OtherDCIM or OtherCMDB").type(AssetSubCategory.class).optional(), fieldWithPath("userId").description("userId"), fieldWithPath("subCategory").description("subCategory"), fieldWithPath("verifyCert").description("Whether to verify the certificate when accessing the serverURL."), fieldWithPath("advanceSetting").description("advanceSetting"), fieldWithPath("integrationStatus.status").type(IntegrationStatus.Status.class).description("The status of integration.").optional(), fieldWithPath("integrationStatus.detail").type(String.class).description("If the status is error, it means error message").optional(), fieldWithPath("integrationStatus.retryCounter").type(JsonFieldType.NUMBER).description("Retry counter").optional())));
} catch (Exception e) {
TestCase.fail();
} finally {
facilitySoftwareRepository.deleteById(facilitySoftware.getId());
}
}
Aggregations