Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1621

Show
Ignore:
Timestamp:
09/13/05 23:26:57 (3 years ago)
Author:
nahi
Message:

test for qualified and unqualified

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/wsdl/qualified/test_qualified.rb

    r1615 r1621  
    1111class TestQualified < Test::Unit::TestCase 
    1212  class Server < ::SOAP::RPC::StandaloneServer 
    13     Namespace = 'urn:lp' 
     13    Namespace = 'http://www50.brinkster.com/vbfacileinpt/np' 
    1414 
    1515    def on_init 
    1616      add_document_method( 
    1717        self, 
    18         Namespace + ':login', 
    19         'login', 
    20         XSD::QName.new(Namespace, 'login'), 
    21         XSD::QName.new(Namespace, 'loginResponse') 
     18        Namespace + '/GetPrimeNumbers', 
     19        'GetPrimeNumbers', 
     20        XSD::QName.new(Namespace, 'GetPrimeNumbers'), 
     21        XSD::QName.new(Namespace, 'GetPrimeNumbersResponse') 
    2222      ) 
    2323    end 
    2424   
    25     def login(arg) 
     25    def GetPrimeNumbers(arg) 
    2626      nil 
    2727    end 
     
    3939  def teardown 
    4040    teardown_server 
    41     File.unlink(pathname('lp.rb')) 
    42     File.unlink(pathname('lpDriver.rb')) 
     41    unless $DEBUG 
     42      File.unlink(pathname('default.rb')) 
     43      File.unlink(pathname('defaultDriver.rb')) 
     44    end 
    4345    @client.reset_stream if @client 
    4446  end 
     
    5557      Dir.chdir(DIR) 
    5658      gen = WSDL::SOAP::WSDL2Ruby.new 
    57       gen.location = pathname("lp.wsdl") 
     59      gen.location = pathname("np.wsdl") 
    5860      gen.basedir = DIR 
    5961      gen.logger.level = Logger::FATAL 
     
    6264      gen.opt['force'] = true 
    6365      gen.run 
    64       require pathname('lp') 
     66      require pathname('default.rb') 
    6567    ensure 
    6668      Dir.chdir(backupdir) 
     
    8688  end 
    8789 
     90  LOGIN_REQUEST_QUALIFIED_NS = 
     91%q[<?xml version="1.0" encoding="utf-8" ?> 
     92<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     93    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     94    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     95  <env:Body> 
     96    <n1:GetPrimeNumbers xmlns:n1="http://www50.brinkster.com/vbfacileinpt/np"> 
     97      <n1:Max>10</n1:Max> 
     98    </n1:GetPrimeNumbers> 
     99  </env:Body> 
     100</env:Envelope>] 
     101 
    88102  LOGIN_REQUEST_QUALIFIED = 
    89103%q[<?xml version="1.0" encoding="utf-8" ?> 
     
    92106    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    93107  <env:Body> 
    94     <n1:login xmlns:n1="urn:lp"> 
    95       <username>NaHi</username> 
    96       <password>passwd</password> 
    97       <timezone>JST</timezone> 
    98     </n1:login> 
     108    <GetPrimeNumbers xmlns="http://www50.brinkster.com/vbfacileinpt/np"> 
     109      <Max>10</Max> 
     110    </GetPrimeNumbers> 
    99111  </env:Body> 
    100112</env:Envelope>] 
    101113 
    102114  def test_wsdl 
    103     wsdl = File.join(DIR, 'lp.wsdl') 
     115    wsdl = File.join(DIR, 'np.wsdl') 
    104116    @client = nil 
    105117    backupdir = Dir.pwd 
     
    112124    @client.endpoint_url = "http://localhost:#{Port}/" 
    113125    @client.wiredump_dev = str = '' 
    114     @client.login(:timezone => 'JST', :password => 'passwd', 
    115       :username => 'NaHi') 
    116     assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 
     126    @client.GetPrimeNumbers(:Max => 10) 
     127    assert_equal(LOGIN_REQUEST_QUALIFIED_NS, parse_requestxml(str)) 
    117128  end 
    118129 
     
    122133    begin 
    123134      Dir.chdir(DIR) 
    124       require pathname('lpDriver') 
     135      require pathname('defaultDriver') 
    125136    ensure 
    126137      Dir.chdir(backupdir) 
    127138    end 
    128     @client = Lp_porttype.new("http://localhost:#{Port}/") 
     139    @client = PnumSoap.new("http://localhost:#{Port}/") 
    129140 
    130141    @client.wiredump_dev = str = '' 
    131     @client.login(Login.new('NaHi', 'passwd', 'JST')) 
     142    @client.getPrimeNumbers(GetPrimeNumbers.new(10)) 
    132143    assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 
    133144  end