@@ -81,7 +81,7 @@ public void upgrade43xToCurrentVersion() throws IOException {
8181 File mappingDir = new File (projectDir , "mappings" );
8282 File entitiesDir = new File (projectDir , "entities" );
8383 verifyDirContents (mappingDir , 1 );
84- verifyDirContents (entitiesDir , 3 );
84+ verifyDirContents (entitiesDir , 4 );
8585
8686 File finalDbFile = hubProject .getUserConfigDir ().resolve ("databases" ).resolve ("final-database.json" ).toFile ();
8787 ObjectNode db = (ObjectNode ) ObjectMapperFactory .getObjectMapper ().readTree (finalDbFile );
@@ -228,7 +228,7 @@ public void onlyLegacyEntitiesUpgrade() throws IOException {
228228 List <String > legacyFlowNames = new ArrayList <>();
229229 legacyEntities .add ("Customer" );
230230 legacyEntities .add ("Product" );
231- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
231+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
232232 assertTrue (hubProject .getFlowsDir ().resolve ("dh_Upgrade_CustomerFlow.flow.json" ).toFile ().exists ());
233233 assertTrue (hubProject .getFlowsDir ().resolve ("dh_Upgrade_ProductFlow.flow.json" ).toFile ().exists ());
234234 assertFalse (hubProject .getFlowsDir ().resolve ("dh_Upgrade_OrderFlow.flow.json" ).toFile ().exists ());
@@ -241,7 +241,7 @@ public void onlyFlowTypeUpgrade() throws IOException {
241241 List <String > legacyFlowTypes = new ArrayList <>();
242242 List <String > legacyFlowNames = new ArrayList <>();
243243 legacyFlowTypes .add ("input" );
244- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
244+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
245245 assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).toFile ().exists ());
246246 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .CUSTOM ).toFile ().exists ());
247247 }
@@ -254,7 +254,7 @@ public void onlyFlowNamesUpgrade() throws IOException {
254254 List <String > legacyFlowNames = new ArrayList <>();
255255 legacyFlowNames .add ("Load Customers" );
256256 legacyFlowNames .add ("Harmonize Products" );
257- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
257+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
258258 assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).resolve ("LoadCustomers.step.json" ).toFile ().exists ());
259259 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).resolve ("LoadOrders.step.json" ).toFile ().exists ());
260260 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).resolve ("LoadProducts.step.json" ).toFile ().exists ());
@@ -270,7 +270,7 @@ public void entityAndFlowNameUpgrade() throws IOException {
270270 legacyEntities .add ("Customer" );
271271 legacyFlowNames .add ("Load Customers" );
272272 legacyFlowNames .add ("Harmonize Products" );
273- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
273+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
274274 assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).resolve ("LoadCustomers.step.json" ).toFile ().exists ());
275275 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .CUSTOM ).resolve ("HarmonizeProducts.step.json" ).toFile ().exists ());
276276 }
@@ -283,7 +283,7 @@ public void entityAndFlowTypeUpgrade() throws IOException {
283283 List <String > legacyFlowNames = new ArrayList <>();
284284 legacyEntities .add ("Product" );
285285 legacyFlowTypes .add ("input" );
286- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
286+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
287287 assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).resolve ("LoadProducts.step.json" ).toFile ().exists ());
288288 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .CUSTOM ).resolve ("HarmonizeProducts.step.json" ).toFile ().exists ());
289289 }
@@ -295,7 +295,7 @@ public void nonExistentFlowName() throws IOException {
295295 List <String > legacyFlowTypes = new ArrayList <>();
296296 List <String > legacyFlowNames = new ArrayList <>();
297297 legacyFlowNames .add ("NonExistentFlow" );
298- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
298+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
299299 assertEquals (0 , hubProject .getFlowsDir ().toFile ().listFiles ().length );
300300 }
301301
@@ -307,13 +307,13 @@ public void multipleLegacyFlowUpgrades() throws IOException {
307307 List <String > legacyFlowTypes = new ArrayList <>();
308308 List <String > legacyFlowNames = new ArrayList <>();
309309 legacyFlowTypes .add ("input" );
310- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
310+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
311311
312312 assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .INGESTION ).toFile ().exists ());
313313 assertFalse (hubProject .getStepsPath (StepDefinition .StepDefinitionType .CUSTOM ).toFile ().exists ());
314314
315315 legacyFlowTypes = new ArrayList <>();
316- hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames );
316+ hubProject .upgradeLegacyFlows (flowManager , legacyEntities , legacyFlowTypes , legacyFlowNames , getHubConfig (). getStagingDbName (), getHubConfig (). getFinalDbName () );
317317 verify4xUpgradedFlows ();
318318 }
319319
@@ -520,6 +520,18 @@ private void verify4xUpgradedFlows() throws IOException {
520520 assertEquals ("Product" , node .get ("options" ).get ("entity" ).asText ());
521521 assertEquals ("json" , node .get ("options" ).get ("dataFormat" ).asText ());
522522 assertEquals ("/entities/Product/harmonize/Harmonize Products/main.sjs" , node .get ("options" ).get ("mainModuleUri" ).asText ());
523+
524+ // validate the step default configuration when properties file is missing
525+ assertTrue (hubProject .getFlowsDir ().resolve ("dh_Upgrade_EmployeeFlow.flow.json" ).toFile ().exists ());
526+ assertTrue (hubProject .getStepsPath (StepDefinition .StepDefinitionType .CUSTOM ).resolve ("NoProperties.step.json" ).toFile ().exists ());
527+ assertTrue (hubProject .getStepDefinitionPath (StepDefinition .StepDefinitionType .CUSTOM ).resolve ("NoProperties" ).toFile ().exists ());
528+ assertNotNull (hubProject .getCustomModuleDir ("NoProperties" , StepDefinition .StepDefinitionType .CUSTOM .toString ()));
529+ JsonNode noPropertiesStep = mapper .readTree (hubProject .getStepFile (StepDefinition .StepDefinitionType .CUSTOM , "NoProperties" ));
530+ assertEquals ("json" , noPropertiesStep .get ("sourceFormat" ).asText ());
531+ assertEquals ("json" , noPropertiesStep .get ("targetFormat" ).asText ());
532+ assertEquals ("json" , noPropertiesStep .get ("options" ).get ("dataFormat" ).asText ());
533+ assertEquals ("/entities/Employee/harmonize/NoProperties/main.sjs" , noPropertiesStep .get ("options" ).get ("mainModuleUri" ).asText ());
534+ assertEquals ("/entities/Employee/harmonize/NoProperties/collector.sjs" , noPropertiesStep .get ("sourceModule" ).get ("modulePath" ).asText ());
523535 }
524536
525537 private HubProjectImpl setUpProject (String sourceProjectName , String destProjectName ) throws IOException {
0 commit comments