Permalink
Browse files

add: Tracker

del: 0.8 Routes
  • Loading branch information...
1 parent 5164b5d commit eae41839986a31d90882a0bc6a570f9d27ef0f8a Sven Krzyzak committed May 15, 2010
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../../../lib/mylyn_connector'
+
+class MylynConnector::TrackersController < ApplicationController
+ unloadable
+ include MylynConnector::Rescue::ClassMethods
+
+ skip_before_filter :verify_authenticity_token
+
+ helper MylynConnector::MylynHelper
+
+ def all
+ @trackers = Tracker.find(:all)
+
+ respond_to do |format|
+ format.xml {render :layout => false}
+ end
+ end
+end
@@ -0,0 +1,9 @@
+xml.instruct! :xml, :encoding => "UTF-8"
+xml.trackers :xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version do
+ @trackers.each do |tracker|
+ xml.tracker :id => tracker.id do
+ xml.name tracker.name
+ xml.position tracker.position
+ end
+ end
+end
View
@@ -2,6 +2,7 @@
map.connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
map.connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :action => "all", :conditions => {:method => :get}
+ map.connect "mylyn/trackers", :controller => "MylynConnector::Trackers", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/activities", :controller => "MylynConnector::Activities", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/issuestatus", :controller => "MylynConnector::IssueStatus", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/issuecategories", :controller => "MylynConnector::IssueCategories", :action => "all", :conditions => {:method => :get}
View
@@ -1,10 +0,0 @@
-connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
-connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
-connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :action => "all", :conditions => {:method => :get}
-connect "mylyn/activities", :controller => "MylynConnector::Activities", :action => "all", :conditions => {:method => :get}
-connect "mylyn/issuestatus", :controller => "MylynConnector::IssueStatus", :action => "all", :conditions => {:method => :get}
-connect "mylyn/customfields", :controller => "MylynConnector::CustomFields", :action => "all", :conditions => {:method => :get}
-connect "mylyn/version", :controller => "MylynConnector::Information", :action => "version", :conditions => {:method => :get}
-connect "mylyn/:project_id/search", :controller => "MylynConnector::Issues", :action => "query"
-connect "mylyn/search", :controller => "MylynConnector::Issues", :action => "query"
-connect "mylyn/:project_id/updatedsince", :controller => "MylynConnector::Issues", :action => "updated_since"
@@ -16,7 +16,7 @@ def test_all
xmldoc = XML::Document.string @response.body
schema = read_schema 'issuePriorities'
valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'priorities'
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'priorities'
pris = {:tag => 'priorities', :children => {:count => 5}, :attributes => {:api => /^2.7.0/}}
pri = {:tag => 'priority', :attributes => {:id => 7}, :parent => pris}
@@ -34,7 +34,7 @@ def test_all_empty_is_valid
xmldoc = XML::Document.string @response.body
schema = read_schema 'issuePriorities'
valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'priorities'
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'priorities'
assert_tag :tag => 'priorities', :children => {:count => 0}, :attributes => {:api => /^2.7.0/}
end
@@ -0,0 +1,40 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class MylynConnector::TrackersControllerTest < MylynConnector::ControllerTest
+ fixtures :trackers
+
+ def setup
+ super
+ @controller = MylynConnector::TrackersController.new
+ end
+
+ def test_all
+ get :all
+ assert_response :success
+ assert_template 'all.xml.builder'
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'trackers'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'priorities'
+
+ trs = {:tag => 'trackers', :children => {:count => 3}, :attributes => {:api => /^2.7.0/}}
+ tr = {:tag => 'tracker', :attributes => {:id => 3}, :parent => trs}
+ assert_tag :tag => 'name', :content => 'Support request', :parent => tr
+ assert_tag :tag => 'position', :content => '3', :parent => tr
+
+ end
+
+ def test_all_empty_is_valid
+ Tracker.delete_all
+
+ get :all
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'trackers'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'trackers'
+
+ assert_tag :tag => 'trackers', :children => {:count => 0}, :attributes => {:api => /^2.7.0/}
+ end
+end
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://redmin-mylyncon.sf.net/api"
+ targetNamespace="http://redmin-mylyncon.sf.net/api"
+ elementFormDefault="qualified" >
+
+ <xsd:include schemaLocation="types/tracker.xsd" />
+ <xsd:include schemaLocation="types/versionstring.xsd" />
+
+ <xsd:element name="trackers" xmlns="http://redmin-mylyncon.sf.net/api" >
+ <xsd:complexType>
+ <xsd:sequence >
+ <xsd:element name="tracker" type="tns:tracker" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="api" type="tns:versionstring" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>

0 comments on commit eae4183

Please sign in to comment.