Committed by
Gerrit Code Review
Renaming Partition{Service, Manager, Event} to IntentPartition{Service, Manager,…
… Event} to better disambiguate between another PartitionService that is responsible for managing datastore partitions Change-Id: I74d311ae991fb241563a1475ea74a625d8069142
Showing
12 changed files
with
58 additions
and
58 deletions
| ... | @@ -51,7 +51,7 @@ import org.onosproject.net.intent.IntentEvent; | ... | @@ -51,7 +51,7 @@ import org.onosproject.net.intent.IntentEvent; |
| 51 | import org.onosproject.net.intent.IntentListener; | 51 | import org.onosproject.net.intent.IntentListener; |
| 52 | import org.onosproject.net.intent.IntentService; | 52 | import org.onosproject.net.intent.IntentService; |
| 53 | import org.onosproject.net.intent.Key; | 53 | import org.onosproject.net.intent.Key; |
| 54 | -import org.onosproject.net.intent.PartitionService; | 54 | +import org.onosproject.net.intent.IntentPartitionService; |
| 55 | import org.onosproject.net.intent.PointToPointIntent; | 55 | import org.onosproject.net.intent.PointToPointIntent; |
| 56 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | 56 | import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
| 57 | import org.onosproject.store.cluster.messaging.MessageSubject; | 57 | import org.onosproject.store.cluster.messaging.MessageSubject; |
| ... | @@ -139,7 +139,7 @@ public class IntentPerfInstaller { | ... | @@ -139,7 +139,7 @@ public class IntentPerfInstaller { |
| 139 | protected MastershipService mastershipService; | 139 | protected MastershipService mastershipService; |
| 140 | 140 | ||
| 141 | @Reference(cardinality = MANDATORY_UNARY) | 141 | @Reference(cardinality = MANDATORY_UNARY) |
| 142 | - protected PartitionService partitionService; | 142 | + protected IntentPartitionService partitionService; |
| 143 | 143 | ||
| 144 | @Reference(cardinality = MANDATORY_UNARY) | 144 | @Reference(cardinality = MANDATORY_UNARY) |
| 145 | protected ComponentConfigService configService; | 145 | protected ComponentConfigService configService; | ... | ... |
| ... | @@ -23,13 +23,13 @@ import org.onosproject.event.AbstractEvent; | ... | @@ -23,13 +23,13 @@ import org.onosproject.event.AbstractEvent; |
| 23 | */ | 23 | */ |
| 24 | //TODO change String into a proper object type | 24 | //TODO change String into a proper object type |
| 25 | @Beta | 25 | @Beta |
| 26 | -public class PartitionEvent extends AbstractEvent<PartitionEvent.Type, String> { | 26 | +public class IntentPartitionEvent extends AbstractEvent<IntentPartitionEvent.Type, String> { |
| 27 | 27 | ||
| 28 | public enum Type { | 28 | public enum Type { |
| 29 | LEADER_CHANGED | 29 | LEADER_CHANGED |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | - public PartitionEvent(Type type, String partition) { | 32 | + public IntentPartitionEvent(Type type, String partition) { |
| 33 | super(type, partition); | 33 | super(type, partition); |
| 34 | } | 34 | } |
| 35 | } | 35 | } | ... | ... |
| ... | @@ -22,5 +22,5 @@ import org.onosproject.event.EventListener; | ... | @@ -22,5 +22,5 @@ import org.onosproject.event.EventListener; |
| 22 | * Entity capable of receiving device partition-related events. | 22 | * Entity capable of receiving device partition-related events. |
| 23 | */ | 23 | */ |
| 24 | @Beta | 24 | @Beta |
| 25 | -public interface PartitionEventListener extends EventListener<PartitionEvent> { | 25 | +public interface IntentPartitionEventListener extends EventListener<IntentPartitionEvent> { |
| 26 | } | 26 | } | ... | ... |
| ... | @@ -20,11 +20,11 @@ import org.onosproject.cluster.NodeId; | ... | @@ -20,11 +20,11 @@ import org.onosproject.cluster.NodeId; |
| 20 | import org.onosproject.event.ListenerService; | 20 | import org.onosproject.event.ListenerService; |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | - * Service for interacting with the partition-to-instance assignments. | 23 | + * Service for interacting with the intent partition-to-instance assignments. |
| 24 | */ | 24 | */ |
| 25 | @Beta | 25 | @Beta |
| 26 | -public interface PartitionService | 26 | +public interface IntentPartitionService |
| 27 | - extends ListenerService<PartitionEvent, PartitionEventListener> { | 27 | + extends ListenerService<IntentPartitionEvent, IntentPartitionEventListener> { |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * Returns whether the given intent key is in a partition owned by this | 30 | * Returns whether the given intent key is in a partition owned by this | ... | ... |
| ... | @@ -18,9 +18,9 @@ package org.onosproject.net.intent; | ... | @@ -18,9 +18,9 @@ package org.onosproject.net.intent; |
| 18 | import org.onosproject.cluster.NodeId; | 18 | import org.onosproject.cluster.NodeId; |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | - * Testing adapter for the partition service. | 21 | + * Testing adapter for the IntentPartitionService. |
| 22 | */ | 22 | */ |
| 23 | -public class PartitionServiceAdapter implements PartitionService { | 23 | +public class IntentPartitionServiceAdapter implements IntentPartitionService { |
| 24 | @Override | 24 | @Override |
| 25 | public boolean isMine(Key intentKey) { | 25 | public boolean isMine(Key intentKey) { |
| 26 | return true; | 26 | return true; |
| ... | @@ -32,12 +32,12 @@ public class PartitionServiceAdapter implements PartitionService { | ... | @@ -32,12 +32,12 @@ public class PartitionServiceAdapter implements PartitionService { |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | @Override | 34 | @Override |
| 35 | - public void addListener(PartitionEventListener listener) { | 35 | + public void addListener(IntentPartitionEventListener listener) { |
| 36 | 36 | ||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | @Override | 39 | @Override |
| 40 | - public void removeListener(PartitionEventListener listener) { | 40 | + public void removeListener(IntentPartitionEventListener listener) { |
| 41 | 41 | ||
| 42 | } | 42 | } |
| 43 | } | 43 | } | ... | ... |
| ... | @@ -33,9 +33,9 @@ import org.onosproject.cluster.NodeId; | ... | @@ -33,9 +33,9 @@ import org.onosproject.cluster.NodeId; |
| 33 | import org.onosproject.event.EventDeliveryService; | 33 | import org.onosproject.event.EventDeliveryService; |
| 34 | import org.onosproject.event.ListenerRegistry; | 34 | import org.onosproject.event.ListenerRegistry; |
| 35 | import org.onosproject.net.intent.Key; | 35 | import org.onosproject.net.intent.Key; |
| 36 | -import org.onosproject.net.intent.PartitionEvent; | 36 | +import org.onosproject.net.intent.IntentPartitionEvent; |
| 37 | -import org.onosproject.net.intent.PartitionEventListener; | 37 | +import org.onosproject.net.intent.IntentPartitionEventListener; |
| 38 | -import org.onosproject.net.intent.PartitionService; | 38 | +import org.onosproject.net.intent.IntentPartitionService; |
| 39 | import org.onosproject.store.AbstractStore; | 39 | import org.onosproject.store.AbstractStore; |
| 40 | import org.slf4j.Logger; | 40 | import org.slf4j.Logger; |
| 41 | 41 | ||
| ... | @@ -51,7 +51,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -51,7 +51,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
| 51 | @Service | 51 | @Service |
| 52 | public class SimpleClusterStore | 52 | public class SimpleClusterStore |
| 53 | extends AbstractStore<ClusterEvent, ClusterStoreDelegate> | 53 | extends AbstractStore<ClusterEvent, ClusterStoreDelegate> |
| 54 | - implements ClusterStore, PartitionService { | 54 | + implements ClusterStore, IntentPartitionService { |
| 55 | 55 | ||
| 56 | public static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1"); | 56 | public static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1"); |
| 57 | 57 | ||
| ... | @@ -64,21 +64,21 @@ public class SimpleClusterStore | ... | @@ -64,21 +64,21 @@ public class SimpleClusterStore |
| 64 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 64 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 65 | protected EventDeliveryService eventDispatcher; | 65 | protected EventDeliveryService eventDispatcher; |
| 66 | 66 | ||
| 67 | - private ListenerRegistry<PartitionEvent, PartitionEventListener> listenerRegistry; | 67 | + private ListenerRegistry<IntentPartitionEvent, IntentPartitionEventListener> listenerRegistry; |
| 68 | 68 | ||
| 69 | @Activate | 69 | @Activate |
| 70 | public void activate() { | 70 | public void activate() { |
| 71 | instance = new DefaultControllerNode(new NodeId("local"), LOCALHOST); | 71 | instance = new DefaultControllerNode(new NodeId("local"), LOCALHOST); |
| 72 | 72 | ||
| 73 | listenerRegistry = new ListenerRegistry<>(); | 73 | listenerRegistry = new ListenerRegistry<>(); |
| 74 | - eventDispatcher.addSink(PartitionEvent.class, listenerRegistry); | 74 | + eventDispatcher.addSink(IntentPartitionEvent.class, listenerRegistry); |
| 75 | 75 | ||
| 76 | log.info("Started"); | 76 | log.info("Started"); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | @Deactivate | 79 | @Deactivate |
| 80 | public void deactivate() { | 80 | public void deactivate() { |
| 81 | - eventDispatcher.removeSink(PartitionEvent.class); | 81 | + eventDispatcher.removeSink(IntentPartitionEvent.class); |
| 82 | log.info("Stopped"); | 82 | log.info("Stopped"); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| ... | @@ -128,12 +128,12 @@ public class SimpleClusterStore | ... | @@ -128,12 +128,12 @@ public class SimpleClusterStore |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | @Override | 130 | @Override |
| 131 | - public void addListener(PartitionEventListener listener) { | 131 | + public void addListener(IntentPartitionEventListener listener) { |
| 132 | listenerRegistry.addListener(listener); | 132 | listenerRegistry.addListener(listener); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | @Override | 135 | @Override |
| 136 | - public void removeListener(PartitionEventListener listener) { | 136 | + public void removeListener(IntentPartitionEventListener listener) { |
| 137 | listenerRegistry.removeListener(listener); | 137 | listenerRegistry.removeListener(listener); |
| 138 | } | 138 | } |
| 139 | } | 139 | } | ... | ... |
| ... | @@ -45,9 +45,9 @@ import org.onosproject.net.intent.Intent; | ... | @@ -45,9 +45,9 @@ import org.onosproject.net.intent.Intent; |
| 45 | import org.onosproject.net.intent.IntentData; | 45 | import org.onosproject.net.intent.IntentData; |
| 46 | import org.onosproject.net.intent.IntentService; | 46 | import org.onosproject.net.intent.IntentService; |
| 47 | import org.onosproject.net.intent.Key; | 47 | import org.onosproject.net.intent.Key; |
| 48 | -import org.onosproject.net.intent.PartitionEvent; | 48 | +import org.onosproject.net.intent.IntentPartitionEvent; |
| 49 | -import org.onosproject.net.intent.PartitionEventListener; | 49 | +import org.onosproject.net.intent.IntentPartitionEventListener; |
| 50 | -import org.onosproject.net.intent.PartitionService; | 50 | +import org.onosproject.net.intent.IntentPartitionService; |
| 51 | import org.onosproject.net.link.LinkEvent; | 51 | import org.onosproject.net.link.LinkEvent; |
| 52 | import org.onosproject.net.newresource.ResourceEvent; | 52 | import org.onosproject.net.newresource.ResourceEvent; |
| 53 | import org.onosproject.net.newresource.ResourceListener; | 53 | import org.onosproject.net.newresource.ResourceListener; |
| ... | @@ -116,7 +116,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -116,7 +116,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
| 116 | protected IntentService intentService; | 116 | protected IntentService intentService; |
| 117 | 117 | ||
| 118 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 118 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 119 | - protected PartitionService partitionService; | 119 | + protected IntentPartitionService partitionService; |
| 120 | 120 | ||
| 121 | private ExecutorService executorService = | 121 | private ExecutorService executorService = |
| 122 | newSingleThreadExecutor(groupedThreads("onos/intent", "objectivetracker")); | 122 | newSingleThreadExecutor(groupedThreads("onos/intent", "objectivetracker")); |
| ... | @@ -127,7 +127,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -127,7 +127,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
| 127 | private ResourceListener resourceListener = new InternalResourceListener(); | 127 | private ResourceListener resourceListener = new InternalResourceListener(); |
| 128 | private DeviceListener deviceListener = new InternalDeviceListener(); | 128 | private DeviceListener deviceListener = new InternalDeviceListener(); |
| 129 | private HostListener hostListener = new InternalHostListener(); | 129 | private HostListener hostListener = new InternalHostListener(); |
| 130 | - private PartitionEventListener partitionListener = new InternalPartitionListener(); | 130 | + private IntentPartitionEventListener partitionListener = new InternalPartitionListener(); |
| 131 | private TopologyChangeDelegate delegate; | 131 | private TopologyChangeDelegate delegate; |
| 132 | 132 | ||
| 133 | protected final AtomicBoolean updateScheduled = new AtomicBoolean(false); | 133 | protected final AtomicBoolean updateScheduled = new AtomicBoolean(false); |
| ... | @@ -445,9 +445,9 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -445,9 +445,9 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | - private final class InternalPartitionListener implements PartitionEventListener { | 448 | + private final class InternalPartitionListener implements IntentPartitionEventListener { |
| 449 | @Override | 449 | @Override |
| 450 | - public void event(PartitionEvent event) { | 450 | + public void event(IntentPartitionEvent event) { |
| 451 | log.debug("got message {}", event.subject()); | 451 | log.debug("got message {}", event.subject()); |
| 452 | scheduleIntentUpdate(1); | 452 | scheduleIntentUpdate(1); |
| 453 | } | 453 | } | ... | ... |
| ... | @@ -42,7 +42,7 @@ import org.onosproject.net.host.HostService; | ... | @@ -42,7 +42,7 @@ import org.onosproject.net.host.HostService; |
| 42 | import org.onosproject.net.intent.IntentService; | 42 | import org.onosproject.net.intent.IntentService; |
| 43 | import org.onosproject.net.intent.IntentExtensionService; | 43 | import org.onosproject.net.intent.IntentExtensionService; |
| 44 | import org.onosproject.net.intent.IntentClockService; | 44 | import org.onosproject.net.intent.IntentClockService; |
| 45 | -import org.onosproject.net.intent.PartitionService; | 45 | +import org.onosproject.net.intent.IntentPartitionService; |
| 46 | import org.onosproject.net.link.LinkAdminService; | 46 | import org.onosproject.net.link.LinkAdminService; |
| 47 | import org.onosproject.net.link.LinkService; | 47 | import org.onosproject.net.link.LinkService; |
| 48 | import org.onosproject.net.packet.PacketService; | 48 | import org.onosproject.net.packet.PacketService; |
| ... | @@ -193,7 +193,7 @@ public final class DefaultPolicyBuilder { | ... | @@ -193,7 +193,7 @@ public final class DefaultPolicyBuilder { |
| 193 | permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET)); | 193 | permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET)); |
| 194 | permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET)); | 194 | permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET)); |
| 195 | permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET)); | 195 | permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET)); |
| 196 | - permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET)); | 196 | + permSet.add(new ServicePermission(IntentPartitionService.class.getName(), ServicePermission.GET)); |
| 197 | permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET)); | 197 | permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET)); |
| 198 | permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET)); | 198 | permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET)); |
| 199 | // permSet.add(new ServicePermission(LabelResourceService.class.getName(), ServicePermission.GET)); | 199 | // permSet.add(new ServicePermission(LabelResourceService.class.getName(), ServicePermission.GET)); |
| ... | @@ -262,7 +262,7 @@ public final class DefaultPolicyBuilder { | ... | @@ -262,7 +262,7 @@ public final class DefaultPolicyBuilder { |
| 262 | serviceDirectory.put(HOST_EVENT, ImmutableSet.of( | 262 | serviceDirectory.put(HOST_EVENT, ImmutableSet.of( |
| 263 | HostService.class.getName())); | 263 | HostService.class.getName())); |
| 264 | serviceDirectory.put(INTENT_READ, ImmutableSet.of( | 264 | serviceDirectory.put(INTENT_READ, ImmutableSet.of( |
| 265 | - IntentService.class.getName(), PartitionService.class.getName(), | 265 | + IntentService.class.getName(), IntentPartitionService.class.getName(), |
| 266 | IntentClockService.class.getName())); | 266 | IntentClockService.class.getName())); |
| 267 | serviceDirectory.put(INTENT_WRITE, ImmutableSet.of( | 267 | serviceDirectory.put(INTENT_WRITE, ImmutableSet.of( |
| 268 | IntentService.class.getName())); | 268 | IntentService.class.getName())); | ... | ... |
| ... | @@ -35,7 +35,7 @@ import org.onosproject.net.intent.IntentState; | ... | @@ -35,7 +35,7 @@ import org.onosproject.net.intent.IntentState; |
| 35 | import org.onosproject.net.intent.IntentStore; | 35 | import org.onosproject.net.intent.IntentStore; |
| 36 | import org.onosproject.net.intent.IntentStoreDelegate; | 36 | import org.onosproject.net.intent.IntentStoreDelegate; |
| 37 | import org.onosproject.net.intent.Key; | 37 | import org.onosproject.net.intent.Key; |
| 38 | -import org.onosproject.net.intent.PartitionService; | 38 | +import org.onosproject.net.intent.IntentPartitionService; |
| 39 | import org.onosproject.store.AbstractStore; | 39 | import org.onosproject.store.AbstractStore; |
| 40 | import org.onosproject.store.service.MultiValuedTimestamp; | 40 | import org.onosproject.store.service.MultiValuedTimestamp; |
| 41 | import org.onosproject.store.service.WallClockTimestamp; | 41 | import org.onosproject.store.service.WallClockTimestamp; |
| ... | @@ -83,7 +83,7 @@ public class GossipIntentStore | ... | @@ -83,7 +83,7 @@ public class GossipIntentStore |
| 83 | protected StorageService storageService; | 83 | protected StorageService storageService; |
| 84 | 84 | ||
| 85 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 85 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 86 | - protected PartitionService partitionService; | 86 | + protected IntentPartitionService partitionService; |
| 87 | 87 | ||
| 88 | private final AtomicLong sequenceNumber = new AtomicLong(0); | 88 | private final AtomicLong sequenceNumber = new AtomicLong(0); |
| 89 | 89 | ... | ... |
| ... | @@ -33,9 +33,9 @@ import org.onosproject.cluster.NodeId; | ... | @@ -33,9 +33,9 @@ import org.onosproject.cluster.NodeId; |
| 33 | import org.onosproject.event.EventDeliveryService; | 33 | import org.onosproject.event.EventDeliveryService; |
| 34 | import org.onosproject.event.ListenerRegistry; | 34 | import org.onosproject.event.ListenerRegistry; |
| 35 | import org.onosproject.net.intent.Key; | 35 | import org.onosproject.net.intent.Key; |
| 36 | -import org.onosproject.net.intent.PartitionEvent; | 36 | +import org.onosproject.net.intent.IntentPartitionEvent; |
| 37 | -import org.onosproject.net.intent.PartitionEventListener; | 37 | +import org.onosproject.net.intent.IntentPartitionEventListener; |
| 38 | -import org.onosproject.net.intent.PartitionService; | 38 | +import org.onosproject.net.intent.IntentPartitionService; |
| 39 | import org.slf4j.Logger; | 39 | import org.slf4j.Logger; |
| 40 | import org.slf4j.LoggerFactory; | 40 | import org.slf4j.LoggerFactory; |
| 41 | 41 | ||
| ... | @@ -52,9 +52,9 @@ import java.util.stream.Collectors; | ... | @@ -52,9 +52,9 @@ import java.util.stream.Collectors; |
| 52 | */ | 52 | */ |
| 53 | @Component(immediate = true) | 53 | @Component(immediate = true) |
| 54 | @Service | 54 | @Service |
| 55 | -public class PartitionManager implements PartitionService { | 55 | +public class IntentPartitionManager implements IntentPartitionService { |
| 56 | 56 | ||
| 57 | - private static final Logger log = LoggerFactory.getLogger(PartitionManager.class); | 57 | + private static final Logger log = LoggerFactory.getLogger(IntentPartitionManager.class); |
| 58 | 58 | ||
| 59 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 59 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 60 | protected LeadershipService leadershipService; | 60 | protected LeadershipService leadershipService; |
| ... | @@ -74,7 +74,7 @@ public class PartitionManager implements PartitionService { | ... | @@ -74,7 +74,7 @@ public class PartitionManager implements PartitionService { |
| 74 | 74 | ||
| 75 | private static final String ELECTION_PREFIX = "intent-partition-"; | 75 | private static final String ELECTION_PREFIX = "intent-partition-"; |
| 76 | 76 | ||
| 77 | - private ListenerRegistry<PartitionEvent, PartitionEventListener> listenerRegistry; | 77 | + private ListenerRegistry<IntentPartitionEvent, IntentPartitionEventListener> listenerRegistry; |
| 78 | private LeadershipEventListener leaderListener = new InternalLeadershipListener(); | 78 | private LeadershipEventListener leaderListener = new InternalLeadershipListener(); |
| 79 | private ClusterEventListener clusterListener = new InternalClusterEventListener(); | 79 | private ClusterEventListener clusterListener = new InternalClusterEventListener(); |
| 80 | 80 | ||
| ... | @@ -87,7 +87,7 @@ public class PartitionManager implements PartitionService { | ... | @@ -87,7 +87,7 @@ public class PartitionManager implements PartitionService { |
| 87 | clusterService.addListener(clusterListener); | 87 | clusterService.addListener(clusterListener); |
| 88 | 88 | ||
| 89 | listenerRegistry = new ListenerRegistry<>(); | 89 | listenerRegistry = new ListenerRegistry<>(); |
| 90 | - eventDispatcher.addSink(PartitionEvent.class, listenerRegistry); | 90 | + eventDispatcher.addSink(IntentPartitionEvent.class, listenerRegistry); |
| 91 | 91 | ||
| 92 | for (int i = 0; i < NUM_PARTITIONS; i++) { | 92 | for (int i = 0; i < NUM_PARTITIONS; i++) { |
| 93 | leadershipService.runForLeadership(getPartitionPath(i)); | 93 | leadershipService.runForLeadership(getPartitionPath(i)); |
| ... | @@ -101,7 +101,7 @@ public class PartitionManager implements PartitionService { | ... | @@ -101,7 +101,7 @@ public class PartitionManager implements PartitionService { |
| 101 | public void deactivate() { | 101 | public void deactivate() { |
| 102 | executor.shutdownNow(); | 102 | executor.shutdownNow(); |
| 103 | 103 | ||
| 104 | - eventDispatcher.removeSink(PartitionEvent.class); | 104 | + eventDispatcher.removeSink(IntentPartitionEvent.class); |
| 105 | leadershipService.removeListener(leaderListener); | 105 | leadershipService.removeListener(leaderListener); |
| 106 | clusterService.removeListener(clusterListener); | 106 | clusterService.removeListener(clusterListener); |
| 107 | } | 107 | } |
| ... | @@ -112,7 +112,7 @@ public class PartitionManager implements PartitionService { | ... | @@ -112,7 +112,7 @@ public class PartitionManager implements PartitionService { |
| 112 | * @param executor scheduled executor service for background tasks | 112 | * @param executor scheduled executor service for background tasks |
| 113 | * @return this PartitionManager | 113 | * @return this PartitionManager |
| 114 | */ | 114 | */ |
| 115 | - public PartitionManager withScheduledExecutor(ScheduledExecutorService executor) { | 115 | + public IntentPartitionManager withScheduledExecutor(ScheduledExecutorService executor) { |
| 116 | this.executor = executor; | 116 | this.executor = executor; |
| 117 | return this; | 117 | return this; |
| 118 | } | 118 | } |
| ... | @@ -146,12 +146,12 @@ public class PartitionManager implements PartitionService { | ... | @@ -146,12 +146,12 @@ public class PartitionManager implements PartitionService { |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | @Override | 148 | @Override |
| 149 | - public void addListener(PartitionEventListener listener) { | 149 | + public void addListener(IntentPartitionEventListener listener) { |
| 150 | listenerRegistry.addListener(listener); | 150 | listenerRegistry.addListener(listener); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | @Override | 153 | @Override |
| 154 | - public void removeListener(PartitionEventListener listener) { | 154 | + public void removeListener(IntentPartitionEventListener listener) { |
| 155 | listenerRegistry.removeListener(listener); | 155 | listenerRegistry.removeListener(listener); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| ... | @@ -226,7 +226,7 @@ public class PartitionManager implements PartitionService { | ... | @@ -226,7 +226,7 @@ public class PartitionManager implements PartitionService { |
| 226 | // See if we need to let some partitions go | 226 | // See if we need to let some partitions go |
| 227 | scheduleRebalance(0); | 227 | scheduleRebalance(0); |
| 228 | 228 | ||
| 229 | - eventDispatcher.post(new PartitionEvent(PartitionEvent.Type.LEADER_CHANGED, | 229 | + eventDispatcher.post(new IntentPartitionEvent(IntentPartitionEvent.Type.LEADER_CHANGED, |
| 230 | leadership.topic())); | 230 | leadership.topic())); |
| 231 | } | 231 | } |
| 232 | } | 232 | } | ... | ... |
| ... | @@ -30,7 +30,7 @@ import org.onosproject.net.intent.IntentData; | ... | @@ -30,7 +30,7 @@ import org.onosproject.net.intent.IntentData; |
| 30 | import org.onosproject.net.intent.IntentState; | 30 | import org.onosproject.net.intent.IntentState; |
| 31 | import org.onosproject.net.intent.IntentTestsMocks; | 31 | import org.onosproject.net.intent.IntentTestsMocks; |
| 32 | import org.onosproject.net.intent.MockIdGenerator; | 32 | import org.onosproject.net.intent.MockIdGenerator; |
| 33 | -import org.onosproject.net.intent.PartitionServiceAdapter; | 33 | +import org.onosproject.net.intent.IntentPartitionServiceAdapter; |
| 34 | import org.onosproject.store.service.TestStorageService; | 34 | import org.onosproject.store.service.TestStorageService; |
| 35 | 35 | ||
| 36 | import static org.hamcrest.Matchers.is; | 36 | import static org.hamcrest.Matchers.is; |
| ... | @@ -52,7 +52,7 @@ public class GossipIntentStoreTest { | ... | @@ -52,7 +52,7 @@ public class GossipIntentStoreTest { |
| 52 | public void setUp() { | 52 | public void setUp() { |
| 53 | intentStore = new GossipIntentStore(); | 53 | intentStore = new GossipIntentStore(); |
| 54 | intentStore.storageService = new TestStorageService(); | 54 | intentStore.storageService = new TestStorageService(); |
| 55 | - intentStore.partitionService = new PartitionServiceAdapter(); | 55 | + intentStore.partitionService = new IntentPartitionServiceAdapter(); |
| 56 | intentStore.clusterService = new ClusterServiceAdapter(); | 56 | intentStore.clusterService = new ClusterServiceAdapter(); |
| 57 | idGenerator = new MockIdGenerator(); | 57 | idGenerator = new MockIdGenerator(); |
| 58 | Intent.bindIdGenerator(idGenerator); | 58 | Intent.bindIdGenerator(idGenerator); | ... | ... |
| ... | @@ -50,9 +50,9 @@ import static org.easymock.EasyMock.verify; | ... | @@ -50,9 +50,9 @@ import static org.easymock.EasyMock.verify; |
| 50 | import static org.junit.Assert.assertTrue; | 50 | import static org.junit.Assert.assertTrue; |
| 51 | 51 | ||
| 52 | /** | 52 | /** |
| 53 | - * Unit tests for the PartitionManager class. | 53 | + * Unit tests for the IntentPartitionManager class. |
| 54 | */ | 54 | */ |
| 55 | -public class PartitionManagerTest { | 55 | +public class IntentPartitionManagerTest { |
| 56 | 56 | ||
| 57 | private final LeadershipEvent event | 57 | private final LeadershipEvent event |
| 58 | = new LeadershipEvent(LeadershipEvent.Type.LEADER_ELECTED, | 58 | = new LeadershipEvent(LeadershipEvent.Type.LEADER_ELECTED, |
| ... | @@ -68,7 +68,7 @@ public class PartitionManagerTest { | ... | @@ -68,7 +68,7 @@ public class PartitionManagerTest { |
| 68 | private LeadershipService leadershipService; | 68 | private LeadershipService leadershipService; |
| 69 | private LeadershipEventListener leaderListener; | 69 | private LeadershipEventListener leaderListener; |
| 70 | 70 | ||
| 71 | - private PartitionManager partitionManager; | 71 | + private IntentPartitionManager partitionManager; |
| 72 | 72 | ||
| 73 | @Before | 73 | @Before |
| 74 | public void setUp() { | 74 | public void setUp() { |
| ... | @@ -76,13 +76,13 @@ public class PartitionManagerTest { | ... | @@ -76,13 +76,13 @@ public class PartitionManagerTest { |
| 76 | 76 | ||
| 77 | leadershipService.addListener(anyObject(LeadershipEventListener.class)); | 77 | leadershipService.addListener(anyObject(LeadershipEventListener.class)); |
| 78 | expectLastCall().andDelegateTo(new TestLeadershipService()); | 78 | expectLastCall().andDelegateTo(new TestLeadershipService()); |
| 79 | - for (int i = 0; i < PartitionManager.NUM_PARTITIONS; i++) { | 79 | + for (int i = 0; i < IntentPartitionManager.NUM_PARTITIONS; i++) { |
| 80 | expect(leadershipService.runForLeadership(ELECTION_PREFIX + i)) | 80 | expect(leadershipService.runForLeadership(ELECTION_PREFIX + i)) |
| 81 | .andReturn(CompletableFuture.completedFuture(null)) | 81 | .andReturn(CompletableFuture.completedFuture(null)) |
| 82 | .times(1); | 82 | .times(1); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | - partitionManager = new PartitionManager() | 85 | + partitionManager = new IntentPartitionManager() |
| 86 | .withScheduledExecutor(new NullScheduledExecutor()); | 86 | .withScheduledExecutor(new NullScheduledExecutor()); |
| 87 | 87 | ||
| 88 | partitionManager.clusterService = new TestClusterService(); | 88 | partitionManager.clusterService = new TestClusterService(); |
| ... | @@ -108,7 +108,7 @@ public class PartitionManagerTest { | ... | @@ -108,7 +108,7 @@ public class PartitionManagerTest { |
| 108 | new Leadership(ELECTION_PREFIX + i, MY_NODE_ID, 0, 0)); | 108 | new Leadership(ELECTION_PREFIX + i, MY_NODE_ID, 0, 0)); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | - for (int i = numMine; i < PartitionManager.NUM_PARTITIONS; i++) { | 111 | + for (int i = numMine; i < IntentPartitionManager.NUM_PARTITIONS; i++) { |
| 112 | expect(leadershipService.getLeader(ELECTION_PREFIX + i)) | 112 | expect(leadershipService.getLeader(ELECTION_PREFIX + i)) |
| 113 | .andReturn(OTHER_NODE_ID).anyTimes(); | 113 | .andReturn(OTHER_NODE_ID).anyTimes(); |
| 114 | 114 | ||
| ... | @@ -129,7 +129,7 @@ public class PartitionManagerTest { | ... | @@ -129,7 +129,7 @@ public class PartitionManagerTest { |
| 129 | 129 | ||
| 130 | leadershipService.addListener(anyObject(LeadershipEventListener.class)); | 130 | leadershipService.addListener(anyObject(LeadershipEventListener.class)); |
| 131 | 131 | ||
| 132 | - for (int i = 0; i < PartitionManager.NUM_PARTITIONS; i++) { | 132 | + for (int i = 0; i < IntentPartitionManager.NUM_PARTITIONS; i++) { |
| 133 | expect(leadershipService.runForLeadership(ELECTION_PREFIX + i)) | 133 | expect(leadershipService.runForLeadership(ELECTION_PREFIX + i)) |
| 134 | .andReturn(CompletableFuture.completedFuture(null)) | 134 | .andReturn(CompletableFuture.completedFuture(null)) |
| 135 | .times(1); | 135 | .times(1); |
| ... | @@ -179,7 +179,7 @@ public class PartitionManagerTest { | ... | @@ -179,7 +179,7 @@ public class PartitionManagerTest { |
| 179 | @Test | 179 | @Test |
| 180 | public void testRebalanceScheduling() { | 180 | public void testRebalanceScheduling() { |
| 181 | // We have all the partitions so we'll need to relinquish some | 181 | // We have all the partitions so we'll need to relinquish some |
| 182 | - setUpLeadershipService(PartitionManager.NUM_PARTITIONS); | 182 | + setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS); |
| 183 | 183 | ||
| 184 | replay(leadershipService); | 184 | replay(leadershipService); |
| 185 | 185 | ||
| ... | @@ -198,7 +198,7 @@ public class PartitionManagerTest { | ... | @@ -198,7 +198,7 @@ public class PartitionManagerTest { |
| 198 | @Test | 198 | @Test |
| 199 | public void testRebalance() { | 199 | public void testRebalance() { |
| 200 | // We have all the partitions so we'll need to relinquish some | 200 | // We have all the partitions so we'll need to relinquish some |
| 201 | - setUpLeadershipService(PartitionManager.NUM_PARTITIONS); | 201 | + setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS); |
| 202 | 202 | ||
| 203 | expect(leadershipService.withdraw(anyString())) | 203 | expect(leadershipService.withdraw(anyString())) |
| 204 | .andReturn(CompletableFuture.completedFuture(null)) | 204 | .andReturn(CompletableFuture.completedFuture(null)) |
| ... | @@ -221,7 +221,7 @@ public class PartitionManagerTest { | ... | @@ -221,7 +221,7 @@ public class PartitionManagerTest { |
| 221 | @Test | 221 | @Test |
| 222 | public void testNoRebalance() { | 222 | public void testNoRebalance() { |
| 223 | // Partitions are already perfectly balanced among the two active instances | 223 | // Partitions are already perfectly balanced among the two active instances |
| 224 | - setUpLeadershipService(PartitionManager.NUM_PARTITIONS / 2); | 224 | + setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS / 2); |
| 225 | replay(leadershipService); | 225 | replay(leadershipService); |
| 226 | 226 | ||
| 227 | partitionManager.activate(); | 227 | partitionManager.activate(); |
| ... | @@ -233,7 +233,7 @@ public class PartitionManagerTest { | ... | @@ -233,7 +233,7 @@ public class PartitionManagerTest { |
| 233 | 233 | ||
| 234 | reset(leadershipService); | 234 | reset(leadershipService); |
| 235 | // We have a smaller share than we should | 235 | // We have a smaller share than we should |
| 236 | - setUpLeadershipService(PartitionManager.NUM_PARTITIONS / 2 - 1); | 236 | + setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS / 2 - 1); |
| 237 | replay(leadershipService); | 237 | replay(leadershipService); |
| 238 | 238 | ||
| 239 | // trigger rebalance | 239 | // trigger rebalance | ... | ... |
-
Please register or login to post a comment