Examples of FTPEpr


Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  }
 
  @Test
  public void testConstructor () throws Exception
  {
    FTPEpr ftpEpr = new FTPEpr("ftp://test:password@foo.bar");

    try
    {
      @SuppressWarnings("unused")
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
     
      Assert.fail();
    }
   
    ftpEpr = new FTPEpr("ftp://foo.bar");
   
    try
    {
      @SuppressWarnings("unused")
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

 
  @Test
  public void testInvalidConnect () throws Exception
  {
    File theFile = new File("test.txt");
    FTPEpr ftpEpr = new FTPEpr("ftp://test:password@foo.bar");

    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
      @SuppressWarnings("unused")
      byte[] content = handler.getFileContents(theFile);
    }
    catch (CourierException ex)
    {
      // good!!
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
     
      Assert.fail();
    }
 
    ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + ":9090");
   
    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
      @SuppressWarnings("unused")
      byte[] content = handler.getFileContents(theFile);
    }
    catch (CourierException ex)
    {
      // good!!
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
     
      Assert.fail();
    }
   
    ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname());
   
    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  }
 
  @Test
  public void testValidConnect () throws Exception
  {
    FTPEpr ftpEpr = null;
   
    if (getFtpPwd() != null)
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + ":" + getFtpPwd()+ "@" + getFtpHostname() + getFtpDir());
    else
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + getFtpDir());

    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

 
  @Test
  public void testDeleteBadFile () throws Exception
  {
    File theFile = new File("test1234567890.txt");
    FTPEpr ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + getFtpDir());

    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  }
 
  @Test
  public void testGetFileList () throws Exception
  {
    FTPEpr ftpEpr = null;
   
    if (getFtpPwd() != null)
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + ":" + getFtpPwd()+ "@" + getFtpHostname() + getFtpDir());
    else
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + getFtpDir());
     
    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  }
 
  @Test
  public void testGetFile () throws Exception
  {
    FTPEpr ftpEpr = null;
   
    if (getFtpPwd() != null)
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + ":" + getFtpPwd()+ "@" + getFtpHostname() + getFtpDir());
    else
      ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + getFtpDir());

    try
    {
      FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
     
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  private final FileEpr getEpr(String sUri) throws Exception
  {
    final String scheme = new URI(sUri).getScheme();

    if ("ftp".equals(scheme))
      return new FTPEpr(sUri);
    if ("file".equals(scheme))
      return new FileEpr(sUri);

    throw new IllegalArgumentException("Not a recognised protocol!");
  }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

        try
        {
          String initialSuffix = ".ftpmsg";
         
          //  Send a Message that will be picked up by a listener, and specify replyTo
          FTPEpr toEpr = new FTPEpr(ftpUrl);
          toEpr.setInputSuffix(initialSuffix);
          toEpr.setPostDelete(true);
          FTPEpr replyToEpr = (FTPEpr)DefaultReplyTo.getReplyTo(toEpr);

          String text_1 = "Outgoing";
          Message outgoingMsg = MessageFactory.getInstance().getMessage();
          outgoingMsg.getHeader().getCall().setTo(toEpr);
          outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
          outgoingMsg.getBody().add(text_1.getBytes());
          CourierUtil.deliverMessage(outgoingMsg);

          // Mock a service that picks up the original message and replies
          FTPEpr serviceEpr = new FTPEpr(toEpr.getURI());
          serviceEpr.setInputSuffix(initialSuffix);
          serviceEpr.setPostDelete(true);
          PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
          Message received = listener.pickup(100);
          String text_2 = new String((byte[]) received.getBody().get());
          assertTrue(text_1.equals(text_2));
          assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

    return configTree;
  }
 
  private static FTPEpr createFTPEpr() throws MalformedURLException, URISyntaxException
  {
    FTPEpr epr = new FTPEpr ( new EPR() );
    epr.setURI( ftpServer.getURL().toURI() );
    epr.setUserName( ftpServer.getUserName() );
    epr.setErrorDirectory( ftpServer.getErrorDirName() );
    epr.setInputSuffix( INPUT_SUFFIX );
    epr.setPassword( ftpServer.getPassword() );
    epr.setPostDirectory( ftpServer.getUploadDirName() );
    epr.setWorkSuffix( ".work" );
    return epr;
  }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.eprs.FTPEpr

  {
    try
    {
            EPR epr = ListenerUtil.assembleEpr(config);
      if (epr instanceof FTPEpr)  {
        FTPEpr ftpEpr = (FTPEpr) epr;
        RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
        rfs.quit();
      } else {
        throw new GatewayException("This Gateway only accepts FTP and SFTP.");
      }
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.