use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class InfobloxServiceTest method testExecuteAsyncNotFindIP.
@Test
public void testExecuteAsyncNotFindIP() {
EventMessage eventMessage = EventMessageUtil.createEventMessage(EventType.InfoBlox, null, "10.161.71.154");
ResponseEntity<FacilitySoftwareConfig[]> infobloxFacilitySoftware = this.getInfobloxFacilitySoftware();
Mockito.doReturn(infobloxFacilitySoftware).when(wormholeAPIClient).getFacilitySoftwareInternalByType(FacilitySoftwareConfig.SoftwareType.InfoBlox);
Mockito.doReturn(new ArrayList<>()).when(infobloxClient).queryHostRecordByIP(Mockito.anyString());
Mockito.doReturn(null).when(infobloxClient).queryIpv4addressByIP(Mockito.anyString());
infoBloxService.executeAsync(eventMessage);
TestCase.assertEquals(IntegrationStatus.Status.ACTIVE, Objects.requireNonNull(infobloxFacilitySoftware.getBody())[0].getIntegrationStatus().getStatus());
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class EventMessageUtil method createEventMessage.
public static EventMessage createEventMessage(EventType type, String targetCommand, String message) {
EventUser targetUser = new EventUserImpl(targetCommand);
Set<EventUser> users = new HashSet<EventUser>();
users.add(targetUser);
EventTarget target = new EventTargetImpl(users);
EventMessage newMessage = new EventMessageImpl(type, null, null, target, new Date().getTime(), message);
return newMessage;
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class EventMessageUtil method generateFacilityNotifyMessage.
public static String generateFacilityNotifyMessage(EventType type) throws IOException {
String command = typeAndCommandIdMap.get(type);
if (command == null) {
return null;
}
EventMessage message = EventMessageUtil.createEventMessage(type, command, "");
;
return EventMessageUtil.convertEventMessageAsString(message);
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class RedisMessageReceiver method receiveMessage.
@Override
public void receiveMessage(String message) {
try {
EventMessage eventMessage = mapper.readValue(message, EventMessageImpl.class);
asyncService.executeAsync(eventMessage);
} catch (IOException e) {
logger.error(String.format("Failed prase message:%s ", message), e);
}
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class RedisMessageReceiver method receiveMessage.
@Override
public void receiveMessage(String message) {
try {
EventMessage eventMessage = mapper.readValue(message, EventMessageImpl.class);
asyncService.executeAsync(eventMessage);
} catch (IOException e) {
logger.info(String.format("Failed prase message %s", message));
}
}
Aggregations