import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public void destroyTopicTest() throws Exception {
topicTestHelper();
TopicId topicId = new TopicId("topic-id-007");
- Map<TopicId,EventSourceTopic> localMap = getEventSourceTopicMap();
+ Map<TopicId, EventSourceTopic> localMap = eventSourceTopology.getEventSourceTopicMap();
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"),
"pattern", eventSourceTopology);
localMap.put(topicId, eventSourceTopic);
public void closeTest() throws Exception {
constructorTestHelper();
topicTestHelper();
- Map<TopicId,EventSourceTopic> localMap = getEventSourceTopicMap();
+ Map<TopicId, EventSourceTopic> localMap = eventSourceTopology.getEventSourceTopicMap();
TopicId topicIdMock = mock(TopicId.class);
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"),
"pattern", eventSourceTopology);
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
- doReturn(nodeKey).when(nodeMock).getKey();
+ doReturn(nodeKey).when(nodeMock).key();
doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(
BindingAwareBroker.RoutedRpcRegistration.class);
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
- Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap =
- getRoutedRpcRegistrations();
+ Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap = eventSourceTopology
+ .getRoutedRpcRegistrations();
NodeKey nodeKeyMock = mock(NodeKey.class);
doReturn(nodeKeyMock).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration<EventSourceService> routedRpcRegistrationMock =
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
- doReturn(nodeKey).when(nodeMock).getKey();
+ doReturn(nodeKey).when(nodeMock).key();
doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(
BindingAwareBroker.RoutedRpcRegistration.class);
assertNotNull("Return value has not been created correctly.",
eventSourceTopology.registerEventSource(eventSourceMock));
}
-
- private Map getEventSourceTopicMap() throws Exception {
- Field nesField = EventSourceTopology.class.getDeclaredField("eventSourceTopicMap");
- nesField.setAccessible(true);
- return (Map) nesField.get(eventSourceTopology);
- }
-
- private Map getRoutedRpcRegistrations() throws Exception {
- Field nesField = EventSourceTopology.class.getDeclaredField("routedRpcRegistrations");
- nesField.setAccessible(true);
- return (Map) nesField.get(eventSourceTopology);
- }
-
}