aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject aurora git commit: Renaming ResourceType.getName()
Date Mon, 11 Apr 2016 23:02:32 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 46ce98d8c -> e95212e2f


Renaming ResourceType.getName()

Reviewed at https://reviews.apache.org/r/46057/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/e95212e2
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/e95212e2
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/e95212e2

Branch: refs/heads/master
Commit: e95212e2fdbe5a921936822bdca316318ae9878f
Parents: 46ce98d
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Mon Apr 11 16:02:20 2016 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Mon Apr 11 16:02:20 2016 -0700

----------------------------------------------------------------------
 .../configuration/executor/ExecutorModule.java  |  2 +-
 .../executor/ExecutorSettings.java              |  2 +-
 .../scheduler/mesos/TestExecutorSettings.java   |  4 +-
 .../scheduler/resources/AcceptedOffer.java      |  8 +--
 .../scheduler/resources/ResourceSlot.java       |  8 +--
 .../scheduler/resources/ResourceType.java       |  4 +-
 .../aurora/scheduler/resources/Resources.java   | 10 +--
 .../local/simulator/ClusterSimulatorModule.java |  8 +--
 .../apache/aurora/scheduler/mesos/Offers.java   |  8 +--
 .../preemptor/PreemptionVictimFilterTest.java   |  4 +-
 .../scheduler/resources/AcceptedOfferTest.java  | 64 +++++++++++---------
 .../scheduler/resources/ResourceSlotTest.java   |  2 +-
 .../scheduler/resources/ResourcesTest.java      |  2 +-
 .../scheduler/stats/AsyncStatsModuleTest.java   |  2 +-
 14 files changed, 66 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorModule.java
b/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorModule.java
index dd9e12b..32f2fa9 100644
--- a/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorModule.java
@@ -197,7 +197,7 @@ public class ExecutorModule extends AbstractModule {
   private static Resource makeResource(ResourceType type, double value) {
     return Resource.newBuilder()
         .setType(Type.SCALAR)
-        .setName(type.getName())
+        .setName(type.getMesosName())
         .setScalar(Scalar.newBuilder().setValue(value))
         .build();
   }

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorSettings.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorSettings.java
b/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorSettings.java
index 78e7be9..501e643 100644
--- a/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorSettings.java
+++ b/src/main/java/org/apache/aurora/scheduler/configuration/executor/ExecutorSettings.java
@@ -46,7 +46,7 @@ public class ExecutorSettings {
 
   private double getExecutorResourceValue(ResourceType resource) {
     return config.getExecutor().getResourcesList().stream()
-        .filter(r -> r.getName().equals(resource.getName()))
+        .filter(r -> r.getName().equals(resource.getMesosName()))
         .findFirst()
         .map(r -> r.getScalar().getValue())
         .orElse(0D);

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/mesos/TestExecutorSettings.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/mesos/TestExecutorSettings.java b/src/main/java/org/apache/aurora/scheduler/mesos/TestExecutorSettings.java
index 1d252bb..9aadceb 100644
--- a/src/main/java/org/apache/aurora/scheduler/mesos/TestExecutorSettings.java
+++ b/src/main/java/org/apache/aurora/scheduler/mesos/TestExecutorSettings.java
@@ -51,12 +51,12 @@ public final class TestExecutorSettings {
                   .setCache(false).build())))
       .addAllResources(ImmutableList.of(
           Resource.newBuilder()
-              .setName(ResourceType.CPUS.getName())
+              .setName(ResourceType.CPUS.getMesosName())
               .setType(Type.SCALAR)
               .setScalar(Scalar.newBuilder().setValue(0.25))
               .build(),
           Resource.newBuilder()
-              .setName(ResourceType.RAM_MB.getName())
+              .setName(ResourceType.RAM_MB.getMesosName())
               .setType(Type.SCALAR)
               .setScalar(Scalar.newBuilder().setValue(128))
               .build()

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/resources/AcceptedOffer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/resources/AcceptedOffer.java b/src/main/java/org/apache/aurora/scheduler/resources/AcceptedOffer.java
index 6a5237f..a735b0b 100644
--- a/src/main/java/org/apache/aurora/scheduler/resources/AcceptedOffer.java
+++ b/src/main/java/org/apache/aurora/scheduler/resources/AcceptedOffer.java
@@ -96,14 +96,14 @@ public final class AcceptedOffer {
     boolean revocable = tierInfo.isRevocable();
     List<Resource.Builder> cpuResources = filterToBuilders(
         reservedFirst,
-        ResourceType.CPUS.getName(),
+        ResourceType.CPUS.getMesosName(),
         revocable ? Resources.REVOCABLE : Resources.NON_REVOCABLE);
     List<Resource.Builder> memResources = filterToBuilderNonRevocable(
-        reservedFirst, ResourceType.RAM_MB.getName());
+        reservedFirst, ResourceType.RAM_MB.getMesosName());
     List<Resource.Builder> diskResources = filterToBuilderNonRevocable(
-        reservedFirst, ResourceType.DISK_MB.getName());
+        reservedFirst, ResourceType.DISK_MB.getMesosName());
     List<Resource.Builder> portsResources = filterToBuilderNonRevocable(
-        reservedFirst, ResourceType.PORTS.getName());
+        reservedFirst, ResourceType.PORTS.getMesosName());
 
     List<Resource> taskResources = ImmutableList.<Resource>builder()
         .addAll(allocateScalarType(cpuResources, taskSlot.getNumCpus(), revocable))

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/resources/ResourceSlot.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/resources/ResourceSlot.java b/src/main/java/org/apache/aurora/scheduler/resources/ResourceSlot.java
index 43696d2..1df2c11 100644
--- a/src/main/java/org/apache/aurora/scheduler/resources/ResourceSlot.java
+++ b/src/main/java/org/apache/aurora/scheduler/resources/ResourceSlot.java
@@ -107,7 +107,7 @@ public final class ResourceSlot {
     TaskInfo.Builder taskBuilder = task.toBuilder();
 
     Optional<Resource> revocableTaskCpu = taskBuilder.getResourcesList().stream()
-        .filter(r -> r.getName().equals(CPUS.getName()))
+        .filter(r -> r.getName().equals(CPUS.getMesosName()))
         .filter(Resource::hasRevocable)
         .findFirst();
     ExecutorInfo.Builder executorBuilder = taskBuilder.getExecutorBuilder();
@@ -121,7 +121,7 @@ public final class ResourceSlot {
     };
 
     executorBuilder.getResourcesBuilderList().stream()
-        .filter(r -> r.getName().equals(CPUS.getName()))
+        .filter(r -> r.getName().equals(CPUS.getMesosName()))
         .forEach(matchRevocable);
 
     return taskBuilder.build();
@@ -154,7 +154,7 @@ public final class ResourceSlot {
       Set<Integer> values) {
 
     return Protos.Resource.newBuilder()
-        .setName(resourceType.getName())
+        .setName(resourceType.getMesosName())
         .setType(Protos.Value.Type.RANGES)
         .setRanges(Protos.Value.Ranges.newBuilder()
             .addAllRange(Iterables.transform(Numbers.toRanges(values), RANGE_TRANSFORM)))
@@ -176,7 +176,7 @@ public final class ResourceSlot {
       boolean revocable) {
 
     Protos.Resource.Builder builder = Protos.Resource.newBuilder()
-        .setName(resourceType.getName())
+        .setName(resourceType.getMesosName())
         .setType(Protos.Value.Type.SCALAR)
         .setScalar(Protos.Value.Scalar.newBuilder().setValue(value));
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/resources/ResourceType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/resources/ResourceType.java b/src/main/java/org/apache/aurora/scheduler/resources/ResourceType.java
index 5900ccb..fc9b10b 100644
--- a/src/main/java/org/apache/aurora/scheduler/resources/ResourceType.java
+++ b/src/main/java/org/apache/aurora/scheduler/resources/ResourceType.java
@@ -18,7 +18,7 @@ import com.google.common.annotations.VisibleForTesting;
 import static java.util.Objects.requireNonNull;
 
 /**
- * Defines Mesos resource types.
+ * Describes Mesos resource types.
  */
 @VisibleForTesting
 public enum ResourceType {
@@ -48,7 +48,7 @@ public enum ResourceType {
     this.resourceName = requireNonNull(resourceName);
   }
 
-  public String getName() {
+  public String getMesosName() {
     return resourceName;
   }
 }

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/main/java/org/apache/aurora/scheduler/resources/Resources.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/resources/Resources.java b/src/main/java/org/apache/aurora/scheduler/resources/Resources.java
index 46b31f0..894c6a6 100644
--- a/src/main/java/org/apache/aurora/scheduler/resources/Resources.java
+++ b/src/main/java/org/apache/aurora/scheduler/resources/Resources.java
@@ -50,7 +50,7 @@ public final class Resources {
   /**
    * CPU resource filter.
    */
-  private static final Predicate<Resource> CPU = e -> e.getName().equals(CPUS.getName());
+  private static final Predicate<Resource> CPU = e -> e.getName().equals(CPUS.getMesosName());
 
   /**
    * Revocable resource filter.
@@ -113,9 +113,9 @@ public final class Resources {
    * @return {@code ResourceSlot} instance.
    */
   public ResourceSlot slot() {
-    return new ResourceSlot(getScalarValue(CPUS.getName()),
-        Amount.of((long) getScalarValue(RAM_MB.getName()), Data.MB),
-        Amount.of((long) getScalarValue(DISK_MB.getName()), Data.MB),
+    return new ResourceSlot(getScalarValue(CPUS.getMesosName()),
+        Amount.of((long) getScalarValue(RAM_MB.getMesosName()), Data.MB),
+        Amount.of((long) getScalarValue(DISK_MB.getMesosName()), Data.MB),
         getNumAvailablePorts());
   }
 
@@ -168,7 +168,7 @@ public final class Resources {
 
   private Iterable<Range> getPortRanges() {
     ImmutableList.Builder<Range> ranges = ImmutableList.builder();
-    for (Resource r : getResources(PORTS.getName())) {
+    for (Resource r : getResources(PORTS.getMesosName())) {
       ranges.addAll(r.getRanges().getRangeList().iterator());
     }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
b/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
index 48a665f..8c0d179 100644
--- a/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
+++ b/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
@@ -94,13 +94,13 @@ public class ClusterSimulatorModule extends AbstractModule {
 
     String host = slaveId + "-hostname";
     return Offer.newBuilder()
-        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(CPUS.getName())
+        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(CPUS.getMesosName())
             .setScalar(Protos.Value.Scalar.newBuilder().setValue(cpu)))
-        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(RAM_MB.getName())
+        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(RAM_MB.getMesosName())
             .setScalar(Protos.Value.Scalar.newBuilder().setValue(ramMb)))
-        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(DISK_MB.getName())
+        .addResources(Protos.Resource.newBuilder().setType(SCALAR).setName(DISK_MB.getMesosName())
             .setScalar(Protos.Value.Scalar.newBuilder().setValue(diskMb)))
-        .addResources(Protos.Resource.newBuilder().setType(RANGES).setName(PORTS.getName())
+        .addResources(Protos.Resource.newBuilder().setType(RANGES).setName(PORTS.getMesosName())
             .setRanges(portRanges))
         .addAttributes(Protos.Attribute.newBuilder().setType(Protos.Value.Type.TEXT)
             .setName("host")

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/mesos/Offers.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/mesos/Offers.java b/src/test/java/org/apache/aurora/scheduler/mesos/Offers.java
index a7fb4b0..b266554 100644
--- a/src/test/java/org/apache/aurora/scheduler/mesos/Offers.java
+++ b/src/test/java/org/apache/aurora/scheduler/mesos/Offers.java
@@ -46,13 +46,13 @@ public final class Offers {
         .build();
 
     return Offer.newBuilder()
-        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(CPUS.getName())
+        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(CPUS.getMesosName())
             .setScalar(Scalar.newBuilder().setValue(cpu)))
-        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(RAM_MB.getName())
+        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(RAM_MB.getMesosName())
             .setScalar(Scalar.newBuilder().setValue(ramMb)))
-        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(DISK_MB.getName())
+        .addResources(Resource.newBuilder().setType(Type.SCALAR).setName(DISK_MB.getMesosName())
             .setScalar(Scalar.newBuilder().setValue(diskMb)))
-        .addResources(Resource.newBuilder().setType(Type.RANGES).setName(PORTS.getName())
+        .addResources(Resource.newBuilder().setType(Type.RANGES).setName(PORTS.getMesosName())
             .setRanges(portRanges))
         .addAttributes(Protos.Attribute.newBuilder().setType(Type.TEXT)
             .setName("host")

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
index 0739877..4efa696 100644
--- a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
@@ -528,10 +528,10 @@ public class PreemptionVictimFilterTest extends EasyMockTest {
     if (revocable) {
       resources = ImmutableList.<Resource>builder()
           .addAll(FluentIterable.from(resources)
-              .filter(e -> !e.getName().equals(CPUS.getName()))
+              .filter(e -> !e.getName().equals(CPUS.getMesosName()))
               .toList())
           .add(Protos.Resource.newBuilder()
-              .setName(CPUS.getName())
+              .setName(CPUS.getMesosName())
               .setType(Protos.Value.Type.SCALAR)
               .setScalar(Protos.Value.Scalar.newBuilder().setValue(cpu))
               .setRevocable(Resource.RevocableInfo.newBuilder())

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java b/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
index 319ffea..d5f2172 100644
--- a/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
@@ -29,6 +29,10 @@ import org.apache.mesos.Protos;
 import org.apache.mesos.Protos.Resource;
 import org.junit.Test;
 
+import static org.apache.aurora.scheduler.resources.ResourceType.CPUS;
+import static org.apache.aurora.scheduler.resources.ResourceType.DISK_MB;
+import static org.apache.aurora.scheduler.resources.ResourceType.PORTS;
+import static org.apache.aurora.scheduler.resources.ResourceType.RAM_MB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -47,10 +51,10 @@ public class AcceptedOfferTest {
 
   @Test
   public void testReservedPredicates() {
-    Protos.Resource withRole = makeScalar(ResourceType.CPUS.getName(), TEST_ROLE, false,
1.0);
+    Protos.Resource withRole = makeScalar(CPUS.getMesosName(), TEST_ROLE, false, 1.0);
     assertTrue(AcceptedOffer.RESERVED.apply(withRole));
     assertFalse(AcceptedOffer.NOT_RESERVED.apply(withRole));
-    Protos.Resource absentRole = makeScalar(ResourceType.CPUS.getName(), ABSENT_ROLE, false,
1.0);
+    Protos.Resource absentRole = makeScalar(CPUS.getMesosName(), ABSENT_ROLE, false, 1.0);
     assertFalse(AcceptedOffer.RESERVED.apply(absentRole));
     assertTrue(AcceptedOffer.NOT_RESERVED.apply(absentRole));
   }
@@ -114,11 +118,11 @@ public class AcceptedOfferTest {
   private void runAllocateSingleRole(Optional<String> role, boolean cpuRevocable) {
     List<Resource> resources = ImmutableList.<Resource>builder()
         .add(makeScalar(
-            ResourceType.CPUS.getName(), role, cpuRevocable, TOTAL_SLOT.getNumCpus()))
+            CPUS.getMesosName(), role, cpuRevocable, TOTAL_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(), role, false, TOTAL_SLOT.getRam().as(Data.MB)))
+            RAM_MB.getMesosName(), role, false, TOTAL_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), role, false, TOTAL_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), role, false, TOTAL_SLOT.getDisk().as(Data.MB)))
         .add(makePortResource(role, TASK_PORTS))
         .build();
     Protos.Offer offer = fakeOffer(resources);
@@ -127,21 +131,21 @@ public class AcceptedOfferTest {
         offer, TASK_SLOT, EXECUTOR_SLOT, TASK_PORTS_SET, new TierInfo(false, cpuRevocable));
 
     List<Resource> taskList = ImmutableList.<Resource>builder()
-        .add(makeScalar(ResourceType.CPUS.getName(), role, cpuRevocable, TASK_SLOT.getNumCpus()))
-        .add(makeScalar(ResourceType.RAM_MB.getName(), role, false, TASK_SLOT.getRam().as(Data.MB)))
+        .add(makeScalar(CPUS.getMesosName(), role, cpuRevocable, TASK_SLOT.getNumCpus()))
+        .add(makeScalar(RAM_MB.getMesosName(), role, false, TASK_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), role, false, TASK_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), role, false, TASK_SLOT.getDisk().as(Data.MB)))
         .add(makePortResource(role, TASK_PORTS))
         .build();
     assertEquals(taskList, offerAllocation.getTaskResources());
 
     List<Resource> executorList = ImmutableList.<Resource>builder()
         .add(makeScalar(
-            ResourceType.CPUS.getName(), role, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
+            CPUS.getMesosName(), role, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(), role, false, EXECUTOR_SLOT.getRam().as(Data.MB)))
+            RAM_MB.getMesosName(), role, false, EXECUTOR_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), role, false, EXECUTOR_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), role, false, EXECUTOR_SLOT.getDisk().as(Data.MB)))
         .build();
     assertEquals(executorList, offerAllocation.getExecutorResources());
   }
@@ -150,11 +154,11 @@ public class AcceptedOfferTest {
   public void testAllocateSingleRoleInsufficient() {
     List<Resource> resources = ImmutableList.<Resource>builder()
         // EXECUTOR_SLOT's CPU is not included here.
-        .add(makeScalar(ResourceType.CPUS.getName(), TEST_ROLE, false, TASK_SLOT.getNumCpus()))
+        .add(makeScalar(CPUS.getMesosName(), TEST_ROLE, false, TASK_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(), TEST_ROLE, false, TOTAL_SLOT.getRam().as(Data.MB)))
+            RAM_MB.getMesosName(), TEST_ROLE, false, TOTAL_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), TEST_ROLE, false, TOTAL_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), TEST_ROLE, false, TOTAL_SLOT.getDisk().as(Data.MB)))
         .add(makePortResource(TEST_ROLE, TASK_PORTS))
         .build();
     Protos.Offer offer = fakeOffer(resources);
@@ -173,24 +177,24 @@ public class AcceptedOfferTest {
     List<Resource> resources = ImmutableList.<Resource>builder()
         // Make cpus come from two roles.
         .add(makeScalar(
-            ResourceType.CPUS.getName(),
+            CPUS.getMesosName(),
             TEST_ROLE,
             cpuRevocable,
             EXECUTOR_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.CPUS.getName(),
+            CPUS.getMesosName(),
             ABSENT_ROLE,
             cpuRevocable,
             TASK_SLOT.getNumCpus()))
         // Make ram come from default role
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(),
+            RAM_MB.getMesosName(),
             ABSENT_ROLE,
             false,
             TOTAL_SLOT.getRam().as(Data.MB)))
         // Make disk come from non-default role.
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(),
+            DISK_MB.getMesosName(),
             TEST_ROLE,
             false,
             TOTAL_SLOT.getDisk().as(Data.MB)))
@@ -206,16 +210,16 @@ public class AcceptedOfferTest {
     List<Resource> taskList = ImmutableList.<Resource>builder()
         // We intentionally sliced the offer resource to not align with TASK_SLOT's num cpus.
         .add(makeScalar(
-            ResourceType.CPUS.getName(), TEST_ROLE, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
+            CPUS.getMesosName(), TEST_ROLE, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.CPUS.getName(),
+            CPUS.getMesosName(),
             ABSENT_ROLE,
             cpuRevocable,
             TASK_SLOT.subtract(EXECUTOR_SLOT).getNumCpus()))
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(), ABSENT_ROLE, false, TASK_SLOT.getRam().as(Data.MB)))
+            RAM_MB.getMesosName(), ABSENT_ROLE, false, TASK_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), TEST_ROLE, false, TASK_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), TEST_ROLE, false, TASK_SLOT.getDisk().as(Data.MB)))
         .add(makePortResource(TEST_ROLE, 80))
         .add(makePortResource(ABSENT_ROLE, 90))
         .build();
@@ -223,11 +227,11 @@ public class AcceptedOfferTest {
 
     List<Resource> executorList = ImmutableList.<Resource>builder()
         .add(makeScalar(
-            ResourceType.CPUS.getName(), ABSENT_ROLE, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
+            CPUS.getMesosName(), ABSENT_ROLE, cpuRevocable, EXECUTOR_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(), ABSENT_ROLE, false, EXECUTOR_SLOT.getRam().as(Data.MB)))
+            RAM_MB.getMesosName(), ABSENT_ROLE, false, EXECUTOR_SLOT.getRam().as(Data.MB)))
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(), TEST_ROLE, false, EXECUTOR_SLOT.getDisk().as(Data.MB)))
+            DISK_MB.getMesosName(), TEST_ROLE, false, EXECUTOR_SLOT.getDisk().as(Data.MB)))
         .build();
     assertEquals(executorList, offerAllocation.getExecutorResources());
   }
@@ -238,24 +242,24 @@ public class AcceptedOfferTest {
     List<Resource> resources = ImmutableList.<Resource>builder()
         // Make cpus come from two roles.
         .add(makeScalar(
-            ResourceType.CPUS.getName(),
+            CPUS.getMesosName(),
             TEST_ROLE,
             true,
             EXECUTOR_SLOT.getNumCpus()))
         .add(makeScalar(
-            ResourceType.CPUS.getName(),
+            CPUS.getMesosName(),
             ABSENT_ROLE,
             false,
             TASK_SLOT.getNumCpus()))
         // Make ram come from default role
         .add(makeScalar(
-            ResourceType.RAM_MB.getName(),
+            RAM_MB.getMesosName(),
             ABSENT_ROLE,
             false,
             TOTAL_SLOT.getRam().as(Data.MB)))
         // Make disk come from non-default role.
         .add(makeScalar(
-            ResourceType.DISK_MB.getName(),
+            DISK_MB.getMesosName(),
             TEST_ROLE,
             false,
             TOTAL_SLOT.getDisk().as(Data.MB)))
@@ -271,7 +275,7 @@ public class AcceptedOfferTest {
   private static Resource makePortResource(Optional<String> role, Integer... values)
{
     Resource.Builder prototype = Resource.newBuilder()
         .setType(Protos.Value.Type.RANGES)
-        .setName(ResourceType.PORTS.getName());
+        .setName(PORTS.getMesosName());
     if (role.isPresent()) {
       prototype.setRole(role.get());
     }

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/resources/ResourceSlotTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/resources/ResourceSlotTest.java b/src/test/java/org/apache/aurora/scheduler/resources/ResourceSlotTest.java
index 8d5a143..0e6a5ac 100644
--- a/src/test/java/org/apache/aurora/scheduler/resources/ResourceSlotTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/resources/ResourceSlotTest.java
@@ -160,7 +160,7 @@ public class ResourceSlotTest {
   private void expectRanges(Set<Pair<Long, Long>> expected, Set<Integer>
values) {
     Protos.Resource resource = makeMesosRangeResource(PORTS, values);
     assertEquals(Protos.Value.Type.RANGES, resource.getType());
-    assertEquals(PORTS.getName(), resource.getName());
+    assertEquals(PORTS.getMesosName(), resource.getName());
 
     Set<Pair<Long, Long>> actual = ImmutableSet.copyOf(Iterables.transform(
         resource.getRanges().getRangeList(),

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/resources/ResourcesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/resources/ResourcesTest.java b/src/test/java/org/apache/aurora/scheduler/resources/ResourcesTest.java
index bc2700c..ceb81e4 100644
--- a/src/test/java/org/apache/aurora/scheduler/resources/ResourcesTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/resources/ResourcesTest.java
@@ -155,7 +155,7 @@ public class ResourcesTest {
     }
 
     return Resource.newBuilder()
-        .setName(PORTS.getName())
+        .setName(PORTS.getMesosName())
         .setType(RANGES)
         .setRanges(ranges)
         .build();

http://git-wip-us.apache.org/repos/asf/aurora/blob/e95212e2/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java b/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
index c23efed..fdd42b7 100644
--- a/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
@@ -60,7 +60,7 @@ public class AsyncStatsModuleTest extends EasyMockTest {
 
   private static Protos.Resource getCpuResource(boolean revocable, double value) {
     Protos.Resource.Builder builder = Protos.Resource.newBuilder()
-        .setName(ResourceType.CPUS.getName())
+        .setName(ResourceType.CPUS.getMesosName())
         .setType(Protos.Value.Type.SCALAR)
         .setScalar(Protos.Value.Scalar.newBuilder().setValue(value));
 


Mime
View raw message