@Test public void testExecute() throws Exception { ExportCfgTask ect = new ExportCfgTask(null); Properties properties = new Properties(); properties.put("hibernate.dialect", "H2"); MetadataDescriptor mdd = MetadataDescriptorFactory.createNativeDescriptor( null, new File[] {}, properties); ect.properties.put(ExporterConstants.METADATA_DESCRIPTOR, mdd); File destinationFolder = tempdir.toFile(); ect.properties.put(ExporterConstants.DESTINATION_FOLDER, destinationFolder); File cfgFile = new File(destinationFolder, "hibernate.cfg.xml"); assertFalse(cfgFile.exists()); ect.execute(); assertTrue(cfgFile.exists()); String cfgXmlString = new String(Files.readAllBytes(cfgFile.toPath())); assertTrue(cfgXmlString.contains("hibernate.dialect")); }
public void execute() { Exporter exporter = ExporterFactory.createExporter(ExporterType.CFG); MetadataDescriptor metadataDescriptor = (MetadataDescriptor)this.properties.get(ExporterConstants.METADATA_DESCRIPTOR); exporter.getProperties().putAll(metadataDescriptor.getProperties()); exporter.getProperties().putAll(this.properties); exporter.start(); }
ExportCfgTask { public void execute() { Exporter exporter = ExporterFactory.createExporter(ExporterType.CFG); MetadataDescriptor metadataDescriptor = (MetadataDescriptor)this.properties.get(ExporterConstants.METADATA_DESCRIPTOR); exporter.getProperties().putAll(metadataDescriptor.getProperties()); exporter.getProperties().putAll(this.properties); exporter.start(); } }
ExportCfgTask { public void execute() { Exporter exporter = ExporterFactory.createExporter(ExporterType.CFG); MetadataDescriptor metadataDescriptor = (MetadataDescriptor)this.properties.get(ExporterConstants.METADATA_DESCRIPTOR); exporter.getProperties().putAll(metadataDescriptor.getProperties()); exporter.getProperties().putAll(this.properties); exporter.start(); } ExportCfgTask(HibernateToolTask parent); }
ExportCfgTask { public void execute() { Exporter exporter = ExporterFactory.createExporter(ExporterType.CFG); MetadataDescriptor metadataDescriptor = (MetadataDescriptor)this.properties.get(ExporterConstants.METADATA_DESCRIPTOR); exporter.getProperties().putAll(metadataDescriptor.getProperties()); exporter.getProperties().putAll(this.properties); exporter.start(); } ExportCfgTask(HibernateToolTask parent); Properties getProperties(); void setDestinationFolder(File destinationFolder); void setMetadataDescriptor(MetadataDescriptor metadataDescriptor); void setTemplatePath(Path path); void addConfiguredProperty(Variable variable); void execute(); }
ExportCfgTask { public void execute() { Exporter exporter = ExporterFactory.createExporter(ExporterType.CFG); MetadataDescriptor metadataDescriptor = (MetadataDescriptor)this.properties.get(ExporterConstants.METADATA_DESCRIPTOR); exporter.getProperties().putAll(metadataDescriptor.getProperties()); exporter.getProperties().putAll(this.properties); exporter.start(); } ExportCfgTask(HibernateToolTask parent); Properties getProperties(); void setDestinationFolder(File destinationFolder); void setMetadataDescriptor(MetadataDescriptor metadataDescriptor); void setTemplatePath(Path path); void addConfiguredProperty(Variable variable); void execute();  }