Examples of Jaxb2Marshaller


Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

  }

  @Test
  public void testXmlOnly() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    standaloneSetup(new PersonController()).setSingleView(new MarshallingView(marshaller)).build()
      .perform(get("/person/Corea"))
        .andExpect(status().isOk())
        .andExpect(content().mimeType(MediaType.APPLICATION_XML))
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

  }

  @Test
  public void testContentNegotiation() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    List<View> viewList = new ArrayList<View>();
    viewList.add(new MappingJacksonJsonView());
    viewList.add(new MarshallingView(marshaller));
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

    @Before
    public void setUp() throws Exception {
        objectMapper = new ObjectMapper(); //需要添加jackson jar包

        marshaller = new Jaxb2Marshaller(); //需要添加jaxb2实现(如xstream)
        marshaller.setPackagesToScan(new String[]{"com.sishuok"});
        marshaller.afterPropertiesSet();

        restTemplate = new RestTemplate();
    }
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

    assertEquals("option not set", "true", options.get("SAVE_PRETTY_PRINT"));
  }

  @Test
  public void jaxb2ContextPathMarshaller() throws Exception {
    Jaxb2Marshaller jaxb2Marshaller = applicationContext.getBean("jaxb2ContextPathMarshaller", Jaxb2Marshaller.class);
    assertNotNull(jaxb2Marshaller);
  }
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

    assertNotNull(jaxb2Marshaller);
  }

  @Test
  public void jaxb2ClassesToBeBoundMarshaller() throws Exception {
    Jaxb2Marshaller jaxb2Marshaller = applicationContext.getBean("jaxb2ClassesMarshaller", Jaxb2Marshaller.class);
    assertNotNull(jaxb2Marshaller);
  }
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

      @Override
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(RequestBodyArgMismatchController.class));

        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setClassesToBeBound(A.class, B.class);
        try {
          marshaller.afterPropertiesSet();
        }
        catch (Exception ex) {
          throw new BeanCreationException(ex.getMessage(), ex);
        }
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

  @Test
  public void responseBodyArgMismatch() throws ServletException, IOException {
    initServlet(new ApplicationContextInitializer<GenericWebApplicationContext>() {
      @Override
      public void initialize(GenericWebApplicationContext wac) {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setClassesToBeBound(A.class, B.class);
        try {
          marshaller.afterPropertiesSet();
        }
        catch (Exception ex) {
          throw new BeanCreationException(ex.getMessage(), ex);
        }
        MarshallingHttpMessageConverter messageConverter = new MarshallingHttpMessageConverter(marshaller);
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

       
        final ClassPathResource xslResource = new ClassPathResource("/org/jasig/portal/io/xml/user/upgrade-user_3-2.xsl");
        final IDataUpgrader xsltDataUpgrader = createXsltDataUpgrader(xslResource, UserPortalDataType.IMPORT_32_DATA_KEY);
        dataImportExportService.setDataUpgraders(Arrays.asList(xsltDataUpgrader));
       
        final Jaxb2Marshaller userJaxb2Marshaller = new Jaxb2Marshaller();
        userJaxb2Marshaller.setContextPath("org.jasig.portal.io.xml.user");
        userJaxb2Marshaller.afterPropertiesSet();
       
        final IDataImporter<ExternalUser> userDataImporter = mock(IDataImporter.class);
        when(userDataImporter.getImportDataKeys()).thenReturn(Collections.singleton(UserPortalDataType.IMPORT_40_DATA_KEY));
        when(userDataImporter.getUnmarshaller()).thenReturn(userJaxb2Marshaller);
       
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

  }

  @Test
  public void testXmlOnly() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    standaloneSetup(new PersonController()).setSingleView(new MarshallingView(marshaller)).build()
      .perform(get("/person/Corea"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_XML))
View Full Code Here

Examples of org.springframework.oxm.jaxb.Jaxb2Marshaller

  }

  @Test
  public void testContentNegotiation() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    List<View> viewList = new ArrayList<View>();
    viewList.add(new MappingJackson2JsonView());
    viewList.add(new MarshallingView(marshaller));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.