thinp_xml 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDliZTU2MTk0NmM1MTVkZmNjOTAyNDFmOTIwNzc2MTFjYWJmODgzZg==
4
+ NDI2YmNiNDk0MDVmYWRmMTE1ZWU3MTM4NGQ2NjM4MzAwY2IxNTYyMw==
5
5
  data.tar.gz: !binary |-
6
- OGQ0ODI3OGM0YjVhZWFmOGYwMjBmZjIxMjFmMTQ5NzNiNWI2MjJjOA==
6
+ ZDI0YzI0OWJjNTdhZmVmMmQ2ZmU5NmFhOWU1NjJjZWJhYWQ5NzNiOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NGYxY2UwYzg1MzVkNDJjZDE5NjFmYTg4ZjYxMWMyMGM2NzY4MzE2M2FiMzE4
10
- ZTMxMjFiMzAyNDc1YjQ1YWUyM2Q3YzFhODU5YzUzYjFjNTIyYTViN2NhMjFj
11
- ZmRiYmMyYzM1ZTM3NzYzZTk0MzBkYjA1M2ZiMWUwMDc2Y2Q3NmQ=
9
+ ODliNDQ3MDBlNzIxOTMyODc5YzBhNjczYjJmMjg2Y2M5MzJiNTYwMzYyODc0
10
+ ZWMwY2U5OTJiYTBiM2I5OWQ4ZDNkZGMxNTE4NGNlZjhiYzRlYTBmNTdmYTM3
11
+ NTNiM2M3Y2MxOTNlNTBhZTc5ZWVjY2JhNDMyZjgxYmU4Yjg0ODA=
12
12
  data.tar.gz: !binary |-
13
- ZTc1M2Y4ODc3YWE0ZjNkOTYzNGM5YjIwYmVkYTM0NDE4ZjVlMzY4YzhhY2Ri
14
- YzMyYTcyMTYyODYwNWIyNmY4MmViYjY2NTViNDlmNjQ4Mzk0OTU5MDFhNGFk
15
- NmY3ZTc4MmFlYjcyYzU0ZTY0MzBjYzBjZWExZWViNzRjYTFiNGM=
13
+ M2I3NDM3Mjc2MzE4YjY1M2UwYmMxZTUyMWYyYWI0MDczODY2ZTcwM2YwMDI3
14
+ MGM5NmQ3MTBiNzA3OGZmNjhmZDMwMzJhYzQxYTFhODI4NThhZGQ1ZTViYTcy
15
+ Yjk1NjY0NDkzNDBmMTVhN2ZiNDc5NmFkZGE1ZGUwNTI0MmY3YjQ=
@@ -47,13 +47,15 @@ CacheCommandLine = CommandLine::Parser.new do
47
47
  value_switch :nr_mappings, :distribution, '--nr-mappings'
48
48
  value_switch :mapping_policy, :layout, '--layout'
49
49
  value_switch :dirty_percentage, :percentage, '--dirty-percent'
50
+ value_switch :policy, :string, '--policy'
50
51
 
51
52
  global do
52
53
  switches :help
53
54
  end
54
55
 
55
56
  command :create do
56
- switches :nr_cache_blocks, :uuid, :block_size, :nr_mappings, :mapping_policy, :dirty_percentage
57
+ switches :nr_cache_blocks, :uuid, :block_size, :nr_mappings,
58
+ :mapping_policy, :dirty_percentage, :policy
57
59
  end
58
60
  end
59
61
 
@@ -82,6 +84,7 @@ class Dispatcher
82
84
  b.nr_mappings = opts.fetch(:nr_mappings, 0)
83
85
  b.mapping_policy = opts.fetch(:mapping_policy, :random)
84
86
  b.dirty_percentage = opts.fetch(:dirty_percentage, 0)
87
+ b.policy_name = opts.fetch(:policy, 'mq')
85
88
  md = b.generate
86
89
  write_xml(md, STDOUT)
87
90
  end
@@ -4,7 +4,7 @@ Feature: I can create new metadata
4
4
  When I cache_xml create
5
5
  Then the stdout should contain:
6
6
  """
7
- <superblock uuid="" block_size="128" nr_cache_blocks="0">
7
+ <superblock uuid="" block_size="128" nr_cache_blocks="0" policy="mq">
8
8
  </superblock>
9
9
  """
10
10
 
@@ -12,7 +12,7 @@ Feature: I can create new metadata
12
12
  When I cache_xml create --uuid 'one two three'
13
13
  Then the stdout should contain:
14
14
  """
15
- <superblock uuid="one two three" block_size="128" nr_cache_blocks="0">
15
+ <superblock uuid="one two three" block_size="128" nr_cache_blocks="0" policy="mq">
16
16
  </superblock>
17
17
  """
18
18
 
@@ -20,7 +20,7 @@ Feature: I can create new metadata
20
20
  When I cache_xml create --block-size 512
21
21
  Then the stdout should contain:
22
22
  """
23
- <superblock uuid="" block_size="512" nr_cache_blocks="0">
23
+ <superblock uuid="" block_size="512" nr_cache_blocks="0" policy="mq">
24
24
  </superblock>
25
25
  """
26
26
 
@@ -28,7 +28,7 @@ Feature: I can create new metadata
28
28
  When I cache_xml create --nr-cache-blocks 345
29
29
  Then the stdout should contain:
30
30
  """
31
- <superblock uuid="" block_size="128" nr_cache_blocks="345">
31
+ <superblock uuid="" block_size="128" nr_cache_blocks="345" policy="mq">
32
32
  </superblock>
33
33
  """
34
34
 
@@ -36,7 +36,7 @@ Feature: I can create new metadata
36
36
  When I cache_xml create --nr-cache-blocks uniform[123..124]
37
37
  Then the stdout should contain:
38
38
  """
39
- <superblock uuid="" block_size="128" nr_cache_blocks="123">
39
+ <superblock uuid="" block_size="128" nr_cache_blocks="123" policy="mq">
40
40
  </superblock>
41
41
  """
42
42
 
@@ -44,7 +44,7 @@ Feature: I can create new metadata
44
44
  When I cache_xml create --nr-cache-blocks 3 --nr-mappings 3 --layout linear
45
45
  Then the stdout should contain:
46
46
  """
47
- <superblock uuid="" block_size="128" nr_cache_blocks="3">
47
+ <superblock uuid="" block_size="128" nr_cache_blocks="3" policy="mq">
48
48
  <mapping cache_block="0" origin_block="0" dirty="false"/>
49
49
  <mapping cache_block="1" origin_block="1" dirty="false"/>
50
50
  <mapping cache_block="2" origin_block="2" dirty="false"/>
@@ -55,11 +55,22 @@ Feature: I can create new metadata
55
55
  When I cache_xml create --nr-cache-blocks 3 --nr-mappings 3 --layout linear --dirty-percent 100
56
56
  Then the stdout should contain:
57
57
  """
58
- <superblock uuid="" block_size="128" nr_cache_blocks="3">
58
+ <superblock uuid="" block_size="128" nr_cache_blocks="3" policy="mq">
59
59
  <mapping cache_block="0" origin_block="0" dirty="true"/>
60
60
  <mapping cache_block="1" origin_block="1" dirty="true"/>
61
61
  <mapping cache_block="2" origin_block="2" dirty="true"/>
62
62
  </superblock>
63
63
  """
64
64
 
65
+ Scenario: Take the policy name
66
+ When I cache_xml create --nr-cache-blocks 3 --nr-mappings 3 --layout linear --policy fred
67
+ Then the stdout should contain:
68
+ """
69
+ <superblock uuid="" block_size="128" nr_cache_blocks="3" policy="fred">
70
+ <mapping cache_block="0" origin_block="0" dirty="false"/>
71
+ <mapping cache_block="1" origin_block="1" dirty="false"/>
72
+ <mapping cache_block="2" origin_block="2" dirty="false"/>
73
+ </superblock>
74
+ """
75
+
65
76
 
@@ -11,7 +11,7 @@ module CacheXML
11
11
  end
12
12
 
13
13
  def emit_superblock(sb, &block)
14
- @e.emit_tag(sb, 'superblock', :uuid, :block_size, :nr_cache_blocks, &block)
14
+ @e.emit_tag(sb, 'superblock', :uuid, :block_size, :nr_cache_blocks, :policy, &block)
15
15
  end
16
16
 
17
17
  def emit_mapping(m)
@@ -2,7 +2,7 @@ module CacheXML
2
2
  SUPERBLOCK_FIELDS = [[:uuid, :string],
3
3
  [:block_size, :int],
4
4
  [:nr_cache_blocks, :int],
5
- [:policy_name, :string]]
5
+ [:policy, :string]]
6
6
 
7
7
  MAPPING_FIELDS = [[:cache_block, :int],
8
8
  [:origin_block, :int],
@@ -1,3 +1,3 @@
1
1
  module ThinpXml
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -231,7 +231,6 @@ describe "CacheXML::Builder" do
231
231
 
232
232
  in_order.should be_false
233
233
  end
234
-
235
234
  end
236
235
  end
237
236
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thinp_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Thornber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-16 00:00:00.000000000 Z
11
+ date: 2013-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ejt_command_line