diametric 0.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +28 -0
  3. data/Jarfile +20 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +264 -0
  6. data/Rakefile +49 -0
  7. data/bin/datomic-rest +33 -0
  8. data/bin/download-datomic +13 -0
  9. data/datomic_version.yml +4 -0
  10. data/diametric-java.gemspec +39 -0
  11. data/ext/diametric/DiametricCollection.java +147 -0
  12. data/ext/diametric/DiametricConnection.java +113 -0
  13. data/ext/diametric/DiametricDatabase.java +107 -0
  14. data/ext/diametric/DiametricEntity.java +90 -0
  15. data/ext/diametric/DiametricListenableFuture.java +47 -0
  16. data/ext/diametric/DiametricObject.java +66 -0
  17. data/ext/diametric/DiametricPeer.java +414 -0
  18. data/ext/diametric/DiametricService.java +102 -0
  19. data/ext/diametric/DiametricUUID.java +61 -0
  20. data/ext/diametric/DiametricUtils.java +183 -0
  21. data/lib/boolean_type.rb +3 -0
  22. data/lib/diametric.rb +42 -0
  23. data/lib/diametric/config.rb +54 -0
  24. data/lib/diametric/config/environment.rb +42 -0
  25. data/lib/diametric/entity.rb +659 -0
  26. data/lib/diametric/errors.rb +13 -0
  27. data/lib/diametric/generators/active_model.rb +42 -0
  28. data/lib/diametric/persistence.rb +48 -0
  29. data/lib/diametric/persistence/common.rb +82 -0
  30. data/lib/diametric/persistence/peer.rb +154 -0
  31. data/lib/diametric/persistence/rest.rb +107 -0
  32. data/lib/diametric/query.rb +259 -0
  33. data/lib/diametric/railtie.rb +52 -0
  34. data/lib/diametric/rest_service.rb +74 -0
  35. data/lib/diametric/service_base.rb +77 -0
  36. data/lib/diametric/transactor.rb +86 -0
  37. data/lib/diametric/version.rb +3 -0
  38. data/lib/diametric_service.jar +0 -0
  39. data/lib/tasks/create_schema.rb +27 -0
  40. data/lib/tasks/diametric_config.rb +45 -0
  41. data/lib/value_enums.rb +8 -0
  42. data/spec/conf_helper.rb +55 -0
  43. data/spec/config/free-transactor-template.properties +73 -0
  44. data/spec/config/logback.xml +59 -0
  45. data/spec/data/seattle-data0.dtm +452 -0
  46. data/spec/data/seattle-data1.dtm +326 -0
  47. data/spec/developer_create_sample.rb +39 -0
  48. data/spec/developer_query_spec.rb +120 -0
  49. data/spec/diametric/config_spec.rb +60 -0
  50. data/spec/diametric/entity_spec.rb +476 -0
  51. data/spec/diametric/peer_api_spec.rb +147 -0
  52. data/spec/diametric/persistence/peer_many2many_spec.rb +76 -0
  53. data/spec/diametric/persistence/peer_spec.rb +27 -0
  54. data/spec/diametric/persistence/rest_spec.rb +30 -0
  55. data/spec/diametric/persistence_spec.rb +59 -0
  56. data/spec/diametric/query_spec.rb +118 -0
  57. data/spec/diametric/rest_service_spec.rb +56 -0
  58. data/spec/diametric/transactor_spec.rb +68 -0
  59. data/spec/integration_spec.rb +107 -0
  60. data/spec/parent_child_sample.rb +42 -0
  61. data/spec/peer_integration_spec.rb +121 -0
  62. data/spec/peer_seattle_spec.rb +200 -0
  63. data/spec/rc2013_seattle_big.rb +82 -0
  64. data/spec/rc2013_seattle_small.rb +60 -0
  65. data/spec/rc2013_simple_sample.rb +72 -0
  66. data/spec/seattle_integration_spec.rb +106 -0
  67. data/spec/simple_validation_sample.rb +31 -0
  68. data/spec/spec_helper.rb +63 -0
  69. data/spec/support/entities.rb +157 -0
  70. data/spec/support/gen_entity_class.rb +9 -0
  71. data/spec/support/persistence_examples.rb +104 -0
  72. data/spec/test_version_file.yml +4 -0
  73. metadata +290 -0
@@ -0,0 +1,9 @@
1
+ require 'diametric/entity'
2
+
3
+ def gen_entity_class(named = 'generated_entity_class', &block)
4
+ Class.new do
5
+ include Diametric::Entity
6
+ namespace_prefix named
7
+ instance_eval &block
8
+ end
9
+ end
@@ -0,0 +1,104 @@
1
+ shared_examples "persistence API" do
2
+ describe "entity instance" do
3
+ let(:model) { model_class.new }
4
+
5
+ it "can save" do
6
+ # TODO deal correctly with nil values
7
+ model.name = "Wilbur"
8
+ model.age = 2
9
+ model.save.should be_true
10
+ model.should be_persisted
11
+ end
12
+
13
+ it "does not transact if nothing is changed" do
14
+ model = model_class.new
15
+ model.should_not be_changed
16
+ model.save.should be_true
17
+ model.should_not be_persisted
18
+ end
19
+
20
+ it "does not transact if invalid" do
21
+ model.stub(:valid? => false)
22
+ model.save.should be_false
23
+ end
24
+
25
+ describe '#update_attributes' do
26
+ it "saves and updates values" do
27
+ model = model_class.new(:name => "Stu").tap(&:save)
28
+ new_values = { "name" => "Stuart" }
29
+ model.update_attributes(new_values)
30
+
31
+ model.should_not be_changed
32
+ model.name.should == "Stuart"
33
+ end
34
+ end
35
+
36
+ describe "#assign_attributes" do
37
+ it "updates attribute values" do
38
+ model.assign_attributes(:name => "Stuart")
39
+ model.name.should == "Stuart"
40
+ end
41
+
42
+ pending "it should do _something_ when attribute doesn't exist"
43
+ end
44
+
45
+ context "that is saved in Datomic" do
46
+ before do
47
+ model.name = "Wilbur"
48
+ model.age = 2
49
+ model.save
50
+ end
51
+
52
+ it "can find it by dbid" do
53
+ model2 = model_class.get(model.dbid)
54
+ model2.should_not be_nil
55
+ model2.name.should == model.name
56
+ model2.should == model
57
+ end
58
+
59
+ it "can save it back to Datomic with changes" do
60
+ model.name = "Mr. Wilbur"
61
+ model.save.should be_true
62
+
63
+ model2 = model_class.get(model.dbid)
64
+ model2.name.should == "Mr. Wilbur"
65
+ end
66
+
67
+ it "can find it by attribute" do
68
+ model2 = model_class.first({:name => "Wilbur"}, nil, true)
69
+ model2.should_not be_nil
70
+ model2.dbid.should == model.dbid
71
+ model2.should == model if model2.is_a? Rat
72
+ model2.should include(mode) if model2.is_a? Array
73
+ end
74
+
75
+ it "can find all matching conditions" do
76
+ mice = model_class.where({:name => "Wilbur"}, nil, true).where(:age => 2).all
77
+ mice.should == [model]
78
+ mice.should include(model)
79
+ end
80
+
81
+ it "can filter entities" do
82
+ mice = model_class.filter(:<, :age, 3).all
83
+ mice.should == [model]
84
+ mice.should include(model)
85
+
86
+ mice = model_class.filter(:>, :age, 3).all
87
+ mice.should == []
88
+ end
89
+
90
+ it "can find all" do
91
+ model_class.new(:name => "Smith", :age => 5).save
92
+ mice = model_class.all(nil, true)
93
+ mice.should_not be_nil
94
+ mice.size.should == 2
95
+ names = ["Smith", "Wilbur"]
96
+ mice.each do |m|
97
+ names.include?(m.name).should be_true
98
+ names.delete(m.name).should == m.name
99
+ end
100
+ names.size.should == 0
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,4 @@
1
+ free:
2
+ datomic-free-0.8.4122
3
+ pro:
4
+ datomic-pro-0.8.4122
metadata ADDED
@@ -0,0 +1,290 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: diametric
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: java
6
+ authors:
7
+ - Clinton N. Dreisbach
8
+ - Ryan K. Neufeld
9
+ - Yoko Harada
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-09-10 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.2
21
+ name: edn
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.2
27
+ type: :runtime
28
+ prerelease: false
29
+ - !ruby/object:Gem::Dependency
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 3.2.14
35
+ name: activesupport
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.14
41
+ type: :runtime
42
+ prerelease: false
43
+ - !ruby/object:Gem::Dependency
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 3.2.14
49
+ name: activemodel
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.14
55
+ type: :runtime
56
+ prerelease: false
57
+ - !ruby/object:Gem::Dependency
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.4.1
63
+ name: datomic-client
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.1
69
+ type: :runtime
70
+ prerelease: false
71
+ - !ruby/object:Gem::Dependency
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 0.9.9
77
+ name: rubyzip
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.9
83
+ type: :runtime
84
+ prerelease: false
85
+ - !ruby/object:Gem::Dependency
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: 0.7.5
91
+ name: lock_jar
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.5
97
+ type: :runtime
98
+ prerelease: false
99
+ - !ruby/object:Gem::Dependency
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: 0.8.8
105
+ name: jruby-openssl
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.8.8
111
+ type: :runtime
112
+ prerelease: false
113
+ - !ruby/object:Gem::Dependency
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: 2.3.7
119
+ name: uuid
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 2.3.7
125
+ type: :runtime
126
+ prerelease: false
127
+ - !ruby/object:Gem::Dependency
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: 2.14.1
133
+ name: rspec
134
+ requirement: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 2.14.1
139
+ type: :runtime
140
+ prerelease: false
141
+ - !ruby/object:Gem::Dependency
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ~>
145
+ - !ruby/object:Gem::Version
146
+ version: 0.9.1
147
+ name: rake-compiler
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: 0.9.1
153
+ type: :runtime
154
+ prerelease: false
155
+ description: |
156
+ Diametric is a library for building schemas, queries, and transactions
157
+ for Datomic from Ruby objects. It is also used to map Ruby objects
158
+ as entities into a Datomic database.
159
+ email:
160
+ - crnixon@gmail.com
161
+ - ryan@thinkrelevance.com
162
+ - yoko@thinkrelevance.com
163
+ executables:
164
+ - datomic-rest
165
+ - download-datomic
166
+ extensions:
167
+ - Rakefile
168
+ extra_rdoc_files: []
169
+ files:
170
+ - Gemfile
171
+ - Jarfile
172
+ - LICENSE.txt
173
+ - README.md
174
+ - Rakefile
175
+ - datomic_version.yml
176
+ - diametric-java.gemspec
177
+ - lib/boolean_type.rb
178
+ - lib/diametric.rb
179
+ - lib/diametric_service.jar
180
+ - lib/value_enums.rb
181
+ - lib/diametric/config.rb
182
+ - lib/diametric/entity.rb
183
+ - lib/diametric/errors.rb
184
+ - lib/diametric/persistence.rb
185
+ - lib/diametric/query.rb
186
+ - lib/diametric/railtie.rb
187
+ - lib/diametric/rest_service.rb
188
+ - lib/diametric/service_base.rb
189
+ - lib/diametric/transactor.rb
190
+ - lib/diametric/version.rb
191
+ - lib/diametric/config/environment.rb
192
+ - lib/diametric/generators/active_model.rb
193
+ - lib/diametric/persistence/common.rb
194
+ - lib/diametric/persistence/peer.rb
195
+ - lib/diametric/persistence/rest.rb
196
+ - lib/tasks/create_schema.rb
197
+ - lib/tasks/diametric_config.rb
198
+ - ext/diametric/DiametricCollection.java
199
+ - ext/diametric/DiametricConnection.java
200
+ - ext/diametric/DiametricDatabase.java
201
+ - ext/diametric/DiametricEntity.java
202
+ - ext/diametric/DiametricListenableFuture.java
203
+ - ext/diametric/DiametricObject.java
204
+ - ext/diametric/DiametricPeer.java
205
+ - ext/diametric/DiametricService.java
206
+ - ext/diametric/DiametricUtils.java
207
+ - ext/diametric/DiametricUUID.java
208
+ - spec/conf_helper.rb
209
+ - spec/developer_create_sample.rb
210
+ - spec/developer_query_spec.rb
211
+ - spec/integration_spec.rb
212
+ - spec/parent_child_sample.rb
213
+ - spec/peer_integration_spec.rb
214
+ - spec/peer_seattle_spec.rb
215
+ - spec/rc2013_seattle_big.rb
216
+ - spec/rc2013_seattle_small.rb
217
+ - spec/rc2013_simple_sample.rb
218
+ - spec/seattle_integration_spec.rb
219
+ - spec/simple_validation_sample.rb
220
+ - spec/spec_helper.rb
221
+ - spec/test_version_file.yml
222
+ - spec/config/free-transactor-template.properties
223
+ - spec/config/logback.xml
224
+ - spec/data/seattle-data0.dtm
225
+ - spec/data/seattle-data1.dtm
226
+ - spec/diametric/config_spec.rb
227
+ - spec/diametric/entity_spec.rb
228
+ - spec/diametric/peer_api_spec.rb
229
+ - spec/diametric/persistence_spec.rb
230
+ - spec/diametric/query_spec.rb
231
+ - spec/diametric/rest_service_spec.rb
232
+ - spec/diametric/transactor_spec.rb
233
+ - spec/diametric/persistence/peer_many2many_spec.rb
234
+ - spec/diametric/persistence/peer_spec.rb
235
+ - spec/diametric/persistence/rest_spec.rb
236
+ - spec/support/entities.rb
237
+ - spec/support/gen_entity_class.rb
238
+ - spec/support/persistence_examples.rb
239
+ - bin/datomic-rest
240
+ - bin/download-datomic
241
+ homepage: https://github.com/relevance/diametric
242
+ licenses: []
243
+ metadata: {}
244
+ post_install_message:
245
+ rdoc_options: []
246
+ require_paths:
247
+ - lib
248
+ required_ruby_version: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - '>='
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
253
+ required_rubygems_version: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - '>='
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ requirements: []
259
+ rubyforge_project:
260
+ rubygems_version: 2.0.7
261
+ signing_key:
262
+ specification_version: 4
263
+ summary: ActiveModel for Datomic (JRuby)
264
+ test_files:
265
+ - spec/conf_helper.rb
266
+ - spec/developer_create_sample.rb
267
+ - spec/developer_query_spec.rb
268
+ - spec/integration_spec.rb
269
+ - spec/parent_child_sample.rb
270
+ - spec/peer_integration_spec.rb
271
+ - spec/peer_seattle_spec.rb
272
+ - spec/rc2013_seattle_big.rb
273
+ - spec/rc2013_seattle_small.rb
274
+ - spec/rc2013_simple_sample.rb
275
+ - spec/seattle_integration_spec.rb
276
+ - spec/simple_validation_sample.rb
277
+ - spec/spec_helper.rb
278
+ - spec/diametric/config_spec.rb
279
+ - spec/diametric/entity_spec.rb
280
+ - spec/diametric/peer_api_spec.rb
281
+ - spec/diametric/persistence_spec.rb
282
+ - spec/diametric/query_spec.rb
283
+ - spec/diametric/rest_service_spec.rb
284
+ - spec/diametric/transactor_spec.rb
285
+ - spec/diametric/persistence/peer_many2many_spec.rb
286
+ - spec/diametric/persistence/peer_spec.rb
287
+ - spec/diametric/persistence/rest_spec.rb
288
+ - spec/support/entities.rb
289
+ - spec/support/gen_entity_class.rb
290
+ - spec/support/persistence_examples.rb