Package org.springframework.core.io

Examples of org.springframework.core.io.ClassPathResource


    }

    private HttpServletRequest getRequest()
            throws IOException
    {
        Resource resource = new ClassPathResource("/org/codehaus/xfire/spring/echoRequest.xml");
        byte[] bytes = FileCopyUtils.copyToByteArray(resource.getInputStream());
        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/Echo");
        request.setContentType("text/xml");
        request.setContent(bytes);
        return request;
    }
View Full Code Here


  }

  @Test
  public void exceptionWithoutAnnotatedServiceInterface() throws Exception {
    JsonRpcServer jsonRpcServer = new JsonRpcServer(mapper, new Service(), ServiceInterfaceWithoutAnnotation.class);
    jsonRpcServer.handle(new ClassPathResource(JSON_FILE).getInputStream(), baos);

    String response = baos.toString(JSON_ENCODING);       
    JsonNode json = mapper.readTree(response);
    JsonNode error = json.get("error");
View Full Code Here

  }

  @Test
  public void exceptionWithAnnotatedServiceInterface() throws Exception {
    JsonRpcServer jsonRpcServer = new JsonRpcServer(mapper, new Service(), ServiceInterfaceWithAnnotation.class);
    jsonRpcServer.handle(new ClassPathResource(JSON_FILE).getInputStream(), baos);

    String response = baos.toString(JSON_ENCODING);       
    JsonNode json = mapper.readTree(response);
    JsonNode error = json.get("error");
View Full Code Here

  }

  @Test
  public void exceptionWithAnnotatedServiceInterfaceMessageAndData() throws Exception {
    JsonRpcServer jsonRpcServer = new JsonRpcServer(mapper, new Service(), ServiceInterfaceWithAnnotationMessageAndData.class);
    jsonRpcServer.handle(new ClassPathResource(JSON_FILE).getInputStream(), baos);

    String response = baos.toString(JSON_ENCODING);
    JsonNode json = mapper.readTree(response);
    JsonNode error = json.get("error");
View Full Code Here

  }
 
  @Test
  public void exceptionWithMsgInException() throws Exception {
    JsonRpcServer jsonRpcServer = new JsonRpcServer(mapper, new ServiceWithExceptionMsg(), ServiceInterfaceWithAnnotation.class);
    jsonRpcServer.handle(new ClassPathResource(JSON_FILE).getInputStream(), baos);

    String response = baos.toString(JSON_ENCODING);
    JsonNode json = mapper.readTree(response);
    JsonNode error = json.get("error");
View Full Code Here

  public void test() throws Exception {
    parser("context.xml");
  }

  private void parser(String path) throws Exception {
    List<ReconfigBeanDefinitionHolder> holders = new BeanDefinitionReader().load(new ClassPathResource(
        path));
    for (ReconfigBeanDefinitionHolder holder : holders) {
      System.out.println(holder);
    }
  }
View Full Code Here

@Test
public class DefinitionBindRegistryTest {

  public void testGet() {
    XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("/context-registry.xml"));
    BindRegistry registry = new DefinitionBindRegistry(factory);
    List<String> names = registry.getBeanNames(TestDao.class);
    Assert.assertNotNull(names);
    Assert.assertTrue(names.size() == 1);
View Full Code Here

  public Resource getExpected(String resourceName, boolean rewrite) {
    if (rewrite) {
      return new FileSystemResource("src/test/resources/" + classPath + "/" + resourceName);
    } else {
      return new ClassPathResource(classPath + "/" + resourceName);
    }
  }
View Full Code Here

  private String beansFile = "smokeTest.xml";
  private ServletServiceAdapterComponent builtComponent;
  private BeanFactory factory;
 
  protected ServletServiceAdapterComponent buildRootComponent() {
    ClassPathResource resource = new ClassPathResource(beansFile);
    factory = new XmlBeanFactory(resource)
    ServletServiceAdapterComponent adapter =
      (ServletServiceAdapterComponent)factory.getBean("servletServiceAdapterComponent");
    builtComponent = adapter;
    return adapter;
View Full Code Here

    /**
     * Create a CompanyModelReader for the specified resourceName.
     * @param resourceName the name of the resource
     */
    public CompanyModelReader(String resourceName, ClassLoader classLoader) {
        super(new ClassPathResource(resourceName, classLoader));
        configureFactory();
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.io.ClassPathResource

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.