summaryrefslogtreecommitdiff
path: root/reach_reports/reach_test.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-08-18 17:53:46 +0200
committermguetlein <martin.guetlein@gmail.com>2010-08-18 17:53:46 +0200
commit0f5cc11dcecf6eda0a7230d69aa346cfb86c6a49 (patch)
tree664f6f902f7150969474e7e76a159623de230c5b /reach_reports/reach_test.rb
parent4e596159e74dea2124b89f1beb1dab01a97b0242 (diff)
first version reach reporting
Diffstat (limited to 'reach_reports/reach_test.rb')
-rw-r--r--reach_reports/reach_test.rb171
1 files changed, 155 insertions, 16 deletions
diff --git a/reach_reports/reach_test.rb b/reach_reports/reach_test.rb
index c96340a..f2ad251 100644
--- a/reach_reports/reach_test.rb
+++ b/reach_reports/reach_test.rb
@@ -11,41 +11,119 @@ LOGGER = MyLogger.new(STDOUT)
LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S "
LOGGER.formatter = Logger::Formatter.new
+#DataMapper::Model.raise_on_save_failure = true
+#
+#class TestResourceX
+# include DataMapper::Resource
+#
+# property :id, Serial
+#
+# has 1, :test_resource
+#end
+#
+#class DataMapper::Associations::ManyToOne::Relationship
+# def get_parent_model
+# @parent_model
+# end
+#end
+#
+#class TestResource
+# include DataMapper::Resource
+#
+# property :id, Serial
+# property :time, DateTime
+# property :body, Text
+#
+# def self.info
+# relationships.each do |k,v|
+# puts k
+# puts v.inspect
+# puts v.get_parent_model
+#
+# end
+# end
+# #validates_format_of :time
+# #validates_length_of :body, :minimum => 1000
+#
+# belongs_to :test_resource_x
+#end
+#
+#TestResourceX.auto_upgrade!
+#TestResource.auto_upgrade!
class ReachTest < Test::Unit::TestCase
include Rack::Test::Methods
include Lib::TestUtil
-
def app
Sinatra::Application
end
-
+
def test_it
+
+# testResource = TestResource.new
+#
+# TestResource.info
+# exit
+
+# p = nil
+# #puts TestResource.properties.inspect
+# TestResource.properties.each do |pp|
+# p = pp if pp.name==:time
+# end
+# #puts p
+# val = "no time" #DateTime.new
+# testResource.time = val
+# #puts p.valid?(val)
+#
+# #puts "test restource: "+testResource.valid?.to_s
+#
+# #puts testResource.time.to_s + " " + testResource.time.class.to_s
+# begin
+# testResource.save
+# rescue DataMapper::SaveFailureError => e
+# puts e.message
+# puts e.resource.errors.inspect
+# end
+# exit
+
#$test_case = self
- post '/reach_report/qmrf',:model_uri=>"http://localhost/model/16"
- ##post '/reach_report/qprf',:compound_uri=>"http://localhost/compound/XYZ"
- uri = last_response.body
- id = uri.split("/")[-1]
- puts uri
+ file = File.new("qmrf-report.xml")
+ raise "File not found: "+file.path.to_s unless File.exist?(file.path)
+ data = File.read(file.path)
+ #puts "data found "+data.to_s[0..1000]
+ puts OpenTox::RestClientWrapper.post("http://localhost/validation/reach_report/qmrf",{:content_type => "application/qmrf-xml"},data).to_s.chomp
+
+ #post "/reach_report/qmrf/2"
+ #puts last_response.body
+
+# post '/reach_report/qmrf',:model_uri=>"http://localhost/majority/class/model/1" #http://localhost/model/1"
+# ##post '/reach_report/qprf',:compound_uri=>"http://localhost/compound/XYZ"
+# uri = last_response.body
+# id = uri.split("/")[-1]
+# puts uri
+
+ #id = "2"
#get '/reach_report/qmrf'
#puts last_response.body
- get '/reach_report/qmrf/'+id.to_s,nil,'HTTP_ACCEPT'=>"application/x-yaml"
- puts "YAML"
- puts last_response.body
+# get '/reach_report/qmrf/'+id.to_s,nil,'HTTP_ACCEPT'=>"application/x-yaml"
+# puts "YAML"
+# puts last_response.body
-# get '/reach_report/qmrf/'+id.to_s,nil,'HTTP_ACCEPT'=>"application/rdf+xml"
+# get '/reach_report/qmrf/'+id.to_s,nil,'HTTP_ACCEPT'=>"application/rdf+xml"
# puts "RDF"
# puts last_response.body
- get '/reach_report/qmrf/'+id,nil,'HTTP_ACCEPT' => "application/qmrf-xml"
- puts "XML"
- puts last_response.body
-
+# get '/reach_report/qmrf/'+id,nil,'HTTP_ACCEPT' => "application/qmrf-xml"
+# puts "XML"
+# puts last_response.body
+
+ #r = ReachReports::QmrfReport.find_like( :QSAR_title => "Hamster")
+ #puts r.collect{|rr| "report with id:"+rr.id.to_s}.inspect
end
end
@@ -59,4 +137,65 @@ end
#}
#EOF
# puts OpenTox::RestClientWrapper.post("http://apps.ideaconsult.net:8080/ontology/",{:accept => "application/rdf+xml", :query => query})
-# exit \ No newline at end of file
+# exit
+
+#class Person
+# include DataMapper::Resource
+#
+# property :id, Serial
+#
+# has 1, :profile
+# has 1, :profile2
+# end
+#
+# class Profile
+# include DataMapper::Resource
+#
+# property :id, Serial
+# property :val, Text
+#
+# belongs_to :person
+# end
+#
+# class Profile2
+# include DataMapper::Resource
+#
+# property :id, Serial
+# property :val, Text
+#
+# belongs_to :person
+# end
+#
+#Person.auto_upgrade!
+#Profile.auto_upgrade!
+#Profile2.auto_upgrade!
+#
+# A.auto_upgrade!
+# ValTest.auto_upgrade!
+ #A.auto_migrate!
+ #ValTest.auto_migrate!
+
+# class ReachTest < Test::Unit::TestCase
+# include Rack::Test::Methods
+# include Lib::TestUtil
+#
+#
+# def app
+# Sinatra::Application
+# end
+#
+# def test_datamapper
+#
+# # Assigning a resource to a one-to-one relationship
+# puts Person.all.collect{|v| v.id}.inspect
+#
+# person = Person.create
+# person.profile = Profile.new
+# person.profile2 = Profile2.new
+# person.profile2.val = "bla"
+# person.save
+#
+# p = Person.get(11)
+## puts p.profile2
+# puts p.profile2.val
+