mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-24 21:07:26 +08:00
#256 added test
This commit is contained in:
parent
7adac10d9e
commit
2fd82e71d1
@ -1,5 +1,7 @@
|
||||
package com.mysema.query.jpa.domain13;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -19,6 +21,8 @@ public class DomainExporterTest {
|
||||
config.addFile(new File("src/test/resources/com/mysema/query/jpa/domain13/domain.hbm.xml"));
|
||||
HibernateDomainExporter exporter = new HibernateDomainExporter("Q", gen, config);
|
||||
exporter.execute();
|
||||
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain13/QEntity.java").exists());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.mysema.query.jpa.domain14;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.jpa.codegen.HibernateDomainExporter;
|
||||
import com.mysema.util.FileUtils;
|
||||
|
||||
public class DomainExporterTest {
|
||||
|
||||
@Test
|
||||
public void Execute() throws IOException {
|
||||
File gen = new File("target/" + getClass().getSimpleName());
|
||||
FileUtils.delete(gen);
|
||||
Configuration config = new Configuration();
|
||||
config.addFile(new File("src/test/resources/com/mysema/query/jpa/domain14/domain.hbm.xml"));
|
||||
HibernateDomainExporter exporter = new HibernateDomainExporter("Q", gen, config);
|
||||
exporter.execute();
|
||||
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain14/QSiCZuCapiRechtMapping.java").exists());
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain14/QMappingID.java").exists());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.mysema.query.jpa.domain14;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MappingID implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4623004134095871109L;
|
||||
private short systemID;
|
||||
|
||||
private int capiID;
|
||||
|
||||
public MappingID() {
|
||||
// Default-Konstruktor wird vom Hinernate Criteria-API verwendet
|
||||
}
|
||||
|
||||
public MappingID(short systemID, int capiID) {
|
||||
this.capiID = capiID;
|
||||
this.systemID = systemID;
|
||||
}
|
||||
|
||||
public short getSystemID() {
|
||||
return systemID;
|
||||
}
|
||||
|
||||
public int getCapiID() {
|
||||
return capiID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.mysema.query.jpa.domain14;
|
||||
|
||||
public abstract class SiCZuCapiRechtMapping {
|
||||
|
||||
private MappingID id;
|
||||
|
||||
public void setId(MappingID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getSystemID() {
|
||||
return id.getSystemID();
|
||||
}
|
||||
|
||||
public int getCapiPID() {
|
||||
return id.getCapiID();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package com.mysema.query.jpa.domain7;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -19,6 +21,10 @@ public class DomainExporterTest {
|
||||
config.addFile(new File("src/test/resources/com/mysema/query/jpa/domain7/domain.hbm.xml"));
|
||||
HibernateDomainExporter exporter = new HibernateDomainExporter("Q", gen, config);
|
||||
exporter.execute();
|
||||
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain7/QA.java").exists());
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain7/QB.java").exists());
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain7/QC.java").exists());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.mysema.query.jpa.domain8;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -19,6 +21,9 @@ public class DomainExporterTest {
|
||||
config.addFile(new File("src/test/resources/com/mysema/query/jpa/domain8/domain.hbm.xml"));
|
||||
HibernateDomainExporter exporter = new HibernateDomainExporter("Q", gen, config);
|
||||
exporter.execute();
|
||||
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain8/QA.java").exists());
|
||||
assertTrue(new File(gen, "com/mysema/query/jpa/domain8/QB.java").exists());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC
|
||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping package="com.mysema.query.jpa.domain14" default-access="field">
|
||||
|
||||
<class name="SiCZuCapiRechtMapping">
|
||||
|
||||
<composite-id name="id" class="MappingID">
|
||||
<key-property name="capiID"/>
|
||||
<key-property name="systemID"/>
|
||||
</composite-id>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
Loading…
Reference in New Issue
Block a user