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
diff --git a/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java b/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
index 2a8c14a..5cd451a 100644
--- a/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
+++ b/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
@@ -51,7 +51,7 @@
import org.onosproject.net.intent.IntentListener;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionService;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
import org.onosproject.store.cluster.messaging.MessageSubject;
@@ -139,7 +139,7 @@
protected MastershipService mastershipService;
@Reference(cardinality = MANDATORY_UNARY)
- protected PartitionService partitionService;
+ protected IntentPartitionService partitionService;
@Reference(cardinality = MANDATORY_UNARY)
protected ComponentConfigService configService;
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEvent.java
similarity index 85%
rename from core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java
rename to core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEvent.java
index c79a381..09758e5 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEvent.java
@@ -23,13 +23,13 @@
*/
//TODO change String into a proper object type
@Beta
-public class PartitionEvent extends AbstractEvent<PartitionEvent.Type, String> {
+public class IntentPartitionEvent extends AbstractEvent<IntentPartitionEvent.Type, String> {
public enum Type {
LEADER_CHANGED
}
- public PartitionEvent(Type type, String partition) {
+ public IntentPartitionEvent(Type type, String partition) {
super(type, partition);
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEventListener.java
similarity index 89%
rename from core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java
rename to core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEventListener.java
index 5f1da33..94ea39a 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionEventListener.java
@@ -22,5 +22,5 @@
* Entity capable of receiving device partition-related events.
*/
@Beta
-public interface PartitionEventListener extends EventListener<PartitionEvent> {
+public interface IntentPartitionEventListener extends EventListener<IntentPartitionEvent> {
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionService.java
similarity index 86%
rename from core/api/src/main/java/org/onosproject/net/intent/PartitionService.java
rename to core/api/src/main/java/org/onosproject/net/intent/IntentPartitionService.java
index 02cccca..5231109 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentPartitionService.java
@@ -20,11 +20,11 @@
import org.onosproject.event.ListenerService;
/**
- * Service for interacting with the partition-to-instance assignments.
+ * Service for interacting with the intent partition-to-instance assignments.
*/
@Beta
-public interface PartitionService
- extends ListenerService<PartitionEvent, PartitionEventListener> {
+public interface IntentPartitionService
+ extends ListenerService<IntentPartitionEvent, IntentPartitionEventListener> {
/**
* Returns whether the given intent key is in a partition owned by this
diff --git a/core/api/src/test/java/org/onosproject/net/intent/PartitionServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/intent/IntentPartitionServiceAdapter.java
similarity index 77%
rename from core/api/src/test/java/org/onosproject/net/intent/PartitionServiceAdapter.java
rename to core/api/src/test/java/org/onosproject/net/intent/IntentPartitionServiceAdapter.java
index 2a38cbb..f998971 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/PartitionServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentPartitionServiceAdapter.java
@@ -18,9 +18,9 @@
import org.onosproject.cluster.NodeId;
/**
- * Testing adapter for the partition service.
+ * Testing adapter for the IntentPartitionService.
*/
-public class PartitionServiceAdapter implements PartitionService {
+public class IntentPartitionServiceAdapter implements IntentPartitionService {
@Override
public boolean isMine(Key intentKey) {
return true;
@@ -32,12 +32,12 @@
}
@Override
- public void addListener(PartitionEventListener listener) {
+ public void addListener(IntentPartitionEventListener listener) {
}
@Override
- public void removeListener(PartitionEventListener listener) {
+ public void removeListener(IntentPartitionEventListener listener) {
}
}
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
index 5eea3cc..256abb7 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleClusterStore.java
@@ -33,9 +33,9 @@
import org.onosproject.event.EventDeliveryService;
import org.onosproject.event.ListenerRegistry;
import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.PartitionEvent;
-import org.onosproject.net.intent.PartitionEventListener;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionEvent;
+import org.onosproject.net.intent.IntentPartitionEventListener;
+import org.onosproject.net.intent.IntentPartitionService;
import org.onosproject.store.AbstractStore;
import org.slf4j.Logger;
@@ -51,7 +51,7 @@
@Service
public class SimpleClusterStore
extends AbstractStore<ClusterEvent, ClusterStoreDelegate>
- implements ClusterStore, PartitionService {
+ implements ClusterStore, IntentPartitionService {
public static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1");
@@ -64,21 +64,21 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected EventDeliveryService eventDispatcher;
- private ListenerRegistry<PartitionEvent, PartitionEventListener> listenerRegistry;
+ private ListenerRegistry<IntentPartitionEvent, IntentPartitionEventListener> listenerRegistry;
@Activate
public void activate() {
instance = new DefaultControllerNode(new NodeId("local"), LOCALHOST);
listenerRegistry = new ListenerRegistry<>();
- eventDispatcher.addSink(PartitionEvent.class, listenerRegistry);
+ eventDispatcher.addSink(IntentPartitionEvent.class, listenerRegistry);
log.info("Started");
}
@Deactivate
public void deactivate() {
- eventDispatcher.removeSink(PartitionEvent.class);
+ eventDispatcher.removeSink(IntentPartitionEvent.class);
log.info("Stopped");
}
@@ -128,12 +128,12 @@
}
@Override
- public void addListener(PartitionEventListener listener) {
+ public void addListener(IntentPartitionEventListener listener) {
listenerRegistry.addListener(listener);
}
@Override
- public void removeListener(PartitionEventListener listener) {
+ public void removeListener(IntentPartitionEventListener listener) {
listenerRegistry.removeListener(listener);
}
}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index ff711a0..ef1c0fd 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -45,9 +45,9 @@
import org.onosproject.net.intent.IntentData;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.PartitionEvent;
-import org.onosproject.net.intent.PartitionEventListener;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionEvent;
+import org.onosproject.net.intent.IntentPartitionEventListener;
+import org.onosproject.net.intent.IntentPartitionService;
import org.onosproject.net.link.LinkEvent;
import org.onosproject.net.newresource.ResourceEvent;
import org.onosproject.net.newresource.ResourceListener;
@@ -116,7 +116,7 @@
protected IntentService intentService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PartitionService partitionService;
+ protected IntentPartitionService partitionService;
private ExecutorService executorService =
newSingleThreadExecutor(groupedThreads("onos/intent", "objectivetracker"));
@@ -127,7 +127,7 @@
private ResourceListener resourceListener = new InternalResourceListener();
private DeviceListener deviceListener = new InternalDeviceListener();
private HostListener hostListener = new InternalHostListener();
- private PartitionEventListener partitionListener = new InternalPartitionListener();
+ private IntentPartitionEventListener partitionListener = new InternalPartitionListener();
private TopologyChangeDelegate delegate;
protected final AtomicBoolean updateScheduled = new AtomicBoolean(false);
@@ -445,9 +445,9 @@
}
}
- private final class InternalPartitionListener implements PartitionEventListener {
+ private final class InternalPartitionListener implements IntentPartitionEventListener {
@Override
- public void event(PartitionEvent event) {
+ public void event(IntentPartitionEvent event) {
log.debug("got message {}", event.subject());
scheduleIntentUpdate(1);
}
diff --git a/core/security/src/main/java/org/onosproject/security/impl/DefaultPolicyBuilder.java b/core/security/src/main/java/org/onosproject/security/impl/DefaultPolicyBuilder.java
index 1fbb7c8..59273b1 100644
--- a/core/security/src/main/java/org/onosproject/security/impl/DefaultPolicyBuilder.java
+++ b/core/security/src/main/java/org/onosproject/security/impl/DefaultPolicyBuilder.java
@@ -42,7 +42,7 @@
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentExtensionService;
import org.onosproject.net.intent.IntentClockService;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionService;
import org.onosproject.net.link.LinkAdminService;
import org.onosproject.net.link.LinkService;
import org.onosproject.net.packet.PacketService;
@@ -193,7 +193,7 @@
permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET));
- permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET));
+ permSet.add(new ServicePermission(IntentPartitionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(LabelResourceService.class.getName(), ServicePermission.GET));
@@ -262,7 +262,7 @@
serviceDirectory.put(HOST_EVENT, ImmutableSet.of(
HostService.class.getName()));
serviceDirectory.put(INTENT_READ, ImmutableSet.of(
- IntentService.class.getName(), PartitionService.class.getName(),
+ IntentService.class.getName(), IntentPartitionService.class.getName(),
IntentClockService.class.getName()));
serviceDirectory.put(INTENT_WRITE, ImmutableSet.of(
IntentService.class.getName()));
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
index 1e5db99..77dbff1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
@@ -35,7 +35,7 @@
import org.onosproject.net.intent.IntentStore;
import org.onosproject.net.intent.IntentStoreDelegate;
import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionService;
import org.onosproject.store.AbstractStore;
import org.onosproject.store.service.MultiValuedTimestamp;
import org.onosproject.store.service.WallClockTimestamp;
@@ -83,7 +83,7 @@
protected StorageService storageService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PartitionService partitionService;
+ protected IntentPartitionService partitionService;
private final AtomicLong sequenceNumber = new AtomicLong(0);
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionManager.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/IntentPartitionManager.java
similarity index 89%
rename from core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionManager.java
rename to core/store/dist/src/main/java/org/onosproject/store/intent/impl/IntentPartitionManager.java
index 09108d2..565c6cf 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/IntentPartitionManager.java
@@ -33,9 +33,9 @@
import org.onosproject.event.EventDeliveryService;
import org.onosproject.event.ListenerRegistry;
import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.PartitionEvent;
-import org.onosproject.net.intent.PartitionEventListener;
-import org.onosproject.net.intent.PartitionService;
+import org.onosproject.net.intent.IntentPartitionEvent;
+import org.onosproject.net.intent.IntentPartitionEventListener;
+import org.onosproject.net.intent.IntentPartitionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,9 +52,9 @@
*/
@Component(immediate = true)
@Service
-public class PartitionManager implements PartitionService {
+public class IntentPartitionManager implements IntentPartitionService {
- private static final Logger log = LoggerFactory.getLogger(PartitionManager.class);
+ private static final Logger log = LoggerFactory.getLogger(IntentPartitionManager.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LeadershipService leadershipService;
@@ -74,7 +74,7 @@
private static final String ELECTION_PREFIX = "intent-partition-";
- private ListenerRegistry<PartitionEvent, PartitionEventListener> listenerRegistry;
+ private ListenerRegistry<IntentPartitionEvent, IntentPartitionEventListener> listenerRegistry;
private LeadershipEventListener leaderListener = new InternalLeadershipListener();
private ClusterEventListener clusterListener = new InternalClusterEventListener();
@@ -87,7 +87,7 @@
clusterService.addListener(clusterListener);
listenerRegistry = new ListenerRegistry<>();
- eventDispatcher.addSink(PartitionEvent.class, listenerRegistry);
+ eventDispatcher.addSink(IntentPartitionEvent.class, listenerRegistry);
for (int i = 0; i < NUM_PARTITIONS; i++) {
leadershipService.runForLeadership(getPartitionPath(i));
@@ -101,7 +101,7 @@
public void deactivate() {
executor.shutdownNow();
- eventDispatcher.removeSink(PartitionEvent.class);
+ eventDispatcher.removeSink(IntentPartitionEvent.class);
leadershipService.removeListener(leaderListener);
clusterService.removeListener(clusterListener);
}
@@ -112,7 +112,7 @@
* @param executor scheduled executor service for background tasks
* @return this PartitionManager
*/
- public PartitionManager withScheduledExecutor(ScheduledExecutorService executor) {
+ public IntentPartitionManager withScheduledExecutor(ScheduledExecutorService executor) {
this.executor = executor;
return this;
}
@@ -146,12 +146,12 @@
}
@Override
- public void addListener(PartitionEventListener listener) {
+ public void addListener(IntentPartitionEventListener listener) {
listenerRegistry.addListener(listener);
}
@Override
- public void removeListener(PartitionEventListener listener) {
+ public void removeListener(IntentPartitionEventListener listener) {
listenerRegistry.removeListener(listener);
}
@@ -226,7 +226,7 @@
// See if we need to let some partitions go
scheduleRebalance(0);
- eventDispatcher.post(new PartitionEvent(PartitionEvent.Type.LEADER_CHANGED,
+ eventDispatcher.post(new IntentPartitionEvent(IntentPartitionEvent.Type.LEADER_CHANGED,
leadership.topic()));
}
}
diff --git a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
index a74c3a2..7fed235 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
@@ -30,7 +30,7 @@
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.IntentTestsMocks;
import org.onosproject.net.intent.MockIdGenerator;
-import org.onosproject.net.intent.PartitionServiceAdapter;
+import org.onosproject.net.intent.IntentPartitionServiceAdapter;
import org.onosproject.store.service.TestStorageService;
import static org.hamcrest.Matchers.is;
@@ -52,7 +52,7 @@
public void setUp() {
intentStore = new GossipIntentStore();
intentStore.storageService = new TestStorageService();
- intentStore.partitionService = new PartitionServiceAdapter();
+ intentStore.partitionService = new IntentPartitionServiceAdapter();
intentStore.clusterService = new ClusterServiceAdapter();
idGenerator = new MockIdGenerator();
Intent.bindIdGenerator(idGenerator);
diff --git a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/PartitionManagerTest.java b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/IntentPartitionManagerTest.java
similarity index 93%
rename from core/store/dist/src/test/java/org/onosproject/store/intent/impl/PartitionManagerTest.java
rename to core/store/dist/src/test/java/org/onosproject/store/intent/impl/IntentPartitionManagerTest.java
index 61d1937..5ba0c7c 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/PartitionManagerTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/IntentPartitionManagerTest.java
@@ -50,9 +50,9 @@
import static org.junit.Assert.assertTrue;
/**
- * Unit tests for the PartitionManager class.
+ * Unit tests for the IntentPartitionManager class.
*/
-public class PartitionManagerTest {
+public class IntentPartitionManagerTest {
private final LeadershipEvent event
= new LeadershipEvent(LeadershipEvent.Type.LEADER_ELECTED,
@@ -68,7 +68,7 @@
private LeadershipService leadershipService;
private LeadershipEventListener leaderListener;
- private PartitionManager partitionManager;
+ private IntentPartitionManager partitionManager;
@Before
public void setUp() {
@@ -76,13 +76,13 @@
leadershipService.addListener(anyObject(LeadershipEventListener.class));
expectLastCall().andDelegateTo(new TestLeadershipService());
- for (int i = 0; i < PartitionManager.NUM_PARTITIONS; i++) {
+ for (int i = 0; i < IntentPartitionManager.NUM_PARTITIONS; i++) {
expect(leadershipService.runForLeadership(ELECTION_PREFIX + i))
.andReturn(CompletableFuture.completedFuture(null))
.times(1);
}
- partitionManager = new PartitionManager()
+ partitionManager = new IntentPartitionManager()
.withScheduledExecutor(new NullScheduledExecutor());
partitionManager.clusterService = new TestClusterService();
@@ -108,7 +108,7 @@
new Leadership(ELECTION_PREFIX + i, MY_NODE_ID, 0, 0));
}
- for (int i = numMine; i < PartitionManager.NUM_PARTITIONS; i++) {
+ for (int i = numMine; i < IntentPartitionManager.NUM_PARTITIONS; i++) {
expect(leadershipService.getLeader(ELECTION_PREFIX + i))
.andReturn(OTHER_NODE_ID).anyTimes();
@@ -129,7 +129,7 @@
leadershipService.addListener(anyObject(LeadershipEventListener.class));
- for (int i = 0; i < PartitionManager.NUM_PARTITIONS; i++) {
+ for (int i = 0; i < IntentPartitionManager.NUM_PARTITIONS; i++) {
expect(leadershipService.runForLeadership(ELECTION_PREFIX + i))
.andReturn(CompletableFuture.completedFuture(null))
.times(1);
@@ -179,7 +179,7 @@
@Test
public void testRebalanceScheduling() {
// We have all the partitions so we'll need to relinquish some
- setUpLeadershipService(PartitionManager.NUM_PARTITIONS);
+ setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS);
replay(leadershipService);
@@ -198,7 +198,7 @@
@Test
public void testRebalance() {
// We have all the partitions so we'll need to relinquish some
- setUpLeadershipService(PartitionManager.NUM_PARTITIONS);
+ setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS);
expect(leadershipService.withdraw(anyString()))
.andReturn(CompletableFuture.completedFuture(null))
@@ -221,7 +221,7 @@
@Test
public void testNoRebalance() {
// Partitions are already perfectly balanced among the two active instances
- setUpLeadershipService(PartitionManager.NUM_PARTITIONS / 2);
+ setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS / 2);
replay(leadershipService);
partitionManager.activate();
@@ -233,7 +233,7 @@
reset(leadershipService);
// We have a smaller share than we should
- setUpLeadershipService(PartitionManager.NUM_PARTITIONS / 2 - 1);
+ setUpLeadershipService(IntentPartitionManager.NUM_PARTITIONS / 2 - 1);
replay(leadershipService);
// trigger rebalance