Package org.exolab.castor.mapping

Examples of org.exolab.castor.mapping.Mapping


     * Test unmarshalling of simple bean without proxy.
     *
     * @throws Exception For any exception thrown.
     */
    public void testUnmarshalSimpleBean() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        Unmarshaller unmarshaller = new Unmarshaller(Bean.class);
        unmarshaller.setMapping(mapping);
       
        String input
View Full Code Here


     * Test unmarshalling of bean refering to another one without proxy.
     *
     * @throws Exception For any exception thrown.
     */
    public void testUnmarshalReferingBean() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        Unmarshaller unmarshaller = new Unmarshaller(Bean.class);
        unmarshaller.setMapping(mapping);
       
        String input
View Full Code Here

     * Test marshalling of simple bean without proxy.
     *
     * @throws Exception For any exception thrown.
     */
    public void testMarshalSimpleBean() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = new Marshaller(out);
        marshaller.setMapping(mapping);
       
View Full Code Here

     * Test marshalling of bean refering to another one without proxy.
     *
     * @throws Exception For any exception thrown.
     */
    public void testMarshalReferingBean() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = new Marshaller(out);
        marshaller.setMapping(mapping);
       
View Full Code Here

     */
    public void testMarshalSimpleBeanProxy() throws Exception {
        XMLContext xmlContext = new XMLContext();
        xmlContext.setProperty(XMLProperties.PROXY_INTERFACES, "net.sf.cglib.proxy.Factory");
       
        Mapping mapping = xmlContext.createMapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = xmlContext.createMarshaller();
        marshaller.setWriter(out);
        marshaller.setMapping(mapping);
View Full Code Here

     */
    public void testMarshalReferingBeanProxy() throws Exception {
        XMLContext xmlContext = new XMLContext();
        xmlContext.setProperty(XMLProperties.PROXY_INTERFACES, "net.sf.cglib.proxy.Factory");
       
        Mapping mapping = xmlContext.createMapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = xmlContext.createMarshaller();
        marshaller.setWriter(out);
        marshaller.setMapping(mapping);
View Full Code Here

   
    private TestHarness setupHarness() throws Exception {
        Unmarshaller unm;
        Harness harness;
        TestHarness testApp;
        Mapping mapping;

        unm = new Unmarshaller(Harness.class);
        mapping = new Mapping();
        mapping.loadMapping(Main.class.getResource("harness/mapping.xml"));
        unm.setMapping(mapping);
        if (_testRes != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    Main.class.getResourceAsStream(_testRes)));
        } else if (_testFile != null) {
View Full Code Here

    return mediaDescription;
  }

  public static void main(String[] args) throws Exception
  {
    Mapping mapping = new Mapping(Item.class.getClassLoader());
    mapping.loadMapping("mapping.xml");

    Unmarshaller unmarshaller = new Unmarshaller(mapping);
    unmarshaller.setClassLoader(Item.class.getClassLoader());
    unmarshaller.setValidation(false);
    Item item = (Item) unmarshaller.unmarshal(new InputSource(new java.io.FileInputStream(args[0])));
View Full Code Here

    /**
     * Test method.
     * @throws Exception For any exception thrown.
     */
    public void testUnmarshalEntity() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        Unmarshaller unmarshaller = getXMLContext().createUnmarshaller();
        unmarshaller.setClass(Entity.class);
        unmarshaller.setMapping(mapping);
       
View Full Code Here

    /**
     * Test method.
     * @throws Exception For any exception thrown.
     */
    public void testMarshalEntity() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = getXMLContext().createMarshaller();
        marshaller.setWriter(out);
        marshaller.setMapping(mapping);
View Full Code Here

TOP

Related Classes of org.exolab.castor.mapping.Mapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.