METAGEN-92 Some clean-up (comments, headers, unused imports, typos)
This commit is contained in:
parent
fb132b281c
commit
7b8b7ead72
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2013, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
@ -21,6 +21,8 @@ import javax.xml.bind.ValidationEventHandler;
|
||||||
import javax.xml.bind.ValidationEventLocator;
|
import javax.xml.bind.ValidationEventLocator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Validation event handler used for obtaining line and column numbers in case of parsing failures.
|
||||||
|
*
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class ContextProvidingValidationEventHandler implements ValidationEventHandler {
|
public class ContextProvidingValidationEventHandler implements ValidationEventHandler {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2013, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
@ -117,7 +117,7 @@ public class JpaNamespaceTransformingEventReader extends EventReaderDelegate {
|
||||||
|
|
||||||
private List<Namespace> updateElementNamespaces(StartElement startElement) {
|
private List<Namespace> updateElementNamespaces(StartElement startElement) {
|
||||||
List<Namespace> newNamespaceList = new ArrayList<Namespace>();
|
List<Namespace> newNamespaceList = new ArrayList<Namespace>();
|
||||||
Iterator existingNamespaceIterator = startElement.getNamespaces();
|
Iterator<?> existingNamespaceIterator = startElement.getNamespaces();
|
||||||
while ( existingNamespaceIterator.hasNext() ) {
|
while ( existingNamespaceIterator.hasNext() ) {
|
||||||
Namespace namespace = (Namespace) existingNamespaceIterator.next();
|
Namespace namespace = (Namespace) existingNamespaceIterator.next();
|
||||||
if ( NAMESPACE_MAPPING.containsKey( namespace.getNamespaceURI() ) ) {
|
if ( NAMESPACE_MAPPING.containsKey( namespace.getNamespaceURI() ) ) {
|
||||||
|
@ -139,7 +139,7 @@ public class JpaNamespaceTransformingEventReader extends EventReaderDelegate {
|
||||||
private List<Attribute> updateElementAttributes(StartElement startElement) {
|
private List<Attribute> updateElementAttributes(StartElement startElement) {
|
||||||
// adjust the version attribute
|
// adjust the version attribute
|
||||||
List<Attribute> newElementAttributeList = new ArrayList<Attribute>();
|
List<Attribute> newElementAttributeList = new ArrayList<Attribute>();
|
||||||
Iterator existingAttributesIterator = startElement.getAttributes();
|
Iterator<?> existingAttributesIterator = startElement.getAttributes();
|
||||||
while ( existingAttributesIterator.hasNext() ) {
|
while ( existingAttributesIterator.hasNext() ) {
|
||||||
Attribute attribute = (Attribute) existingAttributesIterator.next();
|
Attribute attribute = (Attribute) existingAttributesIterator.next();
|
||||||
if ( VERSION_ATTRIBUTE_NAME.equals( attribute.getName().getLocalPart() ) ) {
|
if ( VERSION_ATTRIBUTE_NAME.equals( attribute.getName().getLocalPart() ) ) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2013, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
@ -38,8 +38,7 @@ import org.hibernate.jpamodelgen.xml.jaxb.ObjectFactory;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides common functionality used within the different XML descriptor
|
* Provides common functionality used for XML parsing.
|
||||||
* parsers.
|
|
||||||
*
|
*
|
||||||
* @author Gunnar Morling
|
* @author Gunnar Morling
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2013, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
|
|
@ -49,6 +49,8 @@ import org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitDefaults;
|
||||||
import org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata;
|
import org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Parser for JPA XML descriptors (persistence.xml and referenced mapping files).
|
||||||
|
*
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class JpaDescriptorParser {
|
public class JpaDescriptorParser {
|
||||||
|
@ -234,7 +236,7 @@ public class JpaDescriptorParser {
|
||||||
if ( !xmlMappedTypeExists( fqcn ) ) {
|
if ( !xmlMappedTypeExists( fqcn ) ) {
|
||||||
context.logMessage(
|
context.logMessage(
|
||||||
Diagnostic.Kind.WARNING,
|
Diagnostic.Kind.WARNING,
|
||||||
fqcn + " is mapped in xml, but class does not exists. Skipping meta model generation."
|
fqcn + " is mapped in xml, but class does not exist. Skipping meta model generation."
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +263,7 @@ public class JpaDescriptorParser {
|
||||||
if ( !xmlMappedTypeExists( fqcn ) ) {
|
if ( !xmlMappedTypeExists( fqcn ) ) {
|
||||||
context.logMessage(
|
context.logMessage(
|
||||||
Diagnostic.Kind.WARNING,
|
Diagnostic.Kind.WARNING,
|
||||||
fqcn + " is mapped in xml, but class does not exists. Skipping meta model generation."
|
fqcn + " is mapped in xml, but class does not exist. Skipping meta model generation."
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +290,7 @@ public class JpaDescriptorParser {
|
||||||
if ( !xmlMappedTypeExists( fqcn ) ) {
|
if ( !xmlMappedTypeExists( fqcn ) ) {
|
||||||
context.logMessage(
|
context.logMessage(
|
||||||
Diagnostic.Kind.WARNING,
|
Diagnostic.Kind.WARNING,
|
||||||
fqcn + " is mapped in xml, but class does not exists. Skipping meta model generation."
|
fqcn + " is mapped in xml, but class does not exist. Skipping meta model generation."
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2010, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
@ -21,30 +21,28 @@ import java.util.Map;
|
||||||
|
|
||||||
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.TestUtil;
|
import org.hibernate.jpamodelgen.test.util.TestUtil;
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Car;
|
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Course;
|
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Option;
|
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Period;
|
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Teacher;
|
|
||||||
import org.hibernate.jpamodelgen.test.xmlonly.Tire;
|
|
||||||
import org.testng.annotations.Test;
|
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.assertPresenceOfFieldInMetamodelFor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Test for parsing JPA 2.1 descriptors.
|
||||||
|
*
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class SnafuTest extends CompilationTest {
|
public class Jpa21DescriptorTest extends CompilationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@TestForIssue( jiraKey = "METAGEN-92" )
|
||||||
public void testMetaModelGeneratedForXmlConfiguredEntity() {
|
public void testMetaModelGeneratedForXmlConfiguredEntity() {
|
||||||
assertMetamodelClassGeneratedFor( Snafu.class );
|
assertMetamodelClassGeneratedFor( Snafu.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getPackageNameOfCurrentTest() {
|
protected String getPackageNameOfCurrentTest() {
|
||||||
return SnafuTest.class.getPackage().getName();
|
return Jpa21DescriptorTest.class.getPackage().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,8 +50,8 @@ public class SnafuTest extends CompilationTest {
|
||||||
Map<String, String> properties = new HashMap<String, String>();
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
properties.put(
|
properties.put(
|
||||||
JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION,
|
JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION,
|
||||||
TestUtil.fcnToPath( SnafuTest.class.getPackage().getName() ) + "/persistence.xml"
|
TestUtil.fcnToPath( Jpa21DescriptorTest.class.getPackage().getName() ) + "/persistence.xml"
|
||||||
);
|
);
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* JBoss, Home of Professional Open Source
|
* JBoss, Home of Professional Open Source
|
||||||
* Copyright 2010, Red Hat Middleware LLC, and individual contributors
|
* Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
* full listing of individual contributors.
|
* full listing of individual contributors.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ JBoss, Home of Professional Open Source
|
~ JBoss, Home of Professional Open Source
|
||||||
~ Copyright 2010, Red Hat Middleware LLC, and individual contributors
|
~ Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
~ by the @authors tag. See the copyright.txt in the distribution for a
|
~ by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
~ full listing of individual contributors.
|
~ full listing of individual contributors.
|
||||||
~
|
~
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
~ JBoss, Home of Professional Open Source
|
~ JBoss, Home of Professional Open Source
|
||||||
~ Copyright 2010, Red Hat Middleware LLC, and individual contributors
|
~ Copyright 2013, Red Hat, Inc. and individual contributors
|
||||||
~ by the @authors tag. See the copyright.txt in the distribution for a
|
~ by the @authors tag. See the copyright.txt in the distribution for a
|
||||||
~ full listing of individual contributors.
|
~ full listing of individual contributors.
|
||||||
~
|
~
|
||||||
|
|
Loading…
Reference in New Issue