ToXmlTest.java| Commit | Date | Message |
|---|---|---|
9ebb88522 | 2016-07-18 | Initial commit |
// @Test // Commented out — requires live DB
public void testExp() {
System.getProperties().setProperty("projectForgeDs", "postgres");
SchemaExpMain.main(new String[] { "-exp", "target/pf-dump.xml" });
}Line 8: Sets the system property projectForgeDs to "postgres" — this selects which Spring DataSource bean to activate. The value postgres corresponds to the primary development database defined in local-settings.properties (#4101).
Line 9: Passes two arguments: -exp (the export operation flag) and target/pf-dump.xml (the output path, relative to Maven's build directory). The -exp flag is parsed by SchemaExpMain.parseOption() which sets op = Operation.Export, then delegates to SchemaExpService.doExport() which calls jpaXmlDumpService.dumpToXml().
@Test is intentional. Un-comment only when you have a populated PostgreSQL database available.FromXmlTest (#4106). Together they form a full migration workflow.target/pf-dump.xml assumes the working directory is the tool's root. Running from the wrong directory creates the file elsewhere.de.micromata.genome.db.jpa.xmldump.api.JpaXmlDumpService — not raw XStream. The Genome library adds JPA entity metadata to the XML for correct relationship handling.
This is the export-side developer test — the counterpart to
FromXmlTest(#4106). It initializes a Spring context, overrides the data source to PostgreSQL, then invokesSchemaExpMain.main()with-expto export the entire database totarget/pf-dump.xml. The@Testannotation is commented out because this test requires a live, populated PostgreSQL database — it cannot run in CI without a database fixture.The resulting XML file can be hundreds of megabytes for a production database, containing all entities (users, groups, addresses, time sheets, tasks, invoices, history entries) serialized via the Genome JPA XML Dump library with XStream's
ReferenceByIdMarshallingStrategy.