コード例 #1
0
  @Test
  public void testVetoScaling() {
    control.replay();

    int maxScore = VetoType.INSUFFICIENT_RESOURCES.getScore();
    assertEquals((int) (maxScore * 1.0 / CPU.getRange()), CPU.veto(1).getScore());
    assertEquals(maxScore, CPU.veto(CPU.getRange() * 10).getScore());
    assertEquals((int) (maxScore * 2.0 / RAM.getRange()), RAM.veto(2).getScore());
    assertEquals((int) (maxScore * 200.0 / DISK.getRange()), DISK.veto(200).getScore());
  }
コード例 #2
0
  @Test
  public void testInsufficientResources() {
    control.replay();

    IHostAttributes hostA = hostAttributes(HOST_A, host(HOST_A), rack(RACK_A));
    assertVetoes(
        makeTask(DEFAULT_CPUS + 1, DEFAULT_RAM + 1, DEFAULT_DISK + 1),
        hostA,
        CPU.veto(1),
        DISK.veto(1),
        RAM.veto(1));
    assertVetoes(makeTask(DEFAULT_CPUS + 1, DEFAULT_RAM, DEFAULT_DISK), hostA, CPU.veto(1));
    assertVetoes(makeTask(DEFAULT_CPUS, DEFAULT_RAM + 1, DEFAULT_DISK), hostA, RAM.veto(1));
    assertVetoes(makeTask(DEFAULT_CPUS, DEFAULT_RAM, DEFAULT_DISK + 1), hostA, DISK.veto(1));
  }
コード例 #3
0
ファイル: Graph.java プロジェクト: bertjan/watchboard
 public static Type fromString(String typeStr) {
   if (StringUtils.isEmpty(typeStr)) {
     return null;
   }
   typeStr = typeStr.toUpperCase();
   if (CLOUDWATCH.toString().equals(typeStr)) {
     return CLOUDWATCH;
   } else if (PERFORMR.toString().equals(typeStr)) {
     return PERFORMR;
   } else if (DISK.toString().equals(typeStr)) {
     return DISK;
   } else if ("CLOUDWATCH-DASHBOARD".toString().equals(typeStr)) {
     return CLOUDWATCH_DASHBOARD;
   } else if (KIBANA.toString().equals(typeStr)) {
     return KIBANA;
   } else if (SONAR.toString().equals(typeStr)) {
     return SONAR;
   }
   return null;
 }