[vhffs-dev] [800] Renaming Vhffs::Service::Httpd to Vhffs::Service::Web (part two) |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 800
Author: gradator
Date: 2007-08-29 23:12:18 +0000 (Wed, 29 Aug 2007)
Log Message:
-----------
Renaming Vhffs::Service::Httpd to Vhffs::Service::Web (part two)
Added Paths:
-----------
trunk/vhffs-api/src/Vhffs/Services/Web.pm
trunk/vhffs-tests/src/Services/Web.pl
Removed Paths:
-------------
trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
trunk/vhffs-tests/src/Services/Httpd.pl
Deleted: trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Httpd.pm 2007-08-29 23:10:28 UTC (rev 799)
+++ trunk/vhffs-api/src/Vhffs/Services/Httpd.pm 2007-08-29 23:12:18 UTC (rev 800)
@@ -1,366 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-
-# This file is a part of VHFFS4
-# Please respect the licence of this file, and the whole VHFFS software.
-
-=pod
-
-=head1 NAME
-
-Vhffs::Services::Web - Handle Web Area in VHFFS hosting platform.
-
-=head1 SYNOPSIS
-
-TODO
-
-=head1 METHODS
-
-=cut
-
-package Vhffs::Services::Web;
-
-use Vhffs::Functions;
-use base qw(Vhffs::Object);
-use strict;
-use DBI;
-
-=pod
-
-=head2 create
-
- my $httpd = Vhffs::Services::Web::create($main, $servername, $description, $user, $group);
- die("Unable to create webarea $servername\n") unless(defined $httpd);
-
-Creates a new webarea in database and returns the corresponding fully functional object.
-
-=cut
-
-sub create
-{
- my ($main, $servername, $description, $user, $group) = @_;
- return undef unless(defined($user) && defined($group));
- return undef unless(Vhffs::Functions::check_domain_name($servername));
-
- my $web;
- my $dbh = $main->get_db_object();
- local $dbh->{RaiseError} = 1;
- local $dbh->{PrintError} = 0;
- $dbh->begin_work;
-
- eval {
- my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_HTTPD);
-
- die('Unable to create parent object') unless(defined($parent));
-
- my $sql = 'INSERT INTO vhffs_httpd(servername, object_id) VALUES(?, ?)';
-
- my $sth = $dbh->prepare($sql);
- $sth->execute($servername, $parent->get_oid);
-
- $dbh->commit;
- $web = get_by_servername($main, $servername);
- };
-
- if($@) {
- warn "Unable to create webarea $servername: $@\n";
- $dbh->rollback;
- }
- return $web;
-}
-
-
-=pod
-
-=head2 commit
-
-Commit modified changes to the database.
-
-=cut
-
-sub commit
-{
- my $self = shift;
- $self->SUPER::commit;
-}
-
-=head2 get_servername
-
- my $servername = $httpd->getservername;
-
-Returns webarea server name.
-
-=cut
-
-sub get_servername
-{
- my $self = shift;
- return $self->{'servername'};
-}
-
-
-=head2 get_label
-
-See C<Vhffs::Object::get_label>.
-
-=cut
-
-sub get_label {
- my $self = shift;
- return $self->{servername};
-}
-
-sub get_title
-{
- my $self = shift;
- return $self->{'servername'};
-}
-
-sub get_type
-{
- return 'web';
-}
-
-sub getall
-{
- my ($vhffs, $state, $name, $group) = @_;
-
- my $sql;
- my @params;
- my $sth;
-
- my $objs = [];
- my $result;
- my $tmp;
-
- $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
- if(defined $state) {
- $sql .= ' AND o.state = ?';
- push(@params, $state);
- }
- if(defined($name)) {
- $sql .= ' AND h.servername LIKE ?';
- push(@params, '%'.$name.'%');
- }
- if(defined($group)) {
- $sql .= ' AND o.owner_gid = ?';
- push(@params, $group->get_gid);
- }
- $sql .= " ORDER BY servername";
- $sth = $vhffs->get_db_object->prepare( $sql );
- my $rows = $sth->execute(@params);
-
- return undef unless($rows);
-
- while( $result = $sth->fetchrow_arrayref )
- {
- push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
- }
- return $objs;
-}
-
-sub getall_by_letter
-{
- my ($vhffs, $letter, $state) = @_;
-
- return getall($vhffs, $state) if ( ! defined $letter );
-
- $letter .= '%';
-
- my $sql;
- my @params;
- my $sth;
-
- my $objs = [];
- my $result;
-
- $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername LIKE ?';
-
- push(@params, $letter);
-
- if(defined $state) {
- $sql .= 'AND o.state = ?';
- push(@params, $state);
- }
- $sql .= 'ORDER BY servername';
-
- $sth = $vhffs->get_db_object->prepare( $sql );
- my $rows = $sth->execute(@params);
-
- return undef unless($rows);
-
- while( $result = $sth->fetchrow_arrayref )
- {
- push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
- }
- return $objs;
-}
-
-
-sub search
-{
- my ($vhffs, $state, $name) = @_;
-
- my $sql;
- my $sth;
- my @params;
-
- my $objs;
- my $result;
-
- $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
-
- if( ( defined $state ) && ( $state < Vhffs::Constants::TO_DELETE ) ) {
- $sql .= 'WHERE o.state= ? AND ( o.description LIKE ? OR w.servername LIKE ? )';
- push(@params, $state);
- push(@params, '%'.$name.'%');
- push(@params, '%'.$name.'%');
- }
-
- $sql .= " ORDER BY servername";
- $sth = $vhffs->get_db_object()->prepare( $sql );
-
- my $rows = $sth->execute(@params);
-
- return undef unless($rows);
-
- while( $result = $sth->fetchrow_arrayref )
- {
- push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
- }
- return $objs;
-}
-
-
-sub getall_by_group
-{
- my ($vhffs, $group) = @_;
-
- my $sql;
- my $sth;
-
- my $objs = [];
- my $result;
- my $tmp;
-
-
- $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id AND o.owner_gid = ? ORDER BY servername';
-
-
- $sth = $vhffs->get_db_object()->prepare( $sql );
-
- my $rows = $sth->execute($group->get_gid());
-
- return undef unless($rows);
-
- while( $result = $sth->fetchrow_arrayref )
- {
- push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
- }
- return $objs;
-}
-
-=head2 fill_object
-
-See C<Vhffs::Object::fill_object>.
-
-=cut
-
-sub fill_object {
- my ($class, $obj) = @_;
- my $sql = q{SELECT httpd_id, servername FROM vhffs_httpd
- WHERE object_id = ?};
- return $class->SUPER::_fill_object($obj, $sql);
-}
-
-=head2 get_by_servername
-
- my $httpd = Vhffs::Services::Web::get_by_servername($main, $servername);
- die("Webarea $servername not found\n") unless(defined $httpd);
-
-Fetches the webarea whose address is C<$servername>.
-
-=cut
-
-sub get_by_servername {
- my ($main, $servername) = @_;
- my $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?';
-
- my $dbh = $main->get_db_object();
- my @params;
- return undef unless(@params = $dbh->selectrow_array($sql, undef, $servername));
-
- return _new Vhffs::Services::Web($main, @params);
-}
-
-
-=head2 get_used_letters
-
-Returns a reference on an array, each field is a hash with two fields
-letter and count (count is the number of websites starting with letter).
-0 site letters aren't stored.
-
-=cut
-
-sub get_used_letters {
- my $main = shift;
- my $state = shift;
- $state = Vhffs::Constants::ACTIVATED unless(defined $state);
- my $sql = 'SELECT substr(servername, 1, 1) as letter, COUNT(*) as count FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE state = ? GROUP BY substr(servername, 1, 1) ORDER BY substr(servername, 1, 1)';
- my $dbh = $main->get_db_object;
- return $dbh->selectall_arrayref($sql, { Slice => {} }, $state);
-
-}
-
-sub _new {
- my ($class, $main, $httpd_id, $servername, $owner_uid, $owner_gid, $oid, $date_creation, $description, $state) = @_;
-
- my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, $state, Vhffs::Constants::TYPE_HTTPD);
- return undef unless(defined($self));
-
- $self->{http_id} = $httpd_id;
- $self->{servername} = $servername;
-
- return $self;
-}
-
-
-1;
-
-__END__
-
-=head1 AUTHORS
-
-soda < dieu at gunnm dot org >
-
-Sebastien Le Ray < beuss at tuxfamily dot org >
Copied: trunk/vhffs-api/src/Vhffs/Services/Web.pm (from rev 799, trunk/vhffs-api/src/Vhffs/Services/Httpd.pm)
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Web.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Services/Web.pm 2007-08-29 23:12:18 UTC (rev 800)
@@ -0,0 +1,366 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+
+
+# This file is a part of VHFFS4
+# Please respect the licence of this file, and the whole VHFFS software.
+
+=pod
+
+=head1 NAME
+
+Vhffs::Services::Web - Handle Web Area in VHFFS hosting platform.
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
+package Vhffs::Services::Web;
+
+use Vhffs::Functions;
+use base qw(Vhffs::Object);
+use strict;
+use DBI;
+
+=pod
+
+=head2 create
+
+ my $httpd = Vhffs::Services::Web::create($main, $servername, $description, $user, $group);
+ die("Unable to create webarea $servername\n") unless(defined $httpd);
+
+Creates a new webarea in database and returns the corresponding fully functional object.
+
+=cut
+
+sub create
+{
+ my ($main, $servername, $description, $user, $group) = @_;
+ return undef unless(defined($user) && defined($group));
+ return undef unless(Vhffs::Functions::check_domain_name($servername));
+
+ my $web;
+ my $dbh = $main->get_db_object();
+ local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
+ $dbh->begin_work;
+
+ eval {
+ my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_HTTPD);
+
+ die('Unable to create parent object') unless(defined($parent));
+
+ my $sql = 'INSERT INTO vhffs_httpd(servername, object_id) VALUES(?, ?)';
+
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($servername, $parent->get_oid);
+
+ $dbh->commit;
+ $web = get_by_servername($main, $servername);
+ };
+
+ if($@) {
+ warn "Unable to create webarea $servername: $@\n";
+ $dbh->rollback;
+ }
+ return $web;
+}
+
+
+=pod
+
+=head2 commit
+
+Commit modified changes to the database.
+
+=cut
+
+sub commit
+{
+ my $self = shift;
+ $self->SUPER::commit;
+}
+
+=head2 get_servername
+
+ my $servername = $httpd->getservername;
+
+Returns webarea server name.
+
+=cut
+
+sub get_servername
+{
+ my $self = shift;
+ return $self->{'servername'};
+}
+
+
+=head2 get_label
+
+See C<Vhffs::Object::get_label>.
+
+=cut
+
+sub get_label {
+ my $self = shift;
+ return $self->{servername};
+}
+
+sub get_title
+{
+ my $self = shift;
+ return $self->{'servername'};
+}
+
+sub get_type
+{
+ return 'web';
+}
+
+sub getall
+{
+ my ($vhffs, $state, $name, $group) = @_;
+
+ my $sql;
+ my @params;
+ my $sth;
+
+ my $objs = [];
+ my $result;
+ my $tmp;
+
+ $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
+ if(defined $state) {
+ $sql .= ' AND o.state = ?';
+ push(@params, $state);
+ }
+ if(defined($name)) {
+ $sql .= ' AND h.servername LIKE ?';
+ push(@params, '%'.$name.'%');
+ }
+ if(defined($group)) {
+ $sql .= ' AND o.owner_gid = ?';
+ push(@params, $group->get_gid);
+ }
+ $sql .= " ORDER BY servername";
+ $sth = $vhffs->get_db_object->prepare( $sql );
+ my $rows = $sth->execute(@params);
+
+ return undef unless($rows);
+
+ while( $result = $sth->fetchrow_arrayref )
+ {
+ push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
+ }
+ return $objs;
+}
+
+sub getall_by_letter
+{
+ my ($vhffs, $letter, $state) = @_;
+
+ return getall($vhffs, $state) if ( ! defined $letter );
+
+ $letter .= '%';
+
+ my $sql;
+ my @params;
+ my $sth;
+
+ my $objs = [];
+ my $result;
+
+ $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername LIKE ?';
+
+ push(@params, $letter);
+
+ if(defined $state) {
+ $sql .= 'AND o.state = ?';
+ push(@params, $state);
+ }
+ $sql .= 'ORDER BY servername';
+
+ $sth = $vhffs->get_db_object->prepare( $sql );
+ my $rows = $sth->execute(@params);
+
+ return undef unless($rows);
+
+ while( $result = $sth->fetchrow_arrayref )
+ {
+ push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
+ }
+ return $objs;
+}
+
+
+sub search
+{
+ my ($vhffs, $state, $name) = @_;
+
+ my $sql;
+ my $sth;
+ my @params;
+
+ my $objs;
+ my $result;
+
+ $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
+
+ if( ( defined $state ) && ( $state < Vhffs::Constants::TO_DELETE ) ) {
+ $sql .= 'WHERE o.state= ? AND ( o.description LIKE ? OR w.servername LIKE ? )';
+ push(@params, $state);
+ push(@params, '%'.$name.'%');
+ push(@params, '%'.$name.'%');
+ }
+
+ $sql .= " ORDER BY servername";
+ $sth = $vhffs->get_db_object()->prepare( $sql );
+
+ my $rows = $sth->execute(@params);
+
+ return undef unless($rows);
+
+ while( $result = $sth->fetchrow_arrayref )
+ {
+ push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
+ }
+ return $objs;
+}
+
+
+sub getall_by_group
+{
+ my ($vhffs, $group) = @_;
+
+ my $sql;
+ my $sth;
+
+ my $objs = [];
+ my $result;
+ my $tmp;
+
+
+ $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id AND o.owner_gid = ? ORDER BY servername';
+
+
+ $sth = $vhffs->get_db_object()->prepare( $sql );
+
+ my $rows = $sth->execute($group->get_gid());
+
+ return undef unless($rows);
+
+ while( $result = $sth->fetchrow_arrayref )
+ {
+ push @{$objs}, _new Vhffs::Services::Web($vhffs, @{$result});
+ }
+ return $objs;
+}
+
+=head2 fill_object
+
+See C<Vhffs::Object::fill_object>.
+
+=cut
+
+sub fill_object {
+ my ($class, $obj) = @_;
+ my $sql = q{SELECT httpd_id, servername FROM vhffs_httpd
+ WHERE object_id = ?};
+ return $class->SUPER::_fill_object($obj, $sql);
+}
+
+=head2 get_by_servername
+
+ my $httpd = Vhffs::Services::Web::get_by_servername($main, $servername);
+ die("Webarea $servername not found\n") unless(defined $httpd);
+
+Fetches the webarea whose address is C<$servername>.
+
+=cut
+
+sub get_by_servername {
+ my ($main, $servername) = @_;
+ my $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?';
+
+ my $dbh = $main->get_db_object();
+ my @params;
+ return undef unless(@params = $dbh->selectrow_array($sql, undef, $servername));
+
+ return _new Vhffs::Services::Web($main, @params);
+}
+
+
+=head2 get_used_letters
+
+Returns a reference on an array, each field is a hash with two fields
+letter and count (count is the number of websites starting with letter).
+0 site letters aren't stored.
+
+=cut
+
+sub get_used_letters {
+ my $main = shift;
+ my $state = shift;
+ $state = Vhffs::Constants::ACTIVATED unless(defined $state);
+ my $sql = 'SELECT substr(servername, 1, 1) as letter, COUNT(*) as count FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE state = ? GROUP BY substr(servername, 1, 1) ORDER BY substr(servername, 1, 1)';
+ my $dbh = $main->get_db_object;
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $state);
+
+}
+
+sub _new {
+ my ($class, $main, $httpd_id, $servername, $owner_uid, $owner_gid, $oid, $date_creation, $description, $state) = @_;
+
+ my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, $state, Vhffs::Constants::TYPE_HTTPD);
+ return undef unless(defined($self));
+
+ $self->{http_id} = $httpd_id;
+ $self->{servername} = $servername;
+
+ return $self;
+}
+
+
+1;
+
+__END__
+
+=head1 AUTHORS
+
+soda < dieu at gunnm dot org >
+
+Sebastien Le Ray < beuss at tuxfamily dot org >
Deleted: trunk/vhffs-tests/src/Services/Httpd.pl
===================================================================
--- trunk/vhffs-tests/src/Services/Httpd.pl 2007-08-29 23:10:28 UTC (rev 799)
+++ trunk/vhffs-tests/src/Services/Httpd.pl 2007-08-29 23:12:18 UTC (rev 800)
@@ -1,53 +0,0 @@
-use strict;
-use Vhffs::Tests::Main;
-use Vhffs::Tests::Utils;
-use Vhffs::Constants;
-use Vhffs::User;
-use Vhffs::Services::Web;
-use Test::More 'no_plan';
-
-my $main = init Vhffs::Tests::Main;
-isa_ok($main, 'Vhffs::Tests::Main', '$main');
-
-Vhffs::Tests::Utils::init_db($main->get_db_object);
-
-my $user1 = Vhffs::User::create($main, 'test1', 'abcdef', 0, 'test1@xxxxxxxx');
-isa_ok($user1, 'Vhffs::User', '$user1');
-
-my $group1 = Vhffs::Group::create($main, 'webgroup1', $user1->get_uid, undef, 'Test group for web');
-isa_ok($group1, 'Vhffs::Group', '$group1');
-my $group2 = Vhffs::Group::create($main, 'webgroup2', $user1->get_uid, undef, 'Test group for web');
-isa_ok($group2, 'Vhffs::Group', '$group1');
-
-my $web1 = Vhffs::Services::Web::create($main, 'testweb1.org', 'Test web 1', $user1, $group1);
-isa_ok($web1, 'Vhffs::Services::Web', '$web1');
-cmp_ok($web1->get_servername, 'eq', 'testweb1.org', 'servername is the one defined while creating object');
-cmp_ok($web1->get_owner_uid, '==', $user1->get_uid, 'uid matches');
-cmp_ok($web1->get_owner_gid, '==', $group1->get_gid, 'gid matches');
-
-my ($max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
-ok(! defined(Vhffs::Services::Web::create($main, 'testweb1.org', 'Test web 1', $user1, $group1)), 'Unable to create 2 webareas with the same name');
-my ($new_max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
-cmp_ok($new_max_oid, '==', $max_oid, 'Web service creation is a "all or nothing" process');
-
-
-my @webs = @{Vhffs::Services::Web::getall($main)};
-cmp_ok(scalar(@webs), '==', 1);
-is_deeply($webs[0], $web1);
-
-cmp_ok(@{Vhffs::Services::Web::getall($main, Vhffs::Constants::ACTIVATED)}, '==', 0, 'No ACTIVATED webarea repo');
-
-@webs = @{Vhffs::Services::Web::getall_by_group($main, $group1)};
-cmp_ok(scalar(@webs), '==', 1);
-is_deeply($webs[0], $web1);
-
-cmp_ok(@{Vhffs::Services::Web::getall_by_group($main, $group2)}, '==', 0, 'No webarea repo for group2');
-
-@webs = @{Vhffs::Services::Web::getall_by_letter($main, 't')};
-cmp_ok(scalar(@webs), '==', 1);
-
-# Only first letter matters
-@webs = @{Vhffs::Services::Web::getall_by_letter($main, 'e')};
-cmp_ok(scalar(@webs), '==', 0);
-
-
Copied: trunk/vhffs-tests/src/Services/Web.pl (from rev 799, trunk/vhffs-tests/src/Services/Httpd.pl)
===================================================================
--- trunk/vhffs-tests/src/Services/Web.pl (rev 0)
+++ trunk/vhffs-tests/src/Services/Web.pl 2007-08-29 23:12:18 UTC (rev 800)
@@ -0,0 +1,53 @@
+use strict;
+use Vhffs::Tests::Main;
+use Vhffs::Tests::Utils;
+use Vhffs::Constants;
+use Vhffs::User;
+use Vhffs::Services::Web;
+use Test::More 'no_plan';
+
+my $main = init Vhffs::Tests::Main;
+isa_ok($main, 'Vhffs::Tests::Main', '$main');
+
+Vhffs::Tests::Utils::init_db($main->get_db_object);
+
+my $user1 = Vhffs::User::create($main, 'test1', 'abcdef', 0, 'test1@xxxxxxxx');
+isa_ok($user1, 'Vhffs::User', '$user1');
+
+my $group1 = Vhffs::Group::create($main, 'webgroup1', $user1->get_uid, undef, 'Test group for web');
+isa_ok($group1, 'Vhffs::Group', '$group1');
+my $group2 = Vhffs::Group::create($main, 'webgroup2', $user1->get_uid, undef, 'Test group for web');
+isa_ok($group2, 'Vhffs::Group', '$group1');
+
+my $web1 = Vhffs::Services::Web::create($main, 'testweb1.org', 'Test web 1', $user1, $group1);
+isa_ok($web1, 'Vhffs::Services::Web', '$web1');
+cmp_ok($web1->get_servername, 'eq', 'testweb1.org', 'servername is the one defined while creating object');
+cmp_ok($web1->get_owner_uid, '==', $user1->get_uid, 'uid matches');
+cmp_ok($web1->get_owner_gid, '==', $group1->get_gid, 'gid matches');
+
+my ($max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
+ok(! defined(Vhffs::Services::Web::create($main, 'testweb1.org', 'Test web 1', $user1, $group1)), 'Unable to create 2 webareas with the same name');
+my ($new_max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
+cmp_ok($new_max_oid, '==', $max_oid, 'Web service creation is a "all or nothing" process');
+
+
+my @webs = @{Vhffs::Services::Web::getall($main)};
+cmp_ok(scalar(@webs), '==', 1);
+is_deeply($webs[0], $web1);
+
+cmp_ok(@{Vhffs::Services::Web::getall($main, Vhffs::Constants::ACTIVATED)}, '==', 0, 'No ACTIVATED webarea repo');
+
+@webs = @{Vhffs::Services::Web::getall_by_group($main, $group1)};
+cmp_ok(scalar(@webs), '==', 1);
+is_deeply($webs[0], $web1);
+
+cmp_ok(@{Vhffs::Services::Web::getall_by_group($main, $group2)}, '==', 0, 'No webarea repo for group2');
+
+@webs = @{Vhffs::Services::Web::getall_by_letter($main, 't')};
+cmp_ok(scalar(@webs), '==', 1);
+
+# Only first letter matters
+@webs = @{Vhffs::Services::Web::getall_by_letter($main, 'e')};
+cmp_ok(scalar(@webs), '==', 0);
+
+