@Test public void addNewPartition() { TestHardwareLayout testHardwareLayout = new TestHardwareLayout("Alpha"); PartitionLayout partitionLayout = new PartitionLayout(testHardwareLayout.getHardwareLayout(), clusterMapConfig); StaticClusterManager clusterMapManager = (new StaticClusterAgentsFactory(getDummyConfig(), partitionLayout)).getClusterMap(); int dcCount = testHardwareLayout.getDatacenterCount(); List<PartitionId> partitionIds = clusterMapManager.getWritablePartitionIds(null); assertEquals(partitionIds.size(), 0); clusterMapManager.addNewPartition(testHardwareLayout.getIndependentDisks(3), 100 * 1024 * 1024 * 1024L, MockClusterMap.DEFAULT_PARTITION_CLASS); partitionIds = clusterMapManager.getWritablePartitionIds(null); assertEquals(partitionIds.size(), 1); PartitionId partitionId = partitionIds.get(0); assertEquals(partitionId.getReplicaIds().size(), 3 * dcCount); }
PartitionId addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) { return partitionLayout.addNewPartition(disks, replicaCapacityInBytes, partitionClass); }
StaticClusterManager implements ClusterMap { PartitionId addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) { return partitionLayout.addNewPartition(disks, replicaCapacityInBytes, partitionClass); } }
StaticClusterManager implements ClusterMap { PartitionId addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) { return partitionLayout.addNewPartition(disks, replicaCapacityInBytes, partitionClass); } StaticClusterManager(PartitionLayout partitionLayout, String localDatacenterName, MetricRegistry metricRegistry); }
StaticClusterManager implements ClusterMap { PartitionId addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) { return partitionLayout.addNewPartition(disks, replicaCapacityInBytes, partitionClass); } StaticClusterManager(PartitionLayout partitionLayout, String localDatacenterName, MetricRegistry metricRegistry); @Override List<PartitionId> getWritablePartitionIds(String partitionClass); @Override PartitionId getRandomWritablePartition(String partitionClass, List<PartitionId> partitionsToExclude); @Override List<PartitionId> getAllPartitionIds(String partitionClass); @Override PartitionId getPartitionIdFromStream(InputStream stream); @Override boolean hasDatacenter(String datacenterName); @Override byte getLocalDatacenterId(); @Override String getDatacenterName(byte id); @Override DataNodeId getDataNodeId(String hostname, int port); @Override List<ReplicaId> getReplicaIds(DataNodeId dataNodeId); @Override List<DataNodeId> getDataNodeIds(); @Override MetricRegistry getMetricRegistry(); @Override void registerClusterMapListener(ClusterMapChangeListener clusterMapChangeListener); @Override boolean equals(Object o); @Override void onReplicaEvent(ReplicaId replicaId, ReplicaEventType event); @Override JSONObject getSnapshot(); @Override ReplicaId getBootstrapReplica(String partitionIdStr, DataNodeId dataNodeId); @Override void close(); }
StaticClusterManager implements ClusterMap { PartitionId addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass) { return partitionLayout.addNewPartition(disks, replicaCapacityInBytes, partitionClass); } StaticClusterManager(PartitionLayout partitionLayout, String localDatacenterName, MetricRegistry metricRegistry); @Override List<PartitionId> getWritablePartitionIds(String partitionClass); @Override PartitionId getRandomWritablePartition(String partitionClass, List<PartitionId> partitionsToExclude); @Override List<PartitionId> getAllPartitionIds(String partitionClass); @Override PartitionId getPartitionIdFromStream(InputStream stream); @Override boolean hasDatacenter(String datacenterName); @Override byte getLocalDatacenterId(); @Override String getDatacenterName(byte id); @Override DataNodeId getDataNodeId(String hostname, int port); @Override List<ReplicaId> getReplicaIds(DataNodeId dataNodeId); @Override List<DataNodeId> getDataNodeIds(); @Override MetricRegistry getMetricRegistry(); @Override void registerClusterMapListener(ClusterMapChangeListener clusterMapChangeListener); @Override boolean equals(Object o); @Override void onReplicaEvent(ReplicaId replicaId, ReplicaEventType event); @Override JSONObject getSnapshot(); @Override ReplicaId getBootstrapReplica(String partitionIdStr, DataNodeId dataNodeId); @Override void close();  }