cmis-ruby 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cmis/connection.rb +10 -0
- data/lib/cmis/folder.rb +6 -0
- data/lib/cmis/server.rb +1 -2
- data/lib/cmis/version.rb +1 -1
- data/spec/cmis-ruby/relationship_spec.rb +70 -1
- data/spec/config.yml +6 -0
- data/spec/spec_helper.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2d4ac04b9c8fa478e27d08f3acfd0a99bd4c4a
|
4
|
+
data.tar.gz: 8c50066f231536e87a56a8c38041cb65ca58d57b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3fe2922b129273f6e1116cdb20e19939f1273e0ed49b7896ac6641449392e12faaa1e2d67d163c1ba81badba49fbe709759c86d138f11662de5153c56de2a7
|
7
|
+
data.tar.gz: 28bbc75ed037c441f30a6660b01ffa4d1ecbc52857825370687056f1f7540610a73b3e69113d8c48f6afbc0f89c0267f591780824af74ad004432f3f32005ef5
|
data/lib/cmis/connection.rb
CHANGED
@@ -40,10 +40,20 @@ module CMIS
|
|
40
40
|
else
|
41
41
|
@http.get(url, params.merge(query), headers)
|
42
42
|
end
|
43
|
+
|
44
|
+
rescue Exception
|
45
|
+
raise_enriched_exception(repository_id, params)
|
43
46
|
end
|
44
47
|
|
45
48
|
private
|
46
49
|
|
50
|
+
def raise_enriched_exception(repo_id, params)
|
51
|
+
params_to_log = { repository_id: repo_id }.merge(params)
|
52
|
+
msg_parts = $!.to_s.split("\n", 2)
|
53
|
+
msg_parts.insert(1, JSON.pretty_generate(params_to_log))
|
54
|
+
raise $!, msg_parts.join("\n"), $!.backtrace
|
55
|
+
end
|
56
|
+
|
47
57
|
def connection_options(options)
|
48
58
|
adapter = (options[:adapter] || :net_http).to_sym
|
49
59
|
headers = { user_agent: "cmis-ruby/#{VERSION} [#{adapter}]" }
|
data/lib/cmis/folder.rb
CHANGED
@@ -21,6 +21,12 @@ module CMIS
|
|
21
21
|
Children.new(self, opts)
|
22
22
|
end
|
23
23
|
|
24
|
+
def folder_tree(opts = {})
|
25
|
+
server.execute!({ cmisselector: 'folderTree',
|
26
|
+
repositoryId: repository.id,
|
27
|
+
objectId: cmis_object_id }, opts)
|
28
|
+
end
|
29
|
+
|
24
30
|
def create(object, opts = {})
|
25
31
|
case object
|
26
32
|
when Document
|
data/lib/cmis/server.rb
CHANGED
@@ -15,8 +15,7 @@ module CMIS
|
|
15
15
|
query = options.fetch(:query, {})
|
16
16
|
headers = options.fetch(:headers, {})
|
17
17
|
|
18
|
-
|
19
|
-
response.body
|
18
|
+
connection.do_request(params, query, headers).body
|
20
19
|
end
|
21
20
|
|
22
21
|
def repositories(opts = {})
|
data/lib/cmis/version.rb
CHANGED
@@ -2,6 +2,75 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module CMIS
|
4
4
|
describe Relationship do
|
5
|
-
|
5
|
+
before :all do
|
6
|
+
cleanup_relationships
|
7
|
+
@document = create_document
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
@document.delete
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when deleting relationships with sourceId and targetId pointing to same document' do
|
15
|
+
before :each do
|
16
|
+
40.times { create_relationship(@document.cmis_object_id, @document.cmis_object_id) }
|
17
|
+
end
|
18
|
+
|
19
|
+
after :each do
|
20
|
+
cleanup_relationships
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'deletes all relationships via document' do
|
24
|
+
loop do
|
25
|
+
results = @document.relationships.results
|
26
|
+
break if results.size == 0
|
27
|
+
results.each { |rel| rel.delete }
|
28
|
+
end
|
29
|
+
|
30
|
+
expect(count_relationships).to eq(0)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'deletes all relationships via query' do
|
34
|
+
loop do
|
35
|
+
results = repository.query("select * from cmis:relationship").results
|
36
|
+
break if results.size == 0
|
37
|
+
results.each { |rel| rel.delete}
|
38
|
+
end
|
39
|
+
expect(count_relationships).to eq(0)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'deletes all relationships after retrieving them' do
|
43
|
+
cleanup_relationships
|
44
|
+
expect(count_relationships).to eq(0)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_relationship(source_id, target_id)
|
49
|
+
new_object = repository.new_relationship
|
50
|
+
new_object.name = "doc_#{source_id}"
|
51
|
+
new_object.object_type_id = 'cmis:relationship'
|
52
|
+
new_object.source_id = source_id
|
53
|
+
new_object.target_id = target_id
|
54
|
+
repository.create_relationship(new_object)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_document
|
58
|
+
document = repository.new_document
|
59
|
+
document.name = 'apple_document'
|
60
|
+
document.object_type_id = 'cmis:document'
|
61
|
+
document.create_in_folder(repository.root)
|
62
|
+
end
|
63
|
+
|
64
|
+
def cleanup_relationships
|
65
|
+
results = []
|
66
|
+
repository.query("select * from cmis:relationship").each_result(limit: :all) { | rel | results << rel}
|
67
|
+
results.each { |rel| rel.delete }
|
68
|
+
end
|
69
|
+
|
70
|
+
def count_relationships
|
71
|
+
count = 0
|
72
|
+
repository.query("select cmis:objectId from cmis:relationship").each_result(limit: :all) { | rel | count += 1}
|
73
|
+
count
|
74
|
+
end
|
6
75
|
end
|
7
76
|
end
|
data/spec/config.yml
CHANGED
@@ -3,6 +3,12 @@ local:
|
|
3
3
|
server:
|
4
4
|
service_url: http://33.33.33.100:8080/browser
|
5
5
|
repository: test
|
6
|
+
dev:
|
7
|
+
server:
|
8
|
+
service_url: http://localhost:8150/browser
|
9
|
+
username: cmis_ruby_test
|
10
|
+
password: cmis_ruby_test
|
11
|
+
repository: demo
|
6
12
|
ci:
|
7
13
|
server:
|
8
14
|
service_url: https://cmis-service.ci.apps.up-nxt.com/browser
|
data/spec/spec_helper.rb
CHANGED
@@ -24,13 +24,9 @@ module SpecHelpers
|
|
24
24
|
@@options ||= begin
|
25
25
|
path = File.join(File.dirname(File.expand_path(__FILE__)), 'config.yml')
|
26
26
|
config = YAML.load(ERB.new(File.read(path)).result)
|
27
|
-
config[
|
27
|
+
config[ENV.fetch('TEST_ENV', 'local')]
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
31
|
-
def config_key
|
32
|
-
ENV['TEST_ENV'] || 'local'
|
33
|
-
end
|
34
30
|
end
|
35
31
|
|
36
32
|
RSpec.configure do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmis-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Geerts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|