aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Added store APIs to query for IJobUpdate and IJobUpdateConfiguration.
Date Mon, 15 Sep 2014 19:17:50 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 4fe5d764e -> 8d8a56c2f


Added store APIs to query for IJobUpdate and IJobUpdateConfiguration.

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


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

Branch: refs/heads/master
Commit: 8d8a56c2f48fc8fa12119e6d28b346b7e7d9165c
Parents: 4fe5d76
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Mon Sep 15 12:17:30 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Mon Sep 15 12:17:30 2014 -0700

----------------------------------------------------------------------
 .../scheduler/storage/ForwardingStore.java      | 12 +++
 .../scheduler/storage/JobUpdateStore.java       | 17 ++++
 .../scheduler/storage/db/DBJobUpdateStore.java  | 27 +++++-
 .../storage/db/JobUpdateDetailsMapper.java      | 19 ++++
 .../storage/db/JobUpdateDetailsMapper.xml       | 91 +++++++++++++++-----
 .../storage/db/DBJobUpdateStoreTest.java        | 84 +++++++++++++-----
 6 files changed, 208 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/main/java/org/apache/aurora/scheduler/storage/ForwardingStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/ForwardingStore.java b/src/main/java/org/apache/aurora/scheduler/storage/ForwardingStore.java
index b894a71..6a97f36 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/ForwardingStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/ForwardingStore.java
@@ -25,6 +25,8 @@ import org.apache.aurora.scheduler.base.Query;
 import org.apache.aurora.scheduler.storage.entities.IHostAttributes;
 import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobKey;
+import org.apache.aurora.scheduler.storage.entities.IJobUpdate;
+import org.apache.aurora.scheduler.storage.entities.IJobUpdateConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateQuery;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateSummary;
@@ -151,6 +153,16 @@ public class ForwardingStore implements
   }
 
   @Override
+  public Optional<IJobUpdate> fetchJobUpdate(String updateId) {
+    return jobUpdateStore.fetchJobUpdate(updateId);
+  }
+
+  @Override
+  public Optional<IJobUpdateConfiguration> fetchJobUpdateConfiguration(String updateId)
{
+    return jobUpdateStore.fetchJobUpdateConfiguration(updateId);
+  }
+
+  @Override
   public Set<StoredJobUpdateDetails> fetchAllJobUpdateDetails() {
     return jobUpdateStore.fetchAllJobUpdateDetails();
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/main/java/org/apache/aurora/scheduler/storage/JobUpdateStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/JobUpdateStore.java b/src/main/java/org/apache/aurora/scheduler/storage/JobUpdateStore.java
index 599dbd8..c520e13 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/JobUpdateStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/JobUpdateStore.java
@@ -21,6 +21,7 @@ import com.google.common.base.Optional;
 import org.apache.aurora.gen.storage.StoredJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.entities.IJobInstanceUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdate;
+import org.apache.aurora.scheduler.storage.entities.IJobUpdateConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateQuery;
@@ -48,6 +49,22 @@ public interface JobUpdateStore {
   Optional<IJobUpdateDetails> fetchJobUpdateDetails(String updateId);
 
   /**
+   * Fetches a read-only view of a job update.
+   *
+   * @param updateId Update ID to fetch.
+   * @return A read-only view of job update.
+   */
+  Optional<IJobUpdate> fetchJobUpdate(String updateId);
+
+  /**
+   * Fetches a read-only view of a job update configuration.
+   *
+   * @param updateId Update ID to fetch configuration for.
+   * @return A read-only view of job update configuration.
+   */
+  Optional<IJobUpdateConfiguration> fetchJobUpdateConfiguration(String updateId);
+
+  /**
    * Fetches a read-only view of all job update details available in the store.
    * TODO(wfarner): Generate immutable wrappers for storage.thrift structs, use an immutable
object
    *                here.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/main/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStore.java b/src/main/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStore.java
index ec9b37c..87b773b 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStore.java
@@ -22,11 +22,14 @@ import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 
+import org.apache.aurora.gen.JobUpdate;
+import org.apache.aurora.gen.JobUpdateConfiguration;
 import org.apache.aurora.gen.storage.StoredJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.JobUpdateStore;
 import org.apache.aurora.scheduler.storage.entities.IInstanceTaskConfig;
 import org.apache.aurora.scheduler.storage.entities.IJobInstanceUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdate;
+import org.apache.aurora.scheduler.storage.entities.IJobUpdateConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateQuery;
@@ -73,7 +76,7 @@ public class DBJobUpdateStore implements JobUpdateStore.Mutable {
     Set<IRange> instanceOverrides =
         update.getConfiguration().getSettings().getUpdateOnlyTheseInstances();
 
-    if (instanceOverrides != null && !instanceOverrides.isEmpty()) {
+    if (!instanceOverrides.isEmpty()) {
       detailsMapper.insertInstanceOverrides(updateId, IRange.toBuildersSet(instanceOverrides));
     }
 
@@ -127,6 +130,28 @@ public class DBJobUpdateStore implements JobUpdateStore.Mutable {
   }
 
   @Override
+  public Optional<IJobUpdate> fetchJobUpdate(String updateId) {
+    return Optional.fromNullable(detailsMapper.selectUpdate(updateId))
+        .transform(new Function<JobUpdate, IJobUpdate>() {
+          @Override
+          public IJobUpdate apply(JobUpdate input) {
+            return IJobUpdate.build(input);
+          }
+        });
+  }
+
+  @Override
+  public Optional<IJobUpdateConfiguration> fetchJobUpdateConfiguration(String updateId)
{
+    return Optional.fromNullable(detailsMapper.selectConfiguration(updateId))
+        .transform(new Function<JobUpdateConfiguration, IJobUpdateConfiguration>()
{
+          @Override
+          public IJobUpdateConfiguration apply(JobUpdateConfiguration input) {
+            return IJobUpdateConfiguration.build(input);
+          }
+        });
+  }
+
+  @Override
   public Set<StoredJobUpdateDetails> fetchAllJobUpdateDetails() {
     return ImmutableSet.copyOf(detailsMapper.selectAllDetails());
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/main/java/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.java
b/src/main/java/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.java
index 53f7a9b..04a9246 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.java
@@ -19,6 +19,7 @@ import java.util.Set;
 import javax.annotation.Nullable;
 
 import org.apache.aurora.gen.JobUpdate;
+import org.apache.aurora.gen.JobUpdateConfiguration;
 import org.apache.aurora.gen.JobUpdateQuery;
 import org.apache.aurora.gen.JobUpdateSummary;
 import org.apache.aurora.gen.Range;
@@ -109,6 +110,24 @@ interface JobUpdateDetailsMapper {
   StoredJobUpdateDetails selectDetails(String updateId);
 
   /**
+   * Gets job update for the provided {@code updateId}.
+   *
+   * @param updateId Update ID to select by.
+   * @return job update for the provided update ID, if it exists.
+   */
+  @Nullable
+  JobUpdate selectUpdate(String updateId);
+
+  /**
+   * Gets job update configuration for the provided {@code updateId}.
+   *
+   * @param updateId Update ID to select by.
+   * @return job update configuration for the provided update ID, if it exists.
+   */
+  @Nullable
+  JobUpdateConfiguration selectConfiguration(String updateId);
+
+  /**
    * Gets all stored job update details.
    *
    * @return All stored job update details.

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
b/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
index e59e6f7..0e7f6eb 100644
--- a/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
+++ b/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
@@ -185,7 +185,7 @@
     </collection>
   </resultMap>
 
-  <sql id="timestamps_join">
+  <sql id="timestamps_inner_joins">
     INNER JOIN
     (
       SELECT
@@ -243,7 +243,7 @@
       j.name AS jk_name
     FROM job_updates AS u
     INNER JOIN job_keys AS j ON j.id = u.job_key_id
-    <include refid="timestamps_join" />
+    <include refid="timestamps_inner_joins" />
     <if test="updateId != null || role != null || user != null || jobKey != null || updateStatuses
!= null || limit != 0 || offset != 0">
     WHERE TRUE
       <if test="updateId != null">AND u.update_id = #{updateId}</if>
@@ -269,17 +269,20 @@
   </select>
 
   <!--Column naming convention below follows the thrift object hierarchy and columnPrefix
-      attributes used in associations.
-      For example: jusm_just_status maps to JobUpdateSummary/JobUpdateState/status field.-->
-  <sql id="unscoped_details_select">
-    SELECT
+    attributes used in associations.
+    For example: jusm_just_status maps to JobUpdateSummary/JobUpdateState/status field.-->
+  <sql id="job_update_columns">
       u.id AS u_id,
-      u.id AS juc_juse_id,
       u.update_id AS jusm_update_id,
       u.user AS jusm_user,
       max_status.status AS jusm_just_status,
       min_ts.timestamp_ms AS jusm_just_created_timestamp_ms,
       max_ts.timestamp_ms AS jusm_just_last_modified_timestamp_ms,
+      j.id AS jusm_jk_id,
+      j.role AS jusm_jk_role,
+      j.environment AS jusm_jk_environment,
+      j.name AS jusm_jk_name,
+      u.id AS juc_juse_id,
       u.instance_count AS juc_instance_count,
       u.update_group_size AS juc_juse_update_group_size,
       u.max_per_instance_failures AS juc_juse_max_per_instance_failures,
@@ -287,17 +290,6 @@
       u.max_wait_to_instance_running_ms AS juc_juse_max_wait_to_instance_running_ms,
       u.min_wait_in_instance_running_ms AS juc_juse_min_wait_in_instance_running_ms,
       u.rollback_on_failure AS juc_juse_rollback_on_failure,
-      j.id AS jusm_jk_id,
-      j.role AS jusm_jk_role,
-      j.environment AS jusm_jk_environment,
-      j.name AS jusm_jk_name,
-      e.id AS e_id,
-      e.status AS e_status,
-      e.timestamp_ms AS e_timestamp_ms,
-      i.id AS i_id,
-      i.action AS i_action,
-      i.instance_id AS i_instance_id,
-      i.timestamp_ms AS i_timestamp_ms,
       cn.id AS juc_id,
       cn.task_config AS juc_new_task_config,
       co.id AS juc_itc_id,
@@ -307,20 +299,77 @@
       ci.last AS juc_itc_r_last,
       io.id AS juc_juse_r_id,
       io.first AS juc_juse_r_first,
-      io.last AS juc_juse_r_last,
-      l.lock_token AS lock_token
+      io.last AS juc_juse_r_last
+  </sql>
+
+  <sql id="job_update_to_configs_inner_joins">
     FROM job_updates AS u
     INNER JOIN job_keys AS j ON j.id = u.job_key_id
     INNER JOIN job_update_configs AS cn ON cn.update_id = u.id AND cn.is_new = TRUE
     INNER JOIN job_update_configs AS co ON co.update_id = u.id AND co.is_new = FALSE
     INNER JOIN job_update_configs_to_instances AS ci ON ci.config_id = co.id
-    <include refid="timestamps_join" />
+  </sql>
+
+  <sql id="job_update_to_instance_overrides_outer_join">
     LEFT OUTER JOIN job_updates_to_instance_overrides AS io ON io.update_id = u.id
+  </sql>
+
+  <sql id="unscoped_details_select">
+    SELECT
+      <include refid="job_update_columns" />,
+      e.id AS e_id,
+      e.status AS e_status,
+      e.timestamp_ms AS e_timestamp_ms,
+      i.id AS i_id,
+      i.action AS i_action,
+      i.instance_id AS i_instance_id,
+      i.timestamp_ms AS i_timestamp_ms,
+      l.lock_token AS lock_token
+    <include refid="job_update_to_configs_inner_joins" />
+    <include refid="timestamps_inner_joins" />
+    <include refid="job_update_to_instance_overrides_outer_join" />
     LEFT OUTER JOIN job_update_events AS e ON e.update_id = u.id
     LEFT OUTER JOIN job_instance_update_events AS i ON i.update_id = u.id
     LEFT OUTER JOIN job_update_locks AS l on l.update_id = u.id
   </sql>
 
+  <!--Ideally, update configuration columns could be derived from job_update_columns above
but that
+      hits against the limits of mybatis code reuse as specifying a common "juc_" column
prefix
+      in case of a standalone (no parent association) select appears to be impossible.-->
+  <select id="selectConfiguration" resultMap="jobUpdateConfigurationMap">
+    SELECT
+      u.id AS juse_id,
+      u.instance_count AS instance_count,
+      u.update_group_size AS juse_update_group_size,
+      u.max_per_instance_failures AS juse_max_per_instance_failures,
+      u.max_failed_instances AS juse_max_failed_instances,
+      u.max_wait_to_instance_running_ms AS juse_max_wait_to_instance_running_ms,
+      u.min_wait_in_instance_running_ms AS juse_min_wait_in_instance_running_ms,
+      u.rollback_on_failure AS juse_rollback_on_failure,
+      cn.id AS id,
+      cn.task_config AS new_task_config,
+      co.id AS itc_id,
+      co.task_config AS itc_task,
+      ci.id AS itc_r_id,
+      ci.first AS itc_r_first,
+      ci.last AS itc_r_last,
+      io.id AS juse_r_id,
+      io.first AS juse_r_first,
+      io.last AS juse_r_last
+    <include refid="job_update_to_configs_inner_joins" />
+    <include refid="job_update_to_instance_overrides_outer_join" />
+    WHERE u.update_id = #{id}
+  </select>
+
+  <select id="selectUpdate" resultMap="jobUpdateMap">
+    SELECT
+      <include refid="job_update_columns" />
+    <include refid="job_update_to_configs_inner_joins" />
+    <include refid="timestamps_inner_joins" />
+    <include refid="job_update_to_instance_overrides_outer_join" />
+    WHERE u.update_id = #{id}
+  </select>
+
   <select id="selectDetails" resultMap="jobUpdateDetailsMap">
     <include refid="unscoped_details_select"/>
     WHERE u.update_id = #{id}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d8a56c2/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
index 0be4d78..af644a9 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
@@ -49,6 +49,7 @@ import org.apache.aurora.scheduler.storage.Storage.Work.Quiet;
 import org.apache.aurora.scheduler.storage.entities.IJobInstanceUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobKey;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdate;
+import org.apache.aurora.scheduler.storage.entities.IJobUpdateConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateDetails;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateEvent;
 import org.apache.aurora.scheduler.storage.entities.IJobUpdateQuery;
@@ -90,11 +91,14 @@ public class DBJobUpdateStoreTest {
     IJobUpdate update1 = makeJobUpdate(JobKeys.from("role", "env", "name1"), updateId1);
     IJobUpdate update2 = makeJobUpdate(JobKeys.from("role", "env", "name2"), updateId2);
 
+    assertEquals(Optional.<IJobUpdate>absent(), getUpdate(updateId1));
+    assertEquals(Optional.<IJobUpdate>absent(), getUpdate(updateId2));
+
     saveUpdate(update1, "lock1");
-    assertEquals(populateExpected(update1), getUpdateDetails(updateId1).get().getUpdate());
+    assertUpdate(update1);
 
     saveUpdate(update2, "lock2");
-    assertEquals(populateExpected(update1), getUpdateDetails(updateId1).get().getUpdate());
+    assertUpdate(update2);
   }
 
   @Test
@@ -109,7 +113,7 @@ public class DBJobUpdateStoreTest {
 
     // Save with empty overrides.
     saveUpdate(expected, "lock");
-    assertEquals(populateExpected(expected), getUpdateDetails(updateId).get().getUpdate());
+    assertUpdate(expected);
   }
 
   @Test
@@ -125,7 +129,7 @@ public class DBJobUpdateStoreTest {
     // Save with null overrides.
     builder.getConfiguration().getSettings().setUpdateOnlyTheseInstances(null);
     saveUpdate(IJobUpdate.build(builder), "lock");
-    assertEquals(populateExpected(expected), getUpdateDetails(updateId).get().getUpdate());
+    assertUpdate(expected);
   }
 
   @Test(expected = StorageException.class)
@@ -145,7 +149,7 @@ public class DBJobUpdateStoreTest {
     IJobUpdateEvent event2 = makeJobUpdateEvent(JobUpdateStatus.ROLL_FORWARD_PAUSED, 125L);
 
     saveUpdate(update, "lock1");
-    assertEquals(populateExpected(update), getUpdateDetails(updateId).get().getUpdate());
+    assertUpdate(update);
     assertEquals(ImmutableList.of(FIRST_EVENT), getUpdateDetails(updateId).get().getUpdateEvents());
 
     saveJobEvent(event1, updateId);
@@ -170,7 +174,7 @@ public class DBJobUpdateStoreTest {
     IJobInstanceUpdateEvent event2 = makeJobInstanceEvent(1, 126L, INSTANCE_ADDED);
 
     saveUpdate(update, "lock");
-    assertEquals(populateExpected(update), getUpdateDetails(updateId).get().getUpdate());
+    assertUpdate(update);
     assertEquals(0, getUpdateDetails(updateId).get().getInstanceEvents().size());
 
     saveJobInstanceEvent(event1, updateId);
@@ -212,7 +216,7 @@ public class DBJobUpdateStoreTest {
     saveUpdate(update, "lock1");
 
     // Assert state fields were ignored.
-    assertEquals(populateExpected(update), getUpdateDetails(updateId).get().getUpdate());
+    assertUpdate(update);
   }
 
   @Test
@@ -298,7 +302,7 @@ public class DBJobUpdateStoreTest {
     saveJobInstanceEvent(instanceEvent, updateId);
     assertEquals(
         populateExpected(update, JobUpdateStatus.ROLLING_FORWARD, CREATED_MS, 125L),
-        getUpdateDetails(updateId).get().getUpdate());
+        getUpdate(updateId).get());
     assertEquals(2, getUpdateDetails(updateId).get().getUpdateEvents().size());
     assertEquals(1, getUpdateDetails(updateId).get().getInstanceEvents().size());
 
@@ -460,6 +464,42 @@ public class DBJobUpdateStoreTest {
         getSummaries(new JobUpdateQuery().setRole("no_match")));
   }
 
+  @Test
+  public void testGetConfiguration() {
+    String updateId = "u1";
+
+    IJobUpdate update = makeJobUpdate(JobKeys.from("role", "env", "name1"), updateId);
+
+    assertEquals(Optional.<IJobUpdate>absent(), getUpdateConfiguration(updateId));
+
+    saveUpdate(update, "lock1");
+    assertEquals(Optional.of(makeJobUpdateConfiguration()), getUpdateConfiguration(updateId));
+  }
+
+  private void assertUpdate(IJobUpdate expected) {
+    String updateId = expected.getSummary().getUpdateId();
+    assertEquals(populateExpected(expected), getUpdate(updateId).get());
+    assertEquals(getUpdate(updateId).get(), getUpdateDetails(updateId).get().getUpdate());
+  }
+
+  private Optional<IJobUpdate> getUpdate(final String updateId) {
+    return storage.consistentRead(new Quiet<Optional<IJobUpdate>>() {
+      @Override
+      public Optional<IJobUpdate> apply(Storage.StoreProvider storeProvider) {
+        return storeProvider.getJobUpdateStore().fetchJobUpdate(updateId);
+      }
+    });
+  }
+
+  private Optional<IJobUpdateConfiguration> getUpdateConfiguration(final String updateId)
{
+    return storage.consistentRead(new Quiet<Optional<IJobUpdateConfiguration>>()
{
+      @Override
+      public Optional<IJobUpdateConfiguration> apply(Storage.StoreProvider storeProvider)
{
+        return storeProvider.getJobUpdateStore().fetchJobUpdateConfiguration(updateId);
+      }
+    });
+  }
+
   private Optional<IJobUpdateDetails> getUpdateDetails(final String updateId) {
     return storage.consistentRead(new Quiet<Optional<IJobUpdateDetails>>() {
       @Override
@@ -630,18 +670,22 @@ public class DBJobUpdateStoreTest {
 
   private IJobUpdate makeJobUpdate() {
     return IJobUpdate.build(new JobUpdate()
-        .setConfiguration(new JobUpdateConfiguration()
-            .setNewTaskConfig(makeTaskConfig())
-            .setInstanceCount(8)
-            .setOldTaskConfigs(ImmutableSet.of(
-                new InstanceTaskConfig()
-                    .setInstances(ImmutableSet.of(new Range(0, 1), new Range(2, 3)))
-                    .setTask(makeTaskConfig()),
-                new InstanceTaskConfig()
-                    .setInstances(ImmutableSet.of(new Range(4, 5), new Range(6, 7)))
-                    .setTask(makeTaskConfig())))
-            .setSettings(new JobUpdateSettings()
-                .setUpdateOnlyTheseInstances(ImmutableSet.of(new Range(0, 0), new Range(3,
5))))));
+        .setConfiguration(makeJobUpdateConfiguration().newBuilder()));
+  }
+
+  private IJobUpdateConfiguration makeJobUpdateConfiguration() {
+    return IJobUpdateConfiguration.build(new JobUpdateConfiguration()
+        .setNewTaskConfig(makeTaskConfig())
+        .setInstanceCount(8)
+        .setOldTaskConfigs(ImmutableSet.of(
+            new InstanceTaskConfig()
+                .setInstances(ImmutableSet.of(new Range(0, 1), new Range(2, 3)))
+                .setTask(makeTaskConfig()),
+            new InstanceTaskConfig()
+                .setInstances(ImmutableSet.of(new Range(4, 5), new Range(6, 7)))
+                .setTask(makeTaskConfig())))
+        .setSettings(new JobUpdateSettings()
+            .setUpdateOnlyTheseInstances(ImmutableSet.of(new Range(0, 0), new Range(3, 5)))));
   }
 
   private TaskConfig makeTaskConfig() {


Mime
View raw message