flightstats 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ module FlightStats
25
25
  http.use_ssl = true
26
26
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
27
27
  body = http.request_get(url.path+'?'+url.query) { |response|
28
- if response.is_a?(Net::HTTPSuccess)
28
+ if response.is_a?(Net::HTTPSuccess) and !(response.read_body =~ /<Error[^>]*MajorCode="\d".*>/i)
29
29
  return StringIO.new(response.read_body)
30
30
  else
31
31
  raise StandardError, response.read_body
@@ -20,7 +20,6 @@ class FlightStats::DataFeed::SaxParser
20
20
  attributes['DateTimeUTC'][14..15],
21
21
  attributes['DateTimeUTC'][17..18],
22
22
  attributes['DateTimeUTC'][20..22])
23
-
24
23
  @on_file_block.call(file)
25
24
  end
26
25
  end
@@ -11,14 +11,10 @@ class FlightStats::DataFeed::FileTest < Test::Unit::TestCase
11
11
  :body => File.read("#{File.dirname(__FILE__)}/../../responses/test2.gz"))
12
12
 
13
13
  count = 0
14
- begin
15
- FlightStats::DataFeed.new.files do |file|
16
- file.updates do |update|
17
- count += 1
18
- end
14
+ FlightStats::DataFeed.new.files do |file|
15
+ file.updates do |update|
16
+ count += 1
19
17
  end
20
- rescue
21
- GC.start
22
18
  end
23
19
  assert_equal 11, count
24
20
  end
@@ -47,7 +43,6 @@ class FlightStats::DataFeed::FileTest < Test::Unit::TestCase
47
43
  changes << update
48
44
  end
49
45
  end
50
-
51
46
  update = changes[0]
52
47
  assert_equal(Time.utc(2009,6,8,20,30,0,43), update.timestamp)
53
48
  assert_equal('ASDI', update.source)
@@ -10,11 +10,19 @@ class FlightStatsTest < Test::Unit::TestCase
10
10
 
11
11
  def test_throw_error_when_error_in_response
12
12
  FakeWeb.register_uri(:get, "https://www.pathfinder-xml.com/development/xml?param=2&login.guid=test",
13
- :body => File.read("#{File.dirname(__FILE__)}/responses/error.xml"),
13
+ :body => File.read("#{File.dirname(__FILE__)}/responses/auth_error.xml"),
14
14
  :status => ["401", "HTTPUnauthorized"])
15
15
  assert_raise StandardError do
16
16
  FlightStats.query({:param => '2'})
17
17
  end
18
18
  end
19
19
 
20
+ def test_thow_error_when_error_in_response_even_if_http_status_is_200
21
+ FakeWeb.register_uri(:get, "https://www.pathfinder-xml.com/development/xml?param=2&login.guid=test",
22
+ :body => File.read("#{File.dirname(__FILE__)}/responses/other_error.xml"))
23
+ assert_raise StandardError do
24
+ FlightStats.query({:param => '2'})
25
+ end
26
+ end
27
+
20
28
  end
@@ -0,0 +1,120 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <FlightHistoryEventFeedResponse xmlns="http://pathfinder-xml/FlightHistoryEventFeedService.xsd"><Error MajorCode="4"><Message>An exception occurred during getFileData:
3
+ RootCause: An I/O error occured while sending to the backend.</Message><StackTrace>com.conducivetech.pathfinder.common.util.PathfinderException: An exception occurred during getFileData:
4
+ RootCause: An I/O error occured while sending to the backend.
5
+ at com.conducivetech.pathfinder.managers.FlightHistoryEventFeedManager.getFile(FlightHistoryEventFeedManager.java:742)
6
+ at com.conducivetech.pathfinder.services.ems.feed.FlightHistoryEventFeedService.getFile(FlightHistoryEventFeedService.java:157)
7
+ at com.conducivetech.pathfinder.services.ems.feed.FlightHistoryEventFeedService.service(FlightHistoryEventFeedService.java:67)
8
+ at com.conducivetech.pathfinder.services.ServiceHandler.doService(ServiceHandler.java:148)
9
+ at com.conducivetech.pathfinder.delegates.LocalServiceDelegate.doService(LocalServiceDelegate.java:41)
10
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.invokeService(FlightHistoryFeedServlet.java:220)
11
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.getFile(FlightHistoryFeedServlet.java:543)
12
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.sendCompressedFile(FlightHistoryFeedServlet.java:343)
13
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.doGet(FlightHistoryFeedServlet.java:162)
14
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
15
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
16
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
17
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
18
+ at com.conducivetech.pathfinder.webcommon.UTF8EncodingFilter.doFilter(UTF8EncodingFilter.java:38)
19
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
20
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
21
+ at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
22
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
23
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
24
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
25
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
26
+ at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
27
+ at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
28
+ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
29
+ at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
30
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
31
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
32
+ at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495)
33
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
34
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
35
+ at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
36
+ at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
37
+ at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
38
+ at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
39
+ at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
40
+ at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
41
+ at java.lang.Thread.run(Thread.java:595)
42
+ Caused by: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
43
+ at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
44
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
45
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
46
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255)
47
+ at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
48
+ at com.conducivetech.pathfinder.jboss.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:46)
49
+ at com.conducivetech.pathfinder.managers.FlightHistoryEventFeedManager.getFile(FlightHistoryEventFeedManager.java:719)
50
+ ... 36 more
51
+ Caused by: java.net.SocketException: Broken pipe
52
+ at java.net.SocketOutputStream.socketWrite0(Native Method)
53
+ at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
54
+ at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
55
+ at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
56
+ at java.io.BufferedOutputStream.write(BufferedOutputStream.java:78)
57
+ at org.postgresql.core.PGStream.SendChar(PGStream.java:168)
58
+ at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:759)
59
+ at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1036)
60
+ at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:643)
61
+ at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:189)
62
+ ... 42 more
63
+
64
+ Root Cause: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
65
+ at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
66
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
67
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
68
+ at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255)
69
+ at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
70
+ at com.conducivetech.pathfinder.jboss.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:46)
71
+ at com.conducivetech.pathfinder.managers.FlightHistoryEventFeedManager.getFile(FlightHistoryEventFeedManager.java:719)
72
+ at com.conducivetech.pathfinder.services.ems.feed.FlightHistoryEventFeedService.getFile(FlightHistoryEventFeedService.java:157)
73
+ at com.conducivetech.pathfinder.services.ems.feed.FlightHistoryEventFeedService.service(FlightHistoryEventFeedService.java:67)
74
+ at com.conducivetech.pathfinder.services.ServiceHandler.doService(ServiceHandler.java:148)
75
+ at com.conducivetech.pathfinder.delegates.LocalServiceDelegate.doService(LocalServiceDelegate.java:41)
76
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.invokeService(FlightHistoryFeedServlet.java:220)
77
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.getFile(FlightHistoryFeedServlet.java:543)
78
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.sendCompressedFile(FlightHistoryFeedServlet.java:343)
79
+ at com.conducivetech.pathfinder.xml.FlightHistoryFeedServlet.doGet(FlightHistoryFeedServlet.java:162)
80
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
81
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
82
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
83
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
84
+ at com.conducivetech.pathfinder.webcommon.UTF8EncodingFilter.doFilter(UTF8EncodingFilter.java:38)
85
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
86
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
87
+ at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
88
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
89
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
90
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
91
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
92
+ at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
93
+ at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
94
+ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
95
+ at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
96
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
97
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
98
+ at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495)
99
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
100
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
101
+ at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
102
+ at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
103
+ at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
104
+ at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
105
+ at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
106
+ at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
107
+ at java.lang.Thread.run(Thread.java:595)
108
+ Caused by: java.net.SocketException: Broken pipe
109
+ at java.net.SocketOutputStream.socketWrite0(Native Method)
110
+ at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
111
+ at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
112
+ at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
113
+ at java.io.BufferedOutputStream.write(BufferedOutputStream.java:78)
114
+ at org.postgresql.core.PGStream.SendChar(PGStream.java:168)
115
+ at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:759)
116
+ at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1036)
117
+ at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:643)
118
+ at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:189)
119
+ ... 42 more
120
+ </StackTrace></Error></FlightHistoryEventFeedResponse>
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flightstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - FlightCaster
@@ -15,24 +20,32 @@ default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
17
22
  name: libxml-ruby
18
- type: :runtime
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
21
25
  requirements:
22
26
  - - ">="
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ - 3
24
32
  version: 1.1.3
25
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
26
35
  - !ruby/object:Gem::Dependency
27
36
  name: tzinfo
28
- type: :runtime
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
31
39
  requirements:
32
40
  - - ">="
33
41
  - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 3
45
+ - 14
34
46
  version: 0.3.14
35
- version:
47
+ type: :runtime
48
+ version_requirements: *id002
36
49
  description:
37
50
  email: dev@flightcaster.com
38
51
  executables: []
@@ -62,9 +75,10 @@ files:
62
75
  - test/responses/test2.gz
63
76
  - test/responses/test_tz_fallback1.gz
64
77
  - test/responses/test_tz_fallback2.gz
65
- - test/responses/error.xml
78
+ - test/responses/auth_error.xml
66
79
  - test/responses/feed_file_list.xml
67
80
  - test/responses/feed_file_list_tz_fallback.xml
81
+ - test/responses/other_error.xml
68
82
  has_rdoc: true
69
83
  homepage: http://flightcaster.com/
70
84
  licenses: []
@@ -78,18 +92,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - ">="
80
94
  - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
81
97
  version: "0"
82
- version:
83
98
  required_rubygems_version: !ruby/object:Gem::Requirement
84
99
  requirements:
85
100
  - - ">="
86
101
  - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
87
104
  version: "0"
88
- version:
89
105
  requirements: []
90
106
 
91
107
  rubyforge_project:
92
- rubygems_version: 1.3.5
108
+ rubygems_version: 1.3.6
93
109
  signing_key:
94
110
  specification_version: 3
95
111
  summary: FlightStats wrapper