METAGEN-92 Some clean-up (comments, headers, unused imports, typos)

This commit is contained in:
Gunnar Morling 2013-08-08 10:16:02 +02:00 committed by Strong Liu
parent fb132b281c
commit 7b8b7ead72
9 changed files with 27 additions and 26 deletions

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*
@ -21,6 +21,8 @@ import javax.xml.bind.ValidationEventHandler;
import javax.xml.bind.ValidationEventLocator;
/**
* Validation event handler used for obtaining line and column numbers in case of parsing failures.
*
* @author Hardy Ferentschik
*/
public class ContextProvidingValidationEventHandler implements ValidationEventHandler {

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*
@ -117,7 +117,7 @@ public class JpaNamespaceTransformingEventReader extends EventReaderDelegate {
private List<Namespace> updateElementNamespaces(StartElement startElement) {
List<Namespace> newNamespaceList = new ArrayList<Namespace>();
Iterator existingNamespaceIterator = startElement.getNamespaces();
Iterator<?> existingNamespaceIterator = startElement.getNamespaces();
while ( existingNamespaceIterator.hasNext() ) {
Namespace namespace = (Namespace) existingNamespaceIterator.next();
if ( NAMESPACE_MAPPING.containsKey( namespace.getNamespaceURI() ) ) {
@ -139,7 +139,7 @@ public class JpaNamespaceTransformingEventReader extends EventReaderDelegate {
private List<Attribute> updateElementAttributes(StartElement startElement) {
// adjust the version attribute
List<Attribute> newElementAttributeList = new ArrayList<Attribute>();
Iterator existingAttributesIterator = startElement.getAttributes();
Iterator<?> existingAttributesIterator = startElement.getAttributes();
while ( existingAttributesIterator.hasNext() ) {
Attribute attribute = (Attribute) existingAttributesIterator.next();
if ( VERSION_ATTRIBUTE_NAME.equals( attribute.getName().getLocalPart() ) ) {

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*
@ -38,8 +38,7 @@ import org.hibernate.jpamodelgen.xml.jaxb.ObjectFactory;
import org.xml.sax.SAXException;
/**
* Provides common functionality used within the different XML descriptor
* parsers.
* Provides common functionality used for XML parsing.
*
* @author Gunnar Morling
* @author Hardy Ferentschik

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*

View File

@ -49,6 +49,8 @@ import org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitDefaults;
import org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata;
/**
* Parser for JPA XML descriptors (persistence.xml and referenced mapping files).
*
* @author Hardy Ferentschik
*/
public class JpaDescriptorParser {
@ -234,7 +236,7 @@ public class JpaDescriptorParser {
if ( !xmlMappedTypeExists( fqcn ) ) {
context.logMessage(
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;
}
@ -261,7 +263,7 @@ public class JpaDescriptorParser {
if ( !xmlMappedTypeExists( fqcn ) ) {
context.logMessage(
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;
}
@ -288,7 +290,7 @@ public class JpaDescriptorParser {
if ( !xmlMappedTypeExists( fqcn ) ) {
context.logMessage(
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;
}

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*
@ -21,30 +21,28 @@ import java.util.Map;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor;
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.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 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
*/
public class SnafuTest extends CompilationTest {
public class Jpa21DescriptorTest extends CompilationTest {
@Test
@TestForIssue( jiraKey = "METAGEN-92" )
public void testMetaModelGeneratedForXmlConfiguredEntity() {
assertMetamodelClassGeneratedFor( Snafu.class );
}
@Override
protected String getPackageNameOfCurrentTest() {
return SnafuTest.class.getPackage().getName();
return Jpa21DescriptorTest.class.getPackage().getName();
}
@Override
@ -52,8 +50,8 @@ public class SnafuTest extends CompilationTest {
Map<String, String> properties = new HashMap<String, String>();
properties.put(
JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION,
TestUtil.fcnToPath( SnafuTest.class.getPackage().getName() ) + "/persistence.xml"
TestUtil.fcnToPath( Jpa21DescriptorTest.class.getPackage().getName() ) + "/persistence.xml"
);
return properties;
}
}
}

View File

@ -1,6 +1,6 @@
/*
* 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
* full listing of individual contributors.
*

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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
~ full listing of individual contributors.
~

View File

@ -2,7 +2,7 @@
<!--
~ 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
~ full listing of individual contributors.
~