Fixed generics in JAXBContextFactory. Fixed related compilation errors and warnings. Signed-off-by: Tomas Kraus <tomas.kraus@oracle.com>
diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java index ccfcbcf..4ce57e3 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/JAXBContextFactory.java
@@ -96,7 +96,7 @@ public class JAXBContextFactory { * Create a JAXBContext on the array of Class objects. The JAXBContext will * also be aware of classes reachable from the classes in the array. */ - public static jakarta.xml.bind.JAXBContext createContext(Class[] classesToBeBound, Map properties) throws JAXBException { + public static jakarta.xml.bind.JAXBContext createContext(Class<?>[] classesToBeBound, Map<String, Object> properties) throws JAXBException { ClassLoader loader = null; if (classesToBeBound.length > 0) { loader = classesToBeBound[0].getClassLoader(); @@ -108,7 +108,7 @@ public static jakarta.xml.bind.JAXBContext createContext(Class[] classesToBeBoun * Create a JAXBContext on the array of Class objects. The JAXBContext will * also be aware of classes reachable from the classes in the array. */ - public static jakarta.xml.bind.JAXBContext createContext(Class[] classesToBeBound, Map properties, ClassLoader classLoader) throws JAXBException { + public static jakarta.xml.bind.JAXBContext createContext(Class<?>[] classesToBeBound, Map<String, Object> properties, ClassLoader classLoader) throws JAXBException { Type[] types = new Type[classesToBeBound.length]; System.arraycopy(classesToBeBound, 0, types, 0, classesToBeBound.length); return createContext(types, properties, classLoader); @@ -126,7 +126,7 @@ public static jakarta.xml.bind.JAXBContext createContext(String contextPath, Cla * Create a JAXBContext on context path. The JAXBContext will * also be aware of classes reachable from the classes on the context path. */ - public static jakarta.xml.bind.JAXBContext createContext(String contextPath, ClassLoader classLoader, Map properties) throws JAXBException { + public static jakarta.xml.bind.JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, Object> properties) throws JAXBException { JAXBContextInput contextInput = new ContextPathInput(contextPath, properties, classLoader); JAXBContext context = new JAXBContext(contextInput); if (context.isRefreshable()) { @@ -141,7 +141,7 @@ public static jakarta.xml.bind.JAXBContext createContext(String contextPath, Cla * preferred means of creating a Type aware JAXBContext is to create the * JAXBContext with an array of TypeMappingInfo objects. */ - public static jakarta.xml.bind.JAXBContext createContext(Type[] typesToBeBound, Map properties, ClassLoader classLoader) throws JAXBException { + public static jakarta.xml.bind.JAXBContext createContext(Type[] typesToBeBound, Map<String, Object> properties, ClassLoader classLoader) throws JAXBException { Map<Type, TypeMappingInfo> typeToTypeMappingInfo = new HashMap<Type, TypeMappingInfo>(); TypeMappingInfo[] typeMappingInfos = new TypeMappingInfo[typesToBeBound.length]; for(int i = 0; i < typesToBeBound.length; i++) { @@ -162,7 +162,7 @@ public static jakarta.xml.bind.JAXBContext createContext(Type[] typesToBeBound, * JAXBContext will also be aware of classes reachable from the types in the * array. This is the preferred means of creating a Type aware JAXBContext. */ - public static jakarta.xml.bind.JAXBContext createContext(TypeMappingInfo[] typesToBeBound, Map properties, ClassLoader classLoader) throws JAXBException { + public static jakarta.xml.bind.JAXBContext createContext(TypeMappingInfo[] typesToBeBound, Map<String, Object> properties, ClassLoader classLoader) throws JAXBException { JAXBContextInput contextInput = new TypeMappingInfoInput(typesToBeBound, properties, classLoader); JAXBContext context = new JAXBContext(contextInput); if (context.isRefreshable()) { @@ -201,7 +201,7 @@ public static jakarta.xml.bind.JAXBContext createContext(TypeMappingInfo[] types * xml-bindings element * </pre> */ - public static Map<String, XmlBindings> getXmlBindingsFromProperties(Map properties, ClassLoader classLoader) { + public static Map<String, XmlBindings> getXmlBindingsFromProperties(Map<String, Object> properties, ClassLoader classLoader) { Map<String, List<XmlBindings>> bindings = new HashMap<String, List<XmlBindings>>(); Object value = null; if (properties != null) {
diff --git a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/dynamic/metadata/Metadata.java b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/dynamic/metadata/Metadata.java index 55e3d54..2445720 100644 --- a/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/dynamic/metadata/Metadata.java +++ b/moxy/org.eclipse.persistence.moxy/src/main/java/org/eclipse/persistence/jaxb/dynamic/metadata/Metadata.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -28,9 +28,10 @@ public abstract class Metadata { protected Map<String, XmlBindings> bindings; protected DynamicClassLoader dynamicClassLoader; + @SuppressWarnings("unchecked") public Metadata(DynamicClassLoader dynamicClassLoader, Map<String, ?> properties) { this.dynamicClassLoader = dynamicClassLoader; - this.bindings = JAXBContextFactory.getXmlBindingsFromProperties(properties, dynamicClassLoader); + this.bindings = JAXBContextFactory.getXmlBindingsFromProperties((Map<String, Object>) properties, dynamicClassLoader); } public Map<String, XmlBindings> getBindings() {
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/casesensitivity/JAXBCaseInsensitivityTestCase.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/casesensitivity/JAXBCaseInsensitivityTestCase.java index 1cf7d09..9faa4ad 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/casesensitivity/JAXBCaseInsensitivityTestCase.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/casesensitivity/JAXBCaseInsensitivityTestCase.java
@@ -39,8 +39,10 @@ public class JAXBCaseInsensitivityTestCase extends junit.framework.TestCase { private static final URL CUSTOMER_FILE_URL = Thread.currentThread().getContextClassLoader().getResource("org/eclipse/persistence/testing/jaxb/casesensitivity/customer.xml"); - private static final Class[] CAMEL_CASE_CUSTOMER = new Class[]{CustomerImpl.class}; - private static final Class[] UPPER_CASE_CUSTOMER = new Class[]{org.eclipse.persistence.testing.jaxb.casesensitivity.otherCase.CustomerImpl.class}; + @SuppressWarnings({"unchecked"}) + private static final Class<Customer>[] CAMEL_CASE_CUSTOMER = (Class<Customer>[]) new Class[]{CustomerImpl.class}; + @SuppressWarnings({"unchecked"}) + private static final Class<Customer>[] UPPER_CASE_CUSTOMER = (Class<Customer>[]) new Class[]{org.eclipse.persistence.testing.jaxb.casesensitivity.otherCase.CustomerImpl.class}; private static final boolean DEBUG = false; private CustomerImpl baseCustomer; @@ -111,7 +113,7 @@ public void setUp() throws Exception { baseCustomer.setPersonalName("cafeBabe"); /* Create and assign case-insensitive unmarshallers */ - Map<String, Boolean> properties = new HashMap<String, Boolean>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.UNMARSHALLING_CASE_INSENSITIVE, Boolean.TRUE); JAXBContext ctxCorrectCaseInsensitive = JAXBContextFactory.createContext(CAMEL_CASE_CUSTOMER, properties); JAXBContext ctxOtherCaseInsensitive = JAXBContextFactory.createContext(UPPER_CASE_CUSTOMER, null); /* we set CI by setProperty() */
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/ExternalizedMetadataTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/ExternalizedMetadataTestCases.java index c7aa1f0..40d855a 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/ExternalizedMetadataTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/ExternalizedMetadataTestCases.java
@@ -158,7 +158,7 @@ public void generateSchema(String contextPath, int expectedSchemaCount, MyStream * file(s) in the properties map. * */ - public MySchemaOutputResolver generateSchema(String contextPath, Map<String, Map<String, Source>> properties, int expectedSchemaCount) { + public MySchemaOutputResolver generateSchema(String contextPath, Map<String, Object> properties, int expectedSchemaCount) { MySchemaOutputResolver outputResolver = new MySchemaOutputResolver(); try { generateSchema(contextPath, outputResolver, properties); @@ -180,10 +180,10 @@ public MySchemaOutputResolver generateSchema(String contextPath, Map<String, Map * @param iStream eclipselink-oxm.xml file as a stream */ private MySchemaOutputResolver generateSchema(String contextPath, InputStream iStream, int expectedSchemaCount) { - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(contextPath, new StreamSource(iStream)); validateBindingsFileAgainstSchema(iStream); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); return generateSchema(contextPath, properties, expectedSchemaCount); } @@ -208,9 +208,9 @@ public MySchemaOutputResolver generateSchemaWithFileName(String contextPath, Str fail("Couldn't load metadata file [" + metadataFile + "]"); } validateBindingsFileAgainstSchema(iStreamCopy); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(contextPath, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); return generateSchema(contextPath, properties, expectedSchemaCount); } @@ -344,7 +344,7 @@ public MySchemaOutputResolver generateSchema(Type[] types, String contextPath, S * Generate one or more schemas from a context path. * */ - protected void generateSchema(String contextPath, SchemaOutputResolver outputResolver, Map<String, Map<String, Source>> properties) throws Exception { + protected void generateSchema(String contextPath, SchemaOutputResolver outputResolver, Map<String, Object> properties) throws Exception { try { jaxbContext = (JAXBContext) JAXBContextFactory.createContext(contextPath, loader, properties); jaxbContext.generateSchema(outputResolver); @@ -766,9 +766,9 @@ public JAXBContext createContext(Class[] classes, String contextPath, String met if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(contextPath, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); MySchemaOutputResolver outputResolver = new MySchemaOutputResolver();
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/exceptions/contextfactory/ExceptionHandlingTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/exceptions/contextfactory/ExceptionHandlingTestCases.java index 3fbf381..a10930d 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/exceptions/contextfactory/ExceptionHandlingTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/exceptions/contextfactory/ExceptionHandlingTestCases.java
@@ -20,7 +20,6 @@ import java.util.List; import java.util.Map; -import jakarta.xml.bind.JAXBContext; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; @@ -53,9 +52,9 @@ public ExceptionHandlingTestCases(String name) { * Negative test. */ public void testInvalidMapParameterTypeBadKey() { - Map<Class, Source> metadataSourceMap = new HashMap<Class, Source>(); + Map<Class<?>, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(JAXBContextFactory.class, new StreamSource()); - Map<String, Map<Class, Source>> properties = new HashMap<String, Map<Class, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -73,9 +72,9 @@ public void testInvalidMapParameterTypeBadKey() { * Negative test. */ public void testInvalidMapParameterTypeNullKey() { - Map<Class, Source> metadataSourceMap = new HashMap<Class, Source>(); + Map<Class<?>, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(null, new StreamSource()); - Map<String, Map<Class, Source>> properties = new HashMap<String, Map<Class, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -94,9 +93,9 @@ public void testInvalidMapParameterTypeNullKey() { * Negative test. */ public void testInvalidParameterTypeBadValue() { - Map<String, Class> metadataSourceMap = new HashMap<String, Class>(); + Map<String, Class<?>> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, this.getClass()); - Map<String, Map<String, Class>> properties = new HashMap<String, Map<String, Class>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -114,9 +113,9 @@ public void testInvalidParameterTypeBadValue() { * Negative test. */ public void testInvalidMapParameterTypeNullValue() { - Map<String, Source> metadataSourceMap = new HashMap<String, Source>(); + Map<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, null); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -135,8 +134,8 @@ public void testInvalidMapParameterTypeNullValue() { * Negative test. */ public void testInvalidParameterTypeBadOxmXmlValue() { - Map<String, List<Integer>> properties = new HashMap<String, List<Integer>>(); - ArrayList<Integer> ints = new ArrayList<Integer>(); + Map<String, Object> properties = new HashMap<>(); + ArrayList<Integer> ints = new ArrayList<>(); ints.add(666); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, ints); try { @@ -160,9 +159,9 @@ public void testInvalidClassName() { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -186,9 +185,9 @@ public void testInvalidMetadataFile() { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -215,13 +214,13 @@ public void testInvalidPackageAsKey() { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("java.util", new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { - JAXBContext ctx = JAXBContextFactory.createContext(contextPath, getClass().getClassLoader(), properties); + JAXBContextFactory.createContext(contextPath, getClass().getClassLoader(), properties); } catch (jakarta.xml.bind.JAXBException e) { assertTrue(e.getLinkedException() instanceof JAXBException); assertEquals(JAXBException.JAVATYPE_NOT_ALLOWED_IN_BINDINGS_FILE, ((JAXBException)e.getLinkedException()).getErrorCode()); @@ -239,9 +238,9 @@ public void testInvalidLocation() { String metadataFile = PATH + "eclipselink_doesnt_exist-oxm.xml"; InputStream iStream = getClass().getClassLoader().getResourceAsStream(metadataFile); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -262,9 +261,9 @@ public void testInvalidLocation() { public void testInvalidLocation2() { String metadataFile = PATH + "eclipselink_doesnt_exist-oxm.xml"; - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(metadataFile)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try {
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/jaxbcontextfactory/JAXBContextFactoryTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/jaxbcontextfactory/JAXBContextFactoryTestCases.java index 984887e..0c7e645 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/jaxbcontextfactory/JAXBContextFactoryTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/jaxbcontextfactory/JAXBContextFactoryTestCases.java
@@ -198,7 +198,7 @@ public void testLoadXmlFilesViaProperties() throws IOException, URISyntaxExcepti } metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.properties.foo", new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); outputResolver = generateSchema(contextPath, properties, 1); @@ -262,7 +262,7 @@ public void testStringArrayInTypesToBeBound() { } metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.stringarray.b", new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); MySchemaOutputResolver outputResolver = new MySchemaOutputResolver(); @@ -309,7 +309,7 @@ public void testStringArrayInClassesToBeBound() { } metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.jaxbcontextfactory.stringarray.b", new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); MySchemaOutputResolver outputResolver = new MySchemaOutputResolver();
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/mappings/xmltransformation/JAXBContextTransformationMappingTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/mappings/xmltransformation/JAXBContextTransformationMappingTestCases.java index a7d8dcd..9280a70 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/mappings/xmltransformation/JAXBContextTransformationMappingTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/mappings/xmltransformation/JAXBContextTransformationMappingTestCases.java
@@ -51,9 +51,9 @@ public class JAXBContextTransformationMappingTestCases extends TestCase{ public void testBothClassAndMethod() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(METADATA_FILE_CLASS_AND_METHOD); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -73,9 +73,9 @@ public void testBothClassAndMethod() { public void testNoClassOrMethod() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(METADATA_FILE_NO_CLASS_OR_METHOD); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); try { @@ -98,9 +98,9 @@ public void testNoClassOrMethod() { public void testInvalidMethod() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(METADATA_FILE_BAD_METHOD); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); int exceptionCount = 0; @@ -134,9 +134,9 @@ public void testInvalidMethod() { public void testInvalidTransformerClass() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(METADATA_FILE_BAD_CLASS); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); int exceptionCount = 0;
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlattachmentref/XmlAttachmentRefCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlattachmentref/XmlAttachmentRefCases.java index 811328a..f071814 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlattachmentref/XmlAttachmentRefCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlattachmentref/XmlAttachmentRefCases.java
@@ -160,9 +160,9 @@ public void testInvalidXmlAttachmentRef() { if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); boolean exceptionOccurred = false;
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelement/XmlElementTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelement/XmlElementTestCases.java index fb14a81..ea9c76e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelement/XmlElementTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelement/XmlElementTestCases.java
@@ -109,9 +109,9 @@ public void testTeamWithListOfPlayersSchemaGen() throws Exception{ if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlelement", new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContext jContext = (JAXBContext) JAXBContextFactory.createContext(new Class[] { Team.class }, properties, loader);
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelements/XmlElementsTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelements/XmlElementsTestCases.java index 22f9a36..cc381c2 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelements/XmlElementsTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelements/XmlElementsTestCases.java
@@ -107,9 +107,9 @@ protected Object getControlObject() { public void testXmlElementsWithIdRefSchemaGen() throws Exception { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelements/eclipselink-oxm-idref.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlelements", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); List controlSchemas = new ArrayList(); @@ -138,9 +138,9 @@ public void testXmlElementsWithInvalidIdRef() { if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); // create context
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/XmlElementWrapperTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/XmlElementWrapperTestCases.java index 3c68a6b..1b75b80 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/XmlElementWrapperTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/XmlElementWrapperTestCases.java
@@ -119,8 +119,6 @@ public void testXmlElementWrapperNoOverrideSchemaGen() throws Exception { .getSystemResourceAsStream(XML_RESOURCE); String result = validateAgainstSchema(instanceDocStream, schemaSource); assertTrue("Schema validation failed unxepectedly: " + result, result == null); - - } /** @@ -138,24 +136,23 @@ public void testXmlElementWrapperNoOverrideSchemaGen() throws Exception { public void testXmlElementWrapperNSSchemaGen() throws Exception { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/eclipselink-oxm-ns.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlelementwrapper", - new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + new StreamSource(inputStream)); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); - JAXBContext ctx = JAXBContextFactory.createContext(new Class[] { Employee.class }, properties); + JAXBContext ctx = JAXBContextFactory.createContext(new Class[]{Employee.class}, properties); - MyStreamSchemaOutputResolver outputResolver = new MyStreamSchemaOutputResolver(); - ctx.generateSchema(outputResolver); + MyStreamSchemaOutputResolver outputResolver = new MyStreamSchemaOutputResolver(); + ctx.generateSchema(outputResolver); - List<Writer> generatedSchemas = outputResolver.getSchemaFiles(); - - List controlSchemas = new ArrayList(); + List<Writer> generatedSchemas = outputResolver.getSchemaFiles(); + List<InputStream> controlSchemas = new ArrayList<>(); InputStream is = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlelementwrapper/schema_ns.xsd"); controlSchemas.add(is); - compareSchemas(controlSchemas, generatedSchemas); + compareSchemas(controlSchemas, generatedSchemas); }
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/XmlIdRefExceptionTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/XmlIdRefExceptionTestCases.java index 54e1c1f..b11006c 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/XmlIdRefExceptionTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/XmlIdRefExceptionTestCases.java
@@ -39,14 +39,14 @@ public XmlIdRefExceptionTestCases(String name) throws Exception { * Negative test. */ public void testNoIdException(){ - Class[] classes = new Class[] { Employee2.class, Address2.class }; + Class<?>[] classes = new Class[] { Employee2.class, Address2.class }; boolean ex = false; try { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/eclipselink-oxm-no-id.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlidref", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(classes, properties); @@ -64,14 +64,14 @@ public void testNoIdException(){ * Negative test. */ public void testMultipleIdException(){ - Class[] classes = new Class[] { Employee2.class, Address2.class }; + Class<?>[] classes = new Class[] { Employee2.class, Address2.class }; boolean ex = false; try { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/eclipselink-oxm-multi-id.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlidref", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(classes, properties); @@ -89,14 +89,14 @@ public void testMultipleIdException(){ * Negative test. */ public void testMultipleId2Exception(){ - Class[] classes = new Class[] { Employee2.class, Address2.class }; + Class<?>[] classes = new Class[] { Employee2.class, Address2.class }; boolean ex = false; try { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/eclipselink-oxm-multi-id2.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlidref", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(classes, properties); @@ -114,14 +114,14 @@ public void testMultipleId2Exception(){ * Negative test. */ public void testInvalidRefClass() { - Class[] classes = new Class[] { Employee2.class, Address2.class }; + Class<?>[] classes = new Class[] { Employee2.class, Address2.class }; boolean ex = false; try { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlidref/invalid-ref-class-oxm.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlidref", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(classes, properties);
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmljoinnode/XmlJoinNodeTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmljoinnode/XmlJoinNodeTestCases.java index e472e26..644faef 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmljoinnode/XmlJoinNodeTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmljoinnode/XmlJoinNodeTestCases.java
@@ -143,9 +143,9 @@ public void testInvalidXmlJoinNode() { try { InputStream inputStream = ClassLoader.getSystemResourceAsStream(INVALID_OXM_DOC); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmljoinnode", new StreamSource(inputStream)); - Map<String, Map<String, Source>> invalidProperties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> invalidProperties = new HashMap<>(); invalidProperties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(new Class[] { Company.class }, invalidProperties); @@ -164,9 +164,9 @@ public void testInvalidTargetXPath() { try { InputStream inputStream = ClassLoader.getSystemResourceAsStream(INVALID_XPATH_OXM_DOC); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmljoinnode", new StreamSource(inputStream)); - Map<String, Map<String, Source>> invalidProperties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> invalidProperties = new HashMap<>(); invalidProperties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(new Class[] { Company.class }, invalidProperties); @@ -190,9 +190,9 @@ public void testTargetWithNoKey() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(INVALID_TARGET_OXM_DOC); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmljoinnode", new StreamSource(inputStream)); - Map<String, Map<String, Source>> invalidProperties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> invalidProperties = new HashMap<>(); invalidProperties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(new Class[] { Company.class }, invalidProperties); @@ -210,9 +210,9 @@ public void testContainerType() { try { InputStream inputStream = ClassLoader.getSystemResourceAsStream(OXM_DOC_V2); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmljoinnode", new StreamSource(inputStream)); - Map<String, Map<String, Source>> invalidProperties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> invalidProperties = new HashMap<>(); invalidProperties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); jCtx = (JAXBContext)JAXBContextFactory.createContext(new Class[] { Company.class }, invalidProperties);
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmllist/XmlListTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmllist/XmlListTestCases.java index 326b7bb..c5e9e5a 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmllist/XmlListTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmllist/XmlListTestCases.java
@@ -84,9 +84,9 @@ public void testSchemaGen() throws Exception{ public void testXmlListInvalid() { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmllist/eclipselink-oxm-invalid.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmllist", new StreamSource(inputStream)); - Map<String, Map<String, Source>> invalidProperties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> invalidProperties = new HashMap<>(); invalidProperties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); boolean exception = false;
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmltransient/XmlTransientTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmltransient/XmlTransientTestCases.java index ab714f7..5eeac8c 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmltransient/XmlTransientTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmltransient/XmlTransientTestCases.java
@@ -128,9 +128,9 @@ public void testXmlTransientOnField() { public void testReferenceToTransientClassException() { try { InputStream inputStream = ClassLoader.getSystemResourceAsStream("org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmltransient/contactinfo-oxm.xml"); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmltransient.inheritance", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); JAXBContextFactory.createContext(new Class[] { ContactInfo.class }, properties);
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlvalue/XmlValueTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlvalue/XmlValueTestCases.java index 669b94d..f7f7982 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlvalue/XmlValueTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/externalizedmetadata/xmlvalue/XmlValueTestCases.java
@@ -52,12 +52,12 @@ public XmlValueTestCases(String name) throws Exception{ } @Override - public Map getProperties(){ + public Map<String, Object> getProperties(){ InputStream inputStream = ClassLoader.getSystemResourceAsStream(ADAPTER_OXM_DOC); - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmlvalue.adapter", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); return properties; @@ -84,9 +84,9 @@ public void testTwoXmlValues() { if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); boolean exceptionOccurred = false; @@ -114,9 +114,9 @@ public void testXmlValueWithElement() { if (iStream == null) { fail("Couldn't load metadata file [" + metadataFile + "]"); } - HashMap<String, Source> metadataSourceMap = new HashMap<String, Source>(); + HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put(CONTEXT_PATH, new StreamSource(iStream)); - Map<String, Map<String, Source>> properties = new HashMap<String, Map<String, Source>>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); boolean exceptionOccurred = false;
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/type/TypePropertyCustomNameNamespaceTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/type/TypePropertyCustomNameNamespaceTestCases.java index cfbff81..5d4098e 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/type/TypePropertyCustomNameNamespaceTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/type/TypePropertyCustomNameNamespaceTestCases.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -104,7 +104,7 @@ public void testUnmarshallJsonTelKoo1() throws Exception { private static String marshal(final JAXBElement<?> value) throws Exception { final StringWriter stringWriter = new StringWriter(); final Class<?>[] types = new Class<?>[]{ObjectFactory.class, Tel.class, KooSuper.class, Koo1.class}; - final Map<Object, Object> conf = new LinkedHashMap<>(); + final Map<String, Object> conf = new LinkedHashMap<>(); conf.put(JAXBContextProperties.MEDIA_TYPE, "application/json"); final JAXBContext innerCtx = JAXBContextFactory.createContext(types, conf); final Marshaller marshaller = innerCtx.createMarshaller(); @@ -115,7 +115,7 @@ private static String marshal(final JAXBElement<?> value) throws Exception { private static JAXBElement<?> unmarshal(final String value) throws Exception { final Class<?>[] types = new Class<?>[]{ObjectFactory.class, Tel.class, KooSuper.class, Koo1.class}; - final Map<Object, Object> conf = new LinkedHashMap<>(); + final Map<String, Object> conf = new LinkedHashMap<>(); conf.put(JAXBContextProperties.MEDIA_TYPE, "application/json"); final JAXBContext innerCtx = JAXBContextFactory.createContext(types, conf); final Unmarshaller unmarshaller = innerCtx.createUnmarshaller();
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/unmapped/JsonUnmappedTestCases.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/unmapped/JsonUnmappedTestCases.java index 189557f..ccc0fa2 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/unmapped/JsonUnmappedTestCases.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/jaxb/json/unmapped/JsonUnmappedTestCases.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -33,7 +33,7 @@ public class JsonUnmappedTestCases extends TestCase { public void testLastNull() throws JAXBException, FileNotFoundException { - Map<String, String> jaxbProperties = Collections.singletonMap(JAXBContextProperties.MEDIA_TYPE, "application/json"); + Map<String, Object> jaxbProperties = Collections.singletonMap(JAXBContextProperties.MEDIA_TYPE, "application/json"); JAXBContext jc = JAXBContextFactory.createContext(new Class[]{Foo.class}, jaxbProperties); Unmarshaller um = jc.createUnmarshaller();
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java index cdf894c..7817e24 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/SchemaGeneratorTestCase.java
@@ -76,7 +76,7 @@ public void addTransformerToSchema() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(BINDINGS_DOC); HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); Map<String, XmlBindings> bindings = JAXBContextFactory.getXmlBindingsFromProperties(properties, Thread.currentThread().getContextClassLoader()); JavaModelInputImpl jModelInput = new JavaModelInputImpl(DOMAIN_CLASSES, new JavaModelImpl(new JaxbClassLoader(Thread.currentThread().getContextClassLoader(), DOMAIN_CLASSES)));
diff --git a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java index 7540dbe..aef2a72 100644 --- a/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java +++ b/moxy/org.eclipse.persistence.moxy/src/test/java/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java
@@ -60,7 +60,7 @@ public void testTransformerPropertyBuilder() { InputStream inputStream = ClassLoader.getSystemResourceAsStream(BINDINGS_DOC); HashMap<String, Source> metadataSourceMap = new HashMap<>(); metadataSourceMap.put("org.eclipse.persistence.testing.jaxb.externalizedmetadata.mappings.xmltransformation", new StreamSource(inputStream)); - Map<String, Map<String, Source>> properties = new HashMap<>(); + Map<String, Object> properties = new HashMap<>(); properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, metadataSourceMap); Map<String, XmlBindings> bindings = JAXBContextFactory.getXmlBindingsFromProperties(properties, Thread.currentThread().getContextClassLoader()); JavaModelInputImpl jModelInput = new JavaModelInputImpl(DOMAIN_CLASSES, new JavaModelImpl(new JaxbClassLoader(Thread.currentThread().getContextClassLoader(), DOMAIN_CLASSES))); @@ -90,7 +90,7 @@ public void testTransformerPropertyBuilder() { // Indirect call of org.eclipse.persistence.jaxb.compiler.builder.TransformerPropertyBuilder.getTransformerJavaClass(...) with invalid TransformerClass name try { normalHoursProperty.getXmlTransformation().getXmlWriteTransformer().get(0).setTransformerClass("xxx.xxx.WrongClassName"); - props = transformerPropertyBuilder.buildProperties(); + transformerPropertyBuilder.buildProperties(); fail("Expected JAXBException."); } catch (JAXBException expected) { assertEquals(50054, expected.getErrorCode());