umustafi commented on code in PR #3984:
URL: https://github.com/apache/gobblin/pull/3984#discussion_r1650176276


##########
gobblin-service/src/test/java/org/apache/gobblin/service/modules/orchestration/FlowLaunchHandlerTest.java:
##########
@@ -67,15 +67,34 @@ public void testUpdatePropsInJobDataMap() {
     
originalProperties.setProperty(ConfigurationKeys.SCHEDULER_PRESERVED_CONSENSUS_EVENT_TIME_MILLIS_KEY,
 "1");
     oldJobDataMap.put(GobblinServiceJobScheduler.PROPERTIES_KEY, 
originalProperties);
 
-    JobDataMap newJobDataMap = 
FlowLaunchHandler.updatePropsInJobDataMap(oldJobDataMap, leasedToAnotherStatus,
-        schedulerBackOffMillis);
+    JobDataMap newJobDataMap =
+        FlowLaunchHandler.updatePropsInJobDataMap(oldJobDataMap, 
leasedToAnotherStatus, schedulerBackOffMillis);
     Properties newProperties = (Properties) 
newJobDataMap.get(GobblinServiceJobScheduler.PROPERTIES_KEY);
     
Assert.assertTrue(newProperties.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY).endsWith(cronExpressionSuffix));
     Assert.assertNotEquals("0",
         
newProperties.getProperty(ConfigurationKeys.SCHEDULER_EXPECTED_REMINDER_TIME_MILLIS_KEY));
     
Assert.assertEquals(String.valueOf(leasedToAnotherStatus.getEventTimeMillis()),
         
newProperties.getProperty(ConfigurationKeys.SCHEDULER_PRESERVED_CONSENSUS_EVENT_TIME_MILLIS_KEY));
     
Assert.assertTrue(Boolean.parseBoolean(newProperties.getProperty(ConfigurationKeys.FLOW_IS_REMINDER_EVENT_KEY)));
+    // Note these objects refer to the same object because the original map is 
passed to updatePropsInJobDataMap
+    Assert.assertSame(oldJobDataMap, newJobDataMap);
+  }
+
+  /**
+   * Assert that the JobDataMap and Properties objects do not reference the 
same memory location if using
+   */
+  @Test
+  public void testDeepCopyJobDataMap() {
+    JobDataMap originalJobDataMap = new JobDataMap();
+    Properties properties = new Properties();
+    properties.setProperty("key", "value");
+    originalJobDataMap.put(GobblinServiceJobScheduler.PROPERTIES_KEY, 
properties);
+
+    JobDataMap newJobDataMap = 
FlowLaunchHandler.deepCopyJobDataMap(originalJobDataMap);
+
+    Assert.assertNotSame(originalJobDataMap, newJobDataMap);

Review Comment:
   see above comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to