use of com.vmware.flowgate.common.model.FacilitySoftwareConfig in project flowgate by vmware.
the class FacilitySoftwareControllerTest method syncFacilityServerDataExample1.
@Test
public void syncFacilityServerDataExample1() throws JsonProcessingException, Exception {
ListOperations<String, String> listOperations = Mockito.mock(ListOperations.class);
Mockito.doReturn(0L).when(listOperations).leftPush(Mockito.anyString(), Mockito.anyString());
Mockito.doReturn(listOperations).when(template).opsForList();
Mockito.doNothing().when(publisher).publish(Mockito.anyString(), Mockito.anyString());
FacilitySoftwareConfig facilitySoftware = createFacilitySoftware();
facilitySoftware.setPassword(EncryptionGuard.encode(facilitySoftware.getPassword()));
facilitySoftware = facilitySoftwareRepository.save(facilitySoftware);
try {
MvcResult result = this.mockMvc.perform(post("/v1/facilitysoftware/syncdatabyserverid/" + facilitySoftware.getId() + "")).andReturn();
if (result.getResolvedException() != null) {
throw result.getResolvedException();
}
} finally {
facilitySoftwareRepository.deleteById(facilitySoftware.getId());
}
}
use of com.vmware.flowgate.common.model.FacilitySoftwareConfig in project flowgate by vmware.
the class FacilitySoftwareControllerTest method createOpenManageThrowNotFoundException.
@Test
public void createOpenManageThrowNotFoundException() throws JsonProcessingException, Exception {
OpenManageAuth openmanageAuth = Mockito.mock(OpenManageAuth.class);
Mockito.doThrow(new HttpClientErrorException(HttpStatus.NOT_FOUND, "Not Found")).when(openmanageAuth).auth(Mockito.any(FacilitySoftwareConfig.class));
Mockito.doReturn(createuser()).when(tokenService).getCurrentUser(any());
Mockito.doReturn(openmanageAuth).when(serverValidationService).createOpenManageAuth();
expectedEx.expect(WormholeRequestException.class);
expectedEx.expectMessage("Unknown Host.Please check your server IP.");
FacilitySoftwareConfig facilitySoftware = createFacilitySoftware();
facilitySoftware.setType(SoftwareType.OpenManage);
facilitySoftware.setName("myOpenManage");
MvcResult result = this.mockMvc.perform(post("/v1/facilitysoftware").contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsString(facilitySoftware))).andExpect(status().is4xxClientError()).andReturn();
if (result.getResolvedException() != null) {
throw result.getResolvedException();
} else {
TestCase.fail();
}
}
use of com.vmware.flowgate.common.model.FacilitySoftwareConfig in project flowgate by vmware.
the class FacilitySoftwareControllerTest method createFacilitySoftware.
FacilitySoftwareConfig createFacilitySoftware() throws Exception {
FacilitySoftwareConfig example = new FacilitySoftwareConfig();
example.setId(UUID.randomUUID().toString());
example.setName("Nlyte");
example.setUserName("administrator@vsphere.local");
example.setPassword("Admin!23");
example.setServerURL("https://10.160.30.134");
example.setType(FacilitySoftwareConfig.SoftwareType.Nlyte);
example.setUserId("1");
example.setVerifyCert(false);
example.setDescription("description");
HashMap advanceSetting = new HashMap<AdvanceSettingType, String>();
example.setAdvanceSetting(advanceSetting);
IntegrationStatus integrationStatus = new IntegrationStatus();
integrationStatus.setDetail("");
integrationStatus.setRetryCounter(0);
integrationStatus.setStatus(Status.ACTIVE);
example.setIntegrationStatus(integrationStatus);
return example;
}
use of com.vmware.flowgate.common.model.FacilitySoftwareConfig in project flowgate by vmware.
the class SystemSummaryTest method createFacility.
FacilitySoftwareConfig createFacility() {
FacilitySoftwareConfig facility = new FacilitySoftwareConfig();
facility.setId(UUID.randomUUID().toString());
return facility;
}
use of com.vmware.flowgate.common.model.FacilitySoftwareConfig in project flowgate by vmware.
the class InfobloxServiceTest method getInfobloxFacilitySoftware.
private ResponseEntity<FacilitySoftwareConfig[]> getInfobloxFacilitySoftware() {
FacilitySoftwareConfig[] facilitySoftwareConfigs = new FacilitySoftwareConfig[1];
FacilitySoftwareConfig facilitySoftwareConfig = new FacilitySoftwareConfig();
facilitySoftwareConfig.setPassword("O75xginpkAD748w=Lc20CrTzd1lEpvDTdJqH5IXBZTb5gYp7P8awDAs19F0=");
facilitySoftwareConfig.setServerURL("https://10.161.71.133");
facilitySoftwareConfig.setName("infoblox-1");
facilitySoftwareConfig.setVerifyCert(false);
IntegrationStatus integrationStatus = new IntegrationStatus();
integrationStatus.setRetryCounter(0);
integrationStatus.setDetail("");
integrationStatus.setStatus(IntegrationStatus.Status.ACTIVE);
facilitySoftwareConfig.setIntegrationStatus(integrationStatus);
facilitySoftwareConfig.setUserName("admin");
facilitySoftwareConfig.setType(FacilitySoftwareConfig.SoftwareType.InfoBlox);
facilitySoftwareConfig.setUserId("e1edfv8953002379827896a1aaiqoose");
facilitySoftwareConfigs[0] = facilitySoftwareConfig;
return new ResponseEntity<>(facilitySoftwareConfigs, HttpStatus.OK);
}
Aggregations