@Test public void scoreTest() { ClusterState clusterState = getTestClusterState(); assertEquals(-4, scoreCalculatorConsolidation.calculateScore(clusterState).getHardScore()); assertEquals(0, scoreCalculatorConsolidation.calculateScore(clusterState).getSoftScore()); }
@Override public HardMediumSoftScore calculateScore(ClusterState solution) { int hardScore = calculateHardScore(solution); int mediumScore = 100 * (solution.countOffHosts() + solution.countIdleHosts()); int softScore = 0; if("1".equals(System.getenv("CLOPLA_DEBUG")) && hardScore < 0 ) { System.out.println("with " + (-softScore) + " migrations. Hard, medium, soft: " + hardScore + ", " + mediumScore + ", " + softScore); } return HardMediumSoftScore.valueOf(hardScore,mediumScore,softScore); }
ScoreCalculatorConsolidation implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { int hardScore = calculateHardScore(solution); int mediumScore = 100 * (solution.countOffHosts() + solution.countIdleHosts()); int softScore = 0; if("1".equals(System.getenv("CLOPLA_DEBUG")) && hardScore < 0 ) { System.out.println("with " + (-softScore) + " migrations. Hard, medium, soft: " + hardScore + ", " + mediumScore + ", " + softScore); } return HardMediumSoftScore.valueOf(hardScore,mediumScore,softScore); } }
ScoreCalculatorConsolidation implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { int hardScore = calculateHardScore(solution); int mediumScore = 100 * (solution.countOffHosts() + solution.countIdleHosts()); int softScore = 0; if("1".equals(System.getenv("CLOPLA_DEBUG")) && hardScore < 0 ) { System.out.println("with " + (-softScore) + " migrations. Hard, medium, soft: " + hardScore + ", " + mediumScore + ", " + softScore); } return HardMediumSoftScore.valueOf(hardScore,mediumScore,softScore); }  }
ScoreCalculatorConsolidation implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { int hardScore = calculateHardScore(solution); int mediumScore = 100 * (solution.countOffHosts() + solution.countIdleHosts()); int softScore = 0; if("1".equals(System.getenv("CLOPLA_DEBUG")) && hardScore < 0 ) { System.out.println("with " + (-softScore) + " migrations. Hard, medium, soft: " + hardScore + ", " + mediumScore + ", " + softScore); } return HardMediumSoftScore.valueOf(hardScore,mediumScore,softScore); }  @Override HardMediumSoftScore calculateScore(ClusterState solution); }
ScoreCalculatorConsolidation implements SimpleScoreCalculator<ClusterState> { @Override public HardMediumSoftScore calculateScore(ClusterState solution) { int hardScore = calculateHardScore(solution); int mediumScore = 100 * (solution.countOffHosts() + solution.countIdleHosts()); int softScore = 0; if("1".equals(System.getenv("CLOPLA_DEBUG")) && hardScore < 0 ) { System.out.println("with " + (-softScore) + " migrations. Hard, medium, soft: " + hardScore + ", " + mediumScore + ", " + softScore); } return HardMediumSoftScore.valueOf(hardScore,mediumScore,softScore); }  @Override HardMediumSoftScore calculateScore(ClusterState solution);  }