METAGEN-101 Adding checkstyle plugin and making some style fixes (not 100% Hibernate ORM compatible yet)
|
@ -4,6 +4,7 @@ apply plugin: 'maven'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'maven-publish-auth'
|
apply plugin: 'maven-publish-auth'
|
||||||
apply plugin: 'jdocbook'
|
apply plugin: 'jdocbook'
|
||||||
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = '1.7'
|
gradleVersion = '1.7'
|
||||||
|
@ -158,6 +159,13 @@ test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkstyle {
|
||||||
|
configFile = rootProject.file( 'src/config/checkstyle/checkstyle.xml' )
|
||||||
|
showViolations = true
|
||||||
|
ignoreFailures = true
|
||||||
|
}
|
||||||
|
checkstyleMain.exclude '**/jaxb/**'
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Javadocs
|
// Javadocs
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -173,7 +181,7 @@ task javadocs(type: Javadoc) {
|
||||||
classpath = files( configurations.compile, "${buildDir}/classes/main" )
|
classpath = files( configurations.compile, "${buildDir}/classes/main" )
|
||||||
maxMemory = '512m'
|
maxMemory = '512m'
|
||||||
configure( options ) {
|
configure( options ) {
|
||||||
stylesheetFile = rootProject.file( 'src/main/javadoc/stylesheet.css' )
|
stylesheetFile = rootProject.file( 'src/config/javadoc/stylesheet.css' )
|
||||||
windowTitle = 'Hibernate JPA 2 Metamodel Generator JavaDocs'
|
windowTitle = 'Hibernate JPA 2 Metamodel Generator JavaDocs'
|
||||||
docTitle = "Hibernate JPA 2 Metamodel Generator JavaDocs ($project.version)"
|
docTitle = "Hibernate JPA 2 Metamodel Generator JavaDocs ($project.version)"
|
||||||
bottom = "Copyright © 2001-$copyrightYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
bottom = "Copyright © 2001-$copyrightYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
||||||
|
@ -183,7 +191,7 @@ task javadocs(type: Javadoc) {
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
copy {
|
copy {
|
||||||
from rootProject.file( 'src/main/javadoc/images' )
|
from rootProject.file( 'src/config/javadoc/images' )
|
||||||
into new File( javadocDir, "/images" )
|
into new File( javadocDir, "/images" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,21 +306,19 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// Artifact deploy
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: compileJava) {
|
task sourcesJar(type: Jar, dependsOn: compileJava) {
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives.dependsOn sourcesJar
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// Release
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
~
|
||||||
|
~ Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||||
|
~ indicated by the @author tags or express copyright attribution
|
||||||
|
~ statements applied by the authors. All third-party contributions are
|
||||||
|
~ distributed under license by Red Hat Inc.
|
||||||
|
~
|
||||||
|
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
~
|
||||||
|
~ This program is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
~ for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU Lesser General Public License
|
||||||
|
~ along with this distribution; if not, write to:
|
||||||
|
~ Free Software Foundation, Inc.
|
||||||
|
~ 51 Franklin Street, Fifth Floor
|
||||||
|
~ Boston, MA 02110-1301 USA
|
||||||
|
-->
|
||||||
|
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
||||||
|
<module name="Checker">
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
General regex checks as part of the TreeWalker
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="ignoreComments" value="true" />
|
||||||
|
<property name="format" value="^\t* +\t*\S" />
|
||||||
|
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only." />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Annotation checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_annotation.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="MissingDeprecated" />
|
||||||
|
<module name="MissingOverride" />
|
||||||
|
<module name="PackageAnnotation" />
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Block checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_blocks.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="AvoidNestedBlocks">
|
||||||
|
<property name="allowInSwitchCase" value="true" />
|
||||||
|
<property name="severity" value="warning" />
|
||||||
|
</module>
|
||||||
|
<module name="NeedBraces" />
|
||||||
|
<module name="LeftCurly">
|
||||||
|
<property name="option" value="eol" />
|
||||||
|
</module>
|
||||||
|
<module name="RightCurly">
|
||||||
|
<property name="option" value="alone" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Design checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_design.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="HideUtilityClassConstructor" />
|
||||||
|
<module name="MutableException" />
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Coding checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_coding.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="EmptyStatement" />
|
||||||
|
<module name="EqualsHashCode" />
|
||||||
|
<module name="MissingSwitchDefault" />
|
||||||
|
<module name="SimplifyBooleanExpression" />
|
||||||
|
<module name="SimplifyBooleanReturn" />
|
||||||
|
<module name="StringLiteralEquality" />
|
||||||
|
<module name="NoFinalizer" />
|
||||||
|
<module name="ExplicitInitialization" />
|
||||||
|
<module name="MissingSwitchDefault" />
|
||||||
|
<module name="DefaultComesLast" />
|
||||||
|
<module name="FallThrough" />
|
||||||
|
<module name="OneStatementPerLine" />
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Import checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_imports.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="AvoidStarImport" />
|
||||||
|
<module name="RedundantImport" />
|
||||||
|
<module name="UnusedImports" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Misc checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_misc.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="UpperEll" />
|
||||||
|
<module name="ArrayTypeStyle" />
|
||||||
|
<module name="TrailingComment">
|
||||||
|
<property name="severity" value="warning" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Modifier checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_modifier.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="ModifierOrder"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Naming checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_naming.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="AbstractClassName">
|
||||||
|
<!-- we are just using this to make sure that classes matching the pattern (Abstract*) have the abstract modifier -->
|
||||||
|
<property name="format" value="^Abstract.*$" />
|
||||||
|
<property name="ignoreName" value="true" />
|
||||||
|
</module>
|
||||||
|
<module name="ConstantName">
|
||||||
|
<property name="format" value="^[A-Z](_?[A-Z0-9]+)*$|log" />
|
||||||
|
</module>
|
||||||
|
<module name="LocalFinalVariableName" />
|
||||||
|
<module name="LocalVariableName" />
|
||||||
|
<module name="MemberName" />
|
||||||
|
<!--
|
||||||
|
The org.hibernate.engine.spi.ManagedEntity method names (prefixed with '&&_') muck with this
|
||||||
|
<module name="MethodName" />
|
||||||
|
-->
|
||||||
|
<module name="MethodTypeParameterName" />
|
||||||
|
<module name="PackageName" />
|
||||||
|
<module name="ParameterName" />
|
||||||
|
<module name="StaticVariableName" />
|
||||||
|
<module name="TypeName" />
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Whitespace checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_whitespace.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="MethodParamPad" />
|
||||||
|
<module name="TypecastParenPad" />
|
||||||
|
<module name="ParenPad">
|
||||||
|
<property name="tokens" value="CTOR_CALL, METHOD_CALL, SUPER_CTOR_CALL" />
|
||||||
|
<property name="option" value="space" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Misc checks
|
||||||
|
|
||||||
|
See http://checkstyle.sourceforge.net/config_misc.html
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
-->
|
||||||
|
<module name="NewlineAtEndOfFile" />
|
||||||
|
|
||||||
|
</module>
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -64,7 +64,7 @@ public final class Context {
|
||||||
* Whether all mapping files are xml-mapping-metadata-complete. In this case no annotation processing will take
|
* Whether all mapping files are xml-mapping-metadata-complete. In this case no annotation processing will take
|
||||||
* place.
|
* place.
|
||||||
*/
|
*/
|
||||||
private Boolean fullyXmlConfigured = null;
|
private Boolean fullyXmlConfigured;
|
||||||
private boolean addGeneratedAnnotation = true;
|
private boolean addGeneratedAnnotation = true;
|
||||||
private boolean addGenerationDate;
|
private boolean addGenerationDate;
|
||||||
private boolean addSuppressWarningsAnnotation;
|
private boolean addSuppressWarningsAnnotation;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ImportContextImpl implements ImportContext {
|
||||||
|
|
||||||
private String basePackage = "";
|
private String basePackage = "";
|
||||||
|
|
||||||
private static String LINE_SEPARATOR = System.getProperty( "line.separator" );
|
private static final String LINE_SEPARATOR = System.getProperty( "line.separator" );
|
||||||
private static final Map<String, String> PRIMITIVES = new HashMap<String, String>();
|
private static final Map<String, String> PRIMITIVES = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -110,7 +110,7 @@ public class ImportContextImpl implements ImportContext {
|
||||||
|
|
||||||
|
|
||||||
if ( inSamePackage( fqcn ) || ( imports.contains( pureFqcn ) && canBeSimple ) ) {
|
if ( inSamePackage( fqcn ) || ( imports.contains( pureFqcn ) && canBeSimple ) ) {
|
||||||
result = unqualify( result ); // de-qualify
|
result = unqualify( result );
|
||||||
}
|
}
|
||||||
else if ( inJavaLang( fqcn ) ) {
|
else if ( inJavaLang( fqcn ) ) {
|
||||||
result = result.substring( "java.lang.".length() );
|
result = result.substring( "java.lang.".length() );
|
||||||
|
|
|
@ -80,7 +80,7 @@ public abstract class AnnotationMetaAttribute implements MetaAttribute {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public String getMetaType();
|
public abstract String getMetaType();
|
||||||
|
|
||||||
public String getTypeDeclaration() {
|
public String getTypeDeclaration() {
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -28,13 +28,16 @@ public class AnnotationMetaMap extends AnnotationMetaCollection {
|
||||||
private final String keyType;
|
private final String keyType;
|
||||||
|
|
||||||
public AnnotationMetaMap(AnnotationMetaEntity parent, Element element, String collectionType,
|
public AnnotationMetaMap(AnnotationMetaEntity parent, Element element, String collectionType,
|
||||||
String keyType, String elementType) {
|
String keyType, String elementType) {
|
||||||
super( parent, element, collectionType, elementType );
|
super( parent, element, collectionType, elementType );
|
||||||
this.keyType = keyType;
|
this.keyType = keyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeclarationString() {
|
public String getDeclarationString() {
|
||||||
return "public static volatile " + getHostingEntity().importType( getMetaType() ) + "<" + getHostingEntity().importType( getHostingEntity().getQualifiedName() ) + ", " + getHostingEntity()
|
return "public static volatile " + getHostingEntity().importType( getMetaType() )
|
||||||
.importType( keyType ) + ", " + getHostingEntity().importType( getTypeDeclaration() ) + "> " + getPropertyName() + ";";
|
+ "<" + getHostingEntity().importType( getHostingEntity().getQualifiedName() )
|
||||||
|
+ ", " + getHostingEntity().importType( keyType ) + ", "
|
||||||
|
+ getHostingEntity().importType( getTypeDeclaration() ) + "> "
|
||||||
|
+ getPropertyName() + ";";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class Constants {
|
||||||
public static final String ELEMENT_COLLECTION = "javax.persistence.ElementCollection";
|
public static final String ELEMENT_COLLECTION = "javax.persistence.ElementCollection";
|
||||||
public static final String ACCESS = "javax.persistence.Access";
|
public static final String ACCESS = "javax.persistence.Access";
|
||||||
|
|
||||||
public static Map<String, String> COLLECTIONS = new HashMap<String, String>();
|
public static final Map<String, String> COLLECTIONS = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
COLLECTIONS.put( java.util.Collection.class.getName(), "javax.persistence.metamodel.CollectionAttribute" );
|
COLLECTIONS.put( java.util.Collection.class.getName(), "javax.persistence.metamodel.CollectionAttribute" );
|
||||||
|
@ -54,7 +54,7 @@ public final class Constants {
|
||||||
COLLECTIONS.put( java.util.SortedMap.class.getName(), "javax.persistence.metamodel.MapAttribute" );
|
COLLECTIONS.put( java.util.SortedMap.class.getName(), "javax.persistence.metamodel.MapAttribute" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> BASIC_TYPES = new ArrayList<String>();
|
public static final List<String> BASIC_TYPES = new ArrayList<String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BASIC_TYPES.add( java.lang.String.class.getName() );
|
BASIC_TYPES.add( java.lang.String.class.getName() );
|
||||||
|
@ -76,7 +76,7 @@ public final class Constants {
|
||||||
BASIC_TYPES.add( java.sql.Blob.class.getName() );
|
BASIC_TYPES.add( java.sql.Blob.class.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> BASIC_ARRAY_TYPES = new ArrayList<String>();
|
public static final List<String> BASIC_ARRAY_TYPES = new ArrayList<String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BASIC_ARRAY_TYPES.add( java.lang.Character.class.getName() );
|
BASIC_ARRAY_TYPES.add( java.lang.Character.class.getName() );
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class FileTimeStampChecker implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTimeStampChecker that = ( FileTimeStampChecker ) o;
|
FileTimeStampChecker that = (FileTimeStampChecker) o;
|
||||||
|
|
||||||
if ( !lastModifiedCache.equals( that.lastModifiedCache ) ) {
|
if ( !lastModifiedCache.equals( that.lastModifiedCache ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -55,9 +55,9 @@ public class XmlParserHelper {
|
||||||
*/
|
*/
|
||||||
private static final int NUMBER_OF_SCHEMAS = 4;
|
private static final int NUMBER_OF_SCHEMAS = 4;
|
||||||
|
|
||||||
private static final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
|
private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
|
||||||
|
|
||||||
private static final ConcurrentMap<String, Schema> schemaCache = new ConcurrentHashMap<String, Schema>(
|
private static final ConcurrentMap<String, Schema> SCHEMA_CACHE = new ConcurrentHashMap<String, Schema>(
|
||||||
NUMBER_OF_SCHEMAS
|
NUMBER_OF_SCHEMAS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -102,14 +102,14 @@ public class XmlParserHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Schema getSchema(String schemaResource) throws XmlParsingException {
|
public Schema getSchema(String schemaResource) throws XmlParsingException {
|
||||||
Schema schema = schemaCache.get( schemaResource );
|
Schema schema = SCHEMA_CACHE.get( schemaResource );
|
||||||
|
|
||||||
if ( schema != null ) {
|
if ( schema != null ) {
|
||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
schema = loadSchema( schemaResource );
|
schema = loadSchema( schemaResource );
|
||||||
Schema previous = schemaCache.putIfAbsent( schemaResource, schema );
|
Schema previous = SCHEMA_CACHE.putIfAbsent( schemaResource, schema );
|
||||||
|
|
||||||
return previous != null ? previous : schema;
|
return previous != null ? previous : schema;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class XmlParserHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized XMLEventReader createXmlEventReader(InputStream xmlStream) throws XMLStreamException {
|
private synchronized XMLEventReader createXmlEventReader(InputStream xmlStream) throws XMLStreamException {
|
||||||
return xmlInputFactory.createXMLEventReader( xmlStream );
|
return XML_INPUT_FACTORY.createXMLEventReader( xmlStream );
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPackage(String resourceName) {
|
private String getPackage(String resourceName) {
|
||||||
|
|
|
@ -450,6 +450,8 @@ public class JpaDescriptorParser {
|
||||||
case PROPERTY: {
|
case PROPERTY: {
|
||||||
return AccessType.PROPERTY;
|
return AccessType.PROPERTY;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public abstract class XmlMetaAttribute implements MetaAttribute {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
abstract public String getMetaType();
|
public abstract String getMetaType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -23,14 +23,14 @@ import org.hibernate.jpamodelgen.model.MetaCollection;
|
||||||
*/
|
*/
|
||||||
public class XmlMetaCollection extends XmlMetaAttribute implements MetaCollection {
|
public class XmlMetaCollection extends XmlMetaAttribute implements MetaCollection {
|
||||||
|
|
||||||
private String collectionType;
|
private String collectionType;
|
||||||
|
|
||||||
public XmlMetaCollection(XmlMetaEntity parent, String propertyName, String type, String collectionType) {
|
public XmlMetaCollection(XmlMetaEntity parent, String propertyName, String type, String collectionType) {
|
||||||
super(parent, propertyName, type);
|
super( parent, propertyName, type );
|
||||||
this.collectionType = collectionType;
|
this.collectionType = collectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMetaType() {
|
public String getMetaType() {
|
||||||
return collectionType;
|
return collectionType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ import org.hibernate.jpamodelgen.xml.jaxb.OneToOne;
|
||||||
*/
|
*/
|
||||||
public class XmlMetaEntity implements MetaEntity {
|
public class XmlMetaEntity implements MetaEntity {
|
||||||
|
|
||||||
static Map<String, String> COLLECTIONS = new HashMap<String, String>();
|
static final Map<String, String> COLLECTIONS = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
COLLECTIONS.put( "java.util.Collection", "javax.persistence.metamodel.CollectionAttribute" );
|
COLLECTIONS.put( "java.util.Collection", "javax.persistence.metamodel.CollectionAttribute" );
|
||||||
|
@ -354,6 +354,8 @@ public class XmlMetaEntity implements MetaEntity {
|
||||||
case TYPEVAR: {
|
case TYPEVAR: {
|
||||||
return mirror.toString();
|
return mirror.toString();
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@ import org.hibernate.jpamodelgen.model.MetaSingleAttribute;
|
||||||
*/
|
*/
|
||||||
public class XmlMetaSingleAttribute extends XmlMetaAttribute implements MetaSingleAttribute {
|
public class XmlMetaSingleAttribute extends XmlMetaAttribute implements MetaSingleAttribute {
|
||||||
|
|
||||||
public XmlMetaSingleAttribute(XmlMetaEntity parent, String propertyName, String type) {
|
public XmlMetaSingleAttribute(XmlMetaEntity parent, String propertyName, String type) {
|
||||||
super(parent, propertyName, type);
|
super( parent, propertyName, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMetaType() {
|
public String getMetaType() {
|
||||||
return "javax.persistence.metamodel.SingularAttribute";
|
return "javax.persistence.metamodel.SingularAttribute";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,6 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.accesstype.Product;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Max Andersen
|
* @author Max Andersen
|
||||||
|
@ -34,49 +32,49 @@ import org.hibernate.jpamodelgen.test.accesstype.Product;
|
||||||
@Entity
|
@Entity
|
||||||
public class Item {
|
public class Item {
|
||||||
|
|
||||||
long _id;
|
long id;
|
||||||
|
|
||||||
int _quantity;
|
int quantity;
|
||||||
|
|
||||||
Product _product;
|
Product product;
|
||||||
|
|
||||||
Order _order;
|
Order order;
|
||||||
|
|
||||||
Detail detail;
|
Detail detail;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return _id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this._id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getQuantity() {
|
public int getQuantity() {
|
||||||
return _quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuantity(int quantity) {
|
public void setQuantity(int quantity) {
|
||||||
this._quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
public Product getProduct() {
|
public Product getProduct() {
|
||||||
return _product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProduct(Product product) {
|
public void setProduct(Product product) {
|
||||||
this._product = product;
|
this.product = product;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
public Order getOrder() {
|
public Order getOrder() {
|
||||||
return _order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrder(Order order) {
|
public void setOrder(Order order) {
|
||||||
this._order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany
|
@OneToMany
|
||||||
|
|
|
@ -18,17 +18,12 @@ package org.hibernate.jpamodelgen.test.accesstype;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.accesstype.Item;
|
|
||||||
import org.hibernate.jpamodelgen.test.accesstype.Shop;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Max Andersen
|
* @author Max Andersen
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
|
@ -42,7 +37,7 @@ public class Product {
|
||||||
@Id
|
@Id
|
||||||
long id;
|
long id;
|
||||||
|
|
||||||
int test;
|
int test;
|
||||||
|
|
||||||
String description;
|
String description;
|
||||||
BigDecimal price;
|
BigDecimal price;
|
||||||
|
|
|
@ -20,7 +20,6 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Max Andersen
|
* @author Max Andersen
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
|
@ -32,3 +31,4 @@ public class Shop {
|
||||||
String name;
|
String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,6 @@ import javax.persistence.MappedSuperclass;
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public class Base {
|
public class Base {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
protected String uuid;
|
protected String uuid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,6 @@ import javax.persistence.Entity;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class MyEntity extends Base {
|
public class MyEntity extends Base {
|
||||||
@Embedded
|
@Embedded
|
||||||
private EmbeddableEntity emb;
|
private EmbeddableEntity emb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.io.Serializable;
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class AbstractRef implements Serializable {
|
public abstract class AbstractRef implements Serializable {
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
protected AbstractRef() {
|
protected AbstractRef() {
|
||||||
|
|
|
@ -19,11 +19,10 @@ package org.hibernate.jpamodelgen.test.generatedannotation;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor;
|
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor;
|
||||||
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
||||||
import org.hibernate.jpamodelgen.test.util.TestForIssue;
|
import org.hibernate.jpamodelgen.test.util.TestForIssue;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.getMetaModelSourceAsString;
|
import static org.hibernate.jpamodelgen.test.util.TestUtil.getMetaModelSourceAsString;
|
||||||
|
|
|
@ -29,3 +29,4 @@ public class TestEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.jpamodelgen.test.hashcode;
|
package org.hibernate.jpamodelgen.test.hashcode;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
||||||
import org.hibernate.jpamodelgen.test.util.TestForIssue;
|
import org.hibernate.jpamodelgen.test.util.TestForIssue;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertAbsenceOfFieldInMetamodelFor;
|
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertAbsenceOfFieldInMetamodelFor;
|
||||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
||||||
|
|
|
@ -59,3 +59,4 @@ public class InheritanceTest extends CompilationTest {
|
||||||
return InheritanceTest.class.getPackage().getName();
|
return InheritanceTest.class.getPackage().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import javax.persistence.MappedSuperclass;
|
||||||
@Embeddable
|
@Embeddable
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public class EmbeddableAndMappedSuperClass {
|
public class EmbeddableAndMappedSuperClass {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,4 @@ public class Shop {
|
||||||
String name;
|
String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,3 +39,4 @@ public class Car extends Vehicle {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ import javax.persistence.Embeddable;
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public class Coordinates {
|
public class Coordinates {
|
||||||
public float longitude;
|
public float longitude;
|
||||||
public float latitude;
|
public float latitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,3 +44,4 @@ public class Insurance {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,3 +70,4 @@ public class Location {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,4 @@ public class Vehicle {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,3 +67,4 @@ public class EmployeeWithRawType implements java.io.Serializable {
|
||||||
this.desks = desks;
|
this.desks = desks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,4 @@ public class TestEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ public abstract class CompilationTest {
|
||||||
private static final String ANNOTATION_PROCESSOR_OPTION_PREFIX = "-A";
|
private static final String ANNOTATION_PROCESSOR_OPTION_PREFIX = "-A";
|
||||||
private static final String SOURCE_BASE_DIR_PROPERTY = "sourceBaseDir";
|
private static final String SOURCE_BASE_DIR_PROPERTY = "sourceBaseDir";
|
||||||
private static final String OUT_BASE_DIR_PROPERTY = "outBaseDir";
|
private static final String OUT_BASE_DIR_PROPERTY = "outBaseDir";
|
||||||
private static final String sourceBaseDir;
|
private static final String SOURCE_BASE_DIR;
|
||||||
private static final String outBaseDir;
|
private static final String OUT_BASE_DIR;
|
||||||
|
|
||||||
public static final String DIRECTORY_SEPARATOR = File.separator;
|
public static final String DIRECTORY_SEPARATOR = File.separator;
|
||||||
|
|
||||||
|
@ -61,13 +61,13 @@ public abstract class CompilationTest {
|
||||||
if ( tmp == null ) {
|
if ( tmp == null ) {
|
||||||
fail( "The system property sourceBaseDir has to be set and point to the base directory of the test java sources." );
|
fail( "The system property sourceBaseDir has to be set and point to the base directory of the test java sources." );
|
||||||
}
|
}
|
||||||
sourceBaseDir = tmp;
|
SOURCE_BASE_DIR = tmp;
|
||||||
|
|
||||||
tmp = System.getProperty( OUT_BASE_DIR_PROPERTY );
|
tmp = System.getProperty( OUT_BASE_DIR_PROPERTY );
|
||||||
if ( tmp == null ) {
|
if ( tmp == null ) {
|
||||||
fail( "The system property outBaseDir has to be set and point to the base directory of the test output directory." );
|
fail( "The system property outBaseDir has to be set and point to the base directory of the test output directory." );
|
||||||
}
|
}
|
||||||
outBaseDir = tmp;
|
OUT_BASE_DIR = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompilationTest() {
|
public CompilationTest() {
|
||||||
|
@ -79,14 +79,14 @@ public abstract class CompilationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSourceBaseDir() {
|
public static String getSourceBaseDir() {
|
||||||
return sourceBaseDir;
|
return SOURCE_BASE_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
protected void compileAllTestEntities() throws Exception {
|
protected void compileAllTestEntities() throws Exception {
|
||||||
List<File> sourceFiles = getCompilationUnits( sourceBaseDir, getPackageNameOfCurrentTest() );
|
List<File> sourceFiles = getCompilationUnits( SOURCE_BASE_DIR, getPackageNameOfCurrentTest() );
|
||||||
// make sure there are no relics from previous runs
|
// make sure there are no relics from previous runs
|
||||||
TestUtil.deleteGeneratedSourceFiles( new File( outBaseDir ) );
|
TestUtil.deleteGeneratedSourceFiles( new File( OUT_BASE_DIR ) );
|
||||||
compile( sourceFiles );
|
compile( sourceFiles );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public abstract class CompilationTest {
|
||||||
return javaFiles;
|
return javaFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected String getPackageNameOfCurrentTest();
|
protected abstract String getPackageNameOfCurrentTest();
|
||||||
|
|
||||||
protected Map<String, String> getProcessorOptions() {
|
protected Map<String, String> getProcessorOptions() {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
|
@ -157,7 +157,7 @@ public abstract class CompilationTest {
|
||||||
private List<String> createJavaOptions() {
|
private List<String> createJavaOptions() {
|
||||||
List<String> options = new ArrayList<String>();
|
List<String> options = new ArrayList<String>();
|
||||||
options.add( "-d" );
|
options.add( "-d" );
|
||||||
options.add( outBaseDir );
|
options.add( OUT_BASE_DIR );
|
||||||
|
|
||||||
// pass orm files if specified
|
// pass orm files if specified
|
||||||
if ( !getOrmFiles().isEmpty() ) {
|
if ( !getOrmFiles().isEmpty() ) {
|
||||||
|
|
|
@ -46,14 +46,14 @@ public class TestUtil {
|
||||||
private static final String PATH_SEPARATOR = System.getProperty( "file.separator" );
|
private static final String PATH_SEPARATOR = System.getProperty( "file.separator" );
|
||||||
private static final String PACKAGE_SEPARATOR = ".";
|
private static final String PACKAGE_SEPARATOR = ".";
|
||||||
private static final String META_MODEL_CLASS_POSTFIX = "_";
|
private static final String META_MODEL_CLASS_POSTFIX = "_";
|
||||||
private static final String outBaseDir;
|
private static final String OUT_BASE_DIR;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String tmp = System.getProperty( "outBaseDir" );
|
String tmp = System.getProperty( "outBaseDir" );
|
||||||
if ( tmp == null ) {
|
if ( tmp == null ) {
|
||||||
fail( "The system property outBaseDir has to be set and point to the base directory of the test output directory." );
|
fail( "The system property outBaseDir has to be set and point to the base directory of the test output directory." );
|
||||||
}
|
}
|
||||||
outBaseDir = tmp;
|
OUT_BASE_DIR = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestUtil() {
|
private TestUtil() {
|
||||||
|
@ -112,7 +112,7 @@ public class TestUtil {
|
||||||
// generate the file name
|
// generate the file name
|
||||||
String fileName = metaModelClassName.replace( PACKAGE_SEPARATOR, PATH_SEPARATOR );
|
String fileName = metaModelClassName.replace( PACKAGE_SEPARATOR, PATH_SEPARATOR );
|
||||||
fileName = fileName.concat( ".java" );
|
fileName = fileName.concat( ".java" );
|
||||||
return new File( outBaseDir + PATH_SEPARATOR + fileName );
|
return new File( OUT_BASE_DIR + PATH_SEPARATOR + fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMetaModelSourceAsString(Class<?> clazz) {
|
public static String getMetaModelSourceAsString(Class<?> clazz) {
|
||||||
|
@ -122,7 +122,7 @@ public class TestUtil {
|
||||||
try {
|
try {
|
||||||
BufferedReader input = new BufferedReader( new FileReader( sourceFile ) );
|
BufferedReader input = new BufferedReader( new FileReader( sourceFile ) );
|
||||||
try {
|
try {
|
||||||
String line = null; //not declared within while loop
|
String line = null;
|
||||||
/*
|
/*
|
||||||
* readLine is a bit quirky :
|
* readLine is a bit quirky :
|
||||||
* it returns the content of a line MINUS the newline.
|
* it returns the content of a line MINUS the newline.
|
||||||
|
@ -281,7 +281,7 @@ public class TestUtil {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fail( "Unexpected component type" );
|
fail( "Unexpected component type" );
|
||||||
return null; // making the compiler happy
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,4 @@ public abstract class BusinessEntity<T extends Serializable> implements Serializ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,3 +84,4 @@ public class Boy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.jpamodelgen.test.xmlmapped;
|
package org.hibernate.jpamodelgen.test.xmlmapped;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.test.accesstype.*;
|
|
||||||
import org.hibernate.jpamodelgen.test.accesstype.Address;
|
import org.hibernate.jpamodelgen.test.accesstype.Address;
|
||||||
|
import org.hibernate.jpamodelgen.test.accesstype.Area;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
|
|
|
@ -30,7 +30,8 @@ import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassG
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class IgnoreInvalidXmlTest extends CompilationTest {
|
public class
|
||||||
|
IgnoreInvalidXmlTest extends CompilationTest {
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidXmlFilesGetIgnored() {
|
public void testInvalidXmlFilesGetIgnored() {
|
||||||
// this is only a indirect test, but if the invalid xml files would cause the processor to abort the
|
// this is only a indirect test, but if the invalid xml files would cause the processor to abort the
|
||||||
|
|
|
@ -59,3 +59,4 @@ public class Superhero {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,3 +35,4 @@ public class Dummy {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,3 +57,4 @@ public class XmlMetaDataCompleteMultiplePersistenceUnitsTest extends Compilation
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,3 +35,4 @@ public class Dummy {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,4 @@ public class Car {
|
||||||
public void setTires(Set<Tire> tires) {
|
public void setTires(Set<Tire> tires) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.hibernate.jpamodelgen.test.xmlonly;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Course {
|
public class Course {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String name;
|
private String name;
|
||||||
private Set<Teacher> qualifiedTeachers;
|
private Set<Teacher> qualifiedTeachers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,3 +20,4 @@ public class Option {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Period period;
|
private Period period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,4 @@ public class Period {
|
||||||
private Date start;
|
private Date start;
|
||||||
private Date end;
|
private Date end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.hibernate.jpamodelgen.test.xmlonly;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Teacher {
|
public class Teacher {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Set<Course> qualifiedFor;
|
private Set<Course> qualifiedFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,4 @@ public class Tire {
|
||||||
public void setCar(Car car) {
|
public void setCar(Car car) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,4 @@ public class XmlOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|