aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject [1/4] aurora git commit: Use java.util.Optional throughout
Date Fri, 15 Dec 2017 20:01:53 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 5f79f7ca7 -> 6fd765bcf


http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/AbstractCronJobStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/AbstractCronJobStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/AbstractCronJobStoreTest.java
index 3ec6e2b..889cb01 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/AbstractCronJobStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/AbstractCronJobStoreTest.java
@@ -13,9 +13,9 @@
  */
 package org.apache.aurora.scheduler.storage;
 
+import java.util.Optional;
 import java.util.Set;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
@@ -61,15 +61,15 @@ public abstract class AbstractCronJobStoreTest {
 
   @Test
   public void testJobStore() {
-    assertNull(fetchJob(JobKeys.from("nobody", "nowhere", "noname")).orNull());
+    assertNull(fetchJob(JobKeys.from("nobody", "nowhere", "noname")).orElse(null));
     assertEquals(ImmutableSet.of(), fetchJobs());
 
     saveAcceptedJob(JOB_A);
-    assertEquals(JOB_A, fetchJob(KEY_A).orNull());
+    assertEquals(JOB_A, fetchJob(KEY_A).orElse(null));
     assertEquals(ImmutableSet.of(JOB_A), fetchJobs());
 
     saveAcceptedJob(JOB_B);
-    assertEquals(JOB_B, fetchJob(KEY_B).orNull());
+    assertEquals(JOB_B, fetchJob(KEY_B).orElse(null));
     assertEquals(ImmutableSet.of(JOB_A, JOB_B), fetchJobs());
 
     removeJob(KEY_B);
@@ -93,13 +93,13 @@ public abstract class AbstractCronJobStoreTest {
     saveAcceptedJob(staging);
 
     assertNull(fetchJob(
-        IJobKey.build(templateConfig.getKey().newBuilder().setEnvironment("test"))).orNull());
-    assertEquals(prod, fetchJob(prod.getKey()).orNull());
-    assertEquals(staging, fetchJob(staging.getKey()).orNull());
+        IJobKey.build(templateConfig.getKey().newBuilder().setEnvironment("test"))).orElse(null));
+    assertEquals(prod, fetchJob(prod.getKey()).orElse(null));
+    assertEquals(staging, fetchJob(staging.getKey()).orElse(null));
 
     removeJob(prod.getKey());
-    assertNull(fetchJob(prod.getKey()).orNull());
-    assertEquals(staging, fetchJob(staging.getKey()).orNull());
+    assertNull(fetchJob(prod.getKey()).orElse(null));
+    assertEquals(staging, fetchJob(staging.getKey()).orElse(null));
   }
 
   @Test
@@ -127,7 +127,7 @@ public abstract class AbstractCronJobStoreTest {
     IJobConfiguration jobAUpdated =
         IJobConfiguration.build(JOB_A.newBuilder().setCronSchedule("changed"));
     saveAcceptedJob(jobAUpdated);
-    assertEquals(jobAUpdated, fetchJob(KEY_A).orNull());
+    assertEquals(jobAUpdated, fetchJob(KEY_A).orElse(null));
   }
 
   private static IJobConfiguration makeJob(String name) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/AbstractJobUpdateStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/AbstractJobUpdateStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/AbstractJobUpdateStoreTest.java
index 1510817..3a06a45 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/AbstractJobUpdateStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/AbstractJobUpdateStoreTest.java
@@ -15,11 +15,11 @@
 package org.apache.aurora.scheduler.storage;
 
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Injector;
@@ -134,8 +134,8 @@ public abstract class AbstractJobUpdateStoreTest {
     IJobUpdateDetails update1 = makeFullyPopulatedUpdate(updateId1);
     IJobUpdateDetails update2 = makeJobUpdate(updateId2);
 
-    assertEquals(Optional.absent(), getUpdate(updateId1));
-    assertEquals(Optional.absent(), getUpdate(updateId2));
+    assertEquals(Optional.empty(), getUpdate(updateId1));
+    assertEquals(Optional.empty(), getUpdate(updateId2));
 
     StorageEntityUtil.assertFullyPopulated(
         update1,
@@ -381,7 +381,7 @@ public abstract class AbstractJobUpdateStoreTest {
     JobUpdateDetails builder = makeJobUpdate(updateId).newBuilder();
     builder.getUpdate().getSummary().setMetadata(duplicatedMetadata);
 
-    assertEquals(Optional.absent(), getUpdate(updateId));
+    assertEquals(Optional.empty(), getUpdate(updateId));
 
     IJobUpdateDetails update = IJobUpdateDetails.build(builder);
     saveUpdate(update);

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/AbstractQuotaStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/AbstractQuotaStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/AbstractQuotaStoreTest.java
index c5aca7e..e1d7da5 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/AbstractQuotaStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/AbstractQuotaStoreTest.java
@@ -15,8 +15,8 @@ package org.apache.aurora.scheduler.storage;
 
 import java.io.IOException;
 import java.util.Map;
+import java.util.Optional;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 
 import org.apache.aurora.scheduler.resources.ResourceTestUtil;
@@ -46,7 +46,7 @@ public abstract class AbstractQuotaStoreTest {
 
   @Test
   public void testCrud() {
-    assertEquals(Optional.absent(), select(ROLE_A));
+    assertEquals(Optional.empty(), select(ROLE_A));
     assertQuotas(ImmutableMap.of());
 
     save(ROLE_A, StorageEntityUtil.assertFullyPopulated(QUOTA_A));
@@ -58,21 +58,21 @@ public abstract class AbstractQuotaStoreTest {
 
     delete(ROLE_B);
     assertEquals(Optional.of(QUOTA_A), select(ROLE_A));
-    assertEquals(Optional.absent(), select(ROLE_B));
+    assertEquals(Optional.empty(), select(ROLE_B));
     assertQuotas(ImmutableMap.of(ROLE_A, QUOTA_A));
 
     deleteAll();
-    assertEquals(Optional.absent(), select(ROLE_A));
-    assertEquals(Optional.absent(), select(ROLE_B));
+    assertEquals(Optional.empty(), select(ROLE_A));
+    assertEquals(Optional.empty(), select(ROLE_B));
     assertQuotas(ImmutableMap.of());
   }
 
   @Test
   public void testDeleteNonExistent() {
-    assertEquals(Optional.absent(), select(ROLE_A));
+    assertEquals(Optional.empty(), select(ROLE_A));
     assertQuotas(ImmutableMap.of());
     delete(ROLE_A);
-    assertEquals(Optional.absent(), select(ROLE_A));
+    assertEquals(Optional.empty(), select(ROLE_A));
     assertQuotas(ImmutableMap.of());
   }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/AbstractSchedulerStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/AbstractSchedulerStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/AbstractSchedulerStoreTest.java
index 669b7c0..cb80519 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/AbstractSchedulerStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/AbstractSchedulerStoreTest.java
@@ -14,8 +14,7 @@
 package org.apache.aurora.scheduler.storage;
 
 import java.io.IOException;
-
-import com.google.common.base.Optional;
+import java.util.Optional;
 
 import org.apache.aurora.scheduler.storage.Storage.MutateWork.NoResult;
 import org.junit.Before;
@@ -36,7 +35,7 @@ public abstract class AbstractSchedulerStoreTest {
 
   @Test
   public void testSchedulerStore() {
-    assertEquals(Optional.absent(), select());
+    assertEquals(Optional.empty(), select());
     save("a");
     assertEquals(Optional.of("a"), select());
     save("b");

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/AbstractTaskStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/AbstractTaskStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/AbstractTaskStoreTest.java
index 76595c0..c53e584 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/AbstractTaskStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/AbstractTaskStoreTest.java
@@ -15,6 +15,7 @@ package org.apache.aurora.scheduler.storage;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
@@ -22,7 +23,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -358,7 +358,7 @@ public abstract class AbstractTaskStoreTest extends TearDownTestCase {
         IScheduledTask.build(TASK_A.newBuilder().setStatus(RUNNING)));
 
     assertEquals(
-        Optional.absent(),
+        Optional.empty(),
         mutateTask(
             "nonexistent",
             task -> IScheduledTask.build(task.newBuilder().setStatus(RUNNING))));

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java
index a6bf330..3dd9ce4 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java
@@ -13,6 +13,7 @@
  */
 package org.apache.aurora.scheduler.storage.durability;
 
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.ReentrantLock;
@@ -21,7 +22,6 @@ import java.util.stream.Stream;
 
 import com.google.common.base.Function;
 import com.google.common.base.Functions;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 
@@ -652,7 +652,7 @@ public class DurableStorageTest extends EasyMockTest {
       protected void setupExpectations() throws Exception {
         storageUtil.expectWrite();
         expect(storageUtil.attributeStore.getHostAttributes(host))
-            .andReturn(Optional.absent());
+            .andReturn(Optional.empty());
 
         expect(storageUtil.attributeStore.getHostAttributes(host)).andReturn(hostAttributes);
 
@@ -670,7 +670,7 @@ public class DurableStorageTest extends EasyMockTest {
       @Override
       protected void performMutations(MutableStoreProvider storeProvider) {
         AttributeStore.Mutable store = storeProvider.getAttributeStore();
-        assertEquals(Optional.absent(), store.getHostAttributes(host));
+        assertEquals(Optional.empty(), store.getHostAttributes(host));
 
         assertTrue(store.saveHostAttributes(hostAttributes.get()));
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/durability/WriteRecorderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/durability/WriteRecorderTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/durability/WriteRecorderTest.java
index 1a89e83..27c8c82 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/durability/WriteRecorderTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/durability/WriteRecorderTest.java
@@ -13,10 +13,10 @@
  */
 package org.apache.aurora.scheduler.storage.durability;
 
+import java.util.Optional;
 import java.util.Set;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 
 import org.apache.aurora.common.testing.easymock.EasyMockTest;

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/log/NonVolatileStorageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/log/NonVolatileStorageTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/log/NonVolatileStorageTest.java
index fdde73d..ffd4167 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/log/NonVolatileStorageTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/log/NonVolatileStorageTest.java
@@ -14,9 +14,9 @@
 package org.apache.aurora.scheduler.storage.log;
 
 import java.util.List;
+import java.util.Optional;
 import java.util.function.Consumer;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
@@ -132,7 +132,7 @@ public class NonVolatileStorageTest extends TearDownTestCase {
           stores.getQuotaStore().removeQuota("lucy");
         },
         stores -> {
-          assertEquals(Optional.absent(), stores.getQuotaStore().fetchQuota("lucy"));
+          assertEquals(Optional.empty(), stores.getQuotaStore().fetchQuota("lucy"));
         }
     ));
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/storage/testing/StorageTestUtil.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/testing/StorageTestUtil.java
b/src/test/java/org/apache/aurora/scheduler/storage/testing/StorageTestUtil.java
index 64fbb54..d59118b 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/testing/StorageTestUtil.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/testing/StorageTestUtil.java
@@ -13,7 +13,8 @@
  */
 package org.apache.aurora.scheduler.storage.testing;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
+
 import com.google.common.collect.ImmutableSet;
 
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
@@ -122,7 +123,7 @@ public class StorageTestUtil {
   }
 
   public IExpectationSetters<?> expectTaskFetch(String taskId) {
-    return expect(taskStore.fetchTask(taskId)).andReturn(Optional.absent());
+    return expect(taskStore.fetchTask(taskId)).andReturn(Optional.empty());
   }
 
   public IExpectationSetters<?> expectTaskFetch(Query.Builder query, IScheduledTask...
result) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/thrift/AuditMessagesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/AuditMessagesTest.java b/src/test/java/org/apache/aurora/scheduler/thrift/AuditMessagesTest.java
index d9e935c..f7a5024 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/AuditMessagesTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/AuditMessagesTest.java
@@ -32,8 +32,8 @@ public class AuditMessagesTest extends EasyMockTest {
 
     control.replay();
 
-    assertThat(emptyMessages.killedByRemoteUser(
-        com.google.common.base.Optional.absent()).get(),
+    assertThat(
+        emptyMessages.killedByRemoteUser(Optional.empty()).get(),
         containsString(DEFAULT_USER));
     assertThat(emptyMessages.restartedByRemoteUser().get(), containsString(DEFAULT_USER));
     assertThat(emptyMessages.transitionedBy().get(), containsString(DEFAULT_USER));
@@ -48,9 +48,7 @@ public class AuditMessagesTest extends EasyMockTest {
 
     control.replay();
 
-    assertThat(presentMessages.killedByRemoteUser(
-        com.google.common.base.Optional.absent()).get(),
-        containsString("shiro"));
+    assertThat(presentMessages.killedByRemoteUser(Optional.empty()).get(), containsString("shiro"));
     assertThat(presentMessages.restartedByRemoteUser().get(), containsString("shiro"));
     assertThat(presentMessages.transitionedBy().get(), containsString("shiro"));
   }
@@ -65,10 +63,8 @@ public class AuditMessagesTest extends EasyMockTest {
     control.replay();
 
     assertEquals(messages.killedByRemoteUser(
-        com.google.common.base.Optional.of("Test message")).get(),
+        Optional.of("Test message")).get(),
         "Killed by shiro.\nTest message");
-    assertEquals(messages.killedByRemoteUser(
-        com.google.common.base.Optional.absent()).get(),
-        "Killed by shiro");
+    assertEquals(messages.killedByRemoteUser(Optional.empty()).get(), "Killed by shiro");
   }
 }

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java b/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
index e1b8eaa..2ad2a36 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/Fixtures.java
@@ -15,11 +15,11 @@ package org.apache.aurora.scheduler.thrift;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -127,7 +127,7 @@ final class Fixtures {
   static Response response(ResponseCode code, Optional<Result> result, String... messages)
{
     Response response = Responses.empty()
         .setResponseCode(code)
-        .setResult(result.orNull());
+        .setResult(result.orElse(null));
     if (messages.length > 0) {
       response.setDetails(FluentIterable.from(Arrays.asList(messages)).transform(MESSAGE_TO_DETAIL)
           .toList());

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
index 312e5e0..91cd9ec 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ReadOnlySchedulerImplTest.java
@@ -15,13 +15,13 @@ package org.apache.aurora.scheduler.thrift;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import javax.annotation.Nullable;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
@@ -251,7 +251,7 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
         .setCronSchedule(cronSchedule)
         .setTaskConfig(task);
     expect(cronPredictor.predictNextRun(CrontabEntry.parse(cronSchedule)))
-        .andReturn(Optional.absent())
+        .andReturn(Optional.empty())
         .anyTimes();
     storageUtil.expectTaskFetch(Query.roleScoped(ROLE));
     Set<JobConfiguration> jobOnly = ImmutableSet.of(job);
@@ -739,7 +739,7 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
   @Test
   public void testGetJobUpdateDetailsInvalidId() throws Exception {
     expect(storageUtil.jobUpdateStore.fetchJobUpdate(UPDATE_KEY))
-        .andReturn(Optional.absent());
+        .andReturn(Optional.empty());
 
     control.replay();
 
@@ -761,7 +761,7 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
     makeTasks(30, 40, task4, tasks);
     makeTasks(40, 50, task5, tasks);
 
-    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.absent());
+    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.empty());
     storageUtil.expectTaskFetch(Query.jobScoped(JOB_KEY).active(), tasks.build());
 
     control.replay();
@@ -798,7 +798,7 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
     makeTasks(10, 20, task2, tasks);
     makeTasks(20, 30, task3, tasks);
 
-    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.absent());
+    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.empty());
     storageUtil.expectTaskFetch(Query.jobScoped(JOB_KEY).active(), tasks.build());
 
     control.replay();
@@ -822,7 +822,7 @@ public class ReadOnlySchedulerImplTest extends EasyMockTest {
 
   @Test
   public void testGetJobUpdateDiffWithUnchanged() throws Exception {
-    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.absent());
+    expect(storageUtil.jobStore.fetchJob(JOB_KEY)).andReturn(Optional.empty());
     storageUtil.expectTaskFetch(
         Query.jobScoped(JOB_KEY).active(),
         ImmutableSet.copyOf(makeDefaultScheduledTasks(10)));

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
index 040baf9..2cf66d8 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -16,9 +16,9 @@ package org.apache.aurora.scheduler.thrift;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Proxy;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
@@ -582,7 +582,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   }
 
   private void expectTransitionsToKilling() {
-    expectTransitionsToKilling(Optional.absent());
+    expectTransitionsToKilling(Optional.empty());
   }
 
   private void expectTransitionsToKilling(Optional<String> message) {
@@ -590,7 +590,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         TASK_ID,
-        Optional.absent(),
+        Optional.empty(),
         ScheduleStatus.KILLING,
         Optional.of("test"))).andReturn(StateChangeResult.SUCCESS);
   }
@@ -768,7 +768,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         TASK_ID,
-        Optional.absent(),
+        Optional.empty(),
         ScheduleStatus.FAILED,
         Optional.of("test"))).andReturn(StateChangeResult.SUCCESS);
 
@@ -852,7 +852,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         TASK_ID,
-        Optional.absent(),
+        Optional.empty(),
         ScheduleStatus.RESTARTING,
         Optional.of("test"))).andReturn(StateChangeResult.SUCCESS);
 
@@ -1098,7 +1098,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   }
 
   private static Response okEmptyResponse() {
-    return response(OK, Optional.absent());
+    return response(OK, Optional.empty());
   }
 
   private static Response okEmptyResponse(String message) {
@@ -1137,7 +1137,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
   public void testExplicitTaskReconciliationWithNoBatchSize() throws Exception {
     ExplicitReconciliationSettings settings = new ExplicitReconciliationSettings();
 
-    taskReconciler.triggerExplicitReconciliation(Optional.absent());
+    taskReconciler.triggerExplicitReconciliation(Optional.empty());
     expectLastCall();
 
     control.replay();
@@ -1930,7 +1930,7 @@ public class SchedulerThriftInterfaceTest extends EasyMockTest {
 
   private IExpectationSetters<?> expectNoCronJob() {
     return expect(storageUtil.jobStore.fetchJob(JOB_KEY))
-        .andReturn(Optional.absent());
+        .andReturn(Optional.empty());
   }
 
   private IExpectationSetters<?> expectInstanceQuotaCheck(

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
index 231fd8d..40851c4 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
@@ -128,7 +128,7 @@ public class ThriftIT extends EasyMockTest {
             bindMock(DriverFactory.class);
             bind(DriverSettings.class).toInstance(new DriverSettings(
                 "fakemaster",
-                com.google.common.base.Optional.absent()));
+                Optional.empty()));
             bind(FrameworkInfo.class)
                 .annotatedWith(BaseFrameworkInfo.class)
                 .toInstance(base);

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/updater/InstanceUpdaterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/InstanceUpdaterTest.java b/src/test/java/org/apache/aurora/scheduler/updater/InstanceUpdaterTest.java
index 30f3e4f..190d522 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/InstanceUpdaterTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/InstanceUpdaterTest.java
@@ -15,8 +15,8 @@ package org.apache.aurora.scheduler.updater;
 
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
@@ -55,7 +55,7 @@ import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.SUCCEEDE
 import static org.junit.Assert.assertEquals;
 
 public class InstanceUpdaterTest {
-  private static final Optional<ITaskConfig> NO_CONFIG = Optional.absent();
+  private static final Optional<ITaskConfig> NO_CONFIG = Optional.empty();
 
   private static final ITaskConfig OLD = ITaskConfig.build(new TaskConfig()
           .setResources(ImmutableSet.of(numCpus(1.0))));
@@ -75,7 +75,7 @@ public class InstanceUpdaterTest {
     private final FakeClock clock;
     private final InstanceUpdater updater;
     private final TaskUtil taskUtil;
-    private Optional<IScheduledTask> task = Optional.absent();
+    private Optional<IScheduledTask> task = Optional.empty();
 
     TestFixture(Optional<ITaskConfig> newConfig, int maxToleratedFailures) {
       this.clock = new FakeClock();
@@ -92,7 +92,7 @@ public class InstanceUpdaterTest {
     }
 
     void setActualStateAbsent() {
-      this.task = Optional.absent();
+      this.task = Optional.empty();
     }
 
     private Result changeStatusAndEvaluate(ScheduleStatus status) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
index 92f2582..5667a1b 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
@@ -14,11 +14,11 @@
 package org.apache.aurora.scheduler.updater;
 
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMultimap;
@@ -236,9 +236,9 @@ public class JobUpdaterIT extends EasyMockTest {
               stateManager.changeState(
                   storeProvider,
                   getTaskId(job, instanceId),
-                  Optional.absent(),
+                  Optional.empty(),
                   s,
-                  Optional.absent())));
+                  Optional.empty())));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/updater/KillTaskTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/KillTaskTest.java b/src/test/java/org/apache/aurora/scheduler/updater/KillTaskTest.java
index 61f66b9..2c27ec7 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/KillTaskTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/KillTaskTest.java
@@ -13,7 +13,7 @@
  */
 package org.apache.aurora.scheduler.updater;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
 import org.apache.aurora.gen.InstanceKey;
@@ -75,7 +75,7 @@ public class KillTaskTest extends EasyMockTest {
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         id,
-        Optional.absent(),
+        Optional.empty(),
         ScheduleStatus.KILLING,
         Optional.of("Killed for job update " + UPDATE_ID.getId())))
             .andReturn(StateChangeResult.SUCCESS);
@@ -101,7 +101,7 @@ public class KillTaskTest extends EasyMockTest {
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         id,
-        Optional.absent(),
+        Optional.empty(),
         ScheduleStatus.KILLING,
         Optional.of("Killed for job update " + UPDATE_ID.getId())))
         .andReturn(StateChangeResult.SUCCESS);

http://git-wip-us.apache.org/repos/asf/aurora/blob/6fd765bc/src/test/java/org/apache/aurora/scheduler/updater/OneWayJobUpdaterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/OneWayJobUpdaterTest.java b/src/test/java/org/apache/aurora/scheduler/updater/OneWayJobUpdaterTest.java
index 32a8c89..966678e 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/OneWayJobUpdaterTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/OneWayJobUpdaterTest.java
@@ -14,9 +14,9 @@
 package org.apache.aurora.scheduler.updater;
 
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
@@ -111,14 +111,14 @@ public class OneWayJobUpdaterTest extends EasyMockTest {
     return new SideEffect(
         Optional.of(action),
         ImmutableSet.<InstanceUpdateStatus>builder().add(statuses).build(),
-        Optional.absent());
+        Optional.empty());
   }
 
   private static SideEffect sideEffect(InstanceUpdateStatus... statuses) {
     return new SideEffect(
-        Optional.absent(),
+        Optional.empty(),
         ImmutableSet.<InstanceUpdateStatus>builder().add(statuses).build(),
-        Optional.absent());
+        Optional.empty());
   }
 
   @Test


Mime
View raw message