Examples of IHostAttributes


Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  @Test
  public void testAttribute() {
    control.replay();

    IHostAttributes hostA = hostAttributes(HOST_A, valueAttribute("jvm", "1.0"));

    // Matches attribute, matching value.
    checkConstraint(hostA, "jvm", true, "1.0");

    // Matches attribute, different value.
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  @Test
  public void testAttributes() {
    control.replay();

    IHostAttributes hostA = hostAttributes(
        HOST_A,
        valueAttribute("jvm", "1.4", "1.6", "1.7"),
        valueAttribute("zone", "a", "b", "c"));

    // Matches attribute, matching value.
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  @Test
  public void testDuplicatedAttribute() {
    control.replay();

    IHostAttributes hostA = hostAttributes(HOST_A,
        valueAttribute("jvm", "1.4"),
        valueAttribute("jvm", "1.6", "1.7"));

    // Matches attribute, matching value.
    checkConstraint(hostA, "jvm", true, "1.4");
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  private IExpectationSetters<Optional<IHostAttributes>> expectGetHostAttributes(
      String host,
      Attribute... attributes) {

    IHostAttributes hostAttributes = IHostAttributes.build(new HostAttributes()
        .setHost(host)
        .setAttributes(ImmutableSet.<Attribute>builder().add(attributes).build()));
    return expect(attributeStore.getHostAttributes(host)).andReturn(Optional.of(hostAttributes));
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

    expect(storageUtil.taskStore.fetchTasks(Query.slaveScoped(hostName).active()))
        .andReturn(IScheduledTask.setFromBuilders(tasks));
  }

  private void expectMaintenanceModeChange(String hostName, MaintenanceMode mode) {
    IHostAttributes attributes = IHostAttributes.build(new HostAttributes().setHost(hostName));

    expect(storageUtil.attributeStore.getHostAttributes(hostName))
        .andReturn(Optional.of(attributes));
    IHostAttributes updated = IHostAttributes.build(attributes.newBuilder().setMode(mode));
    expect(storageUtil.attributeStore.saveHostAttributes(updated)).andReturn(true);
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

    insert(HOST_B_ATTRS);
    insert(HOST_B_ATTRS)// Double insert should be allowed.
    assertEquals(Optional.of(HOST_B_ATTRS), read(HOST_B));
    assertEquals(ImmutableSet.of(HOST_A_ATTRS, HOST_B_ATTRS), readAll());

    IHostAttributes updatedA = IHostAttributes.build(
        HOST_A_ATTRS.newBuilder().setAttributes(ImmutableSet.of(ATTR1, ATTR3)));
    insert(updatedA);
    assertEquals(Optional.of(updatedA), read(HOST_A));
    assertEquals(ImmutableSet.of(updatedA, HOST_B_ATTRS), readAll());

    IHostAttributes updatedMode = IHostAttributes.build(updatedA.newBuilder().setMode(DRAINED));
    insert(updatedMode);
    assertEquals(Optional.of(updatedMode), read(HOST_A));
    assertEquals(ImmutableSet.of(updatedMode, HOST_B_ATTRS), readAll());

    truncate();
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

    assertEquals(ImmutableSet.<IHostAttributes>of(), readAll());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testEmptyAttributeValues() {
    IHostAttributes attributes = IHostAttributes.build(HOST_A_ATTRS.newBuilder()
        .setAttributes(ImmutableSet.of(new Attribute("attr1", ImmutableSet.<String>of()))));
    insert(attributes);
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

    insert(attributes);
  }

  @Test
  public void testNoAttributes() {
    IHostAttributes attributes = IHostAttributes.build(
        HOST_A_ATTRS.newBuilder().setAttributes(ImmutableSet.<Attribute>of()));
    insert(attributes);
    assertEquals(Optional.of(attributes), read(HOST_A));
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  }

  @Test
  public void testSlaveIdChanges() {
    insert(HOST_A_ATTRS);
    IHostAttributes updated = IHostAttributes.build(HOST_A_ATTRS.newBuilder().setSlaveId(SLAVE_B));
    insert(updated);
    assertEquals(Optional.of(updated), read(HOST_A));
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IHostAttributes

  @Test
  public void testMeetsOffer() {
    control.replay();

    IHostAttributes attributes = hostAttributes(HOST_A, host(HOST_A), rack(RACK_A));
    assertNoVetoes(makeTask(DEFAULT_CPUS, DEFAULT_RAM, DEFAULT_DISK), attributes);
    assertNoVetoes(
        makeTask(DEFAULT_CPUS - 1, DEFAULT_RAM - 1, DEFAULT_DISK - 1),
        attributes);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.