Package org.apache.aurora.gen

Examples of org.apache.aurora.gen.Attribute


      attribute = Optional.absent();
    } else {
      Set<String> attributeValues = ImmutableSet.copyOf(
          Iterables.concat(Iterables.transform(sameNameAttributes, GET_VALUES)));
      attribute =
          Optional.of(IAttribute.build(new Attribute(constraint.getName(), attributeValues)));
    }

    ITaskConstraint taskConstraint = constraint.getConstraint();
    switch (taskConstraint.getSetField()) {
      case VALUE:
View Full Code Here


  private IExpectationSetters<?> expectGetHostRack(String host, String rackToReturn) {
    IHostAttributes attributes = IHostAttributes.build(new HostAttributes()
        .setHost(host)
        .setAttributes(ImmutableSet.of(
            new Attribute().setName("rack").setValues(ImmutableSet.of(rackToReturn)))));
    return expect(storageUtil.attributeStore.getHostAttributes(host))
        .andReturn(Optional.of(attributes));
  }
View Full Code Here

    IHostAttributes attributes = IHostAttributes.build(
        new HostAttributes()
            .setHost("a")
            .setMode(MaintenanceMode.DRAINING)
            .setAttributes(ImmutableSet.of(
                new Attribute().setName("b").setValues(ImmutableSet.of("1", "2")))));

    expect(attributeStore.saveHostAttributes(attributes)).andReturn(true);
    expectOp(Op.saveHostAttributes(
        new SaveHostAttributes().setHostAttributes(attributes.newBuilder())));
    eventSink.post(new PubsubEvent.HostAttributesChanged(attributes));
View Full Code Here

        IScheduledTask.build(new ScheduledTask().setStatus(ScheduleStatus.PENDING)));
    Set<QuotaConfiguration> quotas =
        ImmutableSet.of(
            new QuotaConfiguration("steve", ResourceAggregates.none().newBuilder()));
    IHostAttributes attribute = IHostAttributes.build(
        new HostAttributes("host", ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value"))))
            .setSlaveId("slave id"));
    // A legacy attribute that has a maintenance mode set, but nothing else.  These should be
    // dropped.
    IHostAttributes legacyAttribute = IHostAttributes.build(
        new HostAttributes("host", ImmutableSet.<Attribute>of()));
View Full Code Here

    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",
            new JobConfiguration().setKey(new JobKey("owner", "env", "jobA")))));
    snapshot.setQuotaConfigurations(
View Full Code Here

    task.getAssignedTask().setSlaveHost(host);
    task.getAssignedTask().setSlaveId(hostToId(host));
  }

  private Attribute host(String host) {
    return new Attribute(HOST_ATTRIBUTE, ImmutableSet.of(host));
  }
View Full Code Here

  private Attribute host(String host) {
    return new Attribute(HOST_ATTRIBUTE, ImmutableSet.of(host));
  }

  private Attribute rack(String rack) {
    return new Attribute(RACK_ATTRIBUTE, ImmutableSet.of(rack));
  }
View Full Code Here

public class IHostAttributesTest {

  @Test
  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);
    assertEquals(immutable2, immutable1);
    attribute.setValues(ImmutableSet.of("a"));
    assertEquals(immutable1, immutable2);
    assertEquals(immutable2, immutable1);
  }
View Full Code Here

  }

  @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

  private Snapshot createSnapshot() {
    return new Snapshot()
        .setTimestamp(1L)
        .setHostAttributes(ImmutableSet.of(new HostAttributes("host",
            ImmutableSet.of(new Attribute("hostname", ImmutableSet.of("abc"))))))
        .setTasks(ImmutableSet.of(
            new ScheduledTask().setStatus(ScheduleStatus.RUNNING)
                .setAssignedTask(new AssignedTask().setTaskId("task_id")
                    .setTask(new TaskConfig().setJobName("job_name")))));
  }
View Full Code Here

TOP

Related Classes of org.apache.aurora.gen.Attribute

Copyright © 2018 www.massapicom. 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.