IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2009, 2:00:56 PM (17 years ago)
Author:
eugene
Message:

merging changes from head

Location:
branches/eam_branches/20090522
Files:
2 deleted
32 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090522

  • branches/eam_branches/20090522/Nebulous

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/Changes

    r23934 r24557  
    11Revision history for Nebulous
     2
     30.17
     4    - add chmod() API
     5    - change neb-ls to always output in --long format
     6    - add neb-rm --force flag
     7    - change neb-locate's output seperator to \n
    28
    390.10
     
    915    - add neb-swap
    1016    - add nebclient:nebSetXattr()
     17    - add neb-rm --move flag
    1118
    12190.09 Wed Jul  9 16:36:27 HST 2008
  • branches/eam_branches/20090522/Nebulous/MANIFEST

    r23934 r24557  
    7979t/00_distribution.t
    8080t/01_load.t
    81 t/50_client_new.t
    82 t/51_client_create.t
     81t/49_client_new.t
     82t/50_client_create.t
    8383t/51_client_open_create.t
    8484t/52_client_replicate.t
     
    9898t/66_client_xattr.t
    9999t/67_client_swap.t
     100t/68_client_chmod.t
    100101t/70_neb-ls.t
    101102t/90_nebclient.t
  • branches/eam_branches/20090522/Nebulous/bin

  • branches/eam_branches/20090522/Nebulous/bin/neb-locate

    r16179 r24557  
    4141    unless defined $neb;
    4242
     43$volume = 'any' if defined $all;
     44
    4345my $uris;
    4446if (defined $volume) {
     
    7072}
    7173
    72 print join(" ", @files), "\n";
     74print join("\n", @files), "\n";
    7375
    7476__END__
  • branches/eam_branches/20090522/Nebulous/bin/neb-ls

    r23934 r24557  
    2121
    2222$server = $ENV{'NEB_SERVER'} unless $server;
     23
     24# make --long the default
     25$long = 1;
    2326
    2427GetOptions(
  • branches/eam_branches/20090522/Nebulous/bin/neb-replicate

    r23696 r24557  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($server, $volume, $copies);
     18my ($server, $volume, $copies, $set_copies);
    1919$copies = 1;  # default to making just one copy
    2020
  • branches/eam_branches/20090522/Nebulous/bin/neb-rm

    r13074 r24557  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($server);
     18my (
     19    $force,
     20    $move,
     21    $server,
     22);
    1923
    2024$server = $ENV{'NEB_SERVER'} unless $server;
    2125
    2226GetOptions(
     27    'force|f'       => \$force,
     28    'move|m'        => \$move,
    2329    'server|s=s'    => \$server,
    2430) || pod2usage( 2 );
     
    3541
    3642foreach my $key (@ARGV) {
    37     $neb->delete($key) or warn "failed to delete key: $key";
     43    unless (defined $move) {
     44        $neb->delete($key) or warn "failed to delete key: $key";
     45    } else {
     46        $neb->move($key, "${key}.rm") or warn "failed to move key: $key";
     47    }
    3848}
    3949
     
    4858=head1 SYNOPSIS
    4959
    50     neb-rm [--server <URL>] <key...>
     60    neb-rm [--server <URL>] [--force] [--move] <key...>
    5161
    5262=head1 DESCRIPTION
     
    5868
    5969=over 4
     70
     71=item * --force|-f
     72
     73When set, C<<key>> will be removed from the nebulous database even if the on
     74disk file(s) are missing.
     75
     76Optional.
     77
     78=item * --move|-m
     79
     80When set, this flag causes C<<key>> to be renamed to C<<key>.rm> instead of
     81being deleted.
     82
     83Optional.
    6084
    6185=item * --server|-s <URL>
  • branches/eam_branches/20090522/Nebulous/bin/neb-stat

    r18016 r24557  
    4141my $stat = $neb->stat($key);
    4242die "nebulous key: $key not found" unless $stat;   
    43 my $instances = $neb->find_instances($key, ':any');
     43my $instances = $neb->find_instances($key, 'any');
    4444die "no instances found" unless $instances;   
    4545
  • branches/eam_branches/20090522/Nebulous/examples

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/lib

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/lib/Nebulous/Client.pm

    r23934 r24557  
    99no warnings qw( uninitialized );
    1010
    11 our $VERSION = '0.09';
     11our $VERSION = '0.17';
    1212
    1313use Digest::MD5;
     
    1616use Nebulous::Client::Log;
    1717use Nebulous::Util qw( :standard );
    18 use Params::Validate qw( validate validate_pos SCALAR UNDEF );
     18use Params::Validate qw( validate validate_pos SCALAR UNDEF BOOLEAN );
    1919#use SOAP::Lite +trace => [qw( debug )];
    2020use SOAP::Lite;
     
    329329    my $uri = $self->delete_instance($key, @$locations[0]);
    330330
     331    eval {
     332        _nuke_file(_get_file_path(@$locations[0]));
     333    };
     334    if ($@) {
     335        $log->logdie($@);
     336    }
     337
    331338    $log->debug("leaving");
    332339
     
    803810    my $self = shift;
    804811
    805     my ( $key ) = validate_pos( @_,
    806         {
    807             type => SCALAR,
     812    my ($key, $force) = validate_pos( @_,
     813        {
     814            type        => SCALAR,
     815        },
     816        {
     817            type        => BOOLEAN,
     818            optional    => 1,
     819            default     => undef,
     820            callbacks   => {
     821                'is boolean' => sub {
     822                    $_[0] == 0 or $_[0] == 1 or $_[0] == undef;
     823                },
     824            },
    808825        },
    809826    );
     
    817834    # a lock is implicitly removed when the last storage object is deleted
    818835    foreach my $uri ( @$locations ) {
     836        # it is being assumed here that it is better to have files on disk and
     837        # not in the database then the inverse.
     838        my $path;
     839        eval {
     840            $path = _get_file_path( $uri );
     841        };
     842        if ($@) {
     843            if ($force) {
     844                $log->warn($@);
     845                $log->warn("exception ignored because force is in effect");
     846            } else {
     847                $log->logdie($@);
     848            }
     849        }
     850
    819851        $self->delete_instance($key, $uri) or return undef;
     852
     853        eval {
     854            _nuke_file( $path );
     855        };
     856        if ($@) {
     857            if ($force) {
     858                $log->warn($@);
     859                $log->warn("exception ignored because force is in effect");
     860            } else {
     861                $log->logdie($@);
     862            }
     863        }
    820864    }
    821865
     
    9591003    $log->debug( "entered - @_" );
    9601004
    961     # it is being assumed here that it is better to have files on disk and not in
    962     # the database then the inverse.
    963 
    964     my $path;
    965     eval {
    966         $path = _get_file_path( $uri );
    967     };
    968     $log->logdie( $@ ) if $@;
    969 
    9701005    my $response = $self->{ 'server' }->delete_instance($key, $uri);
    9711006    if ( $response->fault ) {
     
    9821017    $log->debug( "server deleted instance" );
    9831018
    984     eval {
    985         _nuke_file( $path );
    986     };
    987     $log->logdie( $@ ) if $@;
    988 
    9891019    $log->debug( "leaving" );
    9901020
     
    10451075
    10461076    return $stats;
     1077}
     1078
     1079
     1080sub chmod
     1081{
     1082    my $self = shift;
     1083
     1084    my ($key, $mode) = validate_pos( @_,
     1085        {
     1086            type => SCALAR,
     1087        },
     1088        {
     1089            type => SCALAR,
     1090            regex       => qr/\d{3,4}/,
     1091        },
     1092    );
     1093
     1094    $log->debug( "entered - @_" );
     1095
     1096    my $response = $self->{ 'server' }->chmod_object($key, $mode);
     1097    if ( $response->fault ) {
     1098        $self->set_err($response->faultstring);
     1099        if ($response->faultstring =~ /is valid object key/) {
     1100            $log->debug( "leaving" );
     1101            return;
     1102        }
     1103        if ($response->faultstring =~ /is allowable mode/) {
     1104            $log->debug( "leaving" );
     1105            return;
     1106        }
     1107
     1108        $log->logdie("unhandled fault - ", $self->err);
     1109    }
     1110
     1111    my $response_mode = $response->result;
     1112
     1113    $log->debug( "leaving" );
     1114
     1115    return $response_mode;
    10471116}
    10481117
  • branches/eam_branches/20090522/Nebulous/lib/Nebulous/Client.pod

    r20094 r24557  
    1313    );
    1414
    15     my $uri = $neb->create( "key", "node01" );
    16     my $fh = $neb->open_create( "key", "node01" );
    17     $neb->replicate( "key", "node01" );
    18     $neb->cull( "key", "node01" );
    19     $neb->lock( "key", 'write' );
    20     $neb->unlock( "key", 'write' );
     15    my $uri = $neb->create( $key, $vol );
     16    my $fh = $neb->open_create( $key, $vol );
     17    $neb->replicate( $key, $vol );
     18    $neb->cull( $key, $vol );
     19    $neb->lock( $key, 'write' );
     20    $neb->unlock( $key, 'write' );
    2121    $neb->setxattr( $key, $name, $value, $flags );
    2222    $neb->getxattr( $key, $name );
     
    2424    $neb->removexattr( $key, $name );
    2525    my $uris = $neb->find_objects( $pattern );
    26     my $uris = $neb->find_instances( "key", "node01" );
    27     my $path = $neb->find( "key" );
    28     my $fh = $neb->open( "key", 'read' );
    29     $neb->delete( "key" );
    30     $neb->copy( "key", "new_key", "node01" );
    31     $neb->move( "key", "new_key" );
    32     $neb->swap( "key1", "key2" );
     26    my $uris = $neb->find_instances( $key, $vol );
     27    my $path = $neb->find( $key );
     28    my $fh = $neb->open( $key, 'read' );
     29    $neb->delete( $key );
     30    $neb->copy( $key, $new_key, $vol );
     31    $neb->move( $key, $new_key );
     32    $neb->swap( $key1, $key2 );
    3333    $neb->delete_instance( $uri );
    34     my $stats = $neb->stat( "key" );
     34    my $stats = $neb->stat( $key );
    3535    my $mounts = $neb->mounts();
     36    my $mode = $neb->chmod( $key, $mode );
    3637
    3738=head1 DESCRIPTION
     
    425426    ]
    426427
     428=item * chmod( $key, $mode );
     429
     430Accepts 2 parameters, both mandatory.  C<$key> is the nebulous key to operate
     431on and C<$mode> are the POSIX like file permissions to set on all instances of
     432C<$key>.  C<$mode> must be specified in oct.  Returns C<$mode> or sucess or an
     433exception on failure.
     434
    427435=back
    428436
  • branches/eam_branches/20090522/Nebulous/nebclient

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/nebclient/nebulous.wsdl

    r23935 r24557  
    140140    </message>
    141141
     142    <message name="chmod_objectRequest">
     143        <part name="key" type="xsd:string" />
     144        <part name="mode" type="xsd:int" />
     145    </message>
     146    <message name="chmod_objectResponse">
     147        <!-- fixme -->
     148        <part name="result" type="xsd:int" />
     149    </message>
     150
    142151
    143152    <portType name="Nebulous/Server/SOAPPort">
     
    240249            -->
    241250        </operation>
     251        <operation name="chmod_object">
     252            <input  message="tns:chmod_objectRequest" />
     253            <output message="tns:chmod_objectResponse" />
     254            <!--
     255                <fault name="" message="" />
     256            -->
     257        </operation>
    242258    </portType>
    243259
     
    390406        <operation name="stat_object">
    391407            <soap:operation soapAction="urn:Nebulous/Server/SOAP#stat_object" />
     408            <input>
     409                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
     410                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
     411            </input>
     412            <output>
     413                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
     414                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
     415            </output>
     416        </operation>
     417        <operation name="chmod_object">
     418            <soap:operation soapAction="urn:Nebulous/Server/SOAP#chmod_object" />
    392419            <input>
    393420                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
  • branches/eam_branches/20090522/Nebulous/nebclient/src/nebclient.c

    r23935 r24557  
    832832}
    833833
     834
     835int nebChmod(nebServer *server, const char *key, mode_t mode)
     836{
     837    int response;
     838
     839    REQUIRE_SERVER;
     840
     841    if (!key) {
     842        nebSetErr(server, "parameter 'key' may not be NULL");
     843
     844        return -1;
     845    }
     846
     847    // FIXME is this leaking memory when response goes out of scope?  the gsoap
     848    // manual seems to 'suggest' that this is temporary data that gets cleaed
     849    // up on the next soap function call
     850    if (soap_call_ns1__chmod_USCOREobject(server->soap, server->endpoint,
     851            NULL, (char *)key, mode, &response) != SOAP_OK) {
     852        nebSetServerErr(server);
     853        return -1;
     854    }
     855
     856    return 0;
     857}
     858
     859
    834860char *nebErr(nebServer *server)
    835861{
  • branches/eam_branches/20090522/Nebulous/nebclient/src/nebclient.h

    r23935 r24557  
    1111#ifndef NEBCLIENT_H
    1212#define NEBCLIENT_H 1
     13
     14// #include <sys/stat.h>
    1315
    1416#ifdef __cplusplus
     
    296298);
    297299
     300/** Change permissions of a storage objects
     301 *
     302 * This function will change the file permissions of all currently on disk
     303 * instances of a storage object.
     304 *
     305 * @return the new mode or NULL on failure.
     306 */
     307
     308int nebChmod(
     309    nebServer *server,                  ///< nebServer object
     310    const char *key,                    /// storage object key (name)
     311    mode_t mode                         /// chmod(2) compatible mode (mode_t)
     312);
     313
    298314/** Returns the error message from the last nebclient function that failed.
    299315 *
  • branches/eam_branches/20090522/Nebulous/nebclient/src/nebulous.h

    r23935 r24557  
    11/* src/nebulous.h
    22   Generated by wsdl2h 1.2.12 from nebulous.wsdl and typemap.dat
    3    2009-04-20 22:15:21 GMT
     3   2009-06-01 23:55:50 GMT
    44   Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved.
    55   This part of the software is released under one of the following licenses:
     
    119119  - @ref ns1__delete_USCOREinstance
    120120  - @ref ns1__stat_USCOREobject
     121  - @ref ns1__chmod_USCOREobject
    121122
    122123@section SOAP_ports Endpoints of Binding  "SOAP"
     
    893894);
    894895
     896/******************************************************************************\
     897 *                                                                            *
     898 * ns1__chmod_USCOREobject                                                    *
     899 *                                                                            *
     900\******************************************************************************/
     901
     902
     903/// Operation "ns1__chmod_USCOREobject" of service binding "SOAP"
     904
     905/**
     906
     907Operation details:
     908
     909  - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     910  - SOAP action="urn:Nebulous/Server/SOAP#chmod_object"
     911
     912C stub function (defined in soapClient.c[pp] generated by soapcpp2):
     913@code
     914  int soap_call_ns1__chmod_USCOREobject(
     915    struct soap *soap,
     916    NULL, // char *endpoint = NULL selects default endpoint for this operation
     917    NULL, // char *action = NULL selects default action for this operation
     918    // request parameters:
     919    char*                               key,
     920    int                                 mode,
     921    // response parameters:
     922    int                                *result
     923  );
     924@endcode
     925
     926C server function (called from the service dispatcher defined in soapServer.c[pp]):
     927@code
     928  int ns1__chmod_USCOREobject(
     929    struct soap *soap,
     930    // request parameters:
     931    char*                               key,
     932    int                                 mode,
     933    // response parameters:
     934    int                                *result
     935  );
     936@endcode
     937
     938*/
     939
     940//gsoap ns1  service method-style:      chmod_USCOREobject rpc
     941//gsoap ns1  service method-encoding:   chmod_USCOREobject http://schemas.xmlsoap.org/soap/encoding/
     942//gsoap ns1  service method-action:     chmod_USCOREobject urn:Nebulous/Server/SOAP#chmod_object
     943int ns1__chmod_USCOREobject(
     944    char*                               key,    ///< Request parameter
     945    int                                 mode,   ///< Request parameter
     946    int                                *result  ///< Response parameter
     947);
     948
    895949/* End of src/nebulous.h */
  • branches/eam_branches/20090522/Nebulous/nebclient/src/soapC.c

    r23935 r24557  
    1212#endif
    1313
    14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-04-20 22:15:22 GMT")
     14SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-06-01 23:55:50 GMT")
    1515
    1616
     
    161161        case SOAP_TYPE_int:
    162162                return soap_in_int(soap, NULL, NULL, "xsd:int");
     163        case SOAP_TYPE_ns1__chmod_USCOREobject:
     164                return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, "ns1:chmod_object");
     165        case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
     166                return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, "ns1:chmod_objectResponse");
    163167        case SOAP_TYPE_ns1__stat_USCOREobject:
    164168                return soap_in_ns1__stat_USCOREobject(soap, NULL, NULL, "ns1:stat_object");
     
    250254                        return soap_in_int(soap, NULL, NULL, NULL);
    251255                }
     256                if (!soap_match_tag(soap, t, "ns1:chmod_object"))
     257                {       *type = SOAP_TYPE_ns1__chmod_USCOREobject;
     258                        return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, NULL);
     259                }
     260                if (!soap_match_tag(soap, t, "ns1:chmod_objectResponse"))
     261                {       *type = SOAP_TYPE_ns1__chmod_USCOREobjectResponse;
     262                        return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, NULL);
     263                }
    252264                if (!soap_match_tag(soap, t, "ns1:stat_object"))
    253265                {       *type = SOAP_TYPE_ns1__stat_USCOREobject;
     
    440452        case SOAP_TYPE_int:
    441453                return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int");
     454        case SOAP_TYPE_ns1__chmod_USCOREobject:
     455                return soap_out_ns1__chmod_USCOREobject(soap, tag, id, (const struct ns1__chmod_USCOREobject *)ptr, "ns1:chmod_object");
     456        case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
     457                return soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, (const struct ns1__chmod_USCOREobjectResponse *)ptr, "ns1:chmod_objectResponse");
    442458        case SOAP_TYPE_ns1__stat_USCOREobject:
    443459                return soap_out_ns1__stat_USCOREobject(soap, tag, id, (const struct ns1__stat_USCOREobject *)ptr, "ns1:stat_object");
     
    527543        switch (type)
    528544        {
     545        case SOAP_TYPE_ns1__chmod_USCOREobject:
     546                soap_serialize_ns1__chmod_USCOREobject(soap, (const struct ns1__chmod_USCOREobject *)ptr);
     547                break;
     548        case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
     549                soap_serialize_ns1__chmod_USCOREobjectResponse(soap, (const struct ns1__chmod_USCOREobjectResponse *)ptr);
     550                break;
    529551        case SOAP_TYPE_ns1__stat_USCOREobject:
    530552                soap_serialize_ns1__stat_USCOREobject(soap, (const struct ns1__stat_USCOREobject *)ptr);
     
    11951217#endif
    11961218
     1219SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *a)
     1220{
     1221        (void)soap; (void)a; /* appease -Wall -Werror */
     1222        soap_default_string(soap, &a->key);
     1223        soap_default_int(soap, &a->mode);
     1224}
     1225
     1226SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a)
     1227{
     1228        (void)soap; (void)a; /* appease -Wall -Werror */
     1229        soap_serialize_string(soap, &a->key);
     1230        soap_embedded(soap, &a->mode, SOAP_TYPE_int);
     1231}
     1232
     1233SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a, const char *tag, const char *type)
     1234{
     1235        register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobject);
     1236        if (soap_out_ns1__chmod_USCOREobject(soap, tag, id, a, type))
     1237                return soap->error;
     1238        return soap_putindependent(soap);
     1239}
     1240
     1241SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobject *a, const char *type)
     1242{
     1243        if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobject), type))
     1244                return soap->error;
     1245        if (soap_out_string(soap, "key", -1, &a->key, ""))
     1246                return soap->error;
     1247        if (soap_out_int(soap, "mode", -1, &a->mode, ""))
     1248                return soap->error;
     1249        return soap_element_end_out(soap, tag);
     1250}
     1251
     1252SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *p, const char *tag, const char *type)
     1253{
     1254        if ((p = soap_in_ns1__chmod_USCOREobject(soap, tag, p, type)))
     1255                if (soap_getindependent(soap))
     1256                        return NULL;
     1257        return p;
     1258}
     1259
     1260SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobject *a, const char *type)
     1261{
     1262        size_t soap_flag_key = 1;
     1263        size_t soap_flag_mode = 1;
     1264        if (soap_element_begin_in(soap, tag, 0, type))
     1265                return NULL;
     1266        a = (struct ns1__chmod_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobject, sizeof(struct ns1__chmod_USCOREobject), 0, NULL, NULL, NULL);
     1267        if (!a)
     1268                return NULL;
     1269        soap_default_ns1__chmod_USCOREobject(soap, a);
     1270        if (soap->body && !*soap->href)
     1271        {
     1272                for (;;)
     1273                {       soap->error = SOAP_TAG_MISMATCH;
     1274                        if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
     1275                                if (soap_in_string(soap, "key", &a->key, "xsd:string"))
     1276                                {       soap_flag_key--;
     1277                                        continue;
     1278                                }
     1279                        if (soap_flag_mode && soap->error == SOAP_TAG_MISMATCH)
     1280                                if (soap_in_int(soap, "mode", &a->mode, "xsd:int"))
     1281                                {       soap_flag_mode--;
     1282                                        continue;
     1283                                }
     1284                        if (soap->error == SOAP_TAG_MISMATCH)
     1285                                soap->error = soap_ignore_element(soap);
     1286                        if (soap->error == SOAP_NO_TAG)
     1287                                break;
     1288                        if (soap->error)
     1289                                return NULL;
     1290                }
     1291                if (soap_element_end_in(soap, tag))
     1292                        return NULL;
     1293        }
     1294        else
     1295        {       a = (struct ns1__chmod_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobject, 0, sizeof(struct ns1__chmod_USCOREobject), 0, NULL);
     1296                if (soap->body && soap_element_end_in(soap, tag))
     1297                        return NULL;
     1298        }
     1299        if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_mode > 0))
     1300        {       soap->error = SOAP_OCCURS;
     1301                return NULL;
     1302        }
     1303        return a;
     1304}
     1305
     1306SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *a)
     1307{
     1308        (void)soap; (void)a; /* appease -Wall -Werror */
     1309        a->result = NULL;
     1310}
     1311
     1312SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a)
     1313{
     1314        (void)soap; (void)a; /* appease -Wall -Werror */
     1315        soap_serialize_PointerToint(soap, &a->result);
     1316}
     1317
     1318SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a, const char *tag, const char *type)
     1319{
     1320        register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobjectResponse);
     1321        if (soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, a, type))
     1322                return soap->error;
     1323        return soap_putindependent(soap);
     1324}
     1325
     1326SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobjectResponse *a, const char *type)
     1327{
     1328        if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse), type))
     1329                return soap->error;
     1330        if (soap_out_PointerToint(soap, "result", -1, &a->result, ""))
     1331                return soap->error;
     1332        return soap_element_end_out(soap, tag);
     1333}
     1334
     1335SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *p, const char *tag, const char *type)
     1336{
     1337        if ((p = soap_in_ns1__chmod_USCOREobjectResponse(soap, tag, p, type)))
     1338                if (soap_getindependent(soap))
     1339                        return NULL;
     1340        return p;
     1341}
     1342
     1343SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobjectResponse *a, const char *type)
     1344{
     1345        size_t soap_flag_result = 1;
     1346        if (soap_element_begin_in(soap, tag, 0, type))
     1347                return NULL;
     1348        a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL, NULL, NULL);
     1349        if (!a)
     1350                return NULL;
     1351        soap_default_ns1__chmod_USCOREobjectResponse(soap, a);
     1352        if (soap->body && !*soap->href)
     1353        {
     1354                for (;;)
     1355                {       soap->error = SOAP_TAG_MISMATCH;
     1356                        if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH)
     1357                                if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int"))
     1358                                {       soap_flag_result--;
     1359                                        continue;
     1360                                }
     1361                        if (soap->error == SOAP_TAG_MISMATCH)
     1362                                soap->error = soap_ignore_element(soap);
     1363                        if (soap->error == SOAP_NO_TAG)
     1364                                break;
     1365                        if (soap->error)
     1366                                return NULL;
     1367                }
     1368                if (soap_element_end_in(soap, tag))
     1369                        return NULL;
     1370        }
     1371        else
     1372        {       a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, 0, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL);
     1373                if (soap->body && soap_element_end_in(soap, tag))
     1374                        return NULL;
     1375        }
     1376        return a;
     1377}
     1378
    11971379SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a)
    11981380{
  • branches/eam_branches/20090522/Nebulous/nebclient/src/soapClient.c

    r23935 r24557  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-04-20 22:15:21 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-06-01 23:55:50 GMT")
    1313
    1414
     
    812812}
    813813
     814SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result)
     815{       struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject;
     816        struct ns1__chmod_USCOREobjectResponse *soap_tmp_ns1__chmod_USCOREobjectResponse;
     817        if (!soap_endpoint)
     818                soap_endpoint = "http://localhost:80/nebulous";
     819        if (!soap_action)
     820                soap_action = "urn:Nebulous/Server/SOAP#chmod_object";
     821        soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
     822        soap_tmp_ns1__chmod_USCOREobject.key = key;
     823        soap_tmp_ns1__chmod_USCOREobject.mode = mode;
     824        soap_begin(soap);
     825        soap_serializeheader(soap);
     826        soap_serialize_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject);
     827        if (soap_begin_count(soap))
     828                return soap->error;
     829        if (soap->mode & SOAP_IO_LENGTH)
     830        {       if (soap_envelope_begin_out(soap)
     831                 || soap_putheader(soap)
     832                 || soap_body_begin_out(soap)
     833                 || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "")
     834                 || soap_body_end_out(soap)
     835                 || soap_envelope_end_out(soap))
     836                         return soap->error;
     837        }
     838        if (soap_end_count(soap))
     839                return soap->error;
     840        if (soap_connect(soap, soap_endpoint, soap_action)
     841         || soap_envelope_begin_out(soap)
     842         || soap_putheader(soap)
     843         || soap_body_begin_out(soap)
     844         || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "")
     845         || soap_body_end_out(soap)
     846         || soap_envelope_end_out(soap)
     847         || soap_end_send(soap))
     848                return soap_closesock(soap);
     849        if (!result)
     850                return soap_closesock(soap);
     851        soap_default_int(soap, result);
     852        if (soap_begin_recv(soap)
     853         || soap_envelope_begin_in(soap)
     854         || soap_recv_header(soap)
     855         || soap_body_begin_in(soap))
     856                return soap_closesock(soap);
     857        soap_tmp_ns1__chmod_USCOREobjectResponse = soap_get_ns1__chmod_USCOREobjectResponse(soap, NULL, "ns1:chmod_objectResponse", "");
     858        if (soap->error)
     859        {       if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
     860                        return soap_recv_fault(soap);
     861                return soap_closesock(soap);
     862        }
     863        if (soap_body_end_in(soap)
     864         || soap_envelope_end_in(soap)
     865         || soap_end_recv(soap))
     866                return soap_closesock(soap);
     867        if (result && soap_tmp_ns1__chmod_USCOREobjectResponse->result)
     868                *result = *soap_tmp_ns1__chmod_USCOREobjectResponse->result;
     869        return soap_closesock(soap);
     870}
     871
    814872#ifdef __cplusplus
    815873}
  • branches/eam_branches/20090522/Nebulous/nebclient/src/soapH.h

    r23198 r24557  
    4242
    4343#ifndef SOAP_TYPE_SOAP_ENV__Fault
    44 #define SOAP_TYPE_SOAP_ENV__Fault (64)
     44#define SOAP_TYPE_SOAP_ENV__Fault (67)
    4545#endif
    4646SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);
     
    5656
    5757#ifndef SOAP_TYPE_SOAP_ENV__Reason
    58 #define SOAP_TYPE_SOAP_ENV__Reason (63)
     58#define SOAP_TYPE_SOAP_ENV__Reason (66)
    5959#endif
    6060SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *);
     
    7070
    7171#ifndef SOAP_TYPE_SOAP_ENV__Detail
    72 #define SOAP_TYPE_SOAP_ENV__Detail (60)
     72#define SOAP_TYPE_SOAP_ENV__Detail (63)
    7373#endif
    7474SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);
     
    8484
    8585#ifndef SOAP_TYPE_SOAP_ENV__Code
    86 #define SOAP_TYPE_SOAP_ENV__Code (58)
     86#define SOAP_TYPE_SOAP_ENV__Code (61)
    8787#endif
    8888SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);
     
    9898
    9999#ifndef SOAP_TYPE_SOAP_ENV__Header
    100 #define SOAP_TYPE_SOAP_ENV__Header (57)
     100#define SOAP_TYPE_SOAP_ENV__Header (60)
    101101#endif
    102102SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);
     
    109109#endif
    110110
     111#ifndef SOAP_TYPE_ns1__chmod_USCOREobject
     112#define SOAP_TYPE_ns1__chmod_USCOREobject (59)
     113#endif
     114SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *);
     115SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *);
     116SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *, const char*, const char*);
     117SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap*, const char*, int, const struct ns1__chmod_USCOREobject *, const char*);
     118SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *, const char*, const char*);
     119SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap*, const char*, struct ns1__chmod_USCOREobject *, const char*);
     120
     121#ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse
     122#define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58)
     123#endif
     124SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *);
     125SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *);
     126SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
     127SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__chmod_USCOREobjectResponse *, const char*);
     128SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
     129SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, struct ns1__chmod_USCOREobjectResponse *, const char*);
     130
    111131#ifndef SOAP_TYPE_ns1__stat_USCOREobject
    112132#define SOAP_TYPE_ns1__stat_USCOREobject (56)
     
    402422
    403423#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason
    404 #define SOAP_TYPE_PointerToSOAP_ENV__Reason (66)
     424#define SOAP_TYPE_PointerToSOAP_ENV__Reason (69)
    405425#endif
    406426SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*);
     
    415435
    416436#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail
    417 #define SOAP_TYPE_PointerToSOAP_ENV__Detail (65)
     437#define SOAP_TYPE_PointerToSOAP_ENV__Detail (68)
    418438#endif
    419439SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*);
     
    428448
    429449#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code
    430 #define SOAP_TYPE_PointerToSOAP_ENV__Code (59)
     450#define SOAP_TYPE_PointerToSOAP_ENV__Code (62)
    431451#endif
    432452SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*);
  • branches/eam_branches/20090522/Nebulous/nebclient/src/soapServer.c

    r23935 r24557  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-04-20 22:15:21 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-06-01 23:55:50 GMT")
    1313
    1414
     
    105105        if (!soap_match_tag(soap, soap->tag, "ns1:stat_object"))
    106106                return soap_serve_ns1__stat_USCOREobject(soap);
     107        if (!soap_match_tag(soap, soap->tag, "ns1:chmod_object"))
     108                return soap_serve_ns1__chmod_USCOREobject(soap);
    107109        return soap->error = SOAP_NO_METHOD;
    108110}
     
    713715}
    714716
     717SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap *soap)
     718{       struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject;
     719        struct ns1__chmod_USCOREobjectResponse soap_tmp_ns1__chmod_USCOREobjectResponse;
     720        int soap_tmp_int;
     721        soap_default_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse);
     722        soap_default_int(soap, &soap_tmp_int);
     723        soap_tmp_ns1__chmod_USCOREobjectResponse.result = &soap_tmp_int;
     724        soap_default_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject);
     725        soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
     726        if (!soap_get_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", NULL))
     727                return soap->error;
     728        if (soap_body_end_in(soap)
     729         || soap_envelope_end_in(soap)
     730         || soap_end_recv(soap))
     731                return soap->error;
     732        soap->error = ns1__chmod_USCOREobject(soap, soap_tmp_ns1__chmod_USCOREobject.key, soap_tmp_ns1__chmod_USCOREobject.mode, &soap_tmp_int);
     733        if (soap->error)
     734                return soap->error;
     735        soap_serializeheader(soap);
     736        soap_serialize_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse);
     737        if (soap_begin_count(soap))
     738                return soap->error;
     739        if (soap->mode & SOAP_IO_LENGTH)
     740        {       if (soap_envelope_begin_out(soap)
     741                 || soap_putheader(soap)
     742                 || soap_body_begin_out(soap)
     743                 || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "")
     744                 || soap_body_end_out(soap)
     745                 || soap_envelope_end_out(soap))
     746                         return soap->error;
     747        };
     748        if (soap_end_count(soap)
     749         || soap_response(soap, SOAP_OK)
     750         || soap_envelope_begin_out(soap)
     751         || soap_putheader(soap)
     752         || soap_body_begin_out(soap)
     753         || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "")
     754         || soap_body_end_out(soap)
     755         || soap_envelope_end_out(soap)
     756         || soap_end_send(soap))
     757                return soap->error;
     758        return soap_closesock(soap);
     759}
     760
    715761#ifdef __cplusplus
    716762}
  • branches/eam_branches/20090522/Nebulous/nebclient/src/soapStub.h

    r23935 r24557  
    306306#endif
    307307
     308#ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse
     309#define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58)
     310/* ns1:chmod_objectResponse */
     311struct ns1__chmod_USCOREobjectResponse
     312{
     313        int *result;    /* SOAP 1.2 RPC return element (when namespace qualified) */    /* optional element of type xsd:int */
     314};
     315#endif
     316
     317#ifndef SOAP_TYPE_ns1__chmod_USCOREobject
     318#define SOAP_TYPE_ns1__chmod_USCOREobject (59)
     319/* ns1:chmod_object */
     320struct ns1__chmod_USCOREobject
     321{
     322        char *key;      /* optional element of type xsd:string */
     323        int mode;       /* required element of type xsd:int */
     324};
     325#endif
     326
    308327#ifndef SOAP_TYPE_SOAP_ENV__Header
    309 #define SOAP_TYPE_SOAP_ENV__Header (57)
     328#define SOAP_TYPE_SOAP_ENV__Header (60)
    310329/* SOAP Header: */
    311330struct SOAP_ENV__Header
     
    318337
    319338#ifndef SOAP_TYPE_SOAP_ENV__Code
    320 #define SOAP_TYPE_SOAP_ENV__Code (58)
     339#define SOAP_TYPE_SOAP_ENV__Code (61)
    321340/* SOAP Fault Code: */
    322341struct SOAP_ENV__Code
     
    328347
    329348#ifndef SOAP_TYPE_SOAP_ENV__Detail
    330 #define SOAP_TYPE_SOAP_ENV__Detail (60)
     349#define SOAP_TYPE_SOAP_ENV__Detail (63)
    331350/* SOAP-ENV:Detail */
    332351struct SOAP_ENV__Detail
     
    339358
    340359#ifndef SOAP_TYPE_SOAP_ENV__Reason
    341 #define SOAP_TYPE_SOAP_ENV__Reason (63)
     360#define SOAP_TYPE_SOAP_ENV__Reason (66)
    342361/* SOAP-ENV:Reason */
    343362struct SOAP_ENV__Reason
     
    348367
    349368#ifndef SOAP_TYPE_SOAP_ENV__Fault
    350 #define SOAP_TYPE_SOAP_ENV__Fault (64)
     369#define SOAP_TYPE_SOAP_ENV__Fault (67)
    351370/* SOAP Fault: */
    352371struct SOAP_ENV__Fault
     
    437456SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
    438457
     458SOAP_FMAC5 int SOAP_FMAC6 ns1__chmod_USCOREobject(struct soap*, char *key, int mode, int *result);
     459
    439460/******************************************************************************\
    440461 *                                                                            *
     
    472493SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
    473494
     495SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result);
     496
    474497/******************************************************************************\
    475498 *                                                                            *
     
    509532
    510533SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap*);
     534
     535SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap*);
    511536
    512537#ifdef __cplusplus
  • branches/eam_branches/20090522/Nebulous/nebclient/tests/tap

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/nebclient/tests/tests.c

    r21461 r24557  
    2020    char            *key = "foobarbaz";
    2121
    22     plan_tests(28);
     22    plan_tests(29);
    2323
    2424    if (getenv("NEB_SERVER")) {
     
    136136    neb_ok(server, nebMove(server, "copyiedfile", "movedfile"), "move object");
    137137
     138    neb_ok(server, nebChmod(server, "movedfile", 0440) == 0, "chmod object");
     139
    138140    if (!nebDelete(server, "movedfile")) {
    139141        diag( "cleanup failed %s\n", nebErr(server));
  • branches/eam_branches/20090522/Nebulous/t

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/Nebulous/t/59_client_delete.t

    r18858 r24557  
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 9;
     12plan tests => 13;
    1313
    1414use lib qw( ./t ./lib );
     
    2626        proxy => "http://$hostport/nebulous",
    2727    );
    28     $neb->create( "foo" );
     28    my $uri = $neb->create( "foo" );
    2929
    3030    ok( $neb->delete( "foo" ), "delete object" );
     31
     32    ok( ! -e _get_file_path($uri), "deleted file" );
    3133
    3234    my $locations = $neb->find_instances( "foo" );
     
    7678}
    7779
     80# force flag
     81Test::Nebulous->setup;
     82
     83{
     84    my $neb = Nebulous::Client->new(
     85        proxy => "http://$hostport/nebulous",
     86    );
     87    $neb->create( "foo" );
     88
     89    is( $neb->delete("foo", undef), 1, "force flag false" );
     90}
     91
     92Test::Nebulous->setup;
     93
     94{
     95    my $neb = Nebulous::Client->new(
     96        proxy => "http://$hostport/nebulous",
     97    );
     98    $neb->create( "foo" );
     99
     100    is( $neb->delete("foo", 1), 1, "force flag false" );
     101}
     102
    78103Test::Nebulous->setup;
    79104
     
    84109    $neb->delete();
    85110};
    86 like( $@, qr/1 was expected/, "no params" );
     111like( $@, qr/1 - 2 were expected/, "no params" );
    87112
    88113Test::Nebulous->setup;
     
    92117        proxy => "http://$hostport/nebulous",
    93118    );
    94     $neb->delete( "foo", 2 );
     119    $neb->delete( "foo", 3);
    95120};
    96 like( $@, qr/1 was expected/, "too many params" );
     121like( $@, qr/is boolean/, "force flag not boolean" );
     122
     123Test::Nebulous->setup;
     124
     125eval {
     126    my $neb = Nebulous::Client->new(
     127        proxy => "http://$hostport/nebulous",
     128    );
     129    $neb->delete( "foo", 0, 2 );
     130};
     131like( $@, qr/1 - 2 were expected/, "too many params" );
    97132
    98133Test::Nebulous->cleanup;
  • branches/eam_branches/20090522/Nebulous/t/62_client_delete_instance.t

    r23934 r24557  
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 11;
     12plan tests => 10;
    1313
    1414use lib qw( ./t ./lib );
     
    3535
    3636    is( $uri, @$locations[0], "delete instance" );
    37 
    38     ok( ! -e _get_file_path( @$locations[0] ), "deleted file" );
    3937}
    4038
  • branches/eam_branches/20090522/Nebulous/t/66_client_xattr.t

    r17750 r24557  
    11#!/usr/bin/perl
    22
    3 # Copryight (C) 2007-2008  Joshua Hoblitt
    4 #
    5 # $Id: 66_client_xattr.t,v 1.1 2008-05-20 00:54:30 jhoblitt Exp $
     3# Copryight (C) 2007-2009  Joshua Hoblitt
    64
    75use strict;
     
    97
    108use Apache::Test qw( -withtestmore );
    11 plan tests => 32;
    12 
     9plan tests => 44;
    1310
    1411use lib qw( ./t ./lib );
     
    2017my $hostport = Apache::Test->config->{ 'hostport' };
    2118
     19my $neb = Nebulous::Client->new(
     20    proxy => "http://$hostport/nebulous",
     21);
     22
    2223# 1 key / xattr
    2324
     
    2526
    2627{
    27     my $neb = Nebulous::Client->new(
    28         proxy => "http://$hostport/nebulous",
    29     );
    30 
    3128    my $uri = $neb->create('foo');
    3229
    33     ok($neb->setxattr('foo', 'bar', 'baz', 'create'), 'set object xattr');
     30    ok($neb->setxattr('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
    3431    {
    3532        my $xattrs = $neb->listxattr('foo');
    3633        is(scalar @$xattrs, 1, 'number of xattrs');
    37         is(@$xattrs[0], 'bar', 'xattr name');
    38     }
    39 
    40     my $value = $neb->getxattr('foo', 'bar');
     34        is(@$xattrs[0], 'user.bar', 'xattr name');
     35    }
     36
     37    my $value = $neb->getxattr('foo', 'user.bar');
    4138    is($value, 'baz', 'xattr value');
    4239
    43     ok($neb->removexattr('foo', 'bar'), "remove object xattr");
     40    ok($neb->removexattr('foo', 'user.bar'), "remove object xattr");
    4441    {
    4542        my $xattrs = $neb->listxattr('foo');
     
    5350
    5451{
    55     my $neb = Nebulous::Client->new(
    56         proxy => "http://$hostport/nebulous",
    57     );
    58 
    5952    my $uri = $neb->create('foo');
    6053
    61     ok($neb->setxattr('foo', 'bar', 'baz', 'create'), 'set object xattr');
    62     ok($neb->setxattr('foo', 'bonk', 'quix', 'create'), 'set object xattr');
     54    ok($neb->setxattr('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
     55    ok($neb->setxattr('foo', 'user.bonk', 'quix', 'create'), 'set object xattr');
    6356   
    6457    {
    6558        my $xattrs = $neb->listxattr('foo');
    6659        is(scalar @$xattrs, 2, 'number of xattrs');
    67         is(@$xattrs[0], 'bar', 'xattr name');
    68         is(@$xattrs[1], 'bonk', 'xattr name');
    69     }
    70 
    71     my $value = $neb->getxattr('foo', 'bar');
     60        is(@$xattrs[0], 'user.bar', 'xattr name');
     61        is(@$xattrs[1], 'user.bonk', 'xattr name');
     62    }
     63
     64    my $value = $neb->getxattr('foo', 'user.bar');
    7265    is($value, 'baz', 'xattr value');
    73     $value = $neb->getxattr('foo', 'bonk');
     66    $value = $neb->getxattr('foo', 'user.bonk');
    7467    is($value, 'quix', 'xattr value');
    7568
    76     ok($neb->removexattr('foo', 'bar'), "remove object xattr");
    77     ok($neb->removexattr('foo', 'bonk'), "remove object xattr");
     69    ok($neb->removexattr('foo', 'user.bar'), "remove object xattr");
     70    ok($neb->removexattr('foo', 'user.bonk'), "remove object xattr");
    7871    {
    7972        my $xattrs = $neb->listxattr('foo');
     
    8780
    8881{
    89     my $neb = Nebulous::Client->new(
    90         proxy => "http://$hostport/nebulous",
    91     );
    92 
    9382    my $uri = $neb->create('foo');
    9483
    95     ok($neb->setxattr('foo', 'bar', 'baz', 'create'), 'set object xattr');
    96     ok($neb->setxattr('foo', 'bar', 'quix', 'replace'), 're-set object xattr');
     84    ok($neb->setxattr('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
     85    ok($neb->setxattr('foo', 'user.bar', 'quix', 'replace'), 're-set object xattr');
    9786   
    9887    {
    9988        my $xattrs = $neb->listxattr('foo');
    10089        is(scalar @$xattrs, 1, 'number of xattrs');
    101         is(@$xattrs[0], 'bar', 'xattr name');
    102     }
    103 
    104     my $value = $neb->getxattr('foo', 'bar');
     90        is(@$xattrs[0], 'user.bar', 'xattr name');
     91    }
     92
     93    my $value = $neb->getxattr('foo', 'user.bar');
    10594    is($value, 'quix', 'xattr value');
    10695
    107     ok($neb->removexattr('foo', 'bar'), "remove object xattr");
     96    ok($neb->removexattr('foo', 'user.bar'), "remove object xattr");
    10897    {
    10998        my $xattrs = $neb->listxattr('foo');
     
    117106
    118107eval {
    119     my $neb = Nebulous::Client->new(
    120         proxy => "http://$hostport/nebulous",
    121     );
    122 
     108    $neb->setxattr('foo', 'user.bar', 'baz', 'create');
     109};
     110like($@, qr/is valid object key/, "create xattr on non-existant key");
     111
     112Test::Nebulous->setup;
     113
     114eval {
     115    $neb->create('foo');
     116
     117    $neb->setxattr('foo', 'luser.bar', 'baz', 'create');
     118};
     119like($@, qr/xattr is in user. namespace/, "user. namspace");
     120
     121Test::Nebulous->setup;
     122
     123eval {
     124    $neb->setxattr('foo', 'user.bar', 'baz', 'replace');
     125};
     126like($@, qr/is valid object key/, "replace xattr on non-existant key");
     127
     128Test::Nebulous->setup;
     129
     130eval {
    123131    $neb->setxattr();
    124132};
     
    128136
    129137eval {
    130     my $neb = Nebulous::Client->new(
    131         proxy => "http://$hostport/nebulous",
    132     );
    133 
    134     $neb->create('foo');
    135 
    136     $neb->setxattr('foo', 'bar');
     138    $neb->create('foo');
     139
     140    $neb->setxattr('foo', 'user.bar');
    137141};
    138142like($@, qr/4 were expected/, "too few params");
     
    141145
    142146eval {
    143     my $neb = Nebulous::Client->new(
    144         proxy => "http://$hostport/nebulous",
    145     );
    146 
    147     $neb->create('foo');
    148 
    149     $neb->setxattr('foo', 'bar', 'baz');
     147    $neb->create('foo');
     148
     149    $neb->setxattr('foo', 'user.bar', 'baz');
    150150};
    151151like($@, qr/4 were expected/, "too few params");
     
    154154
    155155eval {
    156     my $neb = Nebulous::Client->new(
    157         proxy => "http://$hostport/nebulous",
    158     );
    159 
    160     $neb->create('foo');
    161 
    162     $neb->setxattr('foo', 'bar', 'baz', 'create', 'quix');
     156    $neb->create('foo');
     157
     158    $neb->setxattr('foo', 'user.bar', 'baz', 'create', 'quix');
    163159};
    164160like($@, qr/4 were expected/, "too many params");
    165161
     162# getxattr
     163
     164Test::Nebulous->setup;
     165
     166eval {
     167    $neb->getxattr('foo', 'bar');
     168};
     169like($@, qr/is valid object key/, "get xattr from non-existant nebulous key");
     170
     171Test::Nebulous->setup;
     172
     173eval {
     174    $neb->create('foo');
     175
     176    $neb->getxattr('foo', 'luser.bar');
     177};
     178like($@, qr/xattr is in user. namespace/, "user. namespace");
     179
     180Test::Nebulous->setup;
     181
     182eval {
     183    $neb->create('foo');
     184    $neb->getxattr('foo', 'user.bar');
     185};
     186like($@, qr|xattr neb:///foo:user.bar does not exist|,
     187    "get xattr from non-existant xattr key");
     188
     189Test::Nebulous->setup;
     190
     191eval {
     192    $neb->getxattr();
     193};
     194like($@, qr/2 were expected/, "no params");
     195
     196Test::Nebulous->setup;
     197
     198eval {
     199    $neb->create('foo');
     200
     201    $neb->getxattr('foo');
     202};
     203like($@, qr/2 were expected/, "too few params");
     204
     205Test::Nebulous->setup;
     206
     207eval {
     208    $neb->create('foo');
     209
     210    $neb->getxattr('foo', 'user.bar', 'baz');
     211};
     212like($@, qr/2 were expected/, "too many params");
     213
    166214# listxattr
    167215
     
    169217
    170218eval {
    171     my $neb = Nebulous::Client->new(
    172         proxy => "http://$hostport/nebulous",
    173     );
    174 
    175219    $neb->create('foo');
    176220
     
    182226
    183227eval {
    184     my $neb = Nebulous::Client->new(
    185         proxy => "http://$hostport/nebulous",
    186     );
    187 
    188228    $neb->create('foo');
    189229
     
    192232like($@, qr/1 was expected/, "too many params");
    193233
    194 # getxattr
    195 
    196 Test::Nebulous->setup;
    197 
    198 eval {
    199     my $neb = Nebulous::Client->new(
    200         proxy => "http://$hostport/nebulous",
    201     );
    202 
    203     $neb->getxattr();
     234# removexattr
     235
     236Test::Nebulous->setup;
     237
     238eval {
     239    $neb->removexattr('foo', 'user.bar');
     240};
     241like($@, qr/is valid object key/, "remove xattr from non-existant nebulous key");
     242
     243Test::Nebulous->setup;
     244
     245eval {
     246    $neb->create('foo');
     247
     248    $neb->getxattr('foo', 'luser.bar');
     249};
     250like($@, qr/xattr is in user. namespace/, "user. namespace");
     251
     252Test::Nebulous->setup;
     253
     254eval {
     255    $neb->create('foo');
     256    $neb->removexattr('foo', 'user.bar');
     257};
     258like($@, qr|xattr neb:///foo:user.bar does not exist|,
     259    "remove xattr from non-existant xattr key");
     260
     261Test::Nebulous->setup;
     262
     263eval {
     264    $neb->removexattr();
    204265};
    205266like($@, qr/2 were expected/, "no params");
     
    208269
    209270eval {
    210     my $neb = Nebulous::Client->new(
    211         proxy => "http://$hostport/nebulous",
    212     );
    213 
    214     $neb->create('foo');
    215 
    216     $neb->getxattr('foo');
     271    $neb->create('foo');
     272
     273    $neb->removexattr('foo');
    217274};
    218275like($@, qr/2 were expected/, "too few params");
     
    221278
    222279eval {
    223     my $neb = Nebulous::Client->new(
    224         proxy => "http://$hostport/nebulous",
    225     );
    226 
    227     $neb->create('foo');
    228 
    229     $neb->getxattr('foo', 'bar', 'baz');
     280    $neb->create('foo');
     281
     282    $neb->removexattr('foo', 'user.bar', 'baz');
    230283};
    231284like($@, qr/2 were expected/, "too many params");
  • branches/eam_branches/20090522/Nebulous/t/70_neb-ls.t

    r23934 r24557  
    3838
    3939# NEB_SERVER env var not set
     40undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'};
    4041Test::Nebulous->setup;
    4142
     
    8283
    8384    is($? >> 8, 0, "exit code");
    84     like($test->stdout, qr/^foo bar$/,  "stdout");
     85    like($test->stdout, qr/^foo\nbar$/,  "stdout");
    8586    like($test->stderr, qr/^$/,         "stderr");
    8687}
     
    160161
    161162    is($? >> 8, 0, "exit code");
    162     like($test->stdout, qr|^a/foo a/bar$|,  "stdout");
     163    like($test->stdout, qr|^a/foo\na/bar$|,  "stdout");
    163164    like($test->stderr, qr/^$/,             "stderr");
    164165}
  • branches/eam_branches/20090522/Nebulous/t/conf/startup.pl.in

    r23934 r24557  
    1818my $config = Nebulous::Server::Config->new(
    1919    trace       => 'all',
     20    memcached_servers => ['127.0.0.1:11211'],
    2021);
    2122$config->add_db(
Note: See TracChangeset for help on using the changeset viewer.