List of usage examples for org.hibernate.cfg Configuration Configuration
public Configuration()
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Contact() throws IOException { FileUtils.delete(new File("target/gen1")); File contact = new File("src/test/resources/contact.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);//from ww w . ja v a 2s .c om HibernateDomainExporter exporter = new HibernateDomainExporter("Q", new File("target/gen1"), config); exporter.execute(); File targetFile = new File("target/gen1/com/mysema/query/jpa/domain2/QContact.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Contact_with_Suffix() throws IOException { FileUtils.delete(new File("target/gen1")); File contact = new File("src/test/resources/contact.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);/* w w w . jav a 2 s . c o m*/ HibernateDomainExporter exporter = new HibernateDomainExporter("", "Type", new File("target/gen1"), config); exporter.execute(); File targetFile = new File("target/gen1/com/mysema/query/jpa/domain2/ContactType.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Contact2() throws IOException { FileUtils.delete(new File("target/gen2")); File contact = new File("src/test/resources/contact2.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);/* w w w . jav a 2 s .c om*/ HibernateDomainExporter exporter = new HibernateDomainExporter("Q", new File("target/gen2"), config); exporter.execute(); File targetFile = new File("target/gen2/com/mysema/query/jpa/domain2/QContact.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Multiple() throws IOException { FileUtils.delete(new File("target/gen3")); Configuration config = new Configuration(); for (Class<?> cl : Domain.classes) { config.addAnnotatedClass(cl);//from w ww . j a v a2 s . c om } HibernateDomainExporter exporter = new HibernateDomainExporter("Q", new File("target/gen3"), serializerConfig, config); exporter.execute(); List<String> failures = new ArrayList<String>(); for (File file : new File("target/gen3/com/mysema/query/jpa/domain").listFiles()) { String result1 = Files.toString(file, Charsets.UTF_8); String result2 = Files.toString( new File("../querydsl-jpa/target/generated-test-sources/java/com/mysema/query/jpa/domain", file.getName()), Charsets.UTF_8); if (!result1.equals(result2)) { System.err.println(file.getName()); failures.add(file.getName()); } } if (!failures.isEmpty()) { fail("Failed with " + failures.size() + " failures"); } }
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Multiple2() throws IOException { FileUtils.delete(new File("target/gen4")); Configuration config = new Configuration(); for (Class<?> cl : Domain2.classes) { config.addAnnotatedClass(cl);/*from www . java 2 s .com*/ } HibernateDomainExporter exporter = new HibernateDomainExporter("Q", new File("target/gen4"), serializerConfig, config); exporter.execute(); List<String> failures = new ArrayList<String>(); for (File file : new File("target/gen4/com/mysema/query/jpa/domain2").listFiles()) { String result1 = Files.toString(file, Charsets.UTF_8); String result2 = Files.toString( new File("../querydsl-jpa/target/generated-test-sources/java/com/mysema/query/jpa/domain2", file.getName()), Charsets.UTF_8); if (!result1.equals(result2)) { System.err.println(file.getName()); failures.add(file.getName()); } } if (!failures.isEmpty()) { fail("Failed with " + failures.size() + " failures"); } }
From source file:com.mysema.query.jpa.codegen.HibernateDomainExporterTest.java
License:Apache License
@Test public void Execute_Store() throws IOException { FileUtils.delete(new File("target/gen5")); File contact = new File("src/test/resources/store.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);/*from w w w. j a v a2 s .co m*/ HibernateDomainExporter exporter = new HibernateDomainExporter("Q", new File("target/gen5"), config); exporter.execute(); File targetFile = new File("target/gen5/com/mysema/query/jpa/domain3/QStore.java"); assertContains(targetFile, "StringPath code", "StringPath address"); targetFile = new File("target/gen5/com/mysema/query/jpa/domain3/QHardwareStore.java"); assertContains(targetFile, "StringPath code = _super.code;", "StringPath address"); }
From source file:com.mysema.query.jpa.codegen.JPADomainExporterTest.java
License:Apache License
@Test @Ignore // FIXME/*from www . j av a 2s. co m*/ public void Execute_MyEntity() throws IOException { FileUtils.delete(new File("target/jpagen6")); File myEntity = new File("src/test/resources/entity.hbm.xml"); Configuration config = new Configuration(); config.addFile(myEntity); JPADomainExporter exporter = new JPADomainExporter("Q", new File("target/jpagen6"), convert(config)); exporter.execute(); File targetFile = new File("target/jpagen6/com/mysema/query/jpa/codegen/QMyEntity.java"); assertContains(targetFile, "StringPath pk1", "StringPath pk2", "StringPath prop1"); }
From source file:com.mysema.query.jpa.codegen.JPADomainExporterTest.java
License:Apache License
@Test public void Execute_Contact() throws IOException { FileUtils.delete(new File("target/jpagen1")); File contact = new File("src/test/resources/contact.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);/*w ww.ja v a2s. c o m*/ JPADomainExporter exporter = new JPADomainExporter("Q", new File("target/jpagen1"), convert(config)); exporter.execute(); File targetFile = new File("target/jpagen1/com/mysema/query/jpa/domain2/QContact.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }
From source file:com.mysema.query.jpa.codegen.JPADomainExporterTest.java
License:Apache License
@Test public void Execute_Contact_with_Suffix() throws IOException { FileUtils.delete(new File("target/jpagen1")); File contact = new File("src/test/resources/contact.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);//from ww w . j av a 2s .com JPADomainExporter exporter = new JPADomainExporter("", "Type", new File("target/jpagen1"), convert(config)); exporter.execute(); File targetFile = new File("target/jpagen1/com/mysema/query/jpa/domain2/ContactType.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }
From source file:com.mysema.query.jpa.codegen.JPADomainExporterTest.java
License:Apache License
@Test public void Execute_Contact2() throws IOException { FileUtils.delete(new File("target/jpagen2")); File contact = new File("src/test/resources/contact2.hbm.xml"); Configuration config = new Configuration(); config.addFile(contact);/*from w ww . j a va 2s. co m*/ JPADomainExporter exporter = new JPADomainExporter("Q", new File("target/jpagen2"), convert(config)); exporter.execute(); File targetFile = new File("target/jpagen2/com/mysema/query/jpa/domain2/QContact.java"); assertContains(targetFile, "StringPath email", "StringPath firstName", "NumberPath<Long> id", "StringPath lastName"); }