Package org.springframework.integration.file.remote.session

Examples of org.springframework.integration.file.remote.session.Session


    byte[] bytes = "foobarbaz".getBytes();
    ApplicationContext ctx = new ClassPathXmlApplicationContext(
        this.getClass().getSimpleName() + "-context.xml", this.getClass());
    this.sessionFactory = ctx.getBean(SessionFactory.class);

    Session session = mock(Session.class);
    when(this.sessionFactory.getSession()).thenReturn(session);
    when(session.readRaw("/foo/bar.txt")).thenReturn(new ByteArrayInputStream(bytes));
    when(session.readRaw("/foo/baz.txt")).thenReturn(new ByteArrayInputStream(bytes));
    when(session.finalizeRaw()).thenReturn(true);
    Object[] fileList = new FTPFile[2];
    FTPFile file = new FTPFile();
    file.setName("bar.txt");
    fileList[0] = file;
    file = new FTPFile();
    file.setName("baz.txt");
    fileList[1] = file;
    when(session.list("/foo/")).thenReturn(fileList);

    this.launcher = ctx.getBean(JobLauncher.class);
    this.job = ctx.getBean(Job.class);
    this.requestsOut = ctx.getBean("stepExecutionRequests.output", MessageChannel.class);
    this.requestsIn = ctx.getBean("stepExecutionRequests.input", MessageChannel.class);
View Full Code Here


  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Before
  public void setup() throws Exception {
    byte[] bytes = "foo".getBytes();
    Session session = mock(Session.class);
    when(this.sessionFactory.getSession()).thenReturn(session);
    when(session.readRaw("/foo/bar.txt")).thenReturn(new ByteArrayInputStream(bytes));
    when(session.readRaw("/foo/baz.txt")).thenReturn(new ByteArrayInputStream(bytes));
    when(session.finalizeRaw()).thenReturn(true);
    Object[] fileList = new FTPFile[2];
    FTPFile file = new FTPFile();
    file.setName("bar.txt");
    fileList[0] = file;
    file = new FTPFile();
    file.setName("baz.txt");
    fileList[1] = file;
    when(session.list("/foo/")).thenReturn(fileList);

    this.bus = new LocalMessageBus();
    this.bus.setApplicationContext(BusTestUtils.MOCK_AC);
    this.bus.bindRequestor("foo", this.requestsOut, this.repliesIn, null);
    this.bus.bindReplier("foo", this.requestsIn, this.repliesOut, null);
View Full Code Here

  public void testWrite() throws Exception {
    File file = new File(tmpDir, "foo.txt");
    file.delete();

    ByteArrayInputStream data = new ByteArrayInputStream("foobarbaz".getBytes());
    Session session = mock(Session.class);
    SessionFactory factory = mock(SessionFactory.class);
    when(factory.getSession()).thenReturn(session);
    when(session.readRaw("foo.txt")).thenReturn(data);
    when(session.finalizeRaw()).thenReturn(true);

    StepExecution stepExecution = new StepExecution("foo", null);
    ExecutionContext stepExecutionContext = new ExecutionContext();
    stepExecutionContext.putString("filePath", "foo.txt");
    stepExecution.setExecutionContext(stepExecutionContext);
View Full Code Here

TOP

Related Classes of org.springframework.integration.file.remote.session.Session

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.