Java Code Examples for org.apache.mesos.Protos#DomainInfo

The following examples show how to use org.apache.mesos.Protos#DomainInfo . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlacementUtils.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
public static boolean hasZone(Protos.Offer offer) {
  if (!offer.hasDomain()) {
    return false;
  }

  Protos.DomainInfo domainInfo = offer.getDomain();
  if (!domainInfo.hasFaultDomain()) {
    return false;
  }

  return domainInfo.getFaultDomain().hasZone();
}
 
Example 2
Source File: TestConstants.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
private static final Protos.DomainInfo getDomainInfo(String region) {
    return Protos.DomainInfo.newBuilder()
            .setFaultDomain(Protos.DomainInfo.FaultDomain.newBuilder()
                    .setZone(Protos.DomainInfo.FaultDomain.ZoneInfo.newBuilder().setName(TestConstants.ZONE))
                    .setRegion(Protos.DomainInfo.FaultDomain.RegionInfo.newBuilder().setName(region)))
            .build();
}
 
Example 3
Source File: IsLocalRegionRule.java    From dcos-commons with Apache License 2.0 4 votes vote down vote up
public static void setLocalDomain(Protos.DomainInfo domainInfo) {
  localDomain = domainInfo;
}
 
Example 4
Source File: IsLocalRegionRuleTest.java    From dcos-commons with Apache License 2.0 4 votes vote down vote up
private Protos.Offer getOffer(Protos.DomainInfo domainInfo) {
    return getOffer().toBuilder()
            .setDomain(domainInfo)
            .build();
}
 
Example 5
Source File: FrameworkSchedulerTest.java    From dcos-commons with Apache License 2.0 4 votes vote down vote up
private static void verifyDomainIsSet(Protos.DomainInfo expectedDomain) {
    // Infer the configured domain via a placement rule invocation
    Protos.Offer offerWithExpectedDomain = getOffer().toBuilder().setDomain(expectedDomain).build();
    EvaluationOutcome outcome = new IsLocalRegionRule().filter(offerWithExpectedDomain, null, null);
    Assert.assertTrue(outcome.getReason(), outcome.isPassing());
}