### Question:
ModelerConversionUtil { public static double upConvertDomain( Domain domain ) { int modelCount = domain.getLogicalModels().size(); LogicalModel model = domain.getLogicalModels().get( 0 ); String versionString = (String) model.getProperty( "AGILE_BI_VERSION" ); String isAgileBiGenerated = (String) model.getProperty( "AGILE_BI_GENERATED_SCHEMA" ); String mondrianCatRef = (String) model.getProperty( "MondrianCatalogRef" ); String dualModelingMode = (String) model.getProperty( "DUAL_MODELING_SCHEMA" ); double currentVersion = Double.parseDouble( BaseModelerWorkspaceHelper.AGILE_BI_VERSION ); if ( "false".equals( dualModelingMode ) ) { return currentVersion; } if ( modelCount > 1 ) { if ( model.getLogicalTables().size() == domain.getLogicalModels().get( 1 ).getLogicalTables().size() ) { return currentVersion; } } else { if ( modelCount == 1 || ( ( isAgileBiGenerated != null && isAgileBiGenerated.equals( "TRUE" ) ) || ( mondrianCatRef != null ) ) ) { double versionNumber = 1.0; boolean ignored = false; try { versionNumber = Double.parseDouble( versionString ); } catch ( NumberFormatException e ) { ignored = true; } catch ( NullPointerException npe ) { ignored = true; } if ( versionNumber < 2.0 ) { LogicalModel olapModel = duplicateModelForOlap( model ); domain.addLogicalModel( olapModel ); } else if ( versionNumber == 2.0 ) { LogicalModel olapModel = upgradeAndSplitCombinedModel( model ); domain.addLogicalModel( olapModel ); } return versionNumber; } } return 0; }  static double upConvertDomain( Domain domain ); static LogicalModel duplicateModelForOlap( LogicalModel logicalModel ); static void duplicateRelationshipsForOlap( LogicalModel relationalModel, LogicalModel olapModel );  }### Answer:
@Test public void testUpConvertDomain_v2_multiTable() throws Exception { XmiParser parser = new XmiParser(); FileInputStream input = new FileInputStream( new File( "src/test/resources/multi-table-model-2.0.xmi" ) ); Domain domain = parser.parseXmi( input ); int tableCount = domain.getLogicalModels().get( 0 ).getLogicalTables().size(); int relationshipCount = domain.getLogicalModels().get( 0 ).getLogicalRelationships().size(); assertEquals( 1, domain.getLogicalModels().size() ); ModelerConversionUtil.upConvertDomain( domain ); assertEquals( 2, domain.getLogicalModels().size() ); assertEquals( tableCount / 2, domain.getLogicalModels().get( 0 ).getLogicalTables().size() ); assertEquals( tableCount / 2, domain.getLogicalModels().get( 1 ).getLogicalTables().size() ); assertEquals( relationshipCount / 2, domain.getLogicalModels().get( 0 ).getLogicalRelationships().size() ); assertEquals( relationshipCount / 2, domain.getLogicalModels().get( 1 ).getLogicalRelationships().size() ); }
@Test public void testUpConvertDomain_v1_sql() throws Exception { XmiParser parser = new XmiParser(); FileInputStream input = new FileInputStream( new File( "src/test/resources/sql-model-1.0.xmi" ) ); Domain domain = parser.parseXmi( input ); int tableCount = domain.getLogicalModels().get( 0 ).getLogicalTables().size(); assertEquals( 1, tableCount ); assertEquals( 1, domain.getLogicalModels().size() ); ModelerConversionUtil.upConvertDomain( domain ); assertEquals( 2, domain.getLogicalModels().size() ); assertEquals( tableCount, domain.getLogicalModels().get( 0 ).getLogicalTables().size() ); assertEquals( tableCount, domain.getLogicalModels().get( 1 ).getLogicalTables().size() ); }