org.springframework.oxm.jaxb.test.FlightType Java Examples
The following examples show how to use
org.springframework.oxm.jaxb.test.FlightType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Jaxb2MarshallerTests.java From java-technology-stack with MIT License | 5 votes |
private void testSupports() throws Exception { assertTrue("Jaxb2Marshaller does not support Flights class", marshaller.supports(Flights.class)); assertTrue("Jaxb2Marshaller does not support Flights generic type", marshaller.supports((Type)Flights.class)); assertFalse("Jaxb2Marshaller supports FlightType class", marshaller.supports(FlightType.class)); assertFalse("Jaxb2Marshaller supports FlightType type", marshaller.supports((Type)FlightType.class)); Method method = ObjectFactory.class.getDeclaredMethod("createFlight", FlightType.class); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(method.getGenericReturnType())); marshaller.setSupportJaxbElementClass(true); JAXBElement<FlightType> flightTypeJAXBElement = new JAXBElement<>(new QName("http://springframework.org", "flight"), FlightType.class, new FlightType()); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(flightTypeJAXBElement.getClass())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyRootElement.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyRootElement.class)); method = getClass().getDeclaredMethod("createDummyRootElement"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyType.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyType.class)); method = getClass().getDeclaredMethod("createDummyType"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); testSupportsPrimitives(); testSupportsStandardClasses(); }
Example #2
Source File: Jaxb2UnmarshallerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test @Override @SuppressWarnings("unchecked") public void unmarshalPartialStaxSourceXmlStreamReader() throws Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING)); streamReader.nextTag(); // skip to flights streamReader.nextTag(); // skip to flight Source source = StaxUtils.createStaxSource(streamReader); JAXBElement<FlightType> element = (JAXBElement<FlightType>) unmarshaller.unmarshal(source); FlightType flight = element.getValue(); testFlight(flight); }
Example #3
Source File: Jaxb2MarshallerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private void testSupports() throws Exception { assertTrue("Jaxb2Marshaller does not support Flights class", marshaller.supports(Flights.class)); assertTrue("Jaxb2Marshaller does not support Flights generic type", marshaller.supports((Type)Flights.class)); assertFalse("Jaxb2Marshaller supports FlightType class", marshaller.supports(FlightType.class)); assertFalse("Jaxb2Marshaller supports FlightType type", marshaller.supports((Type)FlightType.class)); Method method = ObjectFactory.class.getDeclaredMethod("createFlight", FlightType.class); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(method.getGenericReturnType())); marshaller.setSupportJaxbElementClass(true); JAXBElement<FlightType> flightTypeJAXBElement = new JAXBElement<FlightType>(new QName("http://springframework.org", "flight"), FlightType.class, new FlightType()); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(flightTypeJAXBElement.getClass())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyRootElement.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyRootElement.class)); method = getClass().getDeclaredMethod("createDummyRootElement"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyType.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyType.class)); method = getClass().getDeclaredMethod("createDummyType"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); testSupportsPrimitives(); testSupportsStandardClasses(); }
Example #4
Source File: Jaxb2MarshallerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void supportsClassesToBeBound() throws Exception { marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(Flights.class, FlightType.class); marshaller.afterPropertiesSet(); testSupports(); }
Example #5
Source File: Jaxb2MarshallerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test(expected = XmlMappingException.class) public void marshalInvalidClass() throws Exception { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(FlightType.class); marshaller.afterPropertiesSet(); Result result = new StreamResult(new StringWriter()); Flights flights = new Flights(); marshaller.marshal(flights, result); }
Example #6
Source File: Jaxb2MarshallerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected Object createFlights() { FlightType flight = new FlightType(); flight.setNumber(42L); flights = new Flights(); flights.getFlight().add(flight); return flights; }
Example #7
Source File: Jaxb2UnmarshallerTests.java From java-technology-stack with MIT License | 5 votes |
@Test @Override @SuppressWarnings("unchecked") public void unmarshalPartialStaxSourceXmlStreamReader() throws Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING)); streamReader.nextTag(); // skip to flights streamReader.nextTag(); // skip to flight Source source = StaxUtils.createStaxSource(streamReader); JAXBElement<FlightType> element = (JAXBElement<FlightType>) unmarshaller.unmarshal(source); FlightType flight = element.getValue(); testFlight(flight); }
Example #8
Source File: Jaxb2MarshallerTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected Object createFlights() { FlightType flight = new FlightType(); flight.setNumber(42L); flights = new Flights(); flights.getFlight().add(flight); return flights; }
Example #9
Source File: Jaxb2MarshallerTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void supportsClassesToBeBound() throws Exception { marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(Flights.class, FlightType.class); marshaller.afterPropertiesSet(); testSupports(); }
Example #10
Source File: Jaxb2MarshallerTests.java From java-technology-stack with MIT License | 5 votes |
@Test(expected = XmlMappingException.class) public void marshalInvalidClass() throws Exception { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(FlightType.class); marshaller.afterPropertiesSet(); Result result = new StreamResult(new StringWriter()); Flights flights = new Flights(); marshaller.marshal(flights, result); }
Example #11
Source File: Jaxb2MarshallerTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected Object createFlights() { FlightType flight = new FlightType(); flight.setNumber(42L); flights = new Flights(); flights.getFlight().add(flight); return flights; }
Example #12
Source File: Jaxb2UnmarshallerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test @Override @SuppressWarnings("unchecked") public void unmarshalPartialStaxSourceXmlStreamReader() throws Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING)); streamReader.nextTag(); // skip to flights streamReader.nextTag(); // skip to flight Source source = StaxUtils.createStaxSource(streamReader); JAXBElement<FlightType> element = (JAXBElement<FlightType>) unmarshaller.unmarshal(source); FlightType flight = element.getValue(); testFlight(flight); }
Example #13
Source File: Jaxb2MarshallerTests.java From spring-analysis-note with MIT License | 5 votes |
private void testSupports() throws Exception { assertTrue("Jaxb2Marshaller does not support Flights class", marshaller.supports(Flights.class)); assertTrue("Jaxb2Marshaller does not support Flights generic type", marshaller.supports((Type)Flights.class)); assertFalse("Jaxb2Marshaller supports FlightType class", marshaller.supports(FlightType.class)); assertFalse("Jaxb2Marshaller supports FlightType type", marshaller.supports((Type)FlightType.class)); Method method = ObjectFactory.class.getDeclaredMethod("createFlight", FlightType.class); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(method.getGenericReturnType())); marshaller.setSupportJaxbElementClass(true); JAXBElement<FlightType> flightTypeJAXBElement = new JAXBElement<>(new QName("https://springframework.org", "flight"), FlightType.class, new FlightType()); assertTrue("Jaxb2Marshaller does not support JAXBElement<FlightsType>", marshaller.supports(flightTypeJAXBElement.getClass())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyRootElement.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyRootElement.class)); method = getClass().getDeclaredMethod("createDummyRootElement"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); assertFalse("Jaxb2Marshaller supports class not in context path", marshaller.supports(DummyType.class)); assertFalse("Jaxb2Marshaller supports type not in context path", marshaller.supports((Type)DummyType.class)); method = getClass().getDeclaredMethod("createDummyType"); assertFalse("Jaxb2Marshaller supports JAXBElement not in context path", marshaller.supports(method.getGenericReturnType())); testSupportsPrimitives(); testSupportsStandardClasses(); }
Example #14
Source File: Jaxb2MarshallerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void supportsClassesToBeBound() throws Exception { marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(Flights.class, FlightType.class); marshaller.afterPropertiesSet(); testSupports(); }
Example #15
Source File: Jaxb2MarshallerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test(expected = XmlMappingException.class) public void marshalInvalidClass() throws Exception { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(FlightType.class); marshaller.afterPropertiesSet(); Result result = new StreamResult(new StringWriter()); Flights flights = new Flights(); marshaller.marshal(flights, result); }
Example #16
Source File: Jaxb2UnmarshallerTests.java From java-technology-stack with MIT License | 4 votes |
@Override protected void testFlight(Object o) { FlightType flight = (FlightType) o; assertNotNull("Flight is null", flight); assertEquals("Number is invalid", 42L, flight.getNumber()); }
Example #17
Source File: Jaxb2UnmarshallerTests.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void testFlight(Object o) { FlightType flight = (FlightType) o; assertNotNull("Flight is null", flight); assertEquals("Number is invalid", 42L, flight.getNumber()); }
Example #18
Source File: Jaxb2UnmarshallerTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override protected void testFlight(Object o) { FlightType flight = (FlightType) o; assertNotNull("Flight is null", flight); assertEquals("Number is invalid", 42L, flight.getNumber()); }