You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2013/11/07 02:19:21 UTC
[13/53] [abbrv] [HELIX-234]
Convert-all-Id.x-to-x.from-and-assorted-code-cleanup
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
index 3368c87..bfb958d 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
@@ -19,10 +19,10 @@ package org.apache.helix.model.builder;
* under the License.
*/
-import org.apache.helix.model.IdealState.RebalanceMode;
-
import java.util.ArrayList;
+import org.apache.helix.model.IdealState.RebalanceMode;
+
public class AutoRebalanceModeISBuilder extends IdealStateBuilder {
public AutoRebalanceModeISBuilder(String resourceName) {
super(resourceName);
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
index 6296b04..fd3be82 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
@@ -22,9 +22,9 @@ package org.apache.helix.model.builder;
import java.util.Map;
import java.util.TreeMap;
-import org.apache.helix.model.ConstraintItem;
import org.apache.helix.model.ClusterConstraints.ConstraintAttribute;
import org.apache.helix.model.ClusterConstraints.ConstraintValue;
+import org.apache.helix.model.ConstraintItem;
import org.apache.log4j.Logger;
public class ConstraintItemBuilder {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/model/builder/CustomModeISBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/CustomModeISBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/CustomModeISBuilder.java
index 78d8ca3..65c40a0 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/CustomModeISBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/CustomModeISBuilder.java
@@ -19,11 +19,11 @@ package org.apache.helix.model.builder;
* under the License.
*/
-import org.apache.helix.model.IdealState.RebalanceMode;
-
import java.util.Map;
import java.util.TreeMap;
+import org.apache.helix.model.IdealState.RebalanceMode;
+
public class CustomModeISBuilder extends IdealStateBuilder {
public CustomModeISBuilder(String resourceName) {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/monitoring/ZKPathDataDumpTask.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/ZKPathDataDumpTask.java b/helix-core/src/main/java/org/apache/helix/monitoring/ZKPathDataDumpTask.java
index 84d6c08..54778fc 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/ZKPathDataDumpTask.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/ZKPathDataDumpTask.java
@@ -26,9 +26,9 @@ import java.util.TimerTask;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixManager;
+import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.PropertyType;
import org.apache.helix.ZNRecord;
-import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.util.HelixUtil;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterMBeanObserver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterMBeanObserver.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterMBeanObserver.java
index 5922ea9..d66c1f6 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterMBeanObserver.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterMBeanObserver.java
@@ -22,20 +22,13 @@ package org.apache.helix.monitoring.mbeans;
import java.io.IOException;
import java.lang.management.ManagementFactory;
-import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.MBeanServerDelegate;
import javax.management.MBeanServerNotification;
import javax.management.MalformedObjectNameException;
import javax.management.Notification;
import javax.management.NotificationListener;
-import javax.management.ReflectionException;
import javax.management.relation.MBeanServerNotificationFilter;
import org.apache.log4j.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
index 769ef2d..2041999 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
@@ -22,8 +22,6 @@ package org.apache.helix.monitoring.mbeans;
import java.util.Map;
import org.apache.helix.HelixDefinedState;
-import org.apache.helix.HelixManager;
-import org.apache.helix.PropertyType;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.IdealState;
import org.apache.log4j.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java
index 20a4a07..0198410 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java
@@ -22,7 +22,6 @@ package org.apache.helix.monitoring.mbeans;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
import org.apache.helix.monitoring.StatCollector;
import org.apache.helix.monitoring.StateTransitionContext;
import org.apache.helix.monitoring.StateTransitionDataPoint;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/participant/GenericLeaderStandbyModel.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/participant/GenericLeaderStandbyModel.java b/helix-core/src/main/java/org/apache/helix/participant/GenericLeaderStandbyModel.java
index 705d740..aa21ee3 100644
--- a/helix-core/src/main/java/org/apache/helix/participant/GenericLeaderStandbyModel.java
+++ b/helix-core/src/main/java/org/apache/helix/participant/GenericLeaderStandbyModel.java
@@ -21,9 +21,9 @@ package org.apache.helix.participant;
import java.util.List;
+import org.apache.helix.HelixConstants.ChangeType;
import org.apache.helix.HelixManager;
import org.apache.helix.NotificationContext;
-import org.apache.helix.HelixConstants.ChangeType;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.model.Message;
import org.apache.helix.participant.statemachine.StateModel;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/participant/HelixCustomCodeRunner.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/participant/HelixCustomCodeRunner.java b/helix-core/src/main/java/org/apache/helix/participant/HelixCustomCodeRunner.java
index 82488ed..4aa8e6e 100644
--- a/helix-core/src/main/java/org/apache/helix/participant/HelixCustomCodeRunner.java
+++ b/helix-core/src/main/java/org/apache/helix/participant/HelixCustomCodeRunner.java
@@ -23,10 +23,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
import org.apache.helix.HelixConstants.ChangeType;
import org.apache.helix.HelixConstants.StateModelToken;
+import org.apache.helix.HelixDataAccessor;
+import org.apache.helix.HelixManager;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.manager.zk.ZNRecordSerializer;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/participant/HelixStateMachineEngine.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/participant/HelixStateMachineEngine.java b/helix-core/src/main/java/org/apache/helix/participant/HelixStateMachineEngine.java
index 31ee954..5812b1d 100644
--- a/helix-core/src/main/java/org/apache/helix/participant/HelixStateMachineEngine.java
+++ b/helix-core/src/main/java/org/apache/helix/participant/HelixStateMachineEngine.java
@@ -31,7 +31,7 @@ import org.apache.helix.InstanceType;
import org.apache.helix.NotificationContext;
import org.apache.helix.NotificationContext.MapKey;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.MessageId;
import org.apache.helix.api.PartitionId;
import org.apache.helix.api.ResourceId;
import org.apache.helix.api.SessionId;
@@ -118,7 +118,8 @@ public class HelixStateMachineEngine implements StateMachineEngine {
private void sendNopMessage() {
if (_manager.isConnected()) {
try {
- Message nopMsg = new Message(MessageType.NO_OP, Id.message(UUID.randomUUID().toString()));
+ Message nopMsg =
+ new Message(MessageType.NO_OP, MessageId.from(UUID.randomUUID().toString()));
nopMsg.setSrcName(_manager.getInstanceName());
HelixDataAccessor accessor = _manager.getHelixDataAccessor();
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/participant/statemachine/StateModelFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/participant/statemachine/StateModelFactory.java b/helix-core/src/main/java/org/apache/helix/participant/statemachine/StateModelFactory.java
index bd1a668..4d8e598 100644
--- a/helix-core/src/main/java/org/apache/helix/participant/statemachine/StateModelFactory.java
+++ b/helix-core/src/main/java/org/apache/helix/participant/statemachine/StateModelFactory.java
@@ -19,7 +19,6 @@ package org.apache.helix.participant.statemachine;
* under the License.
*/
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/tools/CLMLogFileAppender.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/CLMLogFileAppender.java b/helix-core/src/main/java/org/apache/helix/tools/CLMLogFileAppender.java
index 326607f..4f59925 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/CLMLogFileAppender.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/CLMLogFileAppender.java
@@ -19,14 +19,9 @@ package org.apache.helix.tools;
* under the License.
*/
-import java.io.File;
import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
import java.text.SimpleDateFormat;
import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Layout;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
index c407941..6e5576a 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterStateVerifier.java
@@ -19,9 +19,7 @@ package org.apache.helix.tools;
* under the License.
*/
-import java.io.File;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -41,44 +39,33 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixDefinedState;
+import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.PropertyPathConfig;
import org.apache.helix.PropertyType;
import org.apache.helix.ZNRecord;
-import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.api.Cluster;
import org.apache.helix.api.ClusterAccessor;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.ClusterId;
import org.apache.helix.api.ParticipantId;
import org.apache.helix.api.PartitionId;
import org.apache.helix.api.ResourceId;
import org.apache.helix.api.State;
-import org.apache.helix.api.StateModelDefId;
import org.apache.helix.controller.pipeline.Stage;
import org.apache.helix.controller.pipeline.StageContext;
import org.apache.helix.controller.stages.AttributeName;
-import org.apache.helix.controller.stages.BestPossibleStateCalcStage;
-import org.apache.helix.controller.stages.BestPossibleStateOutput;
import org.apache.helix.controller.stages.ClusterDataCache;
import org.apache.helix.controller.stages.ClusterEvent;
-import org.apache.helix.controller.stages.CurrentStateComputationStage;
import org.apache.helix.controller.stages.NewBestPossibleStateCalcStage;
import org.apache.helix.controller.stages.NewBestPossibleStateOutput;
import org.apache.helix.controller.stages.NewCurrentStateComputationStage;
import org.apache.helix.controller.stages.NewResourceComputationStage;
-import org.apache.helix.controller.stages.ResourceComputationStage;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.manager.zk.ZkBaseDataAccessor;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.IdealState;
-import org.apache.helix.model.Partition;
import org.apache.helix.model.ResourceAssignment;
-import org.apache.helix.model.StateModelDefinition;
import org.apache.helix.model.builder.ResourceAssignmentBuilder;
-import org.apache.helix.participant.statemachine.StateModel;
-import org.apache.helix.participant.statemachine.StateModelFactory;
-import org.apache.helix.store.PropertyJsonComparator;
-import org.apache.helix.store.PropertyJsonSerializer;
import org.apache.helix.util.ZKClientPool;
import org.apache.log4j.Logger;
@@ -266,7 +253,7 @@ public class ClusterStateVerifier {
}
}
- ClusterAccessor clusterAccessor = new ClusterAccessor(Id.cluster(clusterName), accessor);
+ ClusterAccessor clusterAccessor = new ClusterAccessor(ClusterId.from(clusterName), accessor);
Cluster cluster = clusterAccessor.readCluster();
// calculate best possible state
NewBestPossibleStateOutput bestPossOutput = ClusterStateVerifier.calcBestPossState(cluster);
@@ -274,7 +261,7 @@ public class ClusterStateVerifier {
// set error states
if (errStates != null) {
for (String resourceName : errStates.keySet()) {
- ResourceId resourceId = Id.resource(resourceName);
+ ResourceId resourceId = ResourceId.from(resourceName);
Map<String, String> partErrStates = errStates.get(resourceName);
ResourceAssignment resourceAssignment = bestPossOutput.getResourceAssignment(resourceId);
@@ -286,8 +273,8 @@ public class ClusterStateVerifier {
for (String partitionName : partErrStates.keySet()) {
String instanceName = partErrStates.get(partitionName);
- PartitionId partitionId = Id.partition(partitionName);
- ParticipantId participantId = Id.participant(instanceName);
+ PartitionId partitionId = PartitionId.from(partitionName);
+ ParticipantId participantId = ParticipantId.from(instanceName);
raBuilder.addAssignment(partitionId, participantId,
new State(HelixDefinedState.ERROR.toString()));
}
@@ -308,7 +295,7 @@ public class ClusterStateVerifier {
// step 0: remove empty map and DROPPED state from best possible state
Map<String, Map<String, String>> bpStateMap =
ResourceAssignment.stringMapsFromReplicaMaps(bestPossOutput.getResourceAssignment(
- Id.resource(resourceName)).getResourceMap());
+ ResourceId.from(resourceName)).getResourceMap());
Iterator<Entry<String, Map<String, String>>> iter = bpStateMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, Map<String, String>> entry = iter.next();
@@ -333,8 +320,8 @@ public class ClusterStateVerifier {
// step 1: externalView and bestPossibleState has equal size
int extViewSize = extView.getRecord().getMapFields().size();
int bestPossStateSize =
- bestPossOutput.getResourceAssignment(Id.resource(resourceName)).getMappedPartitions()
- .size();
+ bestPossOutput.getResourceAssignment(ResourceId.from(resourceName))
+ .getMappedPartitions().size();
if (extViewSize != bestPossStateSize) {
LOG.info("exterView size (" + extViewSize + ") is different from bestPossState size ("
+ bestPossStateSize + ") for resource: " + resourceName);
@@ -353,7 +340,7 @@ public class ClusterStateVerifier {
Map<String, String> evInstanceStateMap = extView.getRecord().getMapField(partition);
Map<String, String> bpInstanceStateMap =
ResourceAssignment.stringMapFromReplicaMap(bestPossOutput.getResourceAssignment(
- Id.resource(resourceName)).getReplicaMap(Id.partition(partition)));
+ ResourceId.from(resourceName)).getReplicaMap(PartitionId.from(partition)));
boolean result =
ClusterStateVerifier.<String, String> compareMap(evInstanceStateMap,
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/tools/MessagePoster.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/MessagePoster.java b/helix-core/src/main/java/org/apache/helix/tools/MessagePoster.java
index 57d9828..86d2eb8 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/MessagePoster.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/MessagePoster.java
@@ -22,8 +22,9 @@ package org.apache.helix.tools;
import java.util.UUID;
import org.apache.helix.ZNRecord;
-import org.apache.helix.api.Id;
import org.apache.helix.api.MessageId;
+import org.apache.helix.api.PartitionId;
+import org.apache.helix.api.SessionId;
import org.apache.helix.api.State;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
@@ -40,7 +41,7 @@ public class MessagePoster {
String path = HelixUtil.getMessagePath(clusterName, instanceName) + "/" + message.getId();
client.delete(path);
ZNRecord record = client.readData(HelixUtil.getLiveInstancePath(clusterName, instanceName));
- message.setTgtSessionId(Id.session(record.getSimpleField(
+ message.setTgtSessionId(SessionId.from(record.getSimpleField(
LiveInstanceProperty.SESSION_ID.toString()).toString()));
message.setTgtName(record.getId());
// System.out.println(message);
@@ -49,12 +50,12 @@ public class MessagePoster {
public void postFaultInjectionMessage(String zkServer, String clusterName, String instanceName,
String payloadString, String partition) {
- Message message = new Message("FaultInjection", Id.message(UUID.randomUUID().toString()));
+ Message message = new Message("FaultInjection", MessageId.from(UUID.randomUUID().toString()));
if (payloadString != null) {
message.getRecord().setSimpleField("faultType", payloadString);
}
if (partition != null) {
- message.setPartitionId(Id.partition(partition));
+ message.setPartitionId(PartitionId.from(partition));
}
post(zkServer, message, clusterName, instanceName);
@@ -62,7 +63,7 @@ public class MessagePoster {
public void postTestMessage(String zkServer, String clusterName, String instanceName) {
String msgSrc = "cm-instance-0";
- MessageId msgId = Id.message("TestMessageId-2");
+ MessageId msgId = MessageId.from("TestMessageId-2");
Message message = new Message(MessageType.STATE_TRANSITION, msgId);
message.setMsgId(msgId);
@@ -71,7 +72,7 @@ public class MessagePoster {
message.setMsgState(MessageState.NEW);
message.setFromState(State.from("Slave"));
message.setToState(State.from("Master"));
- message.setPartitionId(Id.partition("EspressoDB.partition-0." + instanceName));
+ message.setPartitionId(PartitionId.from("EspressoDB.partition-0." + instanceName));
post(zkServer, message, clusterName, instanceName);
}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java b/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
index 37d4568..d371d1a 100644
--- a/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
@@ -36,14 +36,13 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixProperty;
import org.apache.helix.PropertyKey;
-import org.apache.helix.ZNRecord;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
+import org.apache.helix.ZNRecord;
import org.apache.helix.api.SessionId;
import org.apache.helix.model.Error;
import org.apache.helix.model.Message;
-import org.apache.helix.model.StatusUpdate;
import org.apache.helix.model.Message.MessageType;
+import org.apache.helix.model.StatusUpdate;
import org.apache.log4j.Logger;
/**
@@ -284,7 +283,7 @@ public class StatusUpdateUtil {
* @param additional
* info the additional debug information
*/
- public ZNRecord createMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
+ public ZNRecord createMessageStatusUpdateRecord(Message message, Level level, Class<?> classInfo,
String additionalInfo) {
ZNRecord result = createEmptyStatusUpdateRecord(getStatusUpdateRecordName(message));
Map<String, String> contentMap = new TreeMap<String, String>();
@@ -327,7 +326,7 @@ public class StatusUpdateUtil {
* @param accessor
* the zookeeper data accessor that writes the status update to zookeeper
*/
- public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
+ public void logMessageStatusUpdateRecord(Message message, Level level, Class<?> classInfo,
String additionalInfo, HelixDataAccessor accessor) {
try {
ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
@@ -337,12 +336,12 @@ public class StatusUpdateUtil {
}
}
- public void logError(Message message, Class classInfo, String additionalInfo,
+ public void logError(Message message, Class<?> classInfo, String additionalInfo,
HelixDataAccessor accessor) {
logMessageStatusUpdateRecord(message, Level.HELIX_ERROR, classInfo, additionalInfo, accessor);
}
- public void logError(Message message, Class classInfo, Exception e, String additionalInfo,
+ public void logError(Message message, Class<?> classInfo, Exception e, String additionalInfo,
HelixDataAccessor accessor) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -351,12 +350,12 @@ public class StatusUpdateUtil {
additionalInfo + sw.toString(), accessor);
}
- public void logInfo(Message message, Class classInfo, String additionalInfo,
+ public void logInfo(Message message, Class<?> classInfo, String additionalInfo,
HelixDataAccessor accessor) {
logMessageStatusUpdateRecord(message, Level.HELIX_INFO, classInfo, additionalInfo, accessor);
}
- public void logWarning(Message message, Class classInfo, String additionalInfo,
+ public void logWarning(Message message, Class<?> classInfo, String additionalInfo,
HelixDataAccessor accessor) {
logMessageStatusUpdateRecord(message, Level.HELIX_WARNING, classInfo, additionalInfo, accessor);
}
@@ -382,7 +381,7 @@ public class StatusUpdateUtil {
sessionId = message.getTgtSessionId();
}
if (sessionId == null) {
- sessionId = Id.session("*");
+ sessionId = SessionId.from("*");
}
Builder keyBuilder = accessor.keyBuilder();
@@ -479,7 +478,7 @@ public class StatusUpdateUtil {
sessionId = message.getTgtSessionId();
}
if (sessionId == null) {
- sessionId = Id.session("*");
+ sessionId = SessionId.from("*");
}
Builder keyBuilder = accessor.keyBuilder();
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java b/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
index 0c45020..0980e48 100644
--- a/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
+++ b/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
@@ -22,7 +22,6 @@ package org.apache.helix.util;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.helix.HelixException;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.zookeeper.ZooKeeper.States;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/Mocks.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/Mocks.java b/helix-core/src/test/java/org/apache/helix/Mocks.java
index 7bafe1b..1fdf9fd 100644
--- a/helix-core/src/test/java/org/apache/helix/Mocks.java
+++ b/helix-core/src/test/java/org/apache/helix/Mocks.java
@@ -46,7 +46,6 @@ import org.apache.helix.participant.statemachine.StateModelInfo;
import org.apache.helix.participant.statemachine.Transition;
import org.apache.helix.store.zk.ZkHelixPropertyStore;
import org.apache.zookeeper.data.Stat;
-import org.omg.CORBA._PolicyStub;
public class Mocks {
public static class MockBaseDataAccessor implements BaseDataAccessor<ZNRecord> {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
index c8514ef..d58389d 100644
--- a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
@@ -19,7 +19,6 @@ package org.apache.helix;
* under the License.
*/
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java b/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
index 9e8f943..3413627 100644
--- a/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
+++ b/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
@@ -22,10 +22,6 @@ package org.apache.helix;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.apache.helix.BaseDataAccessor;
-import org.apache.helix.GroupCommit;
-import org.apache.helix.ZNRecord;
-
public class TestGroupCommit {
// @Test
public void testGroupCommit() throws InterruptedException {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java b/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
index 337bcfe..9e8b079 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
@@ -24,8 +24,8 @@ import java.util.List;
import org.apache.helix.manager.zk.ZKHelixAdmin;
import org.apache.helix.model.HelixConfigScope;
-import org.apache.helix.model.InstanceConfig;
import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
+import org.apache.helix.model.InstanceConfig;
import org.apache.helix.model.builder.HelixConfigScopeBuilder;
import org.testng.Assert;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java b/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
index 4cf0744..89c7a04 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
@@ -23,9 +23,12 @@ import org.apache.helix.Mocks.MockHelixTaskExecutor;
import org.apache.helix.Mocks.MockManager;
import org.apache.helix.Mocks.MockStateModel;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
import org.apache.helix.api.MessageId;
+import org.apache.helix.api.PartitionId;
+import org.apache.helix.api.ResourceId;
+import org.apache.helix.api.SessionId;
import org.apache.helix.api.State;
+import org.apache.helix.api.StateModelDefId;
import org.apache.helix.messaging.handling.AsyncCallbackService;
import org.apache.helix.messaging.handling.HelixStateTransitionHandler;
import org.apache.helix.messaging.handling.HelixTask;
@@ -43,18 +46,18 @@ public class TestHelixTaskExecutor {
@Test()
public void testCMTaskExecutor() throws Exception {
System.out.println("START TestCMTaskExecutor");
- MessageId msgId = Id.message("TestMessageId");
+ MessageId msgId = MessageId.from("TestMessageId");
Message message = new Message(MessageType.TASK_REPLY, msgId);
message.setMsgId(msgId);
message.setSrcName("cm-instance-0");
message.setTgtName("cm-instance-1");
- message.setTgtSessionId(Id.session("1234"));
+ message.setTgtSessionId(SessionId.from("1234"));
message.setFromState(State.from("Offline"));
message.setToState(State.from("Slave"));
- message.setPartitionId(Id.partition("TestDB_0"));
- message.setResourceId(Id.resource("TestDB"));
- message.setStateModelDef(Id.stateModelDef("MasterSlave"));
+ message.setPartitionId(PartitionId.from("TestDB_0"));
+ message.setResourceId(ResourceId.from("TestDB"));
+ message.setStateModelDef(StateModelDefId.from("MasterSlave"));
MockManager manager = new MockManager("clusterName");
HelixDataAccessor accessor = manager.getHelixDataAccessor();
@@ -70,7 +73,7 @@ public class TestHelixTaskExecutor {
NotificationContext context = new NotificationContext(manager);
CurrentState currentStateDelta = new CurrentState("TestDB");
- currentStateDelta.setState(Id.partition("TestDB_0"), State.from("OFFLINE"));
+ currentStateDelta.setState(PartitionId.from("TestDB_0"), State.from("OFFLINE"));
StateModelFactory<MockStateModel> stateModelFactory = new StateModelFactory<MockStateModel>() {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java b/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
index 3614425..34bb9da 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
@@ -25,8 +25,12 @@ import org.apache.helix.Mocks.MockManager;
import org.apache.helix.Mocks.MockStateModel;
import org.apache.helix.Mocks.MockStateModelAnnotated;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.MessageId;
+import org.apache.helix.api.PartitionId;
+import org.apache.helix.api.ResourceId;
+import org.apache.helix.api.SessionId;
import org.apache.helix.api.State;
+import org.apache.helix.api.StateModelDefId;
import org.apache.helix.messaging.handling.HelixStateTransitionHandler;
import org.apache.helix.messaging.handling.HelixTask;
import org.apache.helix.messaging.handling.HelixTaskExecutor;
@@ -44,17 +48,17 @@ public class TestHelixTaskHandler {
public void testInvocation() throws Exception {
HelixTaskExecutor executor = new HelixTaskExecutor();
System.out.println("START TestCMTaskHandler.testInvocation()");
- Message message = new Message(MessageType.STATE_TRANSITION, Id.message("Some unique id"));
+ Message message = new Message(MessageType.STATE_TRANSITION, MessageId.from("Some unique id"));
message.setSrcName("cm-instance-0");
- message.setTgtSessionId(Id.session("1234"));
+ message.setTgtSessionId(SessionId.from("1234"));
message.setFromState(State.from("Offline"));
message.setToState(State.from("Slave"));
- message.setPartitionId(Id.partition("TestDB_0"));
- message.setMsgId(Id.message("Some unique message id"));
- message.setResourceId(Id.resource("TestDB"));
+ message.setPartitionId(PartitionId.from("TestDB_0"));
+ message.setMsgId(MessageId.from("Some unique message id"));
+ message.setResourceId(ResourceId.from("TestDB"));
message.setTgtName("localhost");
- message.setStateModelDef(Id.stateModelDef("MasterSlave"));
+ message.setStateModelDef(StateModelDefId.from("MasterSlave"));
message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
MockStateModel stateModel = new MockStateModel();
NotificationContext context;
@@ -67,7 +71,7 @@ public class TestHelixTaskHandler {
context = new NotificationContext(manager);
CurrentState currentStateDelta = new CurrentState("TestDB");
- currentStateDelta.setState(Id.partition("TestDB_0"), State.from("OFFLINE"));
+ currentStateDelta.setState(PartitionId.from("TestDB_0"), State.from("OFFLINE"));
HelixStateTransitionHandler stHandler =
new HelixStateTransitionHandler(null, stateModel, message, context, currentStateDelta);
@@ -84,16 +88,16 @@ public class TestHelixTaskHandler {
System.out.println("START TestCMTaskHandler.testInvocationAnnotated() at "
+ new Date(System.currentTimeMillis()));
HelixTaskExecutor executor = new HelixTaskExecutor();
- Message message = new Message(MessageType.STATE_TRANSITION, Id.message("Some unique id"));
+ Message message = new Message(MessageType.STATE_TRANSITION, MessageId.from("Some unique id"));
message.setSrcName("cm-instance-0");
- message.setTgtSessionId(Id.session("1234"));
+ message.setTgtSessionId(SessionId.from("1234"));
message.setFromState(State.from("Offline"));
message.setToState(State.from("Slave"));
- message.setPartitionId(Id.partition("TestDB_0"));
- message.setMsgId(Id.message("Some unique message id"));
- message.setResourceId(Id.resource("TestDB"));
+ message.setPartitionId(PartitionId.from("TestDB_0"));
+ message.setMsgId(MessageId.from("Some unique message id"));
+ message.setResourceId(ResourceId.from("TestDB"));
message.setTgtName("localhost");
- message.setStateModelDef(Id.stateModelDef("MasterSlave"));
+ message.setStateModelDef(StateModelDefId.from("MasterSlave"));
message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
MockStateModelAnnotated stateModel = new MockStateModelAnnotated();
NotificationContext context;
@@ -109,7 +113,7 @@ public class TestHelixTaskHandler {
context = new NotificationContext(manager);
CurrentState currentStateDelta = new CurrentState("TestDB");
- currentStateDelta.setState(Id.partition("TestDB_0"), State.from("OFFLINE"));
+ currentStateDelta.setState(PartitionId.from("TestDB_0"), State.from("OFFLINE"));
StateModelFactory<MockStateModelAnnotated> stateModelFactory =
new StateModelFactory<MockStateModelAnnotated>() {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelper.java b/helix-core/src/test/java/org/apache/helix/TestHelper.java
index edc9161..681666b 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelper.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelper.java
@@ -45,9 +45,11 @@ import org.I0Itec.zkclient.ZkServer;
import org.I0Itec.zkclient.exception.ZkNoNodeException;
import org.apache.commons.io.FileUtils;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
import org.apache.helix.api.MessageId;
+import org.apache.helix.api.PartitionId;
+import org.apache.helix.api.ResourceId;
import org.apache.helix.api.State;
+import org.apache.helix.api.StateModelDefId;
import org.apache.helix.controller.HelixControllerMain;
import org.apache.helix.integration.manager.ZkTestManager;
import org.apache.helix.manager.zk.CallbackHandler;
@@ -312,7 +314,7 @@ public class TestHelper {
try {
ZKHelixDataAccessor accessor =
- new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(zkClient));
+ new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
Builder keyBuilder = accessor.keyBuilder();
for (String instanceName : instanceNames) {
@@ -395,7 +397,7 @@ public class TestHelper {
try {
ZKHelixDataAccessor accessor =
- new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(zkClient));
+ new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
Builder keyBuilder = accessor.keyBuilder();
for (String resGroupPartitionKey : stateMap.keySet()) {
@@ -503,9 +505,9 @@ public class TestHelper {
msg.setFromState(State.from(fromState));
msg.setToState(State.from(toState));
msg.setTgtName(tgtName);
- msg.setResourceId(Id.resource(resourceName));
- msg.setPartitionId(Id.partition(partitionName));
- msg.setStateModelDef(Id.stateModelDef("MasterSlave"));
+ msg.setResourceId(ResourceId.from(resourceName));
+ msg.setPartitionId(PartitionId.from(partitionName));
+ msg.setStateModelDef(StateModelDefId.from("MasterSlave"));
return msg;
}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestHierarchicalDataStore.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHierarchicalDataStore.java b/helix-core/src/test/java/org/apache/helix/TestHierarchicalDataStore.java
index da6add2..af953e9 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHierarchicalDataStore.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHierarchicalDataStore.java
@@ -19,14 +19,11 @@ package org.apache.helix;
* under the License.
*/
-import org.apache.helix.ZNRecord;
+import java.io.FileFilter;
+
import org.apache.helix.controller.HierarchicalDataHolder;
import org.apache.helix.manager.zk.ZkClient;
-import org.testng.annotations.Test;
import org.testng.AssertJUnit;
-import java.io.FileFilter;
-
-import org.testng.Assert;
import org.testng.annotations.Test;
public class TestHierarchicalDataStore extends ZkUnitTestBase {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestPerformanceHealthReportProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestPerformanceHealthReportProvider.java b/helix-core/src/test/java/org/apache/helix/TestPerformanceHealthReportProvider.java
index 60e1bcb..b49575f 100644
--- a/helix-core/src/test/java/org/apache/helix/TestPerformanceHealthReportProvider.java
+++ b/helix-core/src/test/java/org/apache/helix/TestPerformanceHealthReportProvider.java
@@ -21,8 +21,6 @@ package org.apache.helix;
import java.util.Map;
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.ZNRecord;
import org.apache.helix.Mocks.MockManager;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.healthcheck.PerformanceHealthReportProvider;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZKCallback.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZKCallback.java b/helix-core/src/test/java/org/apache/helix/TestZKCallback.java
index 8ae02c7..7abfd4c 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZKCallback.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZKCallback.java
@@ -24,21 +24,13 @@ import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import org.apache.helix.ConfigChangeListener;
-import org.apache.helix.CurrentStateChangeListener;
-import org.apache.helix.ExternalViewChangeListener;
-import org.apache.helix.HelixConstants;
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
-import org.apache.helix.HelixManagerFactory;
-import org.apache.helix.IdealStateChangeListener;
-import org.apache.helix.InstanceType;
-import org.apache.helix.LiveInstanceChangeListener;
-import org.apache.helix.MessageListener;
-import org.apache.helix.NotificationContext;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.MessageId;
+import org.apache.helix.api.PartitionId;
+import org.apache.helix.api.ResourceId;
+import org.apache.helix.api.SessionId;
import org.apache.helix.api.State;
+import org.apache.helix.api.StateModelDefId;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.CurrentState;
@@ -157,7 +149,7 @@ public class TestZKCallback extends ZkUnitTestBase {
testListener.Reset();
CurrentState curState = new CurrentState("db-12345");
- curState.setSessionId(Id.session("sessionId"));
+ curState.setSessionId(SessionId.from("sessionId"));
curState.setStateModelDefRef("StateModelDef");
accessor.setProperty(keyBuilder.currentState("localhost_8900", testHelixManager.getSessionId(),
curState.getId()), curState);
@@ -187,11 +179,11 @@ public class TestZKCallback extends ZkUnitTestBase {
testListener.Reset();
Message message =
- new Message(MessageType.STATE_TRANSITION, Id.message(UUID.randomUUID().toString()));
- message.setTgtSessionId(Id.session("*"));
- message.setResourceId(Id.resource("testResource"));
- message.setPartitionId(Id.partition("testPartitionKey"));
- message.setStateModelDef(Id.stateModelDef("MasterSlave"));
+ new Message(MessageType.STATE_TRANSITION, MessageId.from(UUID.randomUUID().toString()));
+ message.setTgtSessionId(SessionId.from("*"));
+ message.setResourceId(ResourceId.from("testResource"));
+ message.setPartitionId(PartitionId.from("testPartitionKey"));
+ message.setStateModelDef(StateModelDefId.from("MasterSlave"));
message.setToState(State.from("toState"));
message.setFromState(State.from("fromState"));
message.setTgtName("testTarget");
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZKRoutingInfoProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZKRoutingInfoProvider.java b/helix-core/src/test/java/org/apache/helix/TestZKRoutingInfoProvider.java
index 314d3de..1d45467 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZKRoutingInfoProvider.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZKRoutingInfoProvider.java
@@ -27,10 +27,9 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
-import org.apache.helix.ZNRecord;
import org.apache.helix.controller.ExternalViewGenerator;
-import org.apache.helix.model.Message;
import org.apache.helix.model.CurrentState.CurrentStateProperty;
+import org.apache.helix.model.Message;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZNRecord.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZNRecord.java b/helix-core/src/test/java/org/apache/helix/TestZNRecord.java
index 860d180..9ff4849 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZNRecord.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZNRecord.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.helix.ZNRecord;
import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java b/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java
index 654f145..86f3cc2 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java
@@ -19,7 +19,6 @@ package org.apache.helix;
* under the License.
*/
-import org.apache.helix.ZNRecordBucketizer;
import org.testng.Assert;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZkBasis.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZkBasis.java b/helix-core/src/test/java/org/apache/helix/TestZkBasis.java
index e8d7549..8b315d8 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZkBasis.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZkBasis.java
@@ -19,16 +19,6 @@ package org.apache.helix;
* under the License.
*/
-import org.I0Itec.zkclient.IZkChildListener;
-import org.I0Itec.zkclient.IZkDataListener;
-import org.apache.helix.TestHelper;
-import org.apache.helix.ZkTestHelper;
-import org.apache.helix.ZkUnitTestBase;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
-import org.apache.helix.manager.zk.ZkClient;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -36,6 +26,13 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import org.I0Itec.zkclient.IZkChildListener;
+import org.I0Itec.zkclient.IZkDataListener;
+import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.manager.zk.ZkClient;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
/**
* test zookeeper basis
*/
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZkClientWrapper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZkClientWrapper.java b/helix-core/src/test/java/org/apache/helix/TestZkClientWrapper.java
index f3b0ac9..37c68a2 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZkClientWrapper.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZkClientWrapper.java
@@ -21,7 +21,6 @@ package org.apache.helix;
import org.I0Itec.zkclient.IZkStateListener;
import org.I0Itec.zkclient.ZkConnection;
-import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.zookeeper.WatchedEvent;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/TestZnodeModify.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestZnodeModify.java b/helix-core/src/test/java/org/apache/helix/TestZnodeModify.java
index 7d66ebd..9c71fdd 100644
--- a/helix-core/src/test/java/org/apache/helix/TestZnodeModify.java
+++ b/helix-core/src/test/java/org/apache/helix/TestZnodeModify.java
@@ -25,17 +25,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.IdealState.IdealStateProperty;
import org.apache.helix.model.IdealState.RebalanceMode;
import org.apache.helix.tools.TestCommand;
+import org.apache.helix.tools.TestCommand.CommandType;
import org.apache.helix.tools.TestExecutor;
+import org.apache.helix.tools.TestExecutor.ZnodePropertyType;
import org.apache.helix.tools.TestTrigger;
import org.apache.helix.tools.ZnodeOpArg;
-import org.apache.helix.tools.TestCommand.CommandType;
-import org.apache.helix.tools.TestExecutor.ZnodePropertyType;
import org.apache.log4j.Logger;
import org.testng.Assert;
import org.testng.AssertJUnit;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java b/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java
index db2a6d0..4283143 100644
--- a/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java
+++ b/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java
@@ -23,7 +23,13 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
@@ -31,12 +37,8 @@ import org.I0Itec.zkclient.IZkChildListener;
import org.I0Itec.zkclient.IZkDataListener;
import org.I0Itec.zkclient.IZkStateListener;
import org.I0Itec.zkclient.ZkConnection;
-import org.apache.helix.InstanceType;
-import org.apache.helix.ZNRecord;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.manager.zk.CallbackHandler;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZKHelixManager;
import org.apache.helix.manager.zk.ZkBaseDataAccessor;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.ExternalView;
@@ -323,12 +325,12 @@ public class ZkTestHelper {
return listenerMapBySession;
}
- static java.lang.reflect.Field getField(Class clazz, String fieldName)
+ static java.lang.reflect.Field getField(Class<?> clazz, String fieldName)
throws NoSuchFieldException {
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
- Class superClass = clazz.getSuperclass();
+ Class<?> superClass = clazz.getSuperclass();
if (superClass == null) {
throw e;
} else {
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestAddAlerts.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestAddAlerts.java b/helix-core/src/test/java/org/apache/helix/alerts/TestAddAlerts.java
index 4263ddc..723557c 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestAddAlerts.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestAddAlerts.java
@@ -22,11 +22,9 @@ package org.apache.helix.alerts;
import java.util.Map;
import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.ZNRecord;
import org.apache.helix.Mocks.MockManager;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.alerts.AlertParser;
-import org.apache.helix.alerts.AlertsHolder;
+import org.apache.helix.ZNRecord;
import org.apache.helix.controller.stages.HealthDataCache;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestAddPersistentStats.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestAddPersistentStats.java b/helix-core/src/test/java/org/apache/helix/alerts/TestAddPersistentStats.java
index e9e5e32..0510c7d 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestAddPersistentStats.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestAddPersistentStats.java
@@ -23,10 +23,9 @@ import java.util.Map;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixException;
-import org.apache.helix.ZNRecord;
import org.apache.helix.Mocks.MockManager;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.alerts.StatsHolder;
+import org.apache.helix.ZNRecord;
import org.apache.helix.controller.stages.HealthDataCache;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestAlertValidation.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestAlertValidation.java b/helix-core/src/test/java/org/apache/helix/alerts/TestAlertValidation.java
index 09a9d93..3da2466 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestAlertValidation.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestAlertValidation.java
@@ -20,10 +20,7 @@ package org.apache.helix.alerts;
*/
import org.apache.helix.HelixException;
-import org.apache.helix.alerts.AlertParser;
-import org.testng.annotations.Test;
import org.testng.AssertJUnit;
-import org.testng.Assert;
import org.testng.annotations.Test;
@Test
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestArrivingParticipantStats.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestArrivingParticipantStats.java b/helix-core/src/test/java/org/apache/helix/alerts/TestArrivingParticipantStats.java
index 848ef5a..454d410 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestArrivingParticipantStats.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestArrivingParticipantStats.java
@@ -23,11 +23,9 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.ZNRecord;
import org.apache.helix.Mocks.MockManager;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.alerts.StatsHolder;
-import org.apache.helix.alerts.Tuple;
+import org.apache.helix.ZNRecord;
import org.apache.helix.controller.stages.HealthDataCache;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestBaseStatsValidation.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestBaseStatsValidation.java b/helix-core/src/test/java/org/apache/helix/alerts/TestBaseStatsValidation.java
index 5183182..d9cc86f 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestBaseStatsValidation.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestBaseStatsValidation.java
@@ -20,11 +20,7 @@ package org.apache.helix.alerts;
*/
import org.apache.helix.HelixException;
-import org.apache.helix.alerts.ExpressionOperatorType;
-import org.apache.helix.alerts.ExpressionParser;
-import org.testng.annotations.Test;
import org.testng.AssertJUnit;
-import org.testng.Assert;
import org.testng.annotations.Test;
@Test
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestEvaluateAlerts.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestEvaluateAlerts.java b/helix-core/src/test/java/org/apache/helix/alerts/TestEvaluateAlerts.java
index 403dfdb..7089146 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestEvaluateAlerts.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestEvaluateAlerts.java
@@ -24,11 +24,6 @@ import java.util.Map;
import org.apache.helix.HelixException;
import org.apache.helix.Mocks.MockManager;
-import org.apache.helix.alerts.AlertParser;
-import org.apache.helix.alerts.AlertProcessor;
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.alerts.AlertsHolder;
-import org.apache.helix.alerts.StatsHolder;
import org.apache.helix.controller.stages.HealthDataCache;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestOperators.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestOperators.java b/helix-core/src/test/java/org/apache/helix/alerts/TestOperators.java
index 2d54a27..4e141dc 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestOperators.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestOperators.java
@@ -22,11 +22,7 @@ package org.apache.helix.alerts;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import org.apache.helix.alerts.SumEachOperator;
-import org.apache.helix.alerts.SumOperator;
-import org.apache.helix.alerts.Tuple;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/alerts/TestStatsMatch.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/alerts/TestStatsMatch.java b/helix-core/src/test/java/org/apache/helix/alerts/TestStatsMatch.java
index 094f347..81a2cd4 100644
--- a/helix-core/src/test/java/org/apache/helix/alerts/TestStatsMatch.java
+++ b/helix-core/src/test/java/org/apache/helix/alerts/TestStatsMatch.java
@@ -19,11 +19,7 @@ package org.apache.helix.alerts;
* under the License.
*/
-import org.apache.helix.HelixException;
-import org.apache.helix.alerts.ExpressionParser;
-import org.testng.annotations.Test;
import org.testng.AssertJUnit;
-import org.testng.Assert;
import org.testng.annotations.Test;
@Test
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/api/TestId.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/api/TestId.java b/helix-core/src/test/java/org/apache/helix/api/TestId.java
index 57c01e7..aa870f3 100644
--- a/helix-core/src/test/java/org/apache/helix/api/TestId.java
+++ b/helix-core/src/test/java/org/apache/helix/api/TestId.java
@@ -12,9 +12,9 @@ public class TestId {
final String partitionName = "Resource_3";
final String resourceName = "Resource";
final String partitionSuffix = "3";
- PartitionId partitionId = Id.partition(partitionName);
+ PartitionId partitionId = PartitionId.from(partitionName);
Assert.assertEquals(partitionId.stringify(), partitionName);
- PartitionId partitionId2 = Id.partition(Id.resource(resourceName), partitionSuffix);
+ PartitionId partitionId2 = PartitionId.from(ResourceId.from(resourceName), partitionSuffix);
Assert.assertEquals(partitionId2.stringify(), partitionName);
Assert.assertEquals(partitionId, partitionId2);
Assert.assertEquals(partitionId.toString(), partitionId2.toString());
@@ -26,7 +26,7 @@ public class TestId {
@Test
public void testPartitionIdCompatibility() {
final String partitionName = "Resource--3";
- PartitionId partitionId = Id.partition(partitionName);
+ PartitionId partitionId = PartitionId.from(partitionName);
Assert.assertEquals(partitionId.stringify(), partitionName);
}
@@ -43,15 +43,15 @@ public class TestId {
final String stateModelName = "StateModel";
final String stateModelFactoryName = "StateModelFactory";
final String messageName = "Message";
- Assert.assertEquals(Id.resource(resourceName).stringify(), resourceName);
- Assert.assertEquals(Id.cluster(clusterName).stringify(), clusterName);
- Assert.assertEquals(Id.participant(participantName).stringify(), participantName);
- Assert.assertEquals(Id.session(sessionName).stringify(), sessionName);
- Assert.assertEquals(Id.process(processName).stringify(), processName);
- Assert.assertEquals(Id.stateModelDef(stateModelName).stringify(), stateModelName);
- Assert.assertEquals(Id.stateModelFactory(stateModelFactoryName).stringify(),
+ Assert.assertEquals(ResourceId.from(resourceName).stringify(), resourceName);
+ Assert.assertEquals(ClusterId.from(clusterName).stringify(), clusterName);
+ Assert.assertEquals(ParticipantId.from(participantName).stringify(), participantName);
+ Assert.assertEquals(SessionId.from(sessionName).stringify(), sessionName);
+ Assert.assertEquals(ProcId.from(processName).stringify(), processName);
+ Assert.assertEquals(StateModelDefId.from(stateModelName).stringify(), stateModelName);
+ Assert.assertEquals(StateModelFactoryId.from(stateModelFactoryName).stringify(),
stateModelFactoryName);
- Assert.assertEquals(Id.message(messageName).stringify(), messageName);
+ Assert.assertEquals(MessageId.from(messageName).stringify(), messageName);
}
/**
@@ -60,7 +60,7 @@ public class TestId {
@Test
public void testStringEquality() {
final String resourceName = "Resource";
- Assert.assertTrue(Id.resource(resourceName).equals(resourceName));
+ Assert.assertTrue(ResourceId.from(resourceName).equals(resourceName));
}
/**
@@ -68,14 +68,14 @@ public class TestId {
*/
@Test
public void testNull() {
- Assert.assertNull(Id.cluster(null));
- Assert.assertNull(Id.resource(null));
- Assert.assertNull(Id.partition(null));
- Assert.assertNull(Id.participant(null));
- Assert.assertNull(Id.session(null));
- Assert.assertNull(Id.process(null));
- Assert.assertNull(Id.stateModelDef(null));
- Assert.assertNull(Id.stateModelFactory(null));
- Assert.assertNull(Id.message(null));
+ Assert.assertNull(ClusterId.from(null));
+ Assert.assertNull(ResourceId.from(null));
+ Assert.assertNull(PartitionId.from(null));
+ Assert.assertNull(ParticipantId.from(null));
+ Assert.assertNull(SessionId.from(null));
+ Assert.assertNull(ProcId.from(null));
+ Assert.assertNull(StateModelDefId.from(null));
+ Assert.assertNull(StateModelFactoryId.from(null));
+ Assert.assertNull(MessageId.from(null));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/api/TestNamespacedConfig.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/api/TestNamespacedConfig.java b/helix-core/src/test/java/org/apache/helix/api/TestNamespacedConfig.java
index 380d99e..9f8f494 100644
--- a/helix-core/src/test/java/org/apache/helix/api/TestNamespacedConfig.java
+++ b/helix-core/src/test/java/org/apache/helix/api/TestNamespacedConfig.java
@@ -44,18 +44,18 @@ public class TestNamespacedConfig {
@Test
public void testUserConfigUpdates() {
final String testKey = "testKey";
- final String prefixedKey = UserConfig.class.getSimpleName() + "_testKey";
+ final String prefixedKey = UserConfig.class.getSimpleName() + "!testKey";
final String testSimpleValue = "testValue";
final List<String> testListValue = ImmutableList.of("testValue");
final Map<String, String> testMapValue = ImmutableMap.of("testInnerKey", "testValue");
// first, add Helix configuration to an InstanceConfig
- ParticipantId participantId = Id.participant("testParticipant");
+ ParticipantId participantId = ParticipantId.from("testParticipant");
InstanceConfig instanceConfig = new InstanceConfig(participantId);
instanceConfig.setHostName("localhost");
// now, add user configuration
- UserConfig userConfig = new UserConfig(participantId);
+ UserConfig userConfig = new UserConfig(Scope.participant(participantId));
userConfig.setSimpleField(testKey, testSimpleValue);
userConfig.setListField(testKey, testListValue);
userConfig.setMapField(testKey, testMapValue);
@@ -92,17 +92,17 @@ public class TestNamespacedConfig {
// Set up the namespaced configs
String userKey = "userKey";
String userValue = "userValue";
- ResourceId resourceId = Id.resource("testResource");
- UserConfig userConfig = new UserConfig(resourceId);
+ ResourceId resourceId = ResourceId.from("testResource");
+ UserConfig userConfig = new UserConfig(Scope.resource(resourceId));
userConfig.setSimpleField(userKey, userValue);
- PartitionId partitionId = Id.partition(resourceId, "0");
+ PartitionId partitionId = PartitionId.from(resourceId, "0");
Partition partition = new Partition(partitionId);
Map<ParticipantId, State> preferenceMap = new HashMap<ParticipantId, State>();
- ParticipantId participantId = Id.participant("participant");
+ ParticipantId participantId = ParticipantId.from("participant");
preferenceMap.put(participantId, State.from("ONLINE"));
CustomRebalancerConfig rebalancerConfig =
new CustomRebalancerConfig.Builder(resourceId).replicaCount(1).addPartition(partition)
- .stateModelDef(Id.stateModelDef("OnlineOffline"))
+ .stateModelDef(StateModelDefId.from("OnlineOffline"))
.preferenceMap(partitionId, preferenceMap).build();
// copy in the configs
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/api/TestNewStages.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/api/TestNewStages.java b/helix-core/src/test/java/org/apache/helix/api/TestNewStages.java
index 643875c..7fc4c83 100644
--- a/helix-core/src/test/java/org/apache/helix/api/TestNewStages.java
+++ b/helix-core/src/test/java/org/apache/helix/api/TestNewStages.java
@@ -81,7 +81,7 @@ public class TestNewStages extends ZkUnitTestBase {
Map<ResourceId, CurrentState> curStateMap = participant.getCurrentStateMap();
Assert.assertEquals(curStateMap.size(), 1);
- ResourceId resourceId = new ResourceId("TestDB0");
+ ResourceId resourceId = ResourceId.from("TestDB0");
Assert.assertTrue(curStateMap.containsKey(resourceId));
CurrentState curState = curStateMap.get(resourceId);
Map<PartitionId, State> partitionStateMap = curState.getPartitionStateMap();
@@ -91,7 +91,7 @@ public class TestNewStages extends ZkUnitTestBase {
Map<ResourceId, Resource> resourceMap = cluster.getResourceMap();
Assert.assertEquals(resourceMap.size(), 1);
- ResourceId resourceId = new ResourceId("TestDB0");
+ ResourceId resourceId = ResourceId.from("TestDB0");
Assert.assertTrue(resourceMap.containsKey(resourceId));
Resource resource = resourceMap.get(resourceId);
Assert
@@ -134,7 +134,7 @@ public class TestNewStages extends ZkUnitTestBase {
NewBestPossibleStateOutput bestPossibleStateOutput =
event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.toString());
Assert.assertNotNull(bestPossibleStateOutput);
- ResourceId resourceId = new ResourceId("TestDB0");
+ ResourceId resourceId = ResourceId.from("TestDB0");
ResourceAssignment assignment = bestPossibleStateOutput.getResourceAssignment(resourceId);
Assert.assertNotNull(assignment);
Resource resource = cluster.getResource(resourceId);
@@ -154,7 +154,7 @@ public class TestNewStages extends ZkUnitTestBase {
ClusterAccessor clusterAccessor = new ClusterAccessor(_clusterId, _dataAccessor);
Cluster cluster = clusterAccessor.readCluster();
- ResourceId resourceId = new ResourceId("TestDB0");
+ ResourceId resourceId = ResourceId.from("TestDB0");
Resource resource = cluster.getResource(resourceId);
ResourceCurrentState currentStateOutput = new ResourceCurrentState();
SemiAutoRebalancerConfig semiAutoConfig =
@@ -200,7 +200,7 @@ public class TestNewStages extends ZkUnitTestBase {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
- _clusterId = new ClusterId(clusterName);
+ _clusterId = ClusterId.from(clusterName);
System.out.println("START " + _clusterId + " at " + new Date(System.currentTimeMillis()));
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java b/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java
index b680844..4d96431 100644
--- a/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java
+++ b/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java
@@ -32,12 +32,13 @@ import org.apache.helix.HelixManager;
import org.apache.helix.Mocks;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.ZNRecord;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.ParticipantId;
import org.apache.helix.api.Partition;
import org.apache.helix.api.PartitionId;
import org.apache.helix.api.Resource;
import org.apache.helix.api.ResourceConfig;
import org.apache.helix.api.ResourceId;
+import org.apache.helix.api.Scope;
import org.apache.helix.api.StateModelDefId;
import org.apache.helix.api.UserConfig;
import org.apache.helix.controller.pipeline.Stage;
@@ -116,7 +117,7 @@ public class BaseStageTest {
// setup liveInstances
for (int i = 0; i < numLiveInstances; i++) {
String instanceName = "localhost_" + i;
- InstanceConfig instanceConfig = new InstanceConfig(Id.participant(instanceName));
+ InstanceConfig instanceConfig = new InstanceConfig(ParticipantId.from(instanceName));
instanceConfig.setHostName("localhost");
instanceConfig.setPort(Integer.toString(i));
LiveInstance liveInstance = new LiveInstance(instanceName);
@@ -148,17 +149,17 @@ public class BaseStageTest {
ZNRecord masterSlave = StateModelConfigGenerator.generateConfigForMasterSlave();
StateModelDefinition masterSlaveDef = new StateModelDefinition(masterSlave);
- defs.put(Id.stateModelDef(masterSlaveDef.getId()), masterSlaveDef);
+ defs.put(StateModelDefId.from(masterSlaveDef.getId()), masterSlaveDef);
accessor.setProperty(keyBuilder.stateModelDef(masterSlave.getId()), masterSlaveDef);
ZNRecord leaderStandby = StateModelConfigGenerator.generateConfigForLeaderStandby();
StateModelDefinition leaderStandbyDef = new StateModelDefinition(leaderStandby);
- defs.put(Id.stateModelDef(leaderStandbyDef.getId()), leaderStandbyDef);
+ defs.put(StateModelDefId.from(leaderStandbyDef.getId()), leaderStandbyDef);
accessor.setProperty(keyBuilder.stateModelDef(leaderStandby.getId()), leaderStandbyDef);
ZNRecord onlineOffline = StateModelConfigGenerator.generateConfigForOnlineOffline();
StateModelDefinition onlineOfflineDef = new StateModelDefinition(onlineOffline);
- defs.put(Id.stateModelDef(onlineOfflineDef.getId()), onlineOfflineDef);
+ defs.put(StateModelDefId.from(onlineOfflineDef.getId()), onlineOfflineDef);
accessor.setProperty(keyBuilder.stateModelDef(onlineOffline.getId()), onlineOfflineDef);
return defs;
@@ -174,8 +175,8 @@ public class BaseStageTest {
}
Map<PartitionId, UserConfig> partitionConfigMap = Collections.emptyMap();
Resource resource =
- new Resource(resourceId, idealState, null, null, new UserConfig(resourceId),
- partitionConfigMap);
+ new Resource(resourceId, idealState, null, null, new UserConfig(
+ Scope.resource(resourceId)), partitionConfigMap);
resourceMap.put(resourceId, resource.getConfig());
}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java
index 8873a61..8027d11 100644
--- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java
+++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java
@@ -26,8 +26,8 @@ import java.util.List;
import java.util.Map;
import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.api.Id;
import org.apache.helix.api.ParticipantId;
+import org.apache.helix.api.PartitionId;
import org.apache.helix.api.ResourceConfig;
import org.apache.helix.api.ResourceId;
import org.apache.helix.api.State;
@@ -70,10 +70,10 @@ public class TestBestPossibleCalcStageCompatibility extends BaseStageTest {
event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.toString());
for (int p = 0; p < 5; p++) {
Map<ParticipantId, State> replicaMap =
- output.getResourceAssignment(Id.resource("testResourceName")).getReplicaMap(
- Id.partition("testResourceName_" + p));
+ output.getResourceAssignment(ResourceId.from("testResourceName")).getReplicaMap(
+ PartitionId.from("testResourceName_" + p));
AssertJUnit.assertEquals(State.from("MASTER"),
- replicaMap.get(Id.participant("localhost_" + (p + 1) % 5)));
+ replicaMap.get(ParticipantId.from("localhost_" + (p + 1) % 5)));
}
System.out
.println("END TestBestPossibleStateCalcStageCompatibility_testSemiAutoModeCompatibility at "
@@ -108,10 +108,10 @@ public class TestBestPossibleCalcStageCompatibility extends BaseStageTest {
event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.toString());
for (int p = 0; p < 5; p++) {
Map<ParticipantId, State> replicaMap =
- output.getResourceAssignment(Id.resource("testResourceName")).getReplicaMap(
- Id.partition("testResourceName_" + p));
+ output.getResourceAssignment(ResourceId.from("testResourceName")).getReplicaMap(
+ PartitionId.from("testResourceName_" + p));
AssertJUnit.assertEquals(State.from("MASTER"),
- replicaMap.get(Id.participant("localhost_" + (p + 1) % 5)));
+ replicaMap.get(ParticipantId.from("localhost_" + (p + 1) % 5)));
}
System.out
.println("END TestBestPossibleStateCalcStageCompatibility_testCustomModeCompatibility at "
@@ -136,9 +136,9 @@ public class TestBestPossibleCalcStageCompatibility extends BaseStageTest {
}
idealState.setPreferenceList(resourceName + "_" + p, value);
Map<ParticipantId, State> preferenceMap = new HashMap<ParticipantId, State>();
- preferenceMap.put(Id.participant("localhost_" + (p + 1) % 5), State.from("MASTER"));
+ preferenceMap.put(ParticipantId.from("localhost_" + (p + 1) % 5), State.from("MASTER"));
idealState.setParticipantStateMap(
- Id.partition(Id.resource(resourceName), Integer.toString(p)), preferenceMap);
+ PartitionId.from(ResourceId.from(resourceName), Integer.toString(p)), preferenceMap);
}
idealState.setStateModelDefRef("MasterSlave");
idealState.setIdealStateMode(mode.toString());
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java
index 9f7ea82..4874a83 100644
--- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java
+++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java
@@ -23,8 +23,8 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-import org.apache.helix.api.Id;
import org.apache.helix.api.ParticipantId;
+import org.apache.helix.api.PartitionId;
import org.apache.helix.api.ResourceConfig;
import org.apache.helix.api.ResourceId;
import org.apache.helix.api.State;
@@ -61,10 +61,10 @@ public class TestBestPossibleStateCalcStage extends BaseStageTest {
event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.toString());
for (int p = 0; p < 5; p++) {
Map<ParticipantId, State> replicaMap =
- output.getResourceAssignment(Id.resource("testResourceName")).getReplicaMap(
- Id.partition("testResourceName_" + p));
+ output.getResourceAssignment(ResourceId.from("testResourceName")).getReplicaMap(
+ PartitionId.from("testResourceName_" + p));
AssertJUnit.assertEquals(State.from("MASTER"),
- replicaMap.get(Id.participant("localhost_" + (p + 1) % 5)));
+ replicaMap.get(ParticipantId.from("localhost_" + (p + 1) % 5)));
}
System.out.println("END TestBestPossibleStateCalcStage at "
+ new Date(System.currentTimeMillis()));
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fb96a138/helix-core/src/test/java/org/apache/helix/controller/stages/TestCurrentStateComputationStage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestCurrentStateComputationStage.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestCurrentStateComputationStage.java
index 837eee7..7176797 100644
--- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestCurrentStateComputationStage.java
+++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestCurrentStateComputationStage.java
@@ -24,9 +24,12 @@ import java.util.Map;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.ZNRecord;
-import org.apache.helix.api.Id;
+import org.apache.helix.api.MessageId;
+import org.apache.helix.api.ParticipantId;
+import org.apache.helix.api.PartitionId;
import org.apache.helix.api.ResourceConfig;
import org.apache.helix.api.ResourceId;
+import org.apache.helix.api.SessionId;
import org.apache.helix.api.State;
import org.apache.helix.model.CurrentState;
import org.apache.helix.model.IdealState;
@@ -50,8 +53,8 @@ public class TestCurrentStateComputationStage extends BaseStageTest {
runStage(event, stage);
ResourceCurrentState output = event.getAttribute(AttributeName.CURRENT_STATE.toString());
AssertJUnit.assertEquals(
- output.getCurrentStateMap(Id.resource("testResourceName"),
- Id.partition("testResourceName_0")).size(), 0);
+ output.getCurrentStateMap(ResourceId.from("testResourceName"),
+ PartitionId.from("testResourceName_0")).size(), 0);
}
@Test
@@ -71,17 +74,17 @@ public class TestCurrentStateComputationStage extends BaseStageTest {
runStage(event, stage);
ResourceCurrentState output1 = event.getAttribute(AttributeName.CURRENT_STATE.toString());
AssertJUnit.assertEquals(
- output1.getCurrentStateMap(Id.resource("testResourceName"),
- Id.partition("testResourceName_0")).size(), 0);
+ output1.getCurrentStateMap(ResourceId.from("testResourceName"),
+ PartitionId.from("testResourceName_0")).size(), 0);
// Add a state transition messages
- Message message = new Message(Message.MessageType.STATE_TRANSITION, Id.message("msg1"));
+ Message message = new Message(Message.MessageType.STATE_TRANSITION, MessageId.from("msg1"));
message.setFromState(State.from("OFFLINE"));
message.setToState(State.from("SLAVE"));
- message.setResourceId(Id.resource("testResourceName"));
- message.setPartitionId(Id.partition("testResourceName_1"));
+ message.setResourceId(ResourceId.from("testResourceName"));
+ message.setPartitionId(PartitionId.from("testResourceName_1"));
message.setTgtName("localhost_3");
- message.setTgtSessionId(Id.session("session_3"));
+ message.setTgtSessionId(SessionId.from("session_3"));
Builder keyBuilder = accessor.keyBuilder();
accessor.setProperty(keyBuilder.message("localhost_" + 3, message.getId()), message);
@@ -90,21 +93,21 @@ public class TestCurrentStateComputationStage extends BaseStageTest {
runStage(event, stage);
ResourceCurrentState output2 = event.getAttribute(AttributeName.CURRENT_STATE.toString());
State pendingState =
- output2.getPendingState(Id.resource("testResourceName"),
- Id.partition("testResourceName_1"), Id.participant("localhost_3"));
+ output2.getPendingState(ResourceId.from("testResourceName"),
+ PartitionId.from("testResourceName_1"), ParticipantId.from("localhost_3"));
AssertJUnit.assertEquals(pendingState, State.from("SLAVE"));
ZNRecord record1 = new ZNRecord("testResourceName");
// Add a current state that matches sessionId and one that does not match
CurrentState stateWithLiveSession = new CurrentState(record1);
- stateWithLiveSession.setSessionId(Id.session("session_3"));
+ stateWithLiveSession.setSessionId(SessionId.from("session_3"));
stateWithLiveSession.setStateModelDefRef("MasterSlave");
- stateWithLiveSession.setState(Id.partition("testResourceName_1"), State.from("OFFLINE"));
+ stateWithLiveSession.setState(PartitionId.from("testResourceName_1"), State.from("OFFLINE"));
ZNRecord record2 = new ZNRecord("testResourceName");
CurrentState stateWithDeadSession = new CurrentState(record2);
- stateWithDeadSession.setSessionId(Id.session("session_dead"));
+ stateWithDeadSession.setSessionId(SessionId.from("session_dead"));
stateWithDeadSession.setStateModelDefRef("MasterSlave");
- stateWithDeadSession.setState(Id.partition("testResourceName_1"), State.from("MASTER"));
+ stateWithDeadSession.setState(PartitionId.from("testResourceName_1"), State.from("MASTER"));
accessor.setProperty(keyBuilder.currentState("localhost_3", "session_3", "testResourceName"),
stateWithLiveSession);
@@ -115,8 +118,8 @@ public class TestCurrentStateComputationStage extends BaseStageTest {
runStage(event, stage);
ResourceCurrentState output3 = event.getAttribute(AttributeName.CURRENT_STATE.toString());
State currentState =
- output3.getCurrentState(Id.resource("testResourceName"),
- Id.partition("testResourceName_1"), Id.participant("localhost_3"));
+ output3.getCurrentState(ResourceId.from("testResourceName"),
+ PartitionId.from("testResourceName_1"), ParticipantId.from("localhost_3"));
AssertJUnit.assertEquals(currentState, State.from("OFFLINE"));
}