# Copyright for the Uniform Repository Service (c) 1995 - 2007,
# by Gerald Banon. All rights reserved.
# Version 2.1
# test2
proc TestExecute {} {
global env
global serverAddress ;# used in SetFieldValue
set col ../../../../..
set URLibServiceRepository $env(URLIB_SERVICE_REP)
source ../$col/$URLibServiceRepository/doc/utilities1.tcl
source ../$col/$URLibServiceRepository/doc/cgi/mirrorfind-.tcl
# serverAddressWithIP
set serverAddressWithIP [list $env(IP_ADDR) $env(URLIB_PORT)]
# serverAddress
set serverAddress [list $env(SERVER_NAME) $env(URLIB_PORT)]
# homePath
set homePath $env(DOCUMENT_ROOT)
puts {Content-Type: text/html}
puts {}
puts $serverAddressWithIP
puts $serverAddress
if 0 {
# testing CreateOptionListForCopyright
# SetFieldValue is not completed when run in mtc-m19,
# and banon-pc3 is started enabling wireless, then posting URLibService (150.163.3.97), and then plugging the network cable
set siteList [list $serverAddressWithIP {150.163.2.174 800}]
set query {automatic} ;# drop the repositories that have parents (they contain copyright translation)
puts $query
set siteMetadataRepList [FindMetadataRepositories $query 0 $siteList {} no no 1] ;# {site rep-i} {site rep-i} ...
# return banon-pc3 (without domain name)
puts --$siteMetadataRepList--
# SetFieldValue $site ${rep-i} {citationkey repository} ;# once, running in mtc-m19, SetFieldValue {banon-pc3.dpi.inpe.br 800} didn't respond, producing a blank submission/update form
# SetFieldValue {banon-pc3 800} iconet.com.br/banon/2010/02.13.15.02.51-0 {citationkey repository} 0 ;# from mtc-m19.sid.inpe.br, one gets "Concluido" but doesn't complete the script
# SetFieldValue {150.163.3.97 800} iconet.com.br/banon/2010/02.13.15.02.51-0 {citationkey repository} 0 ;# from mtc-m19.sid.inpe.br, one gets "Recebendo dados de mtc-m19.sid.inpe.br ..." and doesn't complete the script
# SetFieldValue {150.163.3.97 800} iconet.com.br/banon/2010/02.13.15.02.51-0 {citationkey repository} 1 ;# from mtc-m19.sid.inpe.br, one gets "Concluido" but doesn't complete the script
SetFieldValue {150.163.2.174 800} iconet.com.br/banon/2010/02.13.15.02.51-0 {citationkey repository} 0 ;# from mtc-m19.sid.inpe.br, works
puts {
}
puts $citationkey
puts $repository
}
if 0 {
set serverAddress {gemini.dpi.inpe.br 800}
set metadataRep [Execute $serverAddress [list FindMetadataRep dpi.inpe.br/Gemini@80/2006/04.05.15.27]]
puts --$metadataRep--
}
if 0 {
set serverAddressWithIP {192.168.1.100 800}
set nameList [Execute $serverAddressWithIP [list GetMetadataArrayNames dpi.inpe.br/banon/2000/12.04.16.26-1,*]]
puts --$nameList--
}
if 1 {
set command [list list GetSiteStamp]
# MULTIPLE SUBMIT
# set siteWithIP {150.163.2.14 19050}
set siteWithIP {mtc-m19.sid.inpe.br 800}
# set siteWithIP {banon-pc3.dpi.inpe.br 800}
set siteRepIpConfirmation [MultipleExecute [list $siteWithIP] $command]
puts --$siteRepIpConfirmation--
}
if 1 {
if [catch {Execute $serverAddressWithIP [list CreateIBI dpi.inpe.br/banon/1999/01.09.22.14 896322016461] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 1 {
if [catch {Execute $serverAddressWithIP [list CreateIBI dpi.inpe.br/banon/1999/01.09.22.14 896322016461] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 0 {
if [catch {Execute $serverAddressWithIP [list CreateIBI2 2010/07.20.01.14.50] 0} m] {
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 1 {
if [catch {Execute urlib.net:80 [list CreateIBI dpi.inpe.br/banon/1999/01.09.22.14 896322016461] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 0 {
if [catch {Execute urlib.net:80 [list CreateIBI usp.br/gabibanon/2006/01.22.09.19 835468106996] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 0 {
if [catch {Execute urlib.net:80 [list CreateIBI usp.br/gabibanon/2010/06.18.00.53 9460348079561043] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 0 {
if [catch {Execute $serverAddressWithIP [list TestExecute OK] 0} m] {
# couldn't open socket: connection refused
# error writing "sock1884": connection refused
# error writing "sock240": socket is not connected
global errorInfo
puts $errorInfo
} else {
puts $m
}
}
if 0 {
puts [encoding system]
puts "é
"
puts [encoding convertfrom utf-8 "é"]
}
if 1 {
global x y ;# for unix
puts 1
set s [socket -async $env(IP_ADDR) $env(URLIB_PORT)]
# set s [socket -async hermes.dpi.inpe.br 19050]
# set s [socket -async mtc-m19.sid.inpe.br 800]
fconfigure $s -buffering line
puts 2
if [info exists x] {unset x}
fileevent $s writable {set x 1}; vwait x
puts 3
puts $s [list TestExecute OK]
puts 4
if [info exists y] {unset y}
fileevent $s readable {set y 1}; vwait y
puts 5
gets $s line
puts 6
puts --$line--
}
if 0 {
global x y ;# for unix
puts 1
# set s [socket -async 150.163.2.175 80]
# set s [socket -async mtc-m13.sid.inpe.br 80]
# set s [socket -async mtc-m17.sid.inpe.br 80]
set s [socket -async micro02 19050]
# fconfigure $s -buffering line
puts 2
if [info exists x] {unset x}
# fileevent $s writable "set x 1" ;# works
fileevent $s writable {set x 1}
# fileevent $s writable set x 1 ;# dosen't work
# after 1000 "set x 0" ;# works
# after 1000 {set x 0} ;# works
after 1000 set x 0
vwait x
puts --$x--
}
if 0 {
proc ProcessWritableSocket {socket afterID} {
global x$socket
after cancel $afterID
set x$socket 1
}
set s [socket -async micro02 19050]
global x$s ;# for unix
if [info exists x$s] {unset x$s}
set afterID [after 100 set x$s 0]
# fileevent $s writable "set x$s 1"
fileevent $s writable "ProcessWritableSocket $s $afterID"
vwait x$s
puts --[set x$s]--
}
if 0 {
global apacheFlag ;# needed by after
set address mtc-m17.sid.inpe.br
set address banon-pc2
if [catch {socket -async $address 80} s] {
set apacheFlag 0
} else {
if [info exists apacheFlag] {unset apacheFlag}
fileevent $s writable {set apacheFlag 1}
set afterID [after 300 set apacheFlag 0]
vwait apacheFlag ;# wait at most 300 ms
after cancel $afterID
}
puts $apacheFlag
}
if 0 {
Load $homePath/@cmdbuf fileContent
puts
$fileContent} if 0 { set fileContent [Execute $serverAddressWithIP [list Load2 iconet.com.br/banon/2009/06.16.21.10 year=2009_adm.txt 33xx source] 0] puts --$fileContent-- set command [list list MultipleLinesLoad2 iconet.com.br/banon/2009/06.16.21.10 @relatorio.toc 33xx doc] set fileContent [join [MultipleExecute [list $serverAddressWithIP] $command] \n] puts --$fileContent-- } if 0 { set x [Execute $serverAddressWithIP [list UpdateArchivingPolicy dpi.inpe.br/banon-pc2@1905/2005/07.11.21.15 dpi.inpe.br/banon-pc2@1905/2005/07.11.21.15.43 banon 33] 0] puts --$x-- } }