vayacondios-server 0.1.12 → 0.2.1
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.
- data/Rakefile +4 -0
- data/config/vayacondios.example.yaml +3 -0
- data/config/vayacondios.yaml +3 -0
- data/lib/tasks/spec.rake +2 -0
- data/lib/vayacondios/legacy_switch.rb +38 -0
- data/lib/vayacondios/server/model/itemset_document.rb +18 -10
- data/lib/vayacondios/version.rb +1 -1
- data/pom.xml +22 -2
- data/spec/server/itemset_legacy_spec.rb +320 -0
- data/spec/server/itemset_spec.rb +11 -6
- data/src/main/java/com/infochimps/util/DebugUtil.java +14 -14
- data/src/main/java/com/infochimps/util/HttpHelper.java +17 -17
- data/src/main/java/com/infochimps/vayacondios/ItemSets.java +29 -119
- data/src/main/java/com/infochimps/vayacondios/LinkToVCD.java +18 -0
- data/src/main/java/com/infochimps/vayacondios/MemoryVCDShim.java +84 -0
- data/src/main/java/com/infochimps/vayacondios/Organization.java +15 -2
- data/src/main/java/com/infochimps/vayacondios/StandardVCDLink.java +152 -0
- data/src/main/java/com/infochimps/vayacondios/VCDIntegrationTest.java +1 -1
- data/src/main/java/com/infochimps/vayacondios/VayacondiosClient.java +3 -13
- data/src/test/java/com/infochimps/vayacondios/TestVayacondiosInMemory.java +78 -0
- metadata +11 -4
@@ -0,0 +1,78 @@
|
|
1
|
+
package com.infochimps.vayacondios;
|
2
|
+
|
3
|
+
import com.infochimps.vayacondios.VayacondiosClient;
|
4
|
+
|
5
|
+
import static com.infochimps.util.CurrentClass.getLogger;
|
6
|
+
|
7
|
+
import com.infochimps.vayacondios.MemoryVCDShim;
|
8
|
+
import static com.infochimps.vayacondios.ItemSets.Item;
|
9
|
+
import static com.infochimps.vayacondios.ItemSets.ItemSet;
|
10
|
+
import com.infochimps.vayacondios.ItemSets;
|
11
|
+
|
12
|
+
import java.io.IOException;
|
13
|
+
import java.util.Arrays;
|
14
|
+
import java.util.ArrayList;
|
15
|
+
import java.util.Iterator;
|
16
|
+
import java.util.List;
|
17
|
+
|
18
|
+
import static org.junit.Assert.assertEquals;
|
19
|
+
import org.junit.After;
|
20
|
+
import org.junit.Before;
|
21
|
+
import org.junit.Test;
|
22
|
+
import org.junit.Ignore;
|
23
|
+
import org.junit.runner.RunWith;
|
24
|
+
import org.junit.runners.JUnit4;
|
25
|
+
|
26
|
+
import org.slf4j.Logger;
|
27
|
+
|
28
|
+
@RunWith(JUnit4.class)
|
29
|
+
public class TestVayacondiosInMemory {
|
30
|
+
@Before
|
31
|
+
public void setup() {
|
32
|
+
_itemSets = new VayacondiosClient("localhost", VCD_PORT).
|
33
|
+
organization("org").
|
34
|
+
itemsets(new MemoryVCDShim());
|
35
|
+
}
|
36
|
+
|
37
|
+
@Test
|
38
|
+
public void testInMemVCD() throws Exception {
|
39
|
+
create("foo", "baz", "bar", "bing");
|
40
|
+
assertEquals(buildItemList("foo", "baz", "bar", "bing"), fetch());
|
41
|
+
|
42
|
+
update("biff");
|
43
|
+
assertEquals(buildItemList("foo", "baz", "bar", "bing", "biff"), fetch());
|
44
|
+
|
45
|
+
remove("biff", "bar");
|
46
|
+
assertEquals(buildItemList("foo", "baz", "bing"), fetch());
|
47
|
+
}
|
48
|
+
|
49
|
+
private ItemSets itemSets() {
|
50
|
+
return _itemSets;
|
51
|
+
}
|
52
|
+
|
53
|
+
private static List<Item> buildItemList(String... itemNames) {
|
54
|
+
List<Item> result = new ArrayList<Item>();
|
55
|
+
for (String s : itemNames) result.add(new Item(s));
|
56
|
+
return result;
|
57
|
+
}
|
58
|
+
|
59
|
+
private List<Item> fetch() throws IOException {
|
60
|
+
return itemSets().fetch("topic", "id");
|
61
|
+
}
|
62
|
+
|
63
|
+
private void create(String... items) throws IOException {
|
64
|
+
itemSets().create("topic", "id", buildItemList(items));
|
65
|
+
}
|
66
|
+
|
67
|
+
private void remove(String... items) throws IOException {
|
68
|
+
itemSets().remove("topic", "id", buildItemList(items));
|
69
|
+
}
|
70
|
+
|
71
|
+
private void update(String... items) throws IOException {
|
72
|
+
itemSets().update("topic", "id", buildItemList(items));
|
73
|
+
}
|
74
|
+
|
75
|
+
private static final int VCD_PORT = 8000;
|
76
|
+
private static final Logger LOG = getLogger();
|
77
|
+
private ItemSets _itemSets;
|
78
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vayacondios-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: configliere
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/vayacondios/client/itemset.rb
|
210
210
|
- lib/vayacondios/client/notifier.rb
|
211
211
|
- lib/vayacondios/client/zabbix_client.rb
|
212
|
+
- lib/vayacondios/legacy_switch.rb
|
212
213
|
- lib/vayacondios/server/errors/bad_request.rb
|
213
214
|
- lib/vayacondios/server/errors/not_found.rb
|
214
215
|
- lib/vayacondios/server/handlers/config_handler.rb
|
@@ -237,6 +238,7 @@ files:
|
|
237
238
|
- spec/client/notifier_spec.rb
|
238
239
|
- spec/server/config_spec.rb
|
239
240
|
- spec/server/event_spec.rb
|
241
|
+
- spec/server/itemset_legacy_spec.rb
|
240
242
|
- spec/server/itemset_spec.rb
|
241
243
|
- spec/server/rack/extract_methods_spec.rb
|
242
244
|
- spec/server/rack/path_spec.rb
|
@@ -249,10 +251,14 @@ files:
|
|
249
251
|
- src/main/java/com/infochimps/util/DebugUtil.java
|
250
252
|
- src/main/java/com/infochimps/util/HttpHelper.java
|
251
253
|
- src/main/java/com/infochimps/vayacondios/ItemSets.java
|
254
|
+
- src/main/java/com/infochimps/vayacondios/LinkToVCD.java
|
255
|
+
- src/main/java/com/infochimps/vayacondios/MemoryVCDShim.java
|
252
256
|
- src/main/java/com/infochimps/vayacondios/Organization.java
|
253
257
|
- src/main/java/com/infochimps/vayacondios/PathBuilder.java
|
258
|
+
- src/main/java/com/infochimps/vayacondios/StandardVCDLink.java
|
254
259
|
- src/main/java/com/infochimps/vayacondios/VCDIntegrationTest.java
|
255
260
|
- src/main/java/com/infochimps/vayacondios/VayacondiosClient.java
|
261
|
+
- src/test/java/com/infochimps/vayacondios/TestVayacondiosInMemory.java
|
256
262
|
- vayacondios-client.gemspec
|
257
263
|
- vayacondios-server.gemspec
|
258
264
|
homepage: https://github.com/infochimps-labs/vayacondios
|
@@ -269,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
275
|
version: '0'
|
270
276
|
segments:
|
271
277
|
- 0
|
272
|
-
hash: -
|
278
|
+
hash: -3916110167630393144
|
273
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
280
|
none: false
|
275
281
|
requirements:
|
@@ -278,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
284
|
version: '0'
|
279
285
|
segments:
|
280
286
|
- 0
|
281
|
-
hash: -
|
287
|
+
hash: -3916110167630393144
|
282
288
|
requirements: []
|
283
289
|
rubyforge_project:
|
284
290
|
rubygems_version: 1.8.25
|
@@ -290,6 +296,7 @@ test_files:
|
|
290
296
|
- spec/client/notifier_spec.rb
|
291
297
|
- spec/server/config_spec.rb
|
292
298
|
- spec/server/event_spec.rb
|
299
|
+
- spec/server/itemset_legacy_spec.rb
|
293
300
|
- spec/server/itemset_spec.rb
|
294
301
|
- spec/server/rack/extract_methods_spec.rb
|
295
302
|
- spec/server/rack/path_spec.rb
|