Change RooJobInstance to use the delegate DisplayName.

Revision created by MOE tool push_codebase.
MOE_MIGRATION=7100


git-svn-id: https://appengine-pipeline.googlecode.com/svn/trunk@173 1742be92-6d41-bc97-00b7-290b722d530a
diff --git a/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java b/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java
index 6c17cb4..4e80f57 100755
--- a/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java
+++ b/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java
@@ -498,7 +498,7 @@
 
     @Override
     public String getJobDisplayName() {
-      return jobInstance.getClass().getName();
+      return jobInstance.getJobDisplayName();
     }
   }
 
diff --git a/java/src/test/java/com/google/appengine/tools/pipeline/MiscPipelineTest.java b/java/src/test/java/com/google/appengine/tools/pipeline/MiscPipelineTest.java
index 4dc5bbc..2e6a19d 100644
--- a/java/src/test/java/com/google/appengine/tools/pipeline/MiscPipelineTest.java
+++ b/java/src/test/java/com/google/appengine/tools/pipeline/MiscPipelineTest.java
@@ -17,6 +17,8 @@
 import com.google.appengine.tools.pipeline.JobInfo.State;
 import com.google.appengine.tools.pipeline.JobSetting.StatusConsoleUrl;
 import com.google.appengine.tools.pipeline.impl.PipelineManager;
+import com.google.appengine.tools.pipeline.impl.model.JobRecord;
+import com.google.appengine.tools.pipeline.impl.model.PipelineObjects;
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 
@@ -229,6 +231,30 @@
     protected String getValue() {
       return "Shalom";
     }
+
+    @Override
+    public String getJobDisplayName() {
+      return "ConcreteJob: " + getValue();
+    }
+
+    @SuppressWarnings("unused")
+    public Value<String> handleException(Throwable t) {
+      return immediate("Got exception!");
+    }
+  }
+
+  public void testGetJobDisplayName() throws Exception {
+    PipelineService service = PipelineServiceFactory.newPipelineService();
+    ConcreteJob job = new ConcreteJob();
+    String pipelineId = service.startNewPipeline(job);
+    JobRecord jobRecord = PipelineManager.getJob(pipelineId);
+    assertEquals(job.getJobDisplayName(), jobRecord.getRootJobDisplayName());
+    JobInfo jobInfo = waitUntilJobComplete(pipelineId);
+    assertEquals("Shalom", jobInfo.getOutput());
+    jobRecord = PipelineManager.getJob(pipelineId);
+    assertEquals(job.getJobDisplayName(), jobRecord.getRootJobDisplayName());
+    PipelineObjects pobjects = PipelineManager.queryFullPipeline(pipelineId);
+    assertEquals(job.getJobDisplayName(), pobjects.rootJob.getRootJobDisplayName());
   }
 
   public void testJobInheritence() throws Exception {
@@ -247,7 +273,7 @@
     }
   }
 
-  public void testJobFailure() throws Exception {
+ public void testJobFailure() throws Exception {
     PipelineService service = PipelineServiceFactory.newPipelineService();
     String pipelineId = service.startNewPipeline(new FailedJob());
     JobInfo jobInfo = waitUntilJobComplete(pipelineId);