cmis-ruby 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +0,0 @@
1
- require 'cmis-ruby'
2
-
3
- META = CMIS::Server.new.repository('meta')
4
-
5
- def create_repository(id)
6
- delete_repository(id)
7
-
8
- repo_type = META.type('repository')
9
- property_definitions = repo_type.property_definitions.keys
10
-
11
- f = repo_type.new_object
12
- f.name = id
13
- f.properties[:id] = id
14
- f.properties[:supportsRelationships] = true if property_definitions.include?('supportsRelationships')
15
- f.properties[:supportsPolicies] = true if property_definitions.include?('supportsPolicies')
16
- f.properties[:supportsItems] = true if property_definitions.include?('supportsItems')
17
- f.properties[:realtime] = true if property_definitions.include?('realtime')
18
- META.root.create(f)
19
-
20
- CMIS::Server.new.repository(id)
21
- end
22
-
23
- def delete_repository(id)
24
- META.object(id).delete
25
- rescue CMIS::Exceptions::ObjectNotFound => ex
26
- end
@@ -1,100 +0,0 @@
1
- require_relative './helper'
2
-
3
- describe CMIS::Object do
4
-
5
- before :all do
6
- @repo = create_repository('test')
7
- end
8
-
9
- after :all do
10
- delete_repository('test')
11
- end
12
-
13
- it 'repository' do
14
- doc = create_document
15
- doc.repository.should be_a_kind_of CMIS::Repository
16
- doc.repository.id.should eq 'test'
17
- doc.delete
18
- end
19
-
20
- it 'object_type' do
21
- doc = create_document
22
- doc.object_type.should be_a_kind_of CMIS::Type
23
- doc.object_type.id.should eq 'cmis:document'
24
- doc.delete
25
- end
26
-
27
- it 'delete' do
28
- doc = create_document
29
- doc.delete
30
- # TODO check
31
- end
32
-
33
- it 'allowable actions' do
34
- doc = create_document
35
- actions = doc.allowable_actions
36
- actions.should_not be_nil
37
- actions.should_not be_empty
38
- actions.values.each { |v| [true, false].should include v }
39
- doc.delete
40
- end
41
-
42
- it 'relationships' do
43
- doc = create_document
44
- rels = doc.relationships
45
- rels.should_not be_nil
46
- rels.each_relationship do |r|
47
- r.should be_a_kind_of CMIS::Relationship
48
- end
49
- doc.delete
50
- end
51
-
52
- it 'policies' do
53
- doc = create_document
54
- pols = doc.policies
55
- pols.should_not be_nil
56
- pols.each do |p|
57
- p.should be_a_kind_of CMIS::Policy
58
- end
59
- doc.delete
60
- end
61
-
62
- it 'unfile' do
63
- doc = create_document
64
- doc.unfile
65
- # TODO check
66
- doc.delete
67
- end
68
-
69
- it 'acls' do
70
- doc = create_document
71
- acls = doc.acls
72
- acls.should_not be_nil
73
- acls.should_not be_empty
74
- acls.should have_key :aces
75
- acls.should have_key :isExact
76
- [true, false].should include acls[:isExact]
77
- doc.delete
78
- end
79
-
80
- # it 'add aces' do
81
- # doc = create_document
82
- # doc.add_aces({})
83
- # #TODO check
84
- # doc.delete
85
- # end
86
-
87
- # it 'remove aces' do
88
- # doc = create_document
89
- # doc.remove_aces({})
90
- # #TODO check
91
- # doc.delete
92
- # end
93
-
94
- def create_document
95
- new_object = @repo.new_document
96
- new_object.name = 'doc'
97
- new_object.object_type_id = 'cmis:document'
98
- @repo.root.create(new_object)
99
- end
100
- end
@@ -1,19 +0,0 @@
1
- require_relative './helper'
2
-
3
- describe CMIS::Relationship do
4
-
5
- before :all do
6
- @dummy = CMIS::Server.new.repository('meta')
7
- end
8
-
9
- it 'should make properties accessible through method' do
10
- new_object = CMIS::Relationship.new({ succinctProperties: { myProp: 'myValue' } }, @dummy)
11
- new_object.properties['myProp'].should eq 'myValue'
12
- end
13
-
14
- it 'should raise methodmissing for unknown property' do
15
- new_object = CMIS::Relationship.new({ succinctProperties: { 'myProp' => 'myValue' } }, @dummy)
16
- expect { new_object.myOtherProp }.to raise_error(NoMethodError, /undefined method `myOtherProp'/)
17
- end
18
-
19
- end
@@ -1,150 +0,0 @@
1
- require_relative './helper'
2
-
3
- describe CMIS::Repository do
4
-
5
- context 'generic' do
6
-
7
- before do
8
- @id = 'meta'
9
- @repo = CMIS::Server.new.repository(@id)
10
- end
11
-
12
- it 'id' do
13
- @repo.id.should.eql? @id
14
- end
15
-
16
- it 'fields' do
17
- @repo.id.should_not be_nil
18
- @repo.name.should_not be_nil
19
- @repo.product_version.should_not be_nil
20
- @repo.description.should_not be_nil
21
- @repo.root_folder_id.should_not be_nil
22
- @repo.capabilities.should_not be_nil
23
- @repo.url.should_not be_nil
24
- @repo.changes_on_type.should_not be_nil
25
- @repo.root_folder_url.should_not be_nil
26
- @repo.product_name.should_not be_nil
27
- @repo.product_version.should_not be_nil
28
-
29
- %w(1.0 1.1).should include @repo.cmis_version_supported
30
- end
31
-
32
- it 'new object' do
33
- @repo.new_folder.should be_a_kind_of CMIS::Folder
34
- @repo.new_document.should be_a_kind_of CMIS::Document
35
- @repo.new_relationship.should be_a_kind_of CMIS::Relationship
36
- @repo.new_policy.should be_a_kind_of CMIS::Policy
37
- @repo.new_item.should be_a_kind_of CMIS::Item
38
- end
39
-
40
- it 'repositories' do
41
- CMIS::Server.new.repositories
42
- end
43
-
44
- it 'repository' do
45
- r = CMIS::Server.new.repository('meta')
46
- r.name.should eq 'meta'
47
- end
48
-
49
- it 'root' do
50
- root = @repo.root
51
- root.should be_a_kind_of CMIS::Folder
52
- root.cmis_object_id.should eq @repo.root_folder_id
53
- end
54
-
55
- it 'object' do
56
- id = @repo.root_folder_id
57
- object = @repo.object(id)
58
- object.should be_a_kind_of CMIS::Folder
59
- object.cmis_object_id.should eq id
60
- end
61
-
62
- it 'type - document' do
63
- document = @repo.type('cmis:document')
64
- document.should be_a_kind_of CMIS::Type
65
- document.id.should eq 'cmis:document'
66
- end
67
-
68
- it 'type - folder' do
69
- folder = @repo.type('cmis:folder')
70
- folder.should be_a_kind_of CMIS::Type
71
- folder.id.should eq 'cmis:folder'
72
- end
73
- end
74
-
75
- context 'upn' do
76
-
77
- before :all do
78
- @repo = create_repository('testrepository')
79
- end
80
-
81
- after :all do
82
- delete_repository('testrepository')
83
- end
84
-
85
- it 'type - relationship' do
86
- relationship = @repo.type('cmis:relationship')
87
- relationship.should be_a_kind_of CMIS::Type
88
- relationship.id.should eq 'cmis:relationship'
89
- end
90
-
91
- it 'type - policy' do
92
- policy = @repo.type('cmis:policy')
93
- policy.should be_a_kind_of CMIS::Type
94
- policy.id.should eq 'cmis:policy'
95
- end
96
-
97
- it 'type - item' do
98
- begin
99
- item = @repo.type('cmis:item')
100
- item.should be_a_kind_of CMIS::Type
101
- item.id.should eq 'cmis:item'
102
- end unless @repo.cmis_version_supported < '1.1'
103
- end
104
-
105
- it 'create, get, delete type - document' do
106
- type_id = 'apple'
107
-
108
- type = @repo.new_type
109
- type.id = type_id
110
- type.local_name = 'apple'
111
- type.query_name = 'apple'
112
- type.display_name = 'apple'
113
- type.parent_id = 'cmis:document'
114
- type.base_id = 'cmis:document'
115
- type.description = 'appel'
116
- type.creatable = true
117
- type.fileable = true
118
- type.queryable = true
119
- type.controllable_policy = true
120
- type.controllable_acl = true
121
- type.fulltext_indexed = true
122
- type.included_in_supertype_query = true
123
- type.content_stream_allowed = 'allowed'
124
- type.versionable = false
125
-
126
- type.add_property_definition(id: 'color',
127
- localName: 'color',
128
- queryName: 'color',
129
- displayName: 'color',
130
- description: 'color',
131
- propertyType: 'string',
132
- cardinality: 'single',
133
- updatability: 'readwrite',
134
- inherited: false,
135
- required: false,
136
- queryable: true,
137
- orderable: true)
138
-
139
- type.create
140
-
141
- @repo.type(type_id).tap do |t|
142
- t.should be_a_kind_of CMIS::Type
143
- t.id.should eq type_id
144
- end
145
-
146
- @repo.type(type_id).delete
147
- end
148
-
149
- end
150
- end
@@ -1,22 +0,0 @@
1
- require_relative './helper'
2
-
3
- describe CMIS::Server do
4
-
5
- before :all do
6
- @server = CMIS::Server.new
7
- end
8
-
9
- it 'repositories' do
10
- @server.repositories.each do |repo|
11
- repo.should be_a_kind_of CMIS::Repository
12
- end
13
- end
14
-
15
- it 'repository' do
16
- id = 'meta'
17
- repo = @server.repository(id)
18
- repo.should be_a_kind_of CMIS::Repository
19
- repo.id.should eq id
20
- end
21
-
22
- end
@@ -1,69 +0,0 @@
1
- require_relative './helper'
2
-
3
- describe CMIS::Type do
4
-
5
- before :all do
6
- @repo = create_repository('test')
7
- end
8
-
9
- after :all do
10
- delete_repository('test')
11
- end
12
-
13
- it 'shoud update types' do
14
- type = @repo.new_type
15
- type.id = 'apple'
16
- type.local_name = 'apple'
17
- type.query_name = 'apple'
18
- type.display_name = 'Apple'
19
- type.parent_id = 'cmis:document'
20
- type.base_id = 'cmis:document'
21
- type.description = 'The apple fruit.'
22
- type.creatable = true
23
- type.fileable = true
24
- type.queryable = true
25
- type.controllable_policy = true
26
- type.controllable_acl = true
27
- type.fulltext_indexed = true
28
- type.included_in_supertype_query = true
29
- type.content_stream_allowed = 'allowed'
30
- type.versionable = false
31
-
32
- type.add_property_definition(
33
- id: 'color',
34
- localName: 'color',
35
- queryName: 'color',
36
- displayName: 'Color',
37
- description: 'The color.',
38
- propertyType: 'string',
39
- cardinality: 'single',
40
- updatability: 'readwrite',
41
- inherited: false,
42
- required: false,
43
- queryable: true,
44
- orderable: true
45
- )
46
-
47
- full_type = type.create
48
-
49
- new_prop = CMIS::PropertyDefinition.new(
50
- id: 'taste',
51
- localName: 'taste',
52
- queryName: 'taste',
53
- displayName: 'Taste',
54
- description: 'The taste.',
55
- propertyType: 'string',
56
- cardinality: 'single',
57
- updatability: 'readwrite',
58
- inherited: false,
59
- required: false,
60
- queryable: true,
61
- orderable: true
62
- )
63
-
64
- full_type.update([new_prop])
65
-
66
- full_type.delete
67
- end
68
-
69
- end