Permalink
Browse files

add: IssueCategory

  • Loading branch information...
1 parent cf0f76e commit 5164b5df99b7eb8504a802f29a5a81436dc432c3 Sven Krzyzak committed May 14, 2010
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../../../lib/mylyn_connector'
+
+class MylynConnector::IssueCategoriesController < ApplicationController
+ unloadable
+ include MylynConnector::Rescue::ClassMethods
+
+ skip_before_filter :verify_authenticity_token
+
+ helper MylynConnector::MylynHelper
+
+ def all
+ @issue_categories = IssueCategory.find(:all)
+
+ respond_to do |format|
+ format.xml {render :layout => false}
+ end
+ end
+end
@@ -0,0 +1,8 @@
+xml.instruct! :xml, :encoding => "UTF-8"
+xml.issueCategories :xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version do
+ @issue_categories.each do |status|
+ xml.issueCategory :id => status.id do
+ xml.name status.name
+ end
+ end
+end
View
@@ -4,6 +4,7 @@
map.connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :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}
map.connect "mylyn/customfields", :controller => "MylynConnector::CustomFields", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/version", :controller => "MylynConnector::Information", :action => "version", :conditions => {:method => :get}
map.connect "mylyn/:project_id/search", :controller => "MylynConnector::Issues", :action => "query"
@@ -0,0 +1,42 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class MylynConnector::IssueCategoriesControllerTest < MylynConnector::ControllerTest
+
+ fixtures :issue_categories
+
+ def setup
+ super
+ @controller = MylynConnector::IssueCategoriesController.new
+ end
+
+ def test_all
+ get :all
+ assert_response :success
+ assert_template 'all.xml.builder'
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'issueCategories'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'issueCategories'
+
+ cats = {:tag => 'issuecategories', :children => {:count => 4}, :attributes => {:api => /^2.7.0/}}
+ cat = {:tag => 'issuecategory', :attributes => {:id => 3}, :parent => cats}
+ assert_tag :tag => 'name', :content => 'Stock management', :parent => cat
+
+ end
+
+ def test_all_empty_is_valid
+ IssueCategory.delete_all
+
+ get :all
+ assert_response :success
+ assert_template 'all.xml.builder'
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'issueCategories'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'issueCategories'
+
+ assert_tag :tag => 'issuecategories', :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/issueCategory.xsd" />
+ <xsd:include schemaLocation="types/versionstring.xsd" />
+
+ <xsd:element name="issueCategories" xmlns="http://redmin-mylyncon.sf.net/api">
+ <xsd:complexType>
+ <xsd:sequence >
+ <xsd:element name="issueCategory" type="tns:issueCategory" 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 5164b5d

Please sign in to comment.