Examples of HostAttributes


Examples of org.apache.aurora.gen.HostAttributes

  private Snapshot makeSnapshot() {
    Snapshot snapshot = new Snapshot();
    snapshot.setTimestamp(clock.nowMillis());
    snapshot.setHostAttributes(ImmutableSet.of(
        new HostAttributes(
            "hostA",
            ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value"))))));
    snapshot.setJobs(ImmutableSet.of(
        new StoredJob(
            "jobManager",
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

        .transform(new Function<Offer, HostOffer>() {
          @Override
          public HostOffer apply(Offer offer) {
            return new HostOffer(
                offer,
                IHostAttributes.build(new HostAttributes().setMode(MaintenanceMode.NONE)));
          }
        });
    expect(offerQueue.getOffers()).andReturn(hostOffers);
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

  }

  // Sets up a normal host, no dedicated hosts and no maintenance.
  private void setUpHost(String host, String rack) {
    IHostAttributes hostAttrs = IHostAttributes.build(
        new HostAttributes().setHost(host).setSlaveId(host + "_id")
            .setMode(NONE).setAttributes(ImmutableSet.of(rack(rack), host(host))));

    expect(this.storageUtil.attributeStore.getHostAttributes(host))
        .andReturn(Optional.of(hostAttrs)).anyTimes();
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

        .clearResources()
        .addAllResources(resources)
        .build();
    assertEquals(0, insufficientOffers.get());
    assertFalse(gcExecutorLauncher.willUse(
        new HostOffer(smallOffer, IHostAttributes.build(new HostAttributes()))));
    assertEquals(1, insufficientOffers.get());
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    expectAnyMaintenanceCalls();
    Capture<Runnable> offerExpirationCapture = expectOfferDeclineIn(10);

    HostOffer offerAB = new HostOffer(
        Offers.makeOffer("OFFER_B").toBuilder().setSlaveId(OFFER_A.getOffer().getSlaveId()).build(),
        IHostAttributes.build(new HostAttributes()));

    driver.declineOffer(OFFER_A.getOffer().getId());
    driver.declineOffer(offerAB.getOffer().getId());

    replayAndCreateScheduler();
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

  private static HostOffer makeOffer(String offerId, String hostName, MaintenanceMode mode) {
    Offer offer = Offers.makeOffer(offerId, hostName);
    return new HostOffer(
        offer,
        IHostAttributes.build(new HostAttributes()
            .setHost(hostName)
            .setSlaveId(offer.getSlaveId().getValue())
            .setAttributes(ImmutableSet.<Attribute>of())
            .setMode(mode)));
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

  public void testObjectDetachment() {
    // AURORA-729: Immutable wrapper objects are not always immutable.
    Attribute attribute = new Attribute()
        .setName("attr")
        .setValues(ImmutableSet.of("a", "b", "c"));
    HostAttributes mutable = new HostAttributes()
        .setHost("a")
        .setAttributes(ImmutableSet.of(attribute));
    IHostAttributes immutable1 = IHostAttributes.FROM_BUILDER.apply(mutable);
    IHostAttributes immutable2 = IHostAttributes.build(mutable);
    assertEquals(immutable1, immutable2);
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    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.gen.HostAttributes

    assertEquals(Optional.of(attributes), read(HOST_A));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNoMode() {
    HostAttributes noMode = HOST_A_ATTRS.newBuilder();
    noMode.unsetMode();

    insert(IHostAttributes.build(noMode));
  }
View Full Code Here

Examples of org.apache.aurora.gen.HostAttributes

    insert(IHostAttributes.build(noMode));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testSaveAttributesNotSet() {
    HostAttributes attributes = HOST_A_ATTRS.newBuilder();
    attributes.unsetAttributes();

    insert(IHostAttributes.build(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.