You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_ftp-commits@incubator.apache.org by wr...@apache.org on 2006/02/16 06:40:43 UTC
svn commit: r378185 [2/3] - in
/incubator/mod_ftp/trunk/tests/perl-framework: Ssl/ t/ t/conf/ t/ftp/
t/ftp/ftp_exp_ssl/ t/ftp/ftp_imp_ssl/ t/htdocs/ t/htdocs/ftp/
t/htdocs/ftp/anonftpdocs/ t/htdocs/ftp/data/ t/htdocs/ftp/data/.libs/
t/htdocs/ftp/data/a...
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mdtm.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mdtm.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mdtm.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mdtm.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,89 @@
+use Ssl::FTPSSL;
+use Time::gmtime;
+use Time::Local;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use IO::Handle;
+
+plan tests =>1 , need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+use File::Path;
+use File::stat;
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+my $ftp;
+#my $sb;
+my $mdtm_first_time;
+my $mdtm_second_time;
+my $lines=0;
+my $output="";
+my $expected="MDTM Successful";
+my $actual;
+my $getlisting="test.txt";
+my @isarray = (
+'PASV:Getting modification time of the file',
+#'PORT:Getting modification time of the file',
+);
+my $mydir="$install_root/data/dir";
+rmtree($mydir);
+mkdir $mydir;
+#my $buffer = "joydeep";
+
+for($x=0;$x<1;$x++)
+{
+ if ($x==0)
+ {
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E', Debug =>0) or die "Couldn't connect to $host\n";
+ }
+# else
+# {
+# #Using Port mode of data transfer
+# $ftp = Net::FTP->new($host,Port =>$port,Passive =>0) or die "Couldn't connect to $host\n";
+# }
+
+ $ftp->login("common","password") or die "Login failed";
+ #$ftp->ascii();
+ #$ftp->get("/mdtmlist/$getlisting","$install_root/data/mdtmdir/$getlisting");
+
+ $sb=stat("$install_root/ftpdocs/home/common/mdtmlist/$getlisting") or die "No File";
+ printf "First Time is: %s",$sb->mtime;
+ $mdtm_first_time=$sb->mtime;
+ $ftp->cwd("mdtmlist");
+ $mod_time =$ftp->mdtm("$getlisting");
+ $tm = gmtime($mod_time);
+ $mdtm_second_time=timelocal($tm->sec, $tm->min, $tm->hour, $tm->mday, $tm->mon, $tm->year);
+ print "Second Time: $mdtm_second_time";
+
+ #printf("Dateline: %02d:%02d:%02d-%04d/%02d/%02d\n",$tm->hour, $tm->min, $tm->sec, $tm->year+1900,$tm->mon+1, $tm->mday);
+
+ if ($mdtm_first_time eq $mdtm_second_time)
+ {
+ $actual="MDTM Successful";
+ }
+ else
+ {
+ $actual="MDTM Failed";
+ }
+
+ ok t_cmp ($actual,$expected,$isarray[$x]);
+
+ $ftp->quit() or die "Unable to quit";
+
+
+}
+
+
+
+
+
+
+
+
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mkd.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mkd.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mkd.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/mkd.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,72 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use File::Path;
+plan tests => 3, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+$username = ("common");
+$password = ("password");
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/mkddir";
+my $mydir1="$install_root/data/mkddir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+
+my @mkdlist=(
+'mkd_newdir',
+'mkd_existingdir',
+'invalid/dirname',
+);
+
+$r=0;
+
+my @expected =(
+"MKD Successful",
+"MKD Failed",
+"MKD Failed",
+);
+
+my $actual;
+
+my @isarray=(
+"Create a new directory",
+"Attempting to create a directory with the name of an existing directory",
+"Attempting to create a directory with an invalid name format",
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n ";
+
+if($ftp->cwd("mkddir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty mkddir";
+}
+
+for($r=0;$r<3;$r++)
+{
+ if( $ftp->mkdir($mkdlist[$r]))
+ {
+ $actual="MKD Successful";
+ }
+ else
+ {
+ $actual="MKD Failed";
+ }
+ ok t_cmp ( $actual,$expected[$r],$isarray[$r]);
+}
+
+$ftp->quit() or die "Unable to quit\n" ;
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/nlst.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/nlst.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/nlst.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/nlst.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,227 @@
+use Ssl::FTPSSL;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests =>18 , need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = ("common");
+$password = ("password");
+
+my @filelist;
+
+my @expected =(
+"NLST * Successful",
+"NLST *.html Successful",
+"NLST a*b Successful",
+"NLST 3* Successful",
+"NLST *3 Successful",
+"NLST *i* Successful",
+"NLST a* b* Successful",
+"NLST *.* Successful",
+"NLST q Successful",
+"NLST 2*2* Successful",
+"NLST a* Successful",
+"NLST 9* Successful",
+"NLST b Successful",
+"NLST a*b Successful",
+"NLST b* Successful",
+"NLST q* Successful",
+"NLST *q Successful",
+"NLST 12* Successful",
+);
+
+my $actual = "True";
+
+
+my @isarray_pasv=(
+'PASV:Issue NLST * Command',
+'PASV:Issue NLST *.html Command',
+'PASV:Issue NLST a*b Command',
+'PASV:Issue NLST 3* Command',
+'PASV:Issue NLST *3 Command',
+'PASV:Issue NLST *i* Command',
+'PASV:Issue NLST a* b* Command',
+'PASV:Issue NLST *.* Command',
+'PASV:Issue NLST q Command',
+'PASV:Issue NLST 2*2* Command',
+'PASV:Issue NLST a* Command',
+'PASV:Issue NLST 9* Command',
+'PASV:Issue NLST b Command',
+'PASV:Issue NLST a*b Command',
+'PASV:Issue NLST b* Command',
+'PASV:Issue NLST q* Command',
+'PASV:Issue NLST *q Command',
+'PASV:Issue NLST 12* Command',
+);
+
+
+
+my @isarray_port=(
+'PORT:Issue NLST * Command',
+'PORT:Issue NLST *.html Command',
+'PORT:Issue NLST a*b Command',
+'PORT:Issue NLST 3* Command',
+'PORT:Issue NLST *3 Command',
+'PORT:Issue NLST *i* Command',
+'PORT:Issue NLST a*b* Command',
+'PORT:Issue NLST *.* Command',
+'PORT:Issue NLST q Command',
+'PORT:Issue NLST 2*2* Command',
+'PORT:Issue NLST a* Command',
+'PORT:Issue NLST 9* Command',
+'PORT:Issue NLST b Command',
+'PORT:Issue NLST a*b Command',
+'PORT:Issue NLST b* Command',
+'PORT:Issue NLST q* Command',
+'PORT:Issue NLST *q Command',
+'PORT:Issue NLST 12* Command',
+);
+my $l;
+#########################################################################################
+my @commandlist = ("*","*.html","a*b","3*","*3","*i*","a* b*","*.*","q","2*2*","a*","9*","b","a*b","b*","q*","*q","12*");
+my @expectedlist = (
+["123456","23452345","344","543","980","a.html","abcde","acdefb","aoJjugb","b","b.html","bcdef","faqs","list.txt","q","quick"],
+["a.html","b.html"],
+["acdefb","aoJjugb"],
+["344"],
+["543"],
+["list.txt","quick"],
+["a.html","abcde","acdefb"],
+["a.html","b.html","list.txt"],
+["q"],
+["23452345"],
+["a.html","abcde","acdefb","aoJjugb"],
+["980"],
+["b"],
+["acdefb","aoJjugb"],
+["b","b.html","bcdef"],
+["q","quick"],
+["q"],
+["123456"],
+);
+my $flag_value = "true";
+my $i = 0;
+my @filelist_one=("true");
+##########################################################################################
+#Using Passive mode of data transfer
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n";
+if($ftp->cwd("nlst_dir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty nlst_dir";
+}
+########################################################
+for ($i = 0; $i < 18; $i += 1)
+{
+ $ftp->pasv();
+ @filelist_one=$ftp->nlst($commandlist[$i]);
+ if(@filelist_one!=0)
+ {
+ my $k = 0;
+ while($filelist[$k] && $expectedlist[$i][$k])
+ {
+ my $fileLine = $filelist[$k];
+ chomp $fileLine;
+ my ($perm,$unkn,$user,$group,$size,$mo,$day,$time,$name)=split(/\s+/,$fileLine);
+ $filelist_one[$k]=$name;
+ print $name;
+ $l++;
+
+ if($filelist_one[$k] eq $expectedlist[$i][$k])
+ {
+ $k++;
+ }
+ else
+ {
+ $flag_value = "false";
+ $k++;
+ }
+
+ }
+ if ($flag_value eq "false")
+ {
+ $actual = "NLST $commandlist[$i] Failed";
+
+ }
+ else
+ {
+ $actual = "NLST $commandlist[$i] Successful";
+ }
+
+ ok t_cmp ($actual,$expected[$i],$isarray_pasv[$i]);
+ }
+ else
+ {
+ die "NLST * Failed \n";
+ }
+
+}
+
+#####################################################
+$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+#Using Port mode of data transfer
+#$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 1) or die "Couldn't connect to $host\n";
+#
+#$ftp->login($username, $password) or die "Login failed\n";
+#
+#
+#if($ftp->cwd("nlst_dir"))
+#{
+#}
+#else
+#{
+# die "Couldn't change to directoty nlst_dir";
+#}
+#########################################################
+#for ($i = 0; $i < 18; $i += 1)
+#{
+# $ftp->pasv();
+# @filelist_one=$ftp->nlst($commandlist[$i]);
+# if(@filelist_one!=0)
+# {
+# my $k = 0;
+# while($expectedlist[$i][$k])
+# {
+# if($filelist_one[$k] eq $expectedlist[$i][$k])
+# {
+# $k++;
+# }
+# else
+# {
+# $flag_value = "false";
+# $k++;
+# }
+#
+# }
+# if ($flag_value eq "false")
+# {
+# $actual = "NLST $commandlist[$i] Failed";
+#
+# }
+# else
+# {
+# $actual = "NLST $commandlist[$i] Successful";
+# }
+#
+# ok t_cmp ($actual,$expected[$i],$isarray_port[$i]);
+# }
+# else
+# {
+# die "NLST * Failed \n";
+# }
+#
+#}
+
+#####################################################
+#$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/noop.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/noop.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/noop.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/noop.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,31 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $actual;
+my $expected='Success';
+my $isarray='NOOP command Successful';
+
+my $username = "common";
+my $password = "password";
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if ($ftp->noop()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray);
+$ftp->quit();
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pasvRange.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pasvRange.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pasvRange.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pasvRange.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,34 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = "common";
+$password = "password";
+
+#FTPPasvRange 10000 12000
+
+my $ftp = Ssl::FTPSSL->new($host,Port=>$port,Encryption =>'E',Debug=>0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username,$password) or die "Login failed.\n";
+my $actual;
+my $expected = "PasvRange Successful";
+my $host_ip_port=$ftp->pasv_xfer();
+my ($host_ip_one,$host_ip_two,$host_ip_three,
+ $host_ip_four,$host_port_one,$host_port_two)
+ = split(/,/, $host_ip_port);
+my $host_pasv_value = $host_port_one * 256 + $host_port_two;
+if (($host_pasv_value >= 10000) && ($host_pasv_value <= 12000)){
+ $actual = "PasvRange Successful";
+}
+else{
+ $actual = "PasvRange Failed";
+}
+ok t_cmp($actual,$expected,"FTPPasvRange Test");
+$ftp->quit() or die "Unable to quit\n";
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pwd.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pwd.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pwd.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/pwd.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,50 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = ("common");
+$password = ("password");
+
+my @filelist;
+
+my $expected ="PWD Successful";
+
+my $actual;
+
+my $isarray='Issue PWD Command';
+
+#Using Passive mode of data transfer
+
+my $ftp = Ssl::FTPSSL->new($host,Port=>$port, Encryption =>'E', Debug=>0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n";
+if($ftp->cwd("getlist"))
+{
+}
+else
+{
+ die "Couldn't change to directory getlist";
+}
+
+my $pwdir=$ftp->pwd();
+print "PWDIR=$pwdir\n";
+if($pwdir eq "/getlist")
+{
+ $actual="PWD Successful";
+}
+
+else
+{
+ die "Couldn't change to directory getlist 1";
+}
+
+ok t_cmp ($actual,$expected,$isarray);
+
+$ftp->quit() or die "Unable to quit\n";
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rename.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rename.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rename.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rename.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,83 @@
+use Ssl::FTPSSL;
+use File::Path;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 4, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+$username = ("common");
+$password = ("password");
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/renamedir";
+my $mydir1="$install_root/data/renamedir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+
+my @renamefromlist=(
+'rename_oldfilename',
+'rename_nonexistfile',
+'invalid/filename',
+'newfilename3',
+);
+
+my @renametolist=(
+'rename_newfilename',
+'newfilename2',
+'newfilename3',
+'invalid/filename',
+);
+$r=0;
+
+my @expected =(
+"RENAME Successful",
+"RENAME Failed",
+"RENAME Failed",
+"RENAME Failed",
+);
+
+my $actual;
+
+my @isarray=(
+"Rename an existing file",
+"Attempting to rename a non-existing file",
+"Attemting to rename an invalid source file name",
+"Attemting to rename an existing source file to an invalid destination file name",
+);
+
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed.\n";
+
+
+if($ftp->cwd("renamedir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty renamedir";
+}
+
+for($r=0;$r<4;$r++)
+{
+ if( $ftp->rename($renamefromlist[$r], $renametolist[$r]))
+ {
+ $actual="RENAME Successful";
+ }
+ else
+ {
+ $actual="RENAME Failed";
+ }
+ ok t_cmp ( $actual,$expected[$r],$isarray[$r]);
+}
+
+$ftp->quit() or die "Unable to quit\n" ;
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rest.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rest.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rest.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rest.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,72 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use File::Path;
+use File::stat;
+
+plan tests =>2 , need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+my $ftp;
+my $output="";
+#my $expected="REST Successful";
+my @expected = (
+"kfkjfl\r\n",
+"kfkjfl\n",
+);
+my $actual;
+my $getlisting="smallfile";
+my @isarray = (
+ 'PASV:Retrieve a small file in ASCII mode',
+ 'PASV:Retrieve a small file in Binary mode',
+# 'PORT:Retrieve a small file in ASCII mode',
+# 'PORT:Retrieve a small file in Binary mode',
+);
+
+my $mydir="$install_root/data/restdir";
+rmtree($mydir);
+mkdir $mydir;
+my $offset = 2;
+for($x=0;$x<1;$x++){
+ if ($x==0){
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+ }
+# else{
+# #Using Port mode of data transfer
+# $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 1) or die "Couldn't connect to $host\n";
+# }
+ $ftp->login("common","password") or die "Login failed";
+ for($r=0;$r<2;$r++){
+ $ftp->pasv();
+ unlink ( "$install_root/data/restdir/$getlisting" );
+ if ($r==0){
+ $ftp->ascii();
+ }
+ else{
+ $ftp->binary();
+ }
+ $ftp->restart("2");
+ $status=$ftp->get("/restlist/$getlisting","$install_root/data/restdir/$getlisting");
+ if(!$status){
+ die "Unable to retrieve file:/restlist/$getlisting\n";
+ }
+ open(READFILE,"< $install_root/data/restdir/$getlisting") or die "Can't open file for reading\n";
+ $text=<READFILE>;
+ my $len = length $text;
+ $actual= substr ($text, 0, $len-2);
+ close (READFILE);
+ $actual =$text;
+
+ ok t_cmp ( $actual,$expected[$r], $isarray[$r+2*$x]);
+ }
+ $ftp->quit() or die "Unable to quit";
+}
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/retr.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/retr.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/retr.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/retr.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,134 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 9, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+use File::Path;
+use File::stat;
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $ftp;
+my $output="";
+
+my @expected=(
+ 'RETR Successful',
+'text',
+ 'RETR Failed',
+ 'RETR Successful',
+ 'Hello World',
+ 'RETR Failed',
+ 'RETR Failed',
+ 'RETR Successful',
+ 'RETR Successful',
+);
+my $actual;
+
+
+my @getlisting=(
+ 'smallfile',
+ 'a.txt',
+ 'nonexisting',
+ 'smallfile',
+ 'a.out',
+ 'nonexisting',
+ 'retrtestdir',
+ 'bigretr',
+ 'zerobytes',
+);
+
+my @isarray=(
+ 'PASV:Retrieve a small file in ASCII mode',
+ 'PASV:Retrieve and verify contents of a text file in ASCII mode',
+ 'PASV:Retrieve a non-existing file in ASCII mode',
+ 'PASV:Retrieve a small file in Binary mode',
+ 'PASV:Retrieve and execute an executable file in Binary mode',
+ 'PASV:Retrieve a non-existing file in Binary mode',
+ 'PASV:Retrieve a directory',
+ 'PASV:Retrieve a big file',
+ 'PASV:Retrieve a file of size zero bytes',
+# 'PORT:Retrieve a small file in ASCII mode',
+# 'PORT:Retrieve and verify contents of a text file in ASCII mode',
+# 'PORT:Retrieve a non-existing file in ASCII mode',
+# 'PORT:Retrieve a small file in Binary mode',
+# 'PORT:Retrieve and execute an executable file in Binary mode',
+# 'PORT:Retrieve a non-existing file in Binary mode',
+# 'PORT:Retrieve a directory',
+# 'PORT:Retrieve a big file',
+# 'PORT:Retrieve a file of size zero bytes',
+);
+
+my $p;
+
+my $mydir="$install_root/data/retrdir";
+rmtree($mydir);
+mkdir $mydir;
+
+for ($x=0;$x<1;$x++){
+ if ($x==0){
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E', Debug =>0) or die "Couldn't connect to $host\n";
+ $p="pasv";
+ }
+# else{
+# #Using Port mode of data transfer
+# $ftp = Net::FTP->new($host,Port =>$port,Passive =>0) or die "Couldn't connect to $host\n";
+# $p="port";
+# }
+ $ftp->login("common","password") or die "Login failed";
+ for($r=0;$r<9;$r++){
+ $ftp->pasv();
+ if ($r==3 || $r==4 || $r==5){
+ $ftp->binary();
+ }
+ else{
+ $ftp->ascii();
+ }
+ $status=$ftp->get("/getlist/$getlisting[$r]","$install_root/data/retrdir/$getlisting[$r]$p");
+ # For seeing the actual sizes of the files retrieved,uncomment the following lines
+ #if(($r != 2) && ($r !=5)){
+ # my $file_size1 = stat("$install_root/data/retrdir/$getlisting[$r]$p")->size;
+ # my $file_size2 = stat("$install_root/ftpdocs/home/common/getlist/$getlisting[$r]")->size;
+ # print "Size:$file_size2,Received:$file_size1\n";
+ #}
+
+ if( $r==4 && defined($status)){
+ chmod 0777,"$install_root/data/retrdir/$getlisting[$r]$p";
+ my $prog="$install_root/data/retrdir/$getlisting[$r]$p";
+ print "\nExecuting program:$prog\n";
+ $output = `$prog` ;
+ print "Output is:\n$output\n\n";
+ chomp($output);
+ $actual=$output;
+ }
+ else{
+ if ($r==1){
+ open(READFILE,"< $install_root/data/retrdir/$getlisting[$r]$p") or die "Can't open file for reading\n";
+ $text=<READFILE>;
+ my $len = length $text;
+ $actual=substr ($text, 0, $len-2);
+ print "LENGTH = $len\n";
+ close (READFILE);
+ }
+ else{
+ if (defined($status)){
+ $actual="RETR Successful";
+ }
+ else{
+ $actual="RETR Failed";
+ }
+ }
+ }
+ ok t_cmp ( $actual,$expected[$r], $isarray[$r+9*$x]);
+ }
+$ftp->quit() or die "Unable to quit";
+#rmtree($mydir);
+mkdir $mydir;
+}
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rmd.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rmd.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rmd.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/rmd.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,72 @@
+use Ssl::FTPSSL;
+use File::Path;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 5, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+$username = ("common");
+$password = ("password");
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/rmddir";
+my $mydir1="$install_root/data/rmddir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+
+my @rmdlist=(
+ 'rmd_dir',
+ 'rmd_nonexistingdir',
+ 'rmd_file',
+ 'rmd_nonemptydir',
+ 'invalid/dirname',
+);
+
+$r=0;
+
+@expected =(
+ "RMD Successful",
+ "RMD Failed",
+ "RMD Failed",
+ "RMD Failed",
+ "RMD Failed",
+);
+
+my $actual;
+
+my @isarray=(
+ "Remove an existing directory",
+ "Remove a non-existing directory",
+ "Remove a file",
+ "Remove a non-empty directory",
+ "Remove a directory with invalid directory name ",
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if($ftp->cwd("rmddir")){
+}
+else{
+ die "Couldn't change to directoty rmddir";
+}
+
+for($r=0;$r<5;$r++){
+ if( $ftp->rmdir($rmdlist[$r])){
+ $actual="RMD Successful";
+ }
+ else{
+ $actual="RMD Failed";
+ }
+ ok t_cmp ( $actual,$expected[$r],$isarray[$r]);
+}
+$ftp->quit or die "Unable to quit\n" ;
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/size.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/size.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/size.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/size.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,53 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = ("common");
+$password = ("password");
+
+my @filelist;
+
+my @expected =(
+ "SIZE Successful",
+ "SIZE Successful",
+);
+
+my $actual;
+
+@isarray=(
+ 'PASV:Issue SIZE Command',
+ 'PORT:Issue SIZE Command',
+);
+
+#Using Passive mode of data transfer
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n";
+
+if($ftp->cwd("getlist")){
+}
+else{
+ die "Couldn't change to directoty getlist";
+}
+my $filesize=0;
+$filesize=$ftp->size("bigretr");
+if($filesize == "67025184"){
+ $actual = "SIZE Successful";
+}
+else{
+ $actual = "SIZE Failed";
+}
+ok t_cmp ( $actual,$expected[0], $isarray[0]);
+$ftp->quit() or die "Unable to quit\n";
+
+#Using Port mode of data transfer
+#$ftp = Net::FTP->new($host,Port=>$port,Passive =>0) or die "Couldn't connect to $host\n";
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/stor.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/stor.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/stor.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/stor.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,140 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use File::Path;
+use File::stat;
+
+plan tests => 8, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $ftp;
+my $output;
+
+my @expected=(
+ 'STOR Successful',
+ 'text
+',
+ 'STOR Failed',
+ 'STOR Successful',
+ 'Hello World',
+ 'STOR Failed',
+ 'STOR Successful',
+ 'STOR Successful',
+);
+my $actual;
+
+
+my @putlisting=(
+ 'smallfile',
+ 'a.txt',
+ 'nonexisting',
+ 'smallfile',
+ 'a.out',
+ 'nonexisting',
+ 'bigstor',
+ 'zerobytes',
+);
+my @isarray=(
+ 'PASV:Storing a small file in ASCII mode',
+ 'PASV:Store and verify contents of a text file in ASCII mode',
+ 'PASV:Storing a non-existing file in ASCII mode',
+ 'PASV:Storing a small file in binary mode',
+ 'PASV:Store and execute an executable file in Binary mode',
+ 'PASV:Storing a non-existing file in binary mode',
+ 'PASV:Storing a big file',
+ 'PASV:Storing a file of size zero bytes',
+# 'PORT:Storing a small file in ASCII mode',
+# 'PORT:Store and verify contents of a text file in ASCII mode',
+# 'PORT:Storing a non-existing file in ASCII mode',
+# 'PORT:Storing a small file in binary mode',
+# 'PORT:Store and execute an executable file in Binary mode',
+# 'PORT:Storing a non-existing file in binary mode',
+# 'PORT:Storing a big file',
+# 'PORT:Storing a file of size zero bytes',
+
+);
+
+my $p;
+
+my $mydir="$install_root/ftpdocs/home/common/putlist";
+rmtree($mydir);
+mkdir $mydir;
+
+for ($x=0;$x<1;$x++){
+ if ($x==0){
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+ $p="pasv";
+ }
+# else{
+# #Using Port mode of data transfer
+# $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 1) or die "Couldn't connect to $host\n";
+# $p="port";
+# }
+ $ftp->login('common','password') or die "Login failed";
+
+ $ftp->cwd("putlist");
+
+ for($r=0;$r<8;$r++){
+ $ftp->pasv();
+ my $g=$r+8*$x;
+ if ($r==3 || $r==4 || $r==5){
+ $ftp->binary();
+ }
+ else{
+ $ftp->ascii();
+ }
+ $status=$ftp->put("$install_root/data/stordir/$putlisting[$r]","$putlisting[$r]$p");
+ # For seeing the actual sizes of the files stored,uncomment the following lines
+ #if(($r != 2) && ($r !=5))
+ #{
+ # my $file_size1 = stat("$install_root/ftpdocs/home/common/putlist/$putlisting[$r]$p")->size;
+ # my $file_size2 = stat("$install_root/data/stordir/$putlisting[$r]")->size;
+ # print "Size:$file_size2,Stored:$file_size1\n";
+ #}
+ if ($r==1){
+ open(READFILE,"$install_root/ftpdocs/home/common/putlist/$putlisting[$r]$p") or die "Can't open file for reading $!\n";
+ $text=<READFILE>;
+ $actual=$text;
+ close (READFILE);
+ }
+ else{
+ if( $r==4){
+ chmod 0777,"$install_root/ftpdocs/home/common/putlist/$putlisting[$r]$p";
+ my $prog="$install_root/ftpdocs/home/common/putlist/$putlisting[$r]$p";
+ print "\nExecuting program $prog\n";
+ $output =`$prog`;
+ print "Output is:\n$output\n\n";
+ chomp($output);
+ $actual=$output;
+ }
+ else{
+ if (defined($status)){
+ $actual="STOR Successful";
+ }
+ else{
+ $actual="STOR Failed";
+ }
+
+ }
+
+
+ }
+
+ ok t_cmp( $actual,$expected[$r],$isarray[$r+8*$x]);
+
+ }
+$ftp->quit() or die "Unable to quit";
+
+}
+rmtree($mydir);
+mkdir $mydir;
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/syst.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/syst.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/syst.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/syst.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,30 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $actual;
+my $expected='Success';
+my $isarray='SYST command';
+
+my $username = "common";
+my $password = "password";
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if ($ftp->syst()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray);
+$ftp->quit();
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/timeouts.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/timeouts.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/timeouts.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/timeouts.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,120 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 6, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my @expected=(
+ 'Login Failed',
+ 'Login Successful',
+ 'CDUP Failed',
+ 'CDUP Successful',
+ 'LIST Failed',
+ 'LIST Successful',
+);
+
+my @isarray=(
+ 'Logging in after TimeoutLogin occurs ',
+ 'Logging in before TimeoutLogin occurs',
+ 'Logged in and giving CDUP after TimeoutIdle occurs',
+ 'Logged in and giving CDUP before TimeoutIdle occurs',
+ 'Issued a PASV command and giving LIST after TimeoutData occurs',
+ 'Issued a PASV command and giving LIST before TimeoutData occurs',
+);
+
+my $actual;
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+
+#FTPTimeoutLogin 10
+#-------------------
+
+sleep(21);
+
+if($ftp->login("common","password")){
+ $actual="Login Successful";
+}
+else{
+ $actual="Login Failed";
+}
+ok t_cmp ( $actual,$expected[0],$isarray[0]);
+#$ftp->quit() ;
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+sleep(3);
+if($ftp->login("common","password")){
+ $actual="Login Successful";
+}
+else{
+ $actual="Login Failed";
+}
+ok t_cmp ( $actual,$expected[1],$isarray[1]);
+$ftp->quit() or die "Unable to quit";
+#FTPTimeoutIdle 10
+#-------------------
+
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+$ftp->login("common","password") or die"Login failed.\n";
+sleep(21);
+if($ftp->cdup()){
+ $actual="CDUP Successful";
+}
+else{
+ $actual="CDUP Failed";
+}
+ok t_cmp ( $actual,$expected[2],$isarray[2]);
+#$ftp->quit() ;
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+$ftp->login("common","password") or die"Login failed.\n";
+sleep(3);
+if($ftp->cdup()){
+ $actual="CDUP Successful";
+}
+else{
+ $actual="CDUP Failed";
+}
+ok t_cmp ( $actual,$expected[3],$isarray[3]);
+$ftp->quit() or die "Unable to quit";
+
+#FTPTimeoutData 10
+#-------------------
+
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+
+$ftp->login("common","password") or die"Login failed.\n";
+
+$ftp->pasv();
+
+sleep(21);
+if($ftp->list()){
+ $actual="LIST Successful";
+}
+else{
+ $actual="LIST Failed";
+}
+ok t_cmp ( $actual,$expected[4],$isarray[4]);
+
+$ftp->quit() ;
+
+$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'E',Debug =>0) or die "Couldn't connect to $host\n";
+
+$ftp->login("common","password") or die"Login failed.\n";
+
+$ftp->pasv();
+
+sleep(3);
+
+if($ftp->list()){
+ $actual="LIST Successful";
+}
+else{
+ $actual="LIST Failed";
+}
+ok t_cmp ( $actual,$expected[5],$isarray[5]);
+
+$ftp->quit() or die "Unable to quit";
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/type.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/type.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/type.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_exp_ssl/type.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,87 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 7, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_explicit');
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $username = "common";
+my $password = "password";
+my $actual;
+my $expected='Success';
+
+my @isarray=(
+'TYPE A command',
+'TYPE B command',
+'TYPE E command',
+'TYPE I command',
+'TYPE ASCII command',
+'TYPE BINARY command',
+'TYPE FOO command',
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'E',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if ($ftp->A()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[0]);
+
+if ($ftp->B()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[1]);
+
+if ($ftp->E()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[2]);
+
+if ($ftp->I()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[3]);
+
+if ($ftp->ascii()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[4]);
+
+if ($ftp->binary()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[5]);
+
+if ($ftp->foo()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray[6]);
+
+$ftp->quit();
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/aa_setup.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/aa_setup.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/aa_setup.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/aa_setup.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,75 @@
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+plan tests => 4, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $config = Apache::Test::config();
+my $basedir = $config->{httpd_basedir};
+my $libtool = "$basedir/build/libtool";
+
+#This script will auto-generate a file of 61 MB.
+open (BIG_FILE, "> $install_root/data/stordir/bigstor");
+for(my $i=0; $i <5585432; $i++) {
+ print BIG_FILE "abcdefghijkl";
+}
+close (BIG_FILE);
+
+if (!(-e "$install_root/ftpdocs/home/common/getlist/bigretr"))
+{
+ @command=("ln","-s", "$install_root/data/stordir/bigstor", "$install_root/ftpdocs/home/common/getlist/bigretr");
+ system ( @command);
+}
+
+if (!(-e "$install_root/ftpdocs/home/common/abor/bigretr"))
+{
+ @command=("ln","-s", "$install_root/data/stordir/bigstor", "$install_root/ftpdocs/home/common/abor/bigretr");
+ system ( @command);
+}
+
+
+#This script will compile a c program and create a file a.out, which will be used for testing using binary files.It also copies the a.out file created into the appropriate directories, which will be used for testing by other scripts.
+my $datadir="$document_root/ftp/data/";
+
+if($^O eq "hpux"){
+ @command=( "cc", "-c","$datadir/hello.c", "-o", "$datadir/a.o" );
+ system ( @command );
+
+ @command=( "/usr/ccs/bin/ld", "/usr/ccs/lib/crt0.o", "-u", "main", "-o", "$datadir/a.out", "$datadir/a.o", "-lc");
+ system ( @command );
+ print "...$command[0] $command[1] $command[2]\n";
+}
+else {
+ @command=("cc","$datadir/hello.c" , "-o", "$datadir/a.out");
+ system ( @command );
+}
+
+@command=( "chmod","777", "$datadir/a.out");
+system ( @command );
+
+sub makeprog {
+ $dir=$_[0];
+
+ @command=( "cp","$datadir/a.out", "$dir");
+ system ( @command );
+
+ $expected = "File Exists";
+ $actual="";
+ $actual="File Exists" if -e "$dir/a.out";
+ ok t_cmp($actual,$expected,"Check if the a.out file exists");
+
+ $expected = "File is executable";
+ $actual="";
+ $actual="File is executable" if -x "$dir/a.out";
+ ok t_cmp($actual,$expected,"Check if the a.out file is executable");
+}
+
+#setup an executable file in "getlist" dir.
+makeprog("$install_root/ftpdocs/home/common/getlist");
+
+#setup an executable file in "stordir" dir.
+makeprog("$install_root/data/stordir");
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/accesstransfer.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/accesstransfer.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/accesstransfer.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/accesstransfer.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,180 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 11, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $i=0;
+
+
+my @username=(
+"common",
+'incorrect',
+);
+
+my @password=(
+"password",
+"password",
+'incorrect',
+);
+
+my @expected=(
+'Login Successful',
+'Login Failed',
+'Login Failed',
+'CWD Successful',
+'CWD Failed',
+'CDUP Successful',
+'CDUP Successful',
+#'PORT Successful',
+'PASV Successful',
+'TYPE A Successful',
+'TYPE I Successful',
+'Quit Successful',
+
+);
+
+my @isarray=(
+'Login as normal user',
+'Attempting to Login with incorrect username',
+'Attempting to login as normal user and incorrect password',
+'Change working directory to existing directory',
+'Change working directory to a non-existing directory',
+'Giving CDUP command from a sub-directory',
+'Giving CDUP command from root directory',
+#'PORT Command',
+'PASV Command',
+'Type set to ASCII',
+'Type set to Binary',
+'Quit',
+);
+
+
+my $actual;
+
+for ($r=0;$r<2;$r++)
+{
+ my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+ if ($ftp->login($username[$r],$password[$r]))
+ {
+ $actual="Login Successful";
+ }
+ else
+ {
+ $actual="Login Failed";
+ }
+ ok t_cmp( $actual,$expected[$i], $isarray[$i]);
+
+ $i=$i+1;
+ $ftp->quit() or die "Unable to quit";
+}
+
+
+#Opening a new session as default MaxLoginAttempts (3) is reached in previous session
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login("common","password") or die "Login failed";
+
+my @subdir=(
+'cwdtestdir',
+'nonexisting',
+);
+
+
+for ($r=0;$r<2;$r++)
+{
+ if ($ftp->cwd($subdir[$r]))
+ {
+ $actual="CWD Successful";
+ }
+ else
+ {
+ $actual="CWD Failed";
+ }
+ ok t_cmp( $actual,$expected[$i] , $isarray[$i]);
+ $i=$i+1;
+}
+
+for ($r=0;$r<2;$r++)
+{
+ if ($ftp->cdup())
+ {
+ $actual="CDUP Successful";
+ }
+ else
+ {
+ $actual="CDUP Failed";
+ }
+ ok t_cmp( $actual,$expected[$i], $isarray[$i]);
+ $i=$i+1;
+
+}
+
+#if ($ftp->port())
+#{
+# $actual="PORT Successful";
+#}
+#else
+#{
+# $actual="PORT Failed";
+#}
+#ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
+
+#$i=$i+1;
+
+
+if ($ftp->pasv())
+{
+ $actual="PASV Successful";
+}
+else
+{
+ $actual="PASV Failed";
+}
+ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
+
+$i=$i+1;
+
+if ($ftp->ascii())
+{
+ $actual="TYPE A Successful";
+}
+else
+{
+ $actual="TYPE A Failed";
+}
+ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
+
+$i=$i+1;
+
+
+if ($ftp->binary())
+{
+ $actual="TYPE I Successful";
+}
+else
+{
+ $actual="TYPE I Failed";
+}
+ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
+
+$i=$i+1;
+
+
+if ($ftp->quit())
+{
+ $actual="Quit Successful";
+}
+else
+{
+ $actual="Quit Failed";
+}
+
+ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_limitlogin.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_limitlogin.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_limitlogin.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_limitlogin.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,141 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 6, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_anon_host');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my @expected=(
+ 'Test Successful',
+ 'Test Failed',
+ 'Test Successful',
+);
+my $actual='Test Successful';
+
+my @username=(
+ "anonymous",
+ "ftp",
+ "ftp1",
+);
+
+my $password="@.";
+
+
+my $j=0;
+
+#LimitLoginServer 2
+#LimitLoginUser 2
+
+my @isarray=(
+ "\nUser:Anonymous\nLogging in twice using same username",
+ "\nUser:Anonymous\nLogging in third time using same username",
+ "\nUser:Anonymous\nLogout once and Login again using same username",
+ "\nUser:Anonymous\nLogging in twice using different usernames",
+ "\nUser:Anonymous\nLogging in third time using different username",
+ "\nUser:Anonymous\nLogout once and Login again using different username",
+);
+
+$actual="Test Successful";
+my $ftp1;
+my $ftp2;
+my $ftp3;
+
+
+########### Test with same username ###########
+
+
+$ftp1 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp1->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+sleep(3);
+
+$ftp2 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp2->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[0],$isarray[$j]);
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[0],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[1],$isarray[$j+1]);
+
+$ftp3->quit();
+$ftp1->quit();
+
+sleep(3);
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+
+if($ftp3->login($username[0],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[2],$isarray[$j+2]);
+
+$ftp2->quit();
+$ftp3->quit();
+
+########### Test with different usernames ###########
+
+$actual="Test Successful";
+
+$ftp1 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp1->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+sleep(3);
+
+$ftp2 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp2->login($username[1],$password))){
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[0],$isarray[$j]);
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[2],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[1],$isarray[$j+1]);
+
+$ftp3->quit();
+$ftp1->quit();
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[2],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[2],$isarray[$j+2]);
+$ftp2->quit();
+$ftp3->quit();
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_login.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_login.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_login.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/anon_login.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,51 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 2, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_anon_host');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $i=0;
+
+
+my @username=(
+ "anonymous",
+ "anonymous",
+);
+
+my @password=(
+ "@.",
+ 'xx',
+);
+
+my @expected=(
+ 'Login Successful',
+ 'Login Failed',
+);
+
+my @isarray=(
+ 'Login as anonymous user',
+ 'Attempting to login as anonymous user and incorrect e-mail id',
+);
+
+
+
+my $actual;
+for ($r=0;$r<2;$r++){
+ my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+ if ($ftp->login($username[$r],$password[$r])){
+ $actual="Login Successful";
+ }
+ else{
+ $actual="Login Failed";
+ }
+ ok t_cmp ( $actual,$expected[$i], $isarray[$i]);
+
+ $i=$i+1;
+ $ftp->quit() or die "Unable to quit";
+}
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/append.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/append.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/append.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/append.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,146 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 10, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+use File::Path;
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/appenddir";
+my $mydir1="$install_root/data/appenddir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+my $ftp;
+
+
+
+my @expected=(
+ 'APPE Successful',
+ 'APPE Successful',
+ 'APPE Failed',
+ 'APPE Successful',
+ 'APPE Successful',
+ 'APPE Successful',
+ 'APPE Successful',
+ 'APPE Failed',
+ 'APPE Successful',
+ 'APPE Successful',
+# 'APPE Successful',
+# 'APPE Successful',
+# 'APPE Failed',
+# 'APPE Successful',
+# 'APPE Successful',
+# 'APPE Successful',
+# 'APPE Successful',
+# 'APPE Failed',
+# 'APPE Successful',
+# 'APPE Successful',
+);
+
+my $actual;
+
+my @isarray=(
+ 'PASV:Append local file to existing remote file in ASCII mode',
+ 'PASV:Append local file to non-existing remote file in ASCII mode',
+ 'PASV:Attempting to append a non-existing file',
+ 'PASV:Append zero bytes file to existing remote file in ASCII mode',
+ 'PASV:Append zero bytes file to non-existing remote file in ASCII mode',
+ 'PASV:Append local file to existing remote file in Binary mode',
+ 'PASV:Append local file to non-existing remote file in Binary mode',
+ 'PASV:Attempting to append a non-existing file',
+ 'PASV:Append zero bytes file to existing remote file in Binary mode',
+ 'PASV:Append zero bytes file to non-existing remote file in Binary mode',
+ # 'PORT:Append local file to existing remote file in ASCII mode',
+ # 'PORT:Append local file to non-existing remote file in ASCII mode',
+ # 'PORT:Attempting to append a non-existing file',
+ # 'PORT:Append zero bytes file to existing remote file in ASCII mode',
+ # 'PORT:Append zero bytes file to non-existing remote file in ASCII mode',
+ # 'PORT:Append local file to existing remote file in Binary mode',
+ # 'PORT:Append local file to non-existing remote file in Binary mode',
+ # 'PORT:Attempting to append a non-existing file',
+ # 'PORT:Append zero bytes file to existing remote file in Binary mode',
+ # 'PORT:Append zero bytes file to non-existing remote file in Binary mode',
+);
+
+my @locallisting=(
+ 'app1',
+ 'app2',
+ 'nonexisting',
+ 'zerobytes',
+ 'zerobytes',
+ 'app3',
+ 'app4',
+ 'nonexisting',
+ 'zerobytes',
+ 'zerobytes',
+);
+
+my @remotelisting=(
+ 'remoteapp1',
+ '',
+ 'remoteapp1',
+ 'appzero',
+ '',
+ 'remoteapp3',
+ '',
+ 'remoteapp3',
+ 'appzero',
+ '',
+);
+
+
+
+for ($x=0;$x<1;$x++){
+ if ($x==0){
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+ }
+# else{
+# #Using Port mode of data transfer
+# $ftp = Net::FTP->new($host,Port =>$port,Encryption =>'I', Debug =>0) or die "Couldn't connect to $host\n";
+# }
+
+ $ftp->login("common","password") or die "Login failed";
+
+ for($r=0;$r<10;$r++){
+ $ftp->pasv();
+ if ($r>4){
+ $ftp->binary();
+ }
+ else{
+ $ftp->ascii();
+ }
+
+
+ if (($r==0) ||($r==2) ||($r==3) ||($r==5) ||($r==7)||($r==8)){
+ $status=$ftp->append("$install_root/data/appenddir/$locallisting[$r]","appenddir/$remotelisting[$r]");
+ }
+ else{
+ $ftp->cwd("appenddir");
+ $status=$ftp->append("$install_root/data/appenddir/$locallisting[$r]");
+ $ftp->cdup();
+ }
+ if (defined($status)){
+ $actual="APPE Successful";
+ }
+ else{
+ $actual="APPE Failed";
+ }
+
+ ok t_cmp ($actual , $expected[$r+10*$x], $isarray[$r+10*$x]);
+
+
+ }
+
+}
+$ftp->quit() or die "Unable to quit";
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/dele.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/dele.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/dele.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/dele.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,78 @@
+use Ssl::FTPSSL;
+use File::Path;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 4, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/deledir";
+my $mydir1="$install_root/data/deledir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+
+my $username = "common";
+my $password = "password";
+
+my @deletelist=(
+'dele_file',
+'dele_nonexistfile',
+'dele_dir',
+'dele_nonemptydir',
+);
+
+$r=0;
+
+my @expected =(
+"DELE Successful",
+"DELE Failed",
+"DELE Successful",
+"DELE Failed",
+);
+
+my $actual;
+
+my @isarray=(
+"Delete an existing file",
+"Delete a non-existing file",
+"Delete an empty directory",
+"Attempting to delete a non-empty directory",
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if($ftp->cwd("deledir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty deledir";
+}
+
+for($r=0;$r<4;$r++)
+{
+ if( $ftp->delete($deletelist[$r]))
+ {
+ $actual="DELE Successful";
+ }
+ else
+ {
+ $actual="DELE Failed";
+ }
+ ok t_cmp ( $actual,$expected[$r],$isarray[$r]);
+}
+
+$ftp->quit() or die "Unable to quit\n";
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/help.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/help.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/help.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/help.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,33 @@
+use Ssl::FTPSSL;
+use Carp qw( carp croak );
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $username = "common";
+my $password = "password";
+
+my $actual;
+my $expected='Success';
+my $isarray= 'HELP command successful';
+
+my $ftp = Ssl::FTPSSL->new($host, Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if ($ftp->help()) {
+ $actual="Success";
+}
+else{
+ $actual="Failure";
+}
+ok t_cmp ($actual,$expected,$isarray);
+
+$ftp->close();
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/homeDir.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/homeDir.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/homeDir.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/homeDir.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,110 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 3, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my @username=(
+ "user1",
+ "user2",
+ "user3",
+);
+my $password = "password";
+
+#$dirName;
+
+my $r=0;
+
+my @directivestring=(
+ "FTPHomeDir",
+ "FTPJailUser",
+ "FTPOptions CreateHomeDirs"
+);
+
+my @expected =(
+ "FTPHomeDir Successful",
+ "FTPJailUser Successful",
+ "FTPOptions CreateHomeDirs Successful",
+);
+
+my $actual;
+my @isarray=(
+ "FTPHomeDir:Log into user's home directory",
+ "FTPJailUser: Attempting to change to a root directory",
+ "FTPOptions CreateHomeDirs:User whose home directory is not present, is logged in after the home directory is created",
+);
+
+rmdir("$install_root/ftpdocs/home/user3");
+my $ftp = Ssl::FTPSSL->new($host,Port=>$port,Encryption =>'I',Debug => 0 ) or die "Couldn't connect to $host\n";
+
+for($r=0;$r<3;$r++){
+ $ftp->login("$username[$r]", $password) or die "Login Failed. \n";
+ $ftp->pasv();
+ if($r==0){
+ my @filelist=$ftp->nlst();
+ if(@filelist!=0){
+ my $fileLine = $filelist[0];
+ chomp $fileLine;
+ my ($name,$other)=split(/\s+/,$fileLine);
+ if($name eq "user1.txt"){
+ $actual ="$directivestring[$r] Successful";
+ }
+ else{
+ $actual ="$directivestring[$r] Failed";
+ }
+ }
+ else{
+ die "NLST Failed \n";
+ }
+
+ }
+
+
+ if($r==1){
+ #$dirname1= $ftp->pwd();
+ $ftp->cdup();
+ #$dirname2= $ftp->pwd();
+ my @filelist=$ftp->nlst();
+ if(@filelist!=0){
+ my $fileLine = $filelist[0];
+ chomp $fileLine;
+ my ($name,$other)=split(/\s+/,$fileLine);
+ if($name eq "user2.txt"){
+ $actual ="$directivestring[$r] Successful";
+ }
+ else{
+ $actual ="$directivestring[$r] Failed";
+ }
+ }
+ else{
+ die "NLST Failed \n";
+ }
+ }
+
+
+ if($r==2){
+ my @filelist=$ftp->nlst();
+ if(@filelist==0){
+ $actual ="$directivestring[$r] Successful";
+ }
+ else{
+ $actual ="$directivestring[$r] Failed";
+ }
+
+
+ }
+
+
+ ok t_cmp ( $actual,$expected[$r], $isarray[$r]);
+
+}
+$ftp->quit() or die "Unable to quit\n";
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/limitlogin.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/limitlogin.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/limitlogin.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/limitlogin.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,141 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 6, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my @expected=(
+ 'Test Successful',
+ 'Test Failed',
+ 'Test Successful',
+);
+my $actual;
+
+my @username=(
+ "user1",
+ "user2",
+ "user3",
+);
+
+my $password="password";
+
+
+my $j=0;
+
+#LimitLoginServer 2
+#LimitLoginUser 2
+
+my @isarray=(
+ "\nUser:Normal\nLogging in twice using same username",
+ "\nUser:Normal\nLogging in third time using same username",
+ "\nUser:Normal\nLogout once and Login again using same username",
+ "\nUser:Normal\nLogging in twice using different usernames",
+ "\nUser:Normal\nLogging in third time using different username",
+ "\nUser:Normal\nLogout once and Login again using different username",
+);
+
+$actual="Test Successful";
+my $ftp1;
+my $ftp2;
+my $ftp3;
+
+
+########### Test with same username ###########
+
+
+$ftp1 = Ssl::FTPSSL->new($host,Port =>$port, Encryption => 'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp1->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+sleep(3);
+
+$ftp2 = Ssl::FTPSSL->new($host,Port =>$port, Encryption => 'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp2->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[0],$isarray[$j]);
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port, Encryption => 'I',Debug =>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[0],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[1],$isarray[$j+1]);
+
+$ftp3->quit();
+$ftp1->quit();
+
+sleep(3);
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port, Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+
+if($ftp3->login($username[0],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[2],$isarray[$j+2]);
+
+$ftp2->quit();
+$ftp3->quit();
+
+########### Test with different usernames ###########
+
+$actual="Test Successful";
+
+$ftp1 = Ssl::FTPSSL->new($host,Port =>$port, Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp1->login($username[0],$password))){
+ $actual="Test Failed";
+}
+
+sleep(3);
+
+$ftp2 = Ssl::FTPSSL->new($host,Port =>$port, Encryption =>'I',Debug =>0) or die "Couldn't connect to $host\n";
+if(!($ftp2->login($username[1],$password))){
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[0],$isarray[$j]);
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I', Debug=>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[2],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[1],$isarray[$j+1]);
+
+$ftp3->quit();
+$ftp1->quit();
+
+sleep(3);
+
+$ftp3 = Ssl::FTPSSL->new($host,Port =>$port, Encryption => 'I',Debug =>0) or die "Couldn't connect to $host\n";
+if($ftp3->login($username[2],$password)){
+ $actual="Test Successful";
+}
+else {
+ $actual="Test Failed";
+}
+
+ok t_cmp ( $actual,$expected[2],$isarray[$j+2]);
+$ftp2->quit();
+$ftp3->quit();
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/list.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/list.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/list.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/list.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,239 @@
+use Ssl::FTPSSL;
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+plan tests => 19, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = ("common");
+$password = ("password");
+
+#$listFileName = "listFile";
+my @filelist;
+my $l;
+my @expected =(
+"LIST * Successful",
+"LIST *.html Successful",
+"LIST a*b Successful",
+"LIST 3* Successful",
+"LIST *3 Successful",
+"LIST *i* Successful",
+"LIST a* b* Successful",
+"LIST *.* Successful",
+"LIST q Successful",
+"LIST a/* Successful",
+"LIST 2*2* Successful",
+"LIST a* Successful",
+"LIST 9* Successful",
+"LIST b Successful",
+"LIST a*b Successful",
+"LIST b* Successful",
+"LIST q* Successful",
+"LIST *q Successful",
+"LIST 12* Successful",
+);
+
+my $actual;
+
+my @isarray_pasv=(
+'PASV:Issue LIST * Command',
+'PASV:Issue LIST *.html Command',
+'PASV:Issue LIST a*b Command',
+'PASV:Issue LIST 3* Command',
+'PASV:Issue LIST *3 Command',
+'PASV:Issue LIST *i* Command',
+'PASV:Issue LIST a* b* Command',
+'PASV:Issue LIST *.* Command',
+'PASV:Issue LIST q Command',
+'PASV:Issue LIST a/* Command',
+'PASV:Issue LIST 2*2* Command',
+'PASV:Issue LIST a* Command',
+'PASV:Issue LIST 9* Command',
+'PASV:Issue LIST b Command',
+'PASV:Issue LIST a*b Command',
+'PASV:Issue LIST b* Command',
+'PASV:Issue LIST q* Command',
+'PASV:Issue LIST *q Command',
+'PASV:Issue LIST 12* Command',
+);
+my @isarray_port=(
+'PORT:Issue LIST * Command',
+'PORT:Issue LIST *.html Command',
+'PORT:Issue LIST a*b Command',
+'PORT:Issue LIST 3* Command',
+'PORT:Issue LIST *3 Command',
+'PORT:Issue LIST *i* Command',
+'PORT:Issue LIST a*b* Command',
+'PORT:Issue LIST *.* Command',
+'PORT:Issue LIST q Command',
+'PORT:Issue LIST a/* Command',
+'PORT:Issue LIST 2*2* Command',
+'PORT:Issue LIST a* Command',
+'PORT:Issue LIST 9* Command',
+'PORT:Issue LIST b Command',
+'PORT:Issue LIST a*b Command',
+'PORT:Issue LIST b* Command',
+'PORT:Issue LIST q* Command',
+'PORT:Issue LIST *q Command',
+'PORT:Issue LIST 12* Command',
+);
+
+#########################################################################################
+my @commandlist = ("*","*.html","a*b","3*","*3","*i*","a* b*","*.*","q","a/*","2*2*","a*","9*","b","a*b","b*","q*","*q","12*");
+my @expectedlist = (
+["123456","23452345","344","543","980","a","a.html","abcde","acdefb","aoJjugb","b","b.html","bcdef","faqs","list.txt","q","quick"],
+["a.html","b.html"],
+["acdefb","aoJjugb"],
+["344"],
+["543"],
+["list.txt","quick"],
+["a.html","abcde","acdefb"],
+["a.html","b.html","list.txt"],
+["q"],
+["1.txt","2.txt"],
+["23452345"],
+["a.html","abcde","acdefb","aoJjugb"],
+["980"],
+["b"],
+["acdefb","aoJjugb"],
+["b","b.html","bcdef"],
+["q","quick"],
+["q"],
+["123456"],
+);
+my $flag_value = "true";
+my $i = 0;
+my @filelist_one=("true");
+##########################################################################################
+###########################################################################################
+#Using Passive mode of data transfer
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n";
+
+
+if($ftp->cwd("list_dir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty list_dir";
+}
+########################################################
+for ($i = 0; $i < 19; $i += 1)
+{
+ $ftp->pasv();
+ @filelist=$ftp->list($commandlist[$i]);
+ if(@filelist!=0)
+ {
+ my $k = 0;
+ while($filelist[$k] && $expectedlist[$i][$k])
+ {
+ my $fileLine = $filelist[$k];
+ chomp $fileLine;
+ my ($perm,$unkn,$user,$group,$size,$mo,$day,$time,$name)=split(/\s+/,$fileLine);
+ $filelist_one[$k]=$name;
+ print $name;
+ $l++;
+
+ if($filelist_one[$k] eq $expectedlist[$i][$k])
+ {
+ $k++;
+ }
+ else
+ {
+ $flag_value = "false";
+ $k++;
+ }
+
+ }
+ if ($flag_value eq "false")
+ {
+ $actual = "LIST $commandlist[$i] Failed";
+
+ }
+ else
+ {
+ $actual = "LIST $commandlist[$i] Successful";
+ }
+
+ ok t_cmp ($actual,$expected[$i],$isarray_pasv[$i]);
+ }
+ else
+ {
+ die "LIST * Failed \n";
+ }
+
+}
+
+#####################################################
+$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+##############################################################################################
+#Using Passive mode of data transfer
+#$ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 1) or die "Couldn't connect to $host\n";
+#
+#$ftp->login($username, $password) or die "Login failed\n";
+#
+#if($ftp->cwd("list_dir"))
+#{
+#}
+#else
+#{
+# die "Couldn't change to directoty list_dir";
+#}
+#######################################################
+#for ($i = 0; $i < 19; $i += 1)
+#{
+# $ftp->pasv();
+# @filelist=$ftp->list($commandlist[$i]);
+# if(@filelist!=0)
+# {
+# my $k = 0;
+# while($filelist[$k] && $expectedlist[$i][$k])
+# {
+# my $fileLine = $filelist[$k];
+# chomp $fileLine;
+# my ($perm,$unkn,$user,$group,$size,$mo,$day,$time,$name)=split(/\s+/,$fileLine);
+# $filelist_one[$k]=$name;
+# $l++;
+#
+# if($filelist_one[$k] eq $expectedlist[$i][$k])
+# {
+# $k++;
+# }
+# else
+# {
+# $flag_value = "false";
+# $k++;
+# }
+#
+# }
+# if ($flag_value eq "false")
+# {
+# $actual = "LIST $commandlist[$i] Failed";
+#
+# }
+# else
+# {
+# $actual = "LIST $commandlist[$i] Successful";
+# }
+#
+# ok t_cmp ($actual,$expected[$i],$isarray_port[$i]);
+# }
+# else
+# {
+# die "LIST * Failed \n";
+# }
+#
+#}
+
+#####################################################
+#$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/maxloginattempt.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/maxloginattempt.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/maxloginattempt.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/maxloginattempt.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,63 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests => 2, need_module 'mod_ftp' , need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = "common";
+$correct_password = "password";
+
+
+$wrong_password = "wrong_password";
+
+my $r=0;
+
+my @expected =(
+ "MaxLoginAttempts Successful",
+ "MaxLoginAttempts Failed",
+);
+
+my $actual;
+
+my @isarray=(
+ "MaxLoginAttempts 3: Login twice using incorrect logon credentials.Login third time successfully using correct logon credentials.",
+ "MaxLoginAttempts 3: Login thrice using incorrect logon credentials.Attempting to login fourth timeusing correct logon credentials(unsuccessful).",
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port=>$port,Encryption =>'I', Debug =>0) or die "Couldn't connect to $host\n";
+
+
+if($ftp->login($username, $wrong_password)==0
+ && $ftp->login($username, $wrong_password)==0
+ && $ftp->login($username, $correct_password) ){
+ $actual="MaxLoginAttempts Successful";
+}
+else{
+ $actual="MaxLoginAttempts Failed";
+}
+
+ok t_cmp ( $actual,$expected[$r], $isarray[$r]);
+
+$ftp->quit() or die "Unable to quit\n";
+
+$ftp = Ssl::FTPSSL->new($host,Port=>$port, Encryption =>'I', Debug =>0 ) or die "Couldn't connect to $host\n";
+
+if($ftp->login($username, $wrong_password)==0
+ && $ftp->login($username, $wrong_password)==0
+ && $ftp->login($username, $wrong_password)==0
+ && $ftp->login($username, $correct_password)==0 ){
+ $actual="MaxLoginAttempts Successful";
+}
+else{
+ $actual= "MaxLoginAttempts Failed";
+}
+
+ok t_cmp ( $actual,$expected[$r], $isarray[$r]);
+
+$ftp->quit();
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mdtm.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mdtm.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mdtm.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mdtm.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,71 @@
+use Ssl::FTPSSL;
+use Time::gmtime;
+use Time::Local;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use IO::Handle;
+
+plan tests =>1 , need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+use File::Path;
+use File::stat;
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+my $ftp;
+#my $sb;
+my $mdtm_first_time;
+my $mdtm_second_time;
+my $lines=0;
+my $output="";
+my $expected="MDTM Successful";
+my $actual;
+my $getlisting="test.txt";
+my @isarray = (
+ 'PASV:Getting modification time of the file',
+# 'PORT:Getting modification time of the file',
+);
+my $mydir="$install_root/data/dir";
+rmtree($mydir);
+mkdir $mydir;
+#my $buffer = "joydeep";
+
+for($x=0;$x<1;$x++){
+ if ($x==0){
+ #Using Passive mode of data transfer
+ $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption =>'I', Debug =>0) or die "Couldn't connect to $host\n";
+ }
+# else{
+# #Using Port mode of data transfer
+# $ftp = Net::FTP->new($host,Port =>$port,Passive =>0) or die "Couldn't connect to $host\n";
+# }
+ $ftp->login("common","password") or die "Login failed";
+ #$ftp->ascii();
+ #$ftp->get("/mdtmlist/$getlisting","$install_root/data/mdtmdir/$getlisting");
+ $sb=stat("$install_root/ftpdocs/home/common/mdtmlist/$getlisting") or die "No File";
+ printf "First Time is: %s",$sb->mtime;
+ $mdtm_first_time=$sb->mtime;
+ $ftp->cwd("mdtmlist");
+ $mod_time =$ftp->mdtm("$getlisting");
+ $tm = gmtime($mod_time);
+ $mdtm_second_time=timelocal($tm->sec, $tm->min, $tm->hour, $tm->mday, $tm->mon, $tm->year);
+ print "Second Time: $mdtm_second_time";
+ #printf("Dateline: %02d:%02d:%02d-%04d/%02d/%02d\n",$tm->hour, $tm->min, $tm->sec, $tm->year+1900,$tm->mon+1, $tm->mday);
+
+ if ($mdtm_first_time eq $mdtm_second_time){
+ $actual="MDTM Successful";
+ }
+ else{
+ $actual="MDTM Failed";
+ }
+
+ ok t_cmp ($actual,$expected,$isarray[$x]);
+
+ $ftp->quit() or die "Unable to quit";
+}
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mkd.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mkd.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mkd.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/mkd.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,71 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+use File::Path;
+plan tests => 3, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+$username = ("common");
+$password = ("password");
+
+my $vars = Apache::Test::vars();
+$document_root=Apache::Test::vars('documentroot');
+$install_root="$document_root/ftp";
+
+my $mydir="$install_root/ftpdocs/home/common/mkddir";
+my $mydir1="$install_root/data/mkddir_backup";
+rmtree($mydir);
+mkdir $mydir;
+`cp -r $mydir1/\* $mydir`;
+
+my @mkdlist=(
+'mkd_newdir',
+'mkd_existingdir',
+'invalid/dirname',
+);
+
+$r=0;
+
+my @expected =(
+"MKD Successful",
+"MKD Failed",
+"MKD Failed",
+);
+
+my $actual;
+
+my @isarray=(
+"Create a new directory",
+"Attempting to create a directory with the name of an existing directory",
+"Attempting to create a directory with an invalid name format",
+);
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n ";
+
+if($ftp->cwd("mkddir"))
+{
+}
+else
+{
+ die "Couldn't change to directoty mkddir";
+}
+for($r=0;$r<3;$r++)
+{
+ if( $ftp->mkdir($mkdlist[$r]))
+ {
+ $actual="MKD Successful";
+ }
+ else
+ {
+ $actual="MKD Failed";
+ }
+ ok t_cmp ( $actual,$expected[$r],$isarray[$r]);
+}
+
+$ftp->quit() or die "Unable to quit\n" ;
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/nlst.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/nlst.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/nlst.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/nlst.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,206 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+plan tests =>18 , need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+$username = ("common");
+$password = ("password");
+
+my @filelist;
+my $l;
+my @expected =(
+ "NLST * Successful",
+ "NLST *.html Successful",
+ "NLST a*b Successful",
+ "NLST 3* Successful",
+ "NLST *3 Successful",
+ "NLST *i* Successful",
+ "NLST a* b* Successful",
+ "NLST *.* Successful",
+ "NLST q Successful",
+ "NLST 2*2* Successful",
+ "NLST a* Successful",
+ "NLST 9* Successful",
+ "NLST b Successful",
+ "NLST a*b Successful",
+ "NLST b* Successful",
+ "NLST q* Successful",
+ "NLST *q Successful",
+ "NLST 12* Successful",
+);
+
+my $actual = "True";
+
+
+my @isarray_pasv=(
+ 'PASV:Issue NLST * Command',
+ 'PASV:Issue NLST *.html Command',
+ 'PASV:Issue NLST a*b Command',
+ 'PASV:Issue NLST 3* Command',
+ 'PASV:Issue NLST *3 Command',
+ 'PASV:Issue NLST *i* Command',
+ 'PASV:Issue NLST a* b* Command',
+ 'PASV:Issue NLST *.* Command',
+ 'PASV:Issue NLST q Command',
+ 'PASV:Issue NLST 2*2* Command',
+ 'PASV:Issue NLST a* Command',
+ 'PASV:Issue NLST 9* Command',
+ 'PASV:Issue NLST b Command',
+ 'PASV:Issue NLST a*b Command',
+ 'PASV:Issue NLST b* Command',
+ 'PASV:Issue NLST q* Command',
+ 'PASV:Issue NLST *q Command',
+ 'PASV:Issue NLST 12* Command',
+);
+
+
+
+my @isarray_port=(
+ 'PORT:Issue NLST * Command',
+ 'PORT:Issue NLST *.html Command',
+ 'PORT:Issue NLST a*b Command',
+ 'PORT:Issue NLST 3* Command',
+ 'PORT:Issue NLST *3 Command',
+ 'PORT:Issue NLST *i* Command',
+ 'PORT:Issue NLST a*b* Command',
+ 'PORT:Issue NLST *.* Command',
+ 'PORT:Issue NLST q Command',
+ 'PORT:Issue NLST 2*2* Command',
+ 'PORT:Issue NLST a* Command',
+ 'PORT:Issue NLST 9* Command',
+ 'PORT:Issue NLST b Command',
+ 'PORT:Issue NLST a*b Command',
+ 'PORT:Issue NLST b* Command',
+ 'PORT:Issue NLST q* Command',
+ 'PORT:Issue NLST *q Command',
+ 'PORT:Issue NLST 12* Command',
+);
+
+#########################################################################################
+my @commandlist = ("*","*.html","a*b","3*","*3","*i*","a* b*","*.*","q","2*2*","a*","9*","b","a*b","b*","q*","*q","12*");
+my @expectedlist = (
+ ["123456","23452345","344","543","980","a.html","abcde","acdefb","aoJjugb","b","b.html","bcdef","faqs","list.txt","q","quick"],
+ ["a.html","b.html"],
+ ["acdefb","aoJjugb"],
+ ["344"],
+ ["543"],
+ ["list.txt","quick"],
+ ["a.html","abcde","acdefb"],
+ ["a.html","b.html","list.txt"],
+ ["q"],
+ ["23452345"],
+ ["a.html","abcde","acdefb","aoJjugb"],
+ ["980"],
+ ["b"],
+ ["acdefb","aoJjugb"],
+ ["b","b.html","bcdef"],
+ ["q","quick"],
+ ["q"],
+ ["123456"],
+);
+my $flag_value = "true";
+my $i = 0;
+my @filelist_one=("true");
+##########################################################################################
+#Using Passive mode of data transfer
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed\n";
+
+if($ftp->cwd("nlst_dir"))
+{
+}
+else{
+ die "Couldn't change to directoty nlst_dir";
+}
+########################################################
+for ($i = 0; $i < 18; $i += 1){
+ $ftp->pasv();
+ @filelist_one=$ftp->nlst($commandlist[$i]);
+ if(@filelist_one!=0){
+ my $k = 0;
+ while($filelist[$k] && $expectedlist[$i][$k])
+ {
+ my $fileLine = $filelist[$k];
+ chomp $fileLine;
+ my ($perm,$unkn,$user,$group,$size,$mo,$day,$time,$name)=split(/\s+/,$fileLine);
+ $filelist_one[$k]=$name;
+ print $name;
+ $l++;
+
+ if($filelist_one[$k] eq $expectedlist[$i][$k]){
+ $k++;
+ }
+ else{
+ $flag_value = "false";
+ $k++;
+ }
+
+ }
+ if ($flag_value eq "false"){
+ $actual = "NLST $commandlist[$i] Failed";
+ }
+ else{
+ $actual = "NLST $commandlist[$i] Successful";
+ }
+ ok t_cmp ($actual,$expected[$i],$isarray_pasv[$i]);
+ }
+ else{
+ die "NLST * Failed \n";
+ }
+
+}
+
+#####################################################
+$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+#Using Port mode of data transfer
+#my $ftp = Net::FTP->new($host,Port=>$port ,Passive=>0) or die "Couldn't connect to $host\n";
+#
+#$ftp->login($username, $password) or die "Login failed\n";
+#
+#if($ftp->cwd("nlst_dir")){
+#}
+#else{
+# die "Couldn't change to directoty nlst_dir";
+#}
+########################################################
+#for ($i = 0; $i < 18; $i += 1){
+# @filelist_one=$ftp->ls($commandlist[$i]);
+# if(@filelist_one!=0){
+# my $k = 0;
+# while($expectedlist[$i][$k]){
+# if($filelist_one[$k] eq $expectedlist[$i][$k]){
+# $k++;
+# }
+# else{
+# $flag_value = "false";
+# $k++;
+# }
+#
+# }
+# if ($flag_value eq "false"){
+# $actual = "NLST $commandlist[$i] Failed";
+# }
+# else{
+# $actual = "NLST $commandlist[$i] Successful";
+# }
+# ok t_cmp ($actual,$expected[$i],$isarray_port[$i]);
+# }
+# else{
+# die "NLST * Failed \n";
+# }
+#
+#}
+
+#####################################################
+#$ftp->quit() or die "Unable to quit\n";
+##############################################################################################
+
Added: incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/noop.t
URL: http://svn.apache.org/viewcvs/incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/noop.t?rev=378185&view=auto
==============================================================================
--- incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/noop.t (added)
+++ incubator/mod_ftp/trunk/tests/perl-framework/t/ftp/ftp_imp_ssl/noop.t Wed Feb 15 22:40:34 2006
@@ -0,0 +1,31 @@
+use Ssl::FTPSSL;
+use Apache::TestRequest;
+use Apache::Test;
+use Apache::TestUtil;
+
+plan tests => 1, need_module 'mod_ftp', need_module 'mod_ssl';
+
+Apache::TestRequest::module('ftp_ssl_implicit');
+my $hostport = Apache::TestRequest::hostport();
+my ($host,$port)= split(/:/,$hostport);
+
+my $actual;
+my $expected='Success';
+my $isarray='NOOP command Successful';
+
+my $username = "common";
+my $password = "password";
+
+my $ftp = Ssl::FTPSSL->new($host,Port =>$port,Encryption => 'I',Debug => 0) or die "Couldn't connect to $host\n";
+
+$ftp->login($username, $password) or die "Login failed \n";
+
+if ($ftp->noop()) {
+ $actual = 'Success';
+}
+else {
+ $actual = 'Failed';
+}
+ok t_cmp ($actual,$expected,$isarray);
+$ftp->quit();
+