Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

chg: Issue

  • Loading branch information...
commit 8694174144cc26162943dd7eaf05bb7faed15904 1 parent e5b7227
Sven Krzyzak authored
View
5 app/controllers/mylyn_connector/issues_controller.rb
@@ -10,12 +10,11 @@ class MylynConnector::IssuesController < ApplicationController
before_filter :find_project
before_filter :authorize, :except => [:query]
- helper MylynConnector::WatchersHelper
+ helper MylynConnector::MylynHelper
def show
respond_to do |format|
- format.xml {render :xml => @issue, :template => 'mylyn_connector/issues/show.rxml'}
- # format.html {render :xml => @issue, :template => 'mylyn_connector/issues/show.rxml', :content_type => 'application/xml'}
+ format.xml {render :layout => false}
end
end
View
15 app/helpers/mylyn_connector/issues_helper.rb
@@ -2,6 +2,11 @@
module MylynConnector::IssuesHelper
include MylynConnector::Version::ClassMethods
+ def edit_allowed? issue
+ res = User.current.allowed_to?(:edit_issues, issue.project)
+ return res !=nil && res !=false
+ end
+
def available_status issue
status = issue.new_statuses_allowed_to(User.current)
if !status.include?(issue.status)
@@ -20,11 +25,6 @@ def list_status availableStatus
availableStatus.to_s.strip
end
- def integer_list id_based
- id_based.collect! { |i| i.id.to_s + " "}
- id_based.to_s.strip
- end
-
def time_entries_view_allowed?(issue)
return (issue.project.module_enabled?(:time_tracking) && User.current.allowed_to?(:view_time_entries, issue.project)) ? true : false
end
@@ -33,8 +33,9 @@ def time_entries_new_allowed?(issue)
return (issue.project.module_enabled?(:time_tracking) && User.current.allowed_to?(:log_time, issue.project)) ? true : false
end
- def useDoneratioField?(issue)
- is09? ? Setting.issue_done_ratio != 'issue_status' : true
+ def watched?(issue)
+ return false unless User.current.logged?
+ return issue.watched_by?(User.current)
end
end
View
3  app/helpers/mylyn_connector/mylyn_helper.rb
@@ -2,8 +2,7 @@
module MylynConnector::MylynHelper
def integer_list id_based
- id_based.collect! { |i| i.id.to_s + " "}
- id_based.to_s.strip
+ id_based.collect! {|i| i.id }.join(" ")
end
def api_version
View
5 app/helpers/mylyn_connector/projects_helper.rb
@@ -1,11 +1,6 @@
module MylynConnector::ProjectsHelper
include MylynConnector::Version::ClassMethods
-
- def edit_issues_allowed? project
- res = User.current.allowed_to?(:edit_issues, project)
- return res !=nil && res !=false
- end
def get_trackers project
project.trackers.find(:all);
View
13 app/helpers/mylyn_connector/watchers_helper.rb
@@ -1,13 +0,0 @@
-
-module MylynConnector::WatchersHelper
- def watched?(issue)
- return false unless User.current.logged?
- return issue.watched_by?(User.current)
- end
-
-
- def watchers(issue)
- issue.watcher_users.collect {|u| u.id }.join(" ")
- end
-
-end
View
47 app/views/mylyn_connector/issues/_issue.rxml
@@ -1,33 +1,36 @@
-xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => issue.id, :useDoneratioField => useDoneratioField?(issue)) do
- #unused: lock-version
+xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version, :id => issue.id, :editAllowed => edit_allowed?(issue) ) do
#Ticket
xml.subject issue.subject
xml.description issue.description
- xml.author issue.author==nil ? "Anonymous" : issue.author.name
xml.createdOn issue.created_on.xmlschema, :unixtime => issue.created_on.to_i
xml.updatedOn issue.updated_on.xmlschema, :unixtime => issue.updated_on.to_i
- #dateTime(issue.created_on)
#References
- xml.projectId issue.project_id
- xml.trackerId issue.tracker_id
- xml.priorityId issue.priority_id
- xml.statusId issue.status_id
- xml.categoryId issue.category_id if issue.category_id
- xml.fixedVersionId issue.fixed_version_id if issue.fixed_version_id
+ xml.tracker issue.tracker_id
+ xml.project issue.project_id
+ xml.status issue.status_id
+ xml.priority issue.priority_id
- #Work/Progress
- xml.assignedToId issue.assigned_to_id if issue.assigned_to_id
- xml.doneRatio issue.done_ratio
- xml.estimatedHours issue.estimated_hours if issue.estimated_hours
+ #Watchers
+ xml.watched watched?(issue)
+ xml.watchers integer_list(issue.watcher_users)
+
+ #Work/Progress(optional)
xml.startDate issue.start_date.to_s if issue.start_date
xml.dueDate issue.due_date.to_s if issue.due_date
+ xml.doneRatio issue.done_ratio
+ xml.estimatedHours issue.estimated_hours if issue.estimated_hours
+
+ #Optional References
+ xml.author issue.author_id if issue.author_id
+ xml.category issue.category_id if issue.category_id
+ xml.assignedTo issue.assigned_to_id if issue.assigned_to_id
+ xml.fixedVersion issue.fixed_version_id if issue.fixed_version_id
+ xml.parent issue.parent_id if is10? && issue.parent_id
xml.availableStatus integer_list(available_status(issue))
- xml.watched watched?(issue)
- xml.watchers watchers(issue)
xml.customValues {
issue.custom_values.each {|value|
@@ -37,11 +40,10 @@ xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => i
xml.journals {
journals(issue).each {|journal|
- xml.journal :id => journal.id do
- xml.author journal.user==nil ? "Anonymous" : journal.user.name
+ xml.journal(:id => journal.id, :editableByUser => (journal.editable_by?(User.current) ? true : false)) do
+ xml.author journal.user_id if journal.user_id
xml.createdOn journal.created_on.xmlschema, :unixtime => journal.created_on.to_i
xml.notes journal.notes
- xml.editableByUser journal.editable_by?(User.current) ? true : false
end
}
}
@@ -49,7 +51,7 @@ xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => i
xml.attachments {
issue.attachments.each {|attachment|
xml.attachment :id => attachment.id do
- xml.author attachment.author==nil ? "Anonymous" : attachment.author.name
+ xml.author attachment.author_id if attachment.author_id
xml.createdOn attachment.created_on.xmlschema, :unixtime => attachment.created_on.to_i
xml.filename attachment.filename
xml.filesize attachment.filesize
@@ -78,8 +80,8 @@ xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => i
issue.time_entries.each {|entry|
xml.timeEntry :id => entry.id, :editAllowed => entry.editable_by?(User.current)?true:false do
xml.hours entry.hours
- xml.activityId entry.activity_id
- xml.userId entry.user_id
+ xml.activity entry.activity_id
+ xml.user entry.user_id
xml.spentOn entry.spent_on
xml.comments entry.comments
xml.customValues {
@@ -93,3 +95,4 @@ xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => i
end
end
+
View
0  app/views/mylyn_connector/issues/show.rxml → ...s/mylyn_connector/issues/show.xml.builder
File renamed without changes
View
4 config/routes.rb
@@ -17,8 +17,8 @@
#projects
map.connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
- map.connect "mylyn/:project_id/search", :controller => "MylynConnector::Issues", :action => "query"
- map.connect "mylyn/search", :controller => "MylynConnector::Issues", :action => "query"
+# map.connect "mylyn/:project_id/search", :controller => "MylynConnector::Issues", :action => "query"
+# map.connect "mylyn/search", :controller => "MylynConnector::Issues", :action => "query"
map.connect "mylyn/:project_id/updatedsince", :controller => "MylynConnector::Issues", :action => "updated_since"
map.connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
end
View
4 lib/mylyn_connector/version.rb
@@ -47,6 +47,10 @@ def is09?
MylynConnector::Version.redmine_release.to_f >=0.9
end
+ def is10?
+ MylynConnector::Version.redmine_release.to_f >=1.0 || is09? && Redmine::VERSION.to_s.include?('devel')
+ end
+
end
end
View
103 test/fixtures/0.9/custom_values.yml
@@ -0,0 +1,103 @@
+---
+custom_values_006:
+ customized_type: Issue
+ custom_field_id: 2
+ customized_id: 3
+ id: 6
+ value: "125"
+custom_values_007:
+ customized_type: Project
+ custom_field_id: 3
+ customized_id: 1
+ id: 7
+ value: Stable
+custom_values_001:
+ customized_type: Principal
+ custom_field_id: 4
+ customized_id: 3
+ id: 1
+ value: ""
+custom_values_002:
+ customized_type: Principal
+ custom_field_id: 4
+ customized_id: 4
+ id: 2
+ value: 01 23 45 67 89
+custom_values_003:
+ customized_type: Principal
+ custom_field_id: 4
+ customized_id: 2
+ id: 3
+ value: ""
+custom_values_004:
+ customized_type: Issue
+ custom_field_id: 2
+ customized_id: 1
+ id: 4
+ value: "125"
+custom_values_005:
+ customized_type: Issue
+ custom_field_id: 2
+ customized_id: 2
+ id: 5
+ value: ""
+custom_values_008:
+ customized_type: Issue
+ custom_field_id: 1
+ customized_id: 3
+ id: 8
+ value: "MySQL"
+custom_values_009:
+ customized_type: Issue
+ custom_field_id: 2
+ customized_id: 3
+ id: 9
+ value: "this is a stringforcustomfield search"
+custom_values_010:
+ customized_type: Issue
+ custom_field_id: 6
+ customized_id: 1
+ id: 10
+ value: "2.1"
+custom_values_011:
+ customized_type: Issue
+ custom_field_id: 6
+ customized_id: 2
+ id: 11
+ value: "2.05"
+custom_values_012:
+ customized_type: Issue
+ custom_field_id: 6
+ customized_id: 3
+ id: 12
+ value: "11.65"
+custom_values_013:
+ customized_type: Issue
+ custom_field_id: 6
+ customized_id: 7
+ id: 13
+ value: ""
+custom_values_014:
+ customized_type: Issue
+ custom_field_id: 6
+ customized_id: 5
+ id: 14
+ value: "-7.6"
+custom_values_015:
+ customized_type: Enumeration
+ custom_field_id: 7
+ customized_id: 10
+ id: 15
+ value: true
+custom_values_016:
+ customized_type: Enumeration
+ custom_field_id: 7
+ customized_id: 11
+ id: 16
+ value: '1'
+custom_values_017:
+ customized_type: Issue
+ custom_field_id: 8
+ customized_id: 1
+ id: 17
+ value: '2009-12-01'
View
2  test/functional/all_functional_test.rb
@@ -6,7 +6,7 @@
require 'issue_categories_controller_test'
require 'issue_priorities_controller_test'
require 'issue_status_controller_test'
-#require 'issues_controller_test'
+require 'issues_controller_test'
require 'projects_controller_test'
require 'queries_controller_test'
require 'settings_controller_test'
View
380 test/functional/issues_controller_test.rb
@@ -9,191 +9,221 @@ def setup
@controller = MylynConnector::IssuesController.new
end
- def test_show
+ def test_show_unauthenticated
get :show, :id => 1
assert_response :success
- assert_template 'show.rxml'
+ assert_template 'show.xml.builder'
xmldoc = XML::Document.string @response.body
schema = read_schema 'issue'
valid = xmldoc.validate_schema schema
assert valid , 'Ergenis passt nicht zum Schema ' + 'issue'
- assert_tag :tag => 'issue', :attributes => {:id => 1, :usedoneratiofield => "true"}
- assert_tag :tag => 'subject', :content => 'Can\'t print recipes'
- assert_tag :tag => 'description',:content => 'Unable to print recipes'
- assert_tag :tag => 'author', :content => 'John Smith'
- assert_tag :tag => 'projectid', :content => '1'
- assert_tag :tag => 'trackerid', :content => '1'
- assert_tag :tag => 'priorityid', :content => '4'
- assert_tag :tag => 'statusid', :content => '1'
- assert_tag :tag => 'categoryid', :content => '1'
- assert_no_tag :tag => 'fixedversionid'
- assert_no_tag :tag => 'assignedtoid'
- assert_tag :tag => 'doneratio', :content => '0'
- assert_no_tag :tag=> 'estimatedhours'
- assert_tag :tag=> 'startdate', :content => 1.day.ago.to_date.to_s
- assert_tag :tag=> 'duedate', :content => 10.day.from_now.to_date.to_s
- assert_tag :tag => 'availablestatus', :content => '1'
- assert_tag :tag => 'watched', :content => false
- assert_tag :tag => 'watchers'
- #redmine 0.8: 1
- #redmine 0.9: 3
- assert_tag :tag => 'customvalues', :children => {:count => (1..3)}
- assert_tag :tag => 'customvalue', :parent => {:tag => 'customvalues'}, :attributes => {:customfieldid => '2'}, :content => '125'
- assert_tag :tag => 'journals', :children => {:count => 2}
- assert_tag :tag => 'author', :parent => {:tag => 'journal'}, :content => 'redMine Admin'
- assert_tag :tag => 'notes', :parent => {:tag => 'journal'}, :content => 'Journal notes'
- assert_tag :tag => 'editablebyuser', :parent => {:tag => 'journal'}, :content => 'false'
- assert_tag :tag => 'attachments', :children => {:count => 0}
-
- #puts @response.body
- #TODO timeEntries
- assert_tag :tag => 'timeentries', :attributes => {:viewallowed => 'true', :newallowed => 'false'}
- assert_tag :tag => 'sum', :parent => {:tag => 'timeentries'}, :content => '154.25'
- assert_tag :tag => 'timeentry', :parent => {:tag => 'timeentries'}, :attributes => {:id => 1, :editallowed => 'false'}, :children => {:only => {:tag => 'activityId', :content => '9', :sibling => {:tag => 'userId', :content => '2', :sibling => {:tag => 'spentOn', :content => '2007-03-23', :sibling => {:tag => 'comments', :content => 'My hours', :sibling => {:tag => 'hours', :content => '4.25'}}}}}}
- #TODO timeEntries.customValues
-
- #issuerelations
- end
-
- def test_show_attachement
- get :show, :id => 3
- assert_response :success
- assert_template 'show.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issue'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issue'
-
- assert_no_tag :tag => 'categoryid', :content => '1'
- assert_no_tag :tag => 'fixedversionid'
- assert_tag :tag => 'assignedtoid', :content => '3'
- assert_tag :tag => 'attachments', :children => {:count => 4}
- assert_tag :tag => 'author', :parent => {:tag => 'attachment'}, :content => 'John Smith'
- assert_tag :tag => 'contenttype', :parent => {:tag => 'attachment'}, :content => 'text/plain'
- assert_tag :tag => 'filename', :parent => {:tag => 'attachment'}, :content => 'error281.txt'
- assert_tag :tag => 'filesize', :parent => {:tag => 'attachment'}, :content => '28'
- assert_tag :tag => 'digest', :parent => {:tag => 'attachment'}, :content => 'b91e08d0cf966d5c6ff411bd8c4cc3a2'
- #issuerelations
- end
-
- def test_show_assigned
- get :show, :id => 2
- assert_response :success
- assert_template 'show.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issue'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issue'
-
- assert_tag :tag => 'fixedversionid', :content => '2'
- assert_tag :tag => 'assignedtoid', :content => '3'
- #TODO test mit anmeldung als user #1, watched => true
- assert_tag :tag => 'watched', :content => false
- #redmine 0.8: 3
- #redmine 0.9: 1 & 3
- assert_tag :tag => 'watchers', :content => /(1 )?3/
-end
+ i = {:tag => 'issue', :attributes => {:id => 1, :editAllowed => false, :api => /^2.7.0/}}
+ assert_tag i
+
+#puts @response.body
+ assert_tag :tag => 'subject', :content => 'Can\'t print recipes', :parent => i
+ assert_tag :tag => 'description',:content => 'Unable to print recipes', :parent => i
+ assert_tag :tag => 'createdon', :content => 3.days.ago.to_date.xmlschema, :parent => i
+ assert_tag :tag => 'updatedon', :content => 1.days.ago.to_date.xmlschema, :parent => i
+
+ assert_tag :tag => 'tracker', :content => '1', :parent => i
+ assert_tag :tag => 'project', :content => '1', :parent => i
+ assert_tag :tag => 'status', :content => '1', :parent => i
+ assert_tag :tag => 'priority', :content => '4', :parent => i
+
+ assert_tag :tag => 'watched', :content => 'false', :parent => i
+ assert_tag :tag => 'watchers', :content => '', :parent => i
+
+ assert_tag :tag=> 'startdate', :content => 1.day.ago.to_date.to_s, :parent => i
+ assert_tag :tag=> 'duedate', :content => 10.day.from_now.to_date.to_s, :parent => i
+ assert_tag :tag => 'doneratio', :content => '0', :parent => i
+ assert_no_tag :tag=> 'estimatedhours', :parent => i
+
+ assert_tag :tag => 'author', :content => '2', :parent => i
+ assert_tag :tag => 'category', :content => '1', :parent => i
+ assert_no_tag :tag => 'assignedto', :parent => i
+ assert_no_tag :tag => 'fixedversion', :parent => i
+ assert_no_tag :tag => 'parent', :parent => i
+
+ assert_tag :tag => 'availablestatus', :content => '1', :parent => i
+
+ cfs = {:tag => 'customvalues', :children => {:count => 3}, :parent => i}
+ assert_tag :tag => 'customvalue', :attributes => {:customfieldid => 2}, :content => '125', :parent => cfs
+ assert_tag :tag => 'customvalue', :attributes => {:customfieldid => 6}, :content => '2.1', :parent => cfs
+ assert_tag :tag => 'customvalue', :attributes => {:customfieldid => 8}, :content => '2009-12-01', :parent => cfs
+
+ jrns = {:tag => 'journals', :children => {:count => 2},:parent => i}
+ jrn1 = {:tag => 'journal', :attributes => {:id => 1, :editablebyuser => 'false'}, :parent => jrns}
+ assert_tag :tag => 'author', :content => '1', :parent => jrn1
+ assert_tag :tag => 'notes', :content => 'Journal notes', :parent => jrn1
+ assert_tag :tag => 'createdon', :content => 2.days.ago.to_date.xmlschema, :parent => jrn1
+ jrn2 = {:tag => 'journal', :attributes => {:id => 2, :editablebyuser => 'false'}, :parent => jrns}
+ assert_tag :tag => 'author', :content => '2', :parent => jrn2
+ assert_tag :tag => 'notes', :content => 'Some notes with Redmine links: #2, r2.', :parent => jrn2
+ assert_tag :tag => 'createdon', :content => 1.days.ago.to_date.xmlschema, :parent => jrn2
+
+ assert_tag :tag => 'attachments', :children => {:count => 0}, :parent => i
+
+ #TODO issuerelations
+
+ tes = {:tag => 'timeentries', :children => {:count => 3}, :attributes => {:viewallowed => 'true', :newallowed => 'false'}, :parent => i}
+ assert_tag :tag => 'sum', :content => '154.25', :parent => tes
+ te1 = {:tag => 'timeentry', :attributes => {:id => 1, :editallowed => 'false'}, :parent => tes }
+ assert_tag :tag => 'hours', :content => '4.25', :parent => te1
+ assert_tag :tag => 'activity', :content => '9', :parent => te1
+ assert_tag :tag => 'user', :content => '2', :parent => te1
+ assert_tag :tag => 'spenton', :content => '2007-03-23', :parent => te1
+ assert_tag :tag => 'comments', :content => 'My hours', :parent => te1
+ assert_tag :tag => 'customvalues', :children => {:count => 0}, :parent => te1
+ te2 = {:tag => 'timeentry', :attributes => {:id => 2, :editallowed => 'false'}, :parent => tes }
+ assert_tag :tag => 'hours', :content => '150.0', :parent => te2
+ assert_tag :tag => 'activity', :content => '9', :parent => te2
+ assert_tag :tag => 'user', :content => '1', :parent => te2
+ assert_tag :tag => 'spenton', :content => '2007-03-12', :parent => te2
+ assert_tag :tag => 'comments', :content => '', :parent => te2
+ assert_tag :tag => 'customvalue', :attributes => {:customfieldid => 8}, :content => '2009-12-01', :parent => {:tag => 'customvalues', :children => {:count => 1}, :parent => te2}
- def test_show_404
- get :show, :id => 99
- assert_response 404
end
- def test_query_by_id
- get :query, :project_id => 1, :query_id => 1
-
- assert_response :success
- assert_template 'index.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issues'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
-
- assert_tag :tag => 'issues', :children => {:count => 1}
- assert_tag :tag => 'issue', :attributes => {:id => 3}
- end
-
- def test_query_by_string
- post :query, :project_id => 1, :query_string => 'project_id=1&set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=category_id&operators[category_id]=!*&values[category_id][]=1'
-
- assert_response :success
- assert_template 'index.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issues'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
-
- assert_tag :tag => 'issues', :children => {:count => 2}
- assert_tag :tag => 'issue', :attributes => {:id => 3}
- assert_tag :tag => 'issue', :attributes => {:id => 7}
- end
-
- def test_cross_query_by_string
- post :query, :query_string => 'set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=priority_id&operators[priority_id]=%3D&values[priority_id][]=4'
-
- assert_response :success
- assert_template 'index.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issues'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
-
- #redmine 0.8:
- #redmine 0.9: 1,3,5,13
- assert_tag :tag => 'issues', :children => {:count => 3..4}
- assert_tag :tag => 'issue', :attributes => {:id => 1}
- assert_tag :tag => 'issue', :attributes => {:id => 3}
- assert_tag :tag => 'issue', :attributes => {:id => 5}
- if is09?
- assert_tag :tag => 'issue', :attributes => {:id => 13}
- end
- end
-
- def test_cross_query_by_string_authenticated
- @request.session[:user_id] = 2
- post :query, :query_string => 'set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=priority_id&operators[priority_id]=%3D&values[priority_id][]=4'
-
- assert_response :success
- assert_template 'index.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'issues'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
-
- assert_tag :tag => 'issue', :attributes => {:id => 1}
- assert_tag :tag => 'issue', :attributes => {:id => 3}
- assert_tag :tag => 'issue', :attributes => {:id => 5}
- assert_tag :tag => 'issue', :attributes => {:id => 4}
- assert_tag :tag => 'issue', :attributes => {:id => 6}
- end
-
- def test_query_non_exists
- get :query, :project_id => 1, :query_id => 99
- assert_response 404
- end
-
- def test_updated_since
- get :updated_since, :project_id => 1, :unixtime => 11.days.ago.to_i
-
- assert_response :success
- assert_template 'updated_since.rxml'
-
- xmldoc = XML::Document.string @response.body
- schema = read_schema 'updatedIssues'
- valid = xmldoc.validate_schema schema
- assert valid , 'Ergenis passt nicht zum Schema ' + 'updatedIssues'
-
- #redmine 0.8: 1 & 7
- #redmine 0.9: 1,7 & 8
- assert_tag :tag => 'updatedissues', :content => /1 7( 8)?/
- end
+# def test_show_attachement
+# get :show, :id => 3
+# assert_response :success
+# assert_template 'show.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issue'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issue'
+#
+# assert_no_tag :tag => 'categoryid', :content => '1'
+# assert_no_tag :tag => 'fixedversionid'
+# assert_tag :tag => 'assignedtoid', :content => '3'
+# assert_tag :tag => 'attachments', :children => {:count => 4}
+# assert_tag :tag => 'author', :parent => {:tag => 'attachment'}, :content => 'John Smith'
+# assert_tag :tag => 'contenttype', :parent => {:tag => 'attachment'}, :content => 'text/plain'
+# assert_tag :tag => 'filename', :parent => {:tag => 'attachment'}, :content => 'error281.txt'
+# assert_tag :tag => 'filesize', :parent => {:tag => 'attachment'}, :content => '28'
+# assert_tag :tag => 'digest', :parent => {:tag => 'attachment'}, :content => 'b91e08d0cf966d5c6ff411bd8c4cc3a2'
+# #issuerelations
+# end
+#
+# def test_show_assigned
+# get :show, :id => 2
+# assert_response :success
+# assert_template 'show.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issue'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issue'
+#
+# assert_tag :tag => 'fixedversionid', :content => '2'
+# assert_tag :tag => 'assignedtoid', :content => '3'
+# #TODO test mit anmeldung als user #1, watched => true
+# assert_tag :tag => 'watched', :content => false
+# #redmine 0.8: 3
+# #redmine 0.9: 1 & 3
+# assert_tag :tag => 'watchers', :content => /(1 )?3/
+#end
+#
+# def test_show_404
+# get :show, :id => 99
+# assert_response 404
+# end
+#
+# def test_query_by_id
+# get :query, :project_id => 1, :query_id => 1
+#
+# assert_response :success
+# assert_template 'index.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
+#
+# assert_tag :tag => 'issues', :children => {:count => 1}
+# assert_tag :tag => 'issue', :attributes => {:id => 3}
+# end
+#
+# def test_query_by_string
+# post :query, :project_id => 1, :query_string => 'project_id=1&set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=category_id&operators[category_id]=!*&values[category_id][]=1'
+#
+# assert_response :success
+# assert_template 'index.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
+#
+# assert_tag :tag => 'issues', :children => {:count => 2}
+# assert_tag :tag => 'issue', :attributes => {:id => 3}
+# assert_tag :tag => 'issue', :attributes => {:id => 7}
+# end
+#
+# def test_cross_query_by_string
+# post :query, :query_string => 'set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=priority_id&operators[priority_id]=%3D&values[priority_id][]=4'
+#
+# assert_response :success
+# assert_template 'index.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
+#
+# #redmine 0.8:
+# #redmine 0.9: 1,3,5,13
+# assert_tag :tag => 'issues', :children => {:count => 3..4}
+# assert_tag :tag => 'issue', :attributes => {:id => 1}
+# assert_tag :tag => 'issue', :attributes => {:id => 3}
+# assert_tag :tag => 'issue', :attributes => {:id => 5}
+# if is09?
+# assert_tag :tag => 'issue', :attributes => {:id => 13}
+# end
+# end
+#
+# def test_cross_query_by_string_authenticated
+# @request.session[:user_id] = 2
+# post :query, :query_string => 'set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=priority_id&operators[priority_id]=%3D&values[priority_id][]=4'
+#
+# assert_response :success
+# assert_template 'index.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
+#
+# assert_tag :tag => 'issue', :attributes => {:id => 1}
+# assert_tag :tag => 'issue', :attributes => {:id => 3}
+# assert_tag :tag => 'issue', :attributes => {:id => 5}
+# assert_tag :tag => 'issue', :attributes => {:id => 4}
+# assert_tag :tag => 'issue', :attributes => {:id => 6}
+# end
+#
+# def test_query_non_exists
+# get :query, :project_id => 1, :query_id => 99
+# assert_response 404
+# end
+#
+# def test_updated_since
+# get :updated_since, :project_id => 1, :unixtime => 11.days.ago.to_i
+#
+# assert_response :success
+# assert_template 'updated_since.rxml'
+#
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'updatedIssues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'updatedIssues'
+#
+# #redmine 0.8: 1 & 7
+# #redmine 0.9: 1,7 & 8
+# assert_tag :tag => 'updatedissues', :content => /1 7( 8)?/
+# end
end
View
14 test/schema/issue.xsd
@@ -5,8 +5,16 @@
elementFormDefault="qualified" >
<xsd:include schemaLocation="types/issue.xsd" />
-
- <xsd:element name="issue" type="tns:issue"
- xmlns="http://redmine-mylyn.sf.net/schemas/WS-API-2.6/issue" />
+ <xsd:include schemaLocation="types/versionstring.xsd" />
+
+ <xsd:element name="issue" xmlns="http://redmin-mylyncon.sf.net/api" >
+ <xsd:complexType>
+ <xsd:complexContent >
+ <xsd:extension base="tns:issue">
+ <xsd:attribute name="api" type="tns:versionstring" use="required" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
</xsd:schema>
View
5 test/schema/issues.xsd
@@ -4,13 +4,14 @@
targetNamespace="http://redmin-mylyncon.sf.net/api"
elementFormDefault="qualified" >
- <xsd:include schemaLocation="types/issue.xsd" xmlns="http://redmine-mylyn.sf.net/schemas/WS-API-2.6/issues" />
+ <xsd:include schemaLocation="types/issue.xsd" />
- <xsd:element name="issues">
+ <xsd:element name="issues" xmlns="http://redmin-mylyncon.sf.net/api">
<xsd:complexType>
<xsd:sequence >
<xsd:element name="issue" type="tns:issue" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
+ <xsd:attribute name="newAllowed" type="xsd:boolean" use="required"/>
</xsd:complexType>
</xsd:element>
View
8 test/schema/types/attachment.xsd → test/schema/types/attachments.xsd
@@ -7,9 +7,15 @@
<xsd:include schemaLocation="datetime.xsd" />
+ <xsd:complexType name="attachments">
+ <xsd:sequence >
+ <xsd:element name="attachment" type="tns:attachment" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
<xsd:complexType name="attachment">
<xsd:sequence>
- <xsd:element name="author" type="xsd:string" />
+ <xsd:element name="author" type="xsd:integer" minOccurs="0"/><!-- missing, when anonymous -->
<xsd:element name="createdOn" type="tns:datetime" />
<xsd:element name="filename" type="xsd:string" />
<xsd:element name="filesize" type="xsd:integer" />
View
6 test/schema/types/customValue.xsd → test/schema/types/customValues.xsd
@@ -5,6 +5,12 @@
targetNamespace="http://redmin-mylyncon.sf.net/api"
elementFormDefault="qualified" >
+ <xsd:complexType name="customValues">
+ <xsd:sequence >
+ <xsd:element name="customValue" type="tns:customValue" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
<xsd:complexType name="customValue">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
View
100 test/schema/types/issue.xsd
@@ -5,15 +5,18 @@
targetNamespace="http://redmin-mylyncon.sf.net/api"
elementFormDefault="qualified" >
- <xsd:include schemaLocation="customValue.xsd" />
- <xsd:include schemaLocation="journal.xsd" />
- <xsd:include schemaLocation="attachment.xsd" />
- <xsd:include schemaLocation="issueRelation.xsd" />
- <xsd:include schemaLocation="datetime.xsd" />
+ <xsd:include schemaLocation="customValues.xsd" />
+ <xsd:include schemaLocation="journals.xsd" />
+ <xsd:include schemaLocation="attachments.xsd" />
+ <xsd:include schemaLocation="issueRelations.xsd" />
<xsd:include schemaLocation="timeEntries.xsd" />
-
+ <xsd:include schemaLocation="datetime.xsd" />
+ <xsd:include schemaLocation="idList.xsd" />
+
<xsd:complexType name="issue">
<xsd:sequence>
+
+ <!-- REQUIRED -->
<xsd:element name="subject" >
<xsd:simpleType>
<xsd:restriction base="xsd:string">
@@ -22,80 +25,41 @@
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" type="xsd:string" />
- <xsd:element name="author" type="xsd:string" />
<xsd:element name="createdOn" type="tns:datetime" />
<xsd:element name="updatedOn" type="tns:datetime" />
-
- <xsd:element name="projectId" type="xsd:integer" />
- <xsd:element name="trackerId" type="xsd:integer" />
- <xsd:element name="priorityId" type="xsd:integer" />
- <xsd:element name="statusId" type="xsd:integer" />
- <xsd:element name="categoryId" type="xsd:integer" minOccurs="0"/>
- <xsd:element name="fixedVersionId" type="xsd:integer" minOccurs="0"/>
-
- <xsd:element name="assignedToId" type="xsd:integer" minOccurs="0" />
- <xsd:element name="doneRatio" type="xsd:integer" />
- <xsd:element name="estimatedHours" type="xsd:integer" minOccurs="0" />
+ <xsd:element name="tracker" type="xsd:integer" />
+ <xsd:element name="project" type="xsd:integer" />
+ <xsd:element name="status" type="xsd:integer" />
+ <xsd:element name="priority" type="xsd:integer" />
+ <xsd:element name="watched" type="xsd:boolean"/><!-- watched by current user-->
+ <xsd:element name="watchers" type="tns:idList"/>
+
+ <!-- OPTIONAL -->
<xsd:element name="startDate" type="xsd:date" minOccurs="0" />
<xsd:element name="dueDate" type="xsd:date" minOccurs="0" />
+ <xsd:element name="doneRatio" type="xsd:integer" minOccurs="0"/>
+ <xsd:element name="estimatedHours" type="xsd:integer" minOccurs="0" />
- <xsd:element name="availableStatus">
- <xsd:simpleType>
- <xsd:restriction>
- <xsd:simpleType>
- <xsd:list itemType="xsd:integer" />
- </xsd:simpleType>
- <xsd:minLength value="1" fixed="true" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:element>
-
- <xsd:element name="watched" type="xsd:boolean"/><!-- watched by current user-->
- <xsd:element name="watchers">
- <xsd:simpleType>
- <xsd:restriction>
- <xsd:simpleType>
- <xsd:list itemType="xsd:integer" />
- </xsd:simpleType>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:element>
+ <xsd:element name="author" type="xsd:integer" minOccurs="0"/><!-- missing, when anonymous -->
+ <xsd:element name="category" type="xsd:integer" minOccurs="0"/>
+ <xsd:element name="assignedTo" type="xsd:integer" minOccurs="0" />
+ <xsd:element name="fixedVersion" type="xsd:integer" minOccurs="0"/>
+ <xsd:element name="parent" type="xsd:integer" minOccurs="0"/>
- <xsd:element name="customValues" >
- <xsd:complexType>
- <xsd:sequence >
- <xsd:element name="customValue" type="tns:customValue" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="journals" >
- <xsd:complexType>
- <xsd:sequence >
- <xsd:element name="journal" type="tns:journal" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="attachments" >
- <xsd:complexType>
- <xsd:sequence >
- <xsd:element name="attachment" type="tns:attachment" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="issueRelations" >
- <xsd:complexType>
- <xsd:sequence >
- <xsd:element name="issueRelation" type="tns:issueRelation" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
+ <!-- AVAILABLE VALUES -->
+ <xsd:element name="availableStatus" type="tns:idList"/>
+ <!-- EMBEDED -->
+ <xsd:element name="customValues" type="tns:customValues" />
+ <xsd:element name="journals" type="tns:journals" />
+ <xsd:element name="attachments" type="tns:attachments" />
+ <xsd:element name="issueRelations" type="tns:issueRelations" />
<xsd:element name="timeEntries" type="tns:timeEntries" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required" />
- <xsd:attribute name="useDoneratioField" type="xsd:boolean" use="optional" />
+ <xsd:attribute name="editAllowed" type="xsd:boolean" use="required" />
</xsd:complexType>
</xsd:schema>
View
6 test/schema/types/issueRelation.xsd → test/schema/types/issueRelations.xsd
@@ -5,6 +5,12 @@
targetNamespace="http://redmin-mylyncon.sf.net/api"
elementFormDefault="qualified" >
+ <xsd:complexType name="issueRelations">
+ <xsd:sequence >
+ <xsd:element name="issueRelation" type="tns:issueRelation" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
<xsd:complexType name="issueRelation">
<xsd:sequence>
<xsd:element name="issueFromId" type="xsd:integer" />
View
10 test/schema/types/journal.xsd → test/schema/types/journals.xsd
@@ -7,14 +7,20 @@
<xsd:include schemaLocation="datetime.xsd" />
+ <xsd:complexType name="journals">
+ <xsd:sequence >
+ <xsd:element name="journal" type="tns:journal" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
<xsd:complexType name="journal">
<xsd:sequence>
- <xsd:element name="author" type="xsd:string" />
+ <xsd:element name="author" type="xsd:integer" minOccurs="0"/><!-- missing, when anonymous -->
<xsd:element name="createdOn" type="tns:datetime" />
<xsd:element name="notes" type="xsd:string" />
- <xsd:element name="editableByUser" type="xsd:boolean" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required" />
+ <xsd:attribute name="editableByUser" type="xsd:boolean" use="required" />
</xsd:complexType>
</xsd:schema>
View
14 test/schema/types/timeEntries.xsd
@@ -5,7 +5,7 @@
targetNamespace="http://redmin-mylyncon.sf.net/api"
elementFormDefault="qualified" >
- <xsd:include schemaLocation="customValue.xsd" />
+ <xsd:include schemaLocation="customValues.xsd" />
<xsd:complexType name="timeEntries">
<xsd:sequence>
@@ -19,17 +19,11 @@
<xsd:complexType name="timeEntry">
<xsd:sequence>
<xsd:element name="hours" type="xsd:decimal" />
- <xsd:element name="activityId" type="xsd:integer" />
- <xsd:element name="userId" type="xsd:integer" />
+ <xsd:element name="activity" type="xsd:integer" />
+ <xsd:element name="user" type="xsd:integer" />
<xsd:element name="spentOn" type="xsd:date" />
<xsd:element name="comments" type="xsd:string" />
- <xsd:element name="customValues" >
- <xsd:complexType>
- <xsd:sequence >
- <xsd:element name="customValue" type="tns:customValue" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name="customValues" type="tns:customValues" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required" />
<xsd:attribute name="editAllowed" type="xsd:boolean" use="required" />
Please sign in to comment.
Something went wrong with that request. Please try again.