content_server 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/bin/backup_server +8 -20
  2. data/bin/content_server +8 -20
  3. data/bin/testing_memory +60 -0
  4. data/bin/testing_server +57 -0
  5. data/ext/run_in_background/mkrf_conf.rb +34 -0
  6. data/lib/content_data/content_data.rb +613 -0
  7. data/lib/content_data/version.rb +3 -0
  8. data/lib/content_data.rb +6 -0
  9. data/lib/content_server/backup_server.rb +65 -86
  10. data/lib/content_server/content_server.rb +47 -77
  11. data/lib/content_server/file_streamer.rb +27 -33
  12. data/lib/content_server/queue_copy.rb +154 -49
  13. data/lib/content_server/queue_indexer.rb +19 -11
  14. data/lib/content_server/remote_content.rb +41 -23
  15. data/lib/content_server/server.rb +91 -0
  16. data/lib/content_server/version.rb +1 -1
  17. data/lib/content_server.rb +0 -15
  18. data/lib/email/email.rb +87 -0
  19. data/lib/email/version.rb +3 -0
  20. data/lib/email.rb +4 -0
  21. data/lib/file_copy/copy.rb +68 -0
  22. data/lib/file_copy/version.rb +4 -0
  23. data/lib/file_copy.rb +4 -0
  24. data/lib/file_indexing/index_agent.rb +170 -0
  25. data/lib/file_indexing/indexer_patterns.rb +72 -0
  26. data/lib/file_indexing/version.rb +3 -0
  27. data/lib/file_indexing.rb +9 -0
  28. data/lib/file_monitoring/file_monitoring.rb +105 -0
  29. data/lib/file_monitoring/monitor_path.rb +304 -0
  30. data/lib/file_monitoring/version.rb +3 -0
  31. data/lib/file_monitoring.rb +29 -0
  32. data/lib/file_utils/file_generator/README +97 -0
  33. data/lib/file_utils/file_generator/file_generator.rb +156 -0
  34. data/lib/file_utils/file_utils.rb +260 -0
  35. data/lib/file_utils/version.rb +3 -0
  36. data/lib/file_utils.rb +4 -0
  37. data/lib/log/version.rb +3 -0
  38. data/lib/log.rb +188 -0
  39. data/lib/networking/tcp.rb +213 -0
  40. data/lib/networking/version.rb +3 -0
  41. data/lib/networking.rb +4 -0
  42. data/lib/params/version.rb +3 -0
  43. data/lib/params.rb +419 -0
  44. data/lib/process_monitoring/monitoring.rb +85 -0
  45. data/lib/process_monitoring/monitoring_info.rb +79 -0
  46. data/lib/process_monitoring/send_email.rb +40 -0
  47. data/lib/process_monitoring/thread_safe_hash.rb +77 -0
  48. data/lib/process_monitoring/version.rb +3 -0
  49. data/lib/process_monitoring.rb +6 -0
  50. data/lib/run_in_background/version.rb +3 -0
  51. data/lib/run_in_background.rb +432 -0
  52. data/lib/testing_memory/testing_memory.rb +187 -0
  53. data/lib/testing_server/testing_server.rb +236 -0
  54. data/lib/testing_server/version.rb +3 -0
  55. data/lib/testing_server.rb +12 -0
  56. data/lib/validations/index_validations.rb +106 -0
  57. data/lib/validations/version.rb +3 -0
  58. data/lib/validations.rb +4 -0
  59. data/spec/content_data/validations_spec.rb +113 -0
  60. data/spec/file_copy/copy_spec.rb +54 -0
  61. data/spec/file_indexing/index_agent_spec.rb +53 -0
  62. data/spec/networking/tcp_spec.rb +95 -0
  63. data/spec/validations/index_validations_spec.rb +77 -0
  64. data/test/content_data/content_data_test.rb +290 -0
  65. data/test/file_generator/file_generator_spec.rb +84 -0
  66. data/test/file_indexing/index_agent_test/New.txt +0 -0
  67. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/libexslt.dll +0 -0
  68. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/libxslt.dll +0 -0
  69. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/xsltproc.exe +0 -0
  70. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exslt.h +102 -0
  71. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exsltconfig.h +73 -0
  72. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exsltexports.h +140 -0
  73. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/libexslt.h +29 -0
  74. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/attributes.h +38 -0
  75. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/documents.h +93 -0
  76. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/extensions.h +262 -0
  77. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/extra.h +80 -0
  78. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/functions.h +78 -0
  79. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/imports.h +75 -0
  80. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/keys.h +53 -0
  81. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/libxslt.h +30 -0
  82. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/namespaces.h +68 -0
  83. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/numbersInternals.h +69 -0
  84. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/pattern.h +81 -0
  85. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/preproc.h +43 -0
  86. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/security.h +104 -0
  87. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/templates.h +77 -0
  88. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/transform.h +207 -0
  89. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/trio.h +216 -0
  90. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/triodef.h +220 -0
  91. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/variables.h +91 -0
  92. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/win32config.h +101 -0
  93. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xslt.h +103 -0
  94. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltInternals.h +1967 -0
  95. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltconfig.h +172 -0
  96. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltexports.h +142 -0
  97. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltlocale.h +57 -0
  98. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltutils.h +309 -0
  99. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltwin32config.h +105 -0
  100. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libexslt.lib +0 -0
  101. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libexslt_a.lib +0 -0
  102. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libxslt.lib +0 -0
  103. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libxslt_a.lib +0 -0
  104. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/readme.txt +22 -0
  105. data/test/file_indexing/index_agent_test/patterns.input +3 -0
  106. data/test/file_indexing/index_agent_test.rb +51 -0
  107. data/test/file_monitoring/file_monitoring_test/conf.yml +4 -0
  108. data/test/file_monitoring/file_monitoring_test/conf_win32.yml +5 -0
  109. data/test/file_monitoring/file_monitoring_test/log +56 -0
  110. data/test/file_monitoring/file_monitoring_test.rb +0 -0
  111. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000 +1000 -0
  112. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000.0 +1000 -0
  113. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000.1 +1000 -0
  114. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500 +1500 -0
  115. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500.0 +1500 -0
  116. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500.1 +1500 -0
  117. data/test/file_monitoring/monitor_path_test/test_file.500 +500 -0
  118. data/test/file_monitoring/monitor_path_test/test_file.500.0 +500 -0
  119. data/test/file_monitoring/monitor_path_test/test_file.500.1 +500 -0
  120. data/test/file_monitoring/monitor_path_test.rb +153 -0
  121. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500 +1500 -0
  122. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500.0 +1500 -0
  123. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500.1 +1500 -0
  124. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000 +1000 -0
  125. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000.0 +1000 -0
  126. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000.1 +1000 -0
  127. data/test/file_utils/fileutil_mksymlink_test/test_file.500 +500 -0
  128. data/test/file_utils/fileutil_mksymlink_test/test_file.500.0 +500 -0
  129. data/test/file_utils/fileutil_mksymlink_test/test_file.500.1 +500 -0
  130. data/test/file_utils/fileutil_mksymlink_test.rb +125 -0
  131. data/test/file_utils/time_modification_test.rb +132 -0
  132. data/test/params/params_spec.rb +280 -0
  133. data/test/params/params_test.rb +43 -0
  134. data/test/run_in_background/run_in_background_test.rb +122 -0
  135. data/test/run_in_background/test_app +57 -0
  136. metadata +272 -132
  137. data/lib/content_server/globals.rb +0 -10
@@ -0,0 +1,500 @@
1
+ 0
2
+ 1
3
+ 2
4
+ 3
5
+ 4
6
+ 5
7
+ 6
8
+ 7
9
+ 8
10
+ 9
11
+ 10
12
+ 11
13
+ 12
14
+ 13
15
+ 14
16
+ 15
17
+ 16
18
+ 17
19
+ 18
20
+ 19
21
+ 20
22
+ 21
23
+ 22
24
+ 23
25
+ 24
26
+ 25
27
+ 26
28
+ 27
29
+ 28
30
+ 29
31
+ 30
32
+ 31
33
+ 32
34
+ 33
35
+ 34
36
+ 35
37
+ 36
38
+ 37
39
+ 38
40
+ 39
41
+ 40
42
+ 41
43
+ 42
44
+ 43
45
+ 44
46
+ 45
47
+ 46
48
+ 47
49
+ 48
50
+ 49
51
+ 50
52
+ 51
53
+ 52
54
+ 53
55
+ 54
56
+ 55
57
+ 56
58
+ 57
59
+ 58
60
+ 59
61
+ 60
62
+ 61
63
+ 62
64
+ 63
65
+ 64
66
+ 65
67
+ 66
68
+ 67
69
+ 68
70
+ 69
71
+ 70
72
+ 71
73
+ 72
74
+ 73
75
+ 74
76
+ 75
77
+ 76
78
+ 77
79
+ 78
80
+ 79
81
+ 80
82
+ 81
83
+ 82
84
+ 83
85
+ 84
86
+ 85
87
+ 86
88
+ 87
89
+ 88
90
+ 89
91
+ 90
92
+ 91
93
+ 92
94
+ 93
95
+ 94
96
+ 95
97
+ 96
98
+ 97
99
+ 98
100
+ 99
101
+ 100
102
+ 101
103
+ 102
104
+ 103
105
+ 104
106
+ 105
107
+ 106
108
+ 107
109
+ 108
110
+ 109
111
+ 110
112
+ 111
113
+ 112
114
+ 113
115
+ 114
116
+ 115
117
+ 116
118
+ 117
119
+ 118
120
+ 119
121
+ 120
122
+ 121
123
+ 122
124
+ 123
125
+ 124
126
+ 125
127
+ 126
128
+ 127
129
+ 128
130
+ 129
131
+ 130
132
+ 131
133
+ 132
134
+ 133
135
+ 134
136
+ 135
137
+ 136
138
+ 137
139
+ 138
140
+ 139
141
+ 140
142
+ 141
143
+ 142
144
+ 143
145
+ 144
146
+ 145
147
+ 146
148
+ 147
149
+ 148
150
+ 149
151
+ 150
152
+ 151
153
+ 152
154
+ 153
155
+ 154
156
+ 155
157
+ 156
158
+ 157
159
+ 158
160
+ 159
161
+ 160
162
+ 161
163
+ 162
164
+ 163
165
+ 164
166
+ 165
167
+ 166
168
+ 167
169
+ 168
170
+ 169
171
+ 170
172
+ 171
173
+ 172
174
+ 173
175
+ 174
176
+ 175
177
+ 176
178
+ 177
179
+ 178
180
+ 179
181
+ 180
182
+ 181
183
+ 182
184
+ 183
185
+ 184
186
+ 185
187
+ 186
188
+ 187
189
+ 188
190
+ 189
191
+ 190
192
+ 191
193
+ 192
194
+ 193
195
+ 194
196
+ 195
197
+ 196
198
+ 197
199
+ 198
200
+ 199
201
+ 200
202
+ 201
203
+ 202
204
+ 203
205
+ 204
206
+ 205
207
+ 206
208
+ 207
209
+ 208
210
+ 209
211
+ 210
212
+ 211
213
+ 212
214
+ 213
215
+ 214
216
+ 215
217
+ 216
218
+ 217
219
+ 218
220
+ 219
221
+ 220
222
+ 221
223
+ 222
224
+ 223
225
+ 224
226
+ 225
227
+ 226
228
+ 227
229
+ 228
230
+ 229
231
+ 230
232
+ 231
233
+ 232
234
+ 233
235
+ 234
236
+ 235
237
+ 236
238
+ 237
239
+ 238
240
+ 239
241
+ 240
242
+ 241
243
+ 242
244
+ 243
245
+ 244
246
+ 245
247
+ 246
248
+ 247
249
+ 248
250
+ 249
251
+ 250
252
+ 251
253
+ 252
254
+ 253
255
+ 254
256
+ 255
257
+ 256
258
+ 257
259
+ 258
260
+ 259
261
+ 260
262
+ 261
263
+ 262
264
+ 263
265
+ 264
266
+ 265
267
+ 266
268
+ 267
269
+ 268
270
+ 269
271
+ 270
272
+ 271
273
+ 272
274
+ 273
275
+ 274
276
+ 275
277
+ 276
278
+ 277
279
+ 278
280
+ 279
281
+ 280
282
+ 281
283
+ 282
284
+ 283
285
+ 284
286
+ 285
287
+ 286
288
+ 287
289
+ 288
290
+ 289
291
+ 290
292
+ 291
293
+ 292
294
+ 293
295
+ 294
296
+ 295
297
+ 296
298
+ 297
299
+ 298
300
+ 299
301
+ 300
302
+ 301
303
+ 302
304
+ 303
305
+ 304
306
+ 305
307
+ 306
308
+ 307
309
+ 308
310
+ 309
311
+ 310
312
+ 311
313
+ 312
314
+ 313
315
+ 314
316
+ 315
317
+ 316
318
+ 317
319
+ 318
320
+ 319
321
+ 320
322
+ 321
323
+ 322
324
+ 323
325
+ 324
326
+ 325
327
+ 326
328
+ 327
329
+ 328
330
+ 329
331
+ 330
332
+ 331
333
+ 332
334
+ 333
335
+ 334
336
+ 335
337
+ 336
338
+ 337
339
+ 338
340
+ 339
341
+ 340
342
+ 341
343
+ 342
344
+ 343
345
+ 344
346
+ 345
347
+ 346
348
+ 347
349
+ 348
350
+ 349
351
+ 350
352
+ 351
353
+ 352
354
+ 353
355
+ 354
356
+ 355
357
+ 356
358
+ 357
359
+ 358
360
+ 359
361
+ 360
362
+ 361
363
+ 362
364
+ 363
365
+ 364
366
+ 365
367
+ 366
368
+ 367
369
+ 368
370
+ 369
371
+ 370
372
+ 371
373
+ 372
374
+ 373
375
+ 374
376
+ 375
377
+ 376
378
+ 377
379
+ 378
380
+ 379
381
+ 380
382
+ 381
383
+ 382
384
+ 383
385
+ 384
386
+ 385
387
+ 386
388
+ 387
389
+ 388
390
+ 389
391
+ 390
392
+ 391
393
+ 392
394
+ 393
395
+ 394
396
+ 395
397
+ 396
398
+ 397
399
+ 398
400
+ 399
401
+ 400
402
+ 401
403
+ 402
404
+ 403
405
+ 404
406
+ 405
407
+ 406
408
+ 407
409
+ 408
410
+ 409
411
+ 410
412
+ 411
413
+ 412
414
+ 413
415
+ 414
416
+ 415
417
+ 416
418
+ 417
419
+ 418
420
+ 419
421
+ 420
422
+ 421
423
+ 422
424
+ 423
425
+ 424
426
+ 425
427
+ 426
428
+ 427
429
+ 428
430
+ 429
431
+ 430
432
+ 431
433
+ 432
434
+ 433
435
+ 434
436
+ 435
437
+ 436
438
+ 437
439
+ 438
440
+ 439
441
+ 440
442
+ 441
443
+ 442
444
+ 443
445
+ 444
446
+ 445
447
+ 446
448
+ 447
449
+ 448
450
+ 449
451
+ 450
452
+ 451
453
+ 452
454
+ 453
455
+ 454
456
+ 455
457
+ 456
458
+ 457
459
+ 458
460
+ 459
461
+ 460
462
+ 461
463
+ 462
464
+ 463
465
+ 464
466
+ 465
467
+ 466
468
+ 467
469
+ 468
470
+ 469
471
+ 470
472
+ 471
473
+ 472
474
+ 473
475
+ 474
476
+ 475
477
+ 476
478
+ 477
479
+ 478
480
+ 479
481
+ 480
482
+ 481
483
+ 482
484
+ 483
485
+ 484
486
+ 485
487
+ 486
488
+ 487
489
+ 488
490
+ 489
491
+ 490
492
+ 491
493
+ 492
494
+ 493
495
+ 494
496
+ 495
497
+ 496
498
+ 497
499
+ 498
500
+ 499
@@ -0,0 +1,153 @@
1
+ require './lib/file_monitoring/monitor_path'
2
+ require 'test/unit'
3
+ require 'fileutils'
4
+
5
+ module FileMonitoring
6
+ module Test
7
+ class TestPathMonitor < ::Test::Unit::TestCase
8
+ # directory where tested files will be placed: __FILE__/time_modification_test
9
+ RESOURCES_DIR = File.expand_path(File.dirname(__FILE__) + '/path_monitor_test')
10
+ MOVE_DIR = '/dir1500' # directory that will be moved
11
+ MOVE_FILE = '/test_file.1000' # file that will be moved
12
+ MOVE_SRC_DIR = RESOURCES_DIR + '/dir1000' # directory where moved entities where placed
13
+ MOVE_DEST_DIR = RESOURCES_DIR # directory where moved entities will be placed
14
+ LOG_PATH = RESOURCES_DIR + '/../log.txt'
15
+
16
+ def setup
17
+ @sizes = [500, 1000, 1500]
18
+ @numb_of_copies = 2
19
+ @numb_entities = @sizes.size * (@numb_of_copies + 1) + @sizes.size
20
+ @test_file_name = 'test_file' # file name format: <test_file_name_prefix>.<size>[.serial_number_if_more_then_1]
21
+ @test_dir_name = 'dir'
22
+ ::FileUtils.rm_rf(RESOURCES_DIR) if (File.exists?(RESOURCES_DIR))
23
+
24
+ # prepare files for testing
25
+ cur_dir = nil; # directory where currently files created in this iteration will be placed
26
+
27
+ @sizes.each do |size|
28
+ file_name = @test_file_name + '.' + size.to_s
29
+
30
+ if (cur_dir == nil)
31
+ cur_dir = String.new(RESOURCES_DIR)
32
+ else
33
+ cur_dir = cur_dir + "/#{@test_dir_name}" + size.to_s
34
+ end
35
+ Dir.mkdir(cur_dir) unless (File.exists?(cur_dir))
36
+ raise "Can't create writable working directory: #{cur_dir}" unless (File.exists?(cur_dir) and File.writable?(cur_dir))
37
+
38
+ file_path = cur_dir + '/' + file_name
39
+ File.open(file_path, 'w') do |file|
40
+ content = Array.new
41
+ size.times do |i|
42
+ content.push(sprintf('%5d ', i))
43
+ end
44
+ file.puts(content)
45
+ end
46
+
47
+ @numb_of_copies.times do |i|
48
+ ::FileUtils.cp(file_path, "#{file_path}.#{i}")
49
+ end
50
+ end
51
+ end
52
+
53
+ def test_monitor
54
+ log = File.open(LOG_PATH, 'w+')
55
+ FileStat.set_log(log)
56
+ test_dir = DirStat.new(RESOURCES_DIR)
57
+
58
+ # Initial run of monitoring -> initializing DirStat object
59
+ # all found object will be set to NEW state
60
+ # no output to the log
61
+ test_dir.monitor
62
+
63
+ # all files will be set to UNCHANGED
64
+ log_prev_pos = log.pos
65
+ log_prev_line = log.lineno
66
+ test_dir.monitor
67
+ sleep(1) # to be sure that data was indeed written
68
+ log.pos= log_prev_pos
69
+ log.each_line do |line|
70
+ assert_equal(true, line.include?(FileStatEnum::UNCHANGED))
71
+ end
72
+ assert_equal(@numb_entities, log.lineno - log_prev_line) # checking that all entities were monitored
73
+
74
+ # move (equivalent to delete and create new) directory with including files to new location
75
+ ::FileUtils.mv MOVE_SRC_DIR + MOVE_DIR, MOVE_DEST_DIR + MOVE_DIR
76
+ log_prev_pos = log.pos
77
+ log_prev_line = log.lineno
78
+ test_dir.monitor
79
+ sleep(1)
80
+ log.pos= log_prev_pos
81
+ log.each_line do |line|
82
+ if (line.include?(MOVE_SRC_DIR + MOVE_DIR))
83
+ assert_equal(true, line.include?(FileStatEnum::NON_EXISTING))
84
+ elsif (line.include?(MOVE_DEST_DIR + MOVE_DIR))
85
+ assert_equal(true, line.include?(FileStatEnum::NEW))
86
+ elsif (line.include?(MOVE_SRC_DIR) or line.include?(MOVE_DEST_DIR))
87
+ assert_not_equal(true, line.include?(FileStatEnum::UNCHANGED))
88
+ assert_equal(true, line.include?(FileStatEnum::CHANGED))
89
+ end
90
+ end
91
+ # old and new containing directories: 2
92
+ # moved directory: 1
93
+ # deleted directory: 1
94
+ # moved files: @numb_of_copies + 1
95
+ assert_equal(5 + @numb_of_copies, log.lineno - log_prev_line) # checking that only MOVE_DIR_SRC, MOVE_DIR_DEST states were changed
96
+
97
+ # no changes:
98
+ # changed and new files moved to UNCHANGED
99
+ log_prev_pos = log.pos
100
+ log_prev_line = log.lineno
101
+ test_dir.monitor
102
+ sleep(1)
103
+ log.pos= log_prev_pos
104
+ log.each_line do |line|
105
+ assert_equal(true, line.include?(FileStatEnum::UNCHANGED))
106
+ end
107
+ # old and new containing directories: 2
108
+ # moved directory: 1
109
+ # moved files: @numb_of_copies + 1
110
+ assert_equal(4 + @numb_of_copies, log.lineno - log_prev_line)
111
+
112
+ # move (equivalent to delete and create new) file
113
+ log_prev_pos = log.pos
114
+ log_prev_line = log.lineno
115
+ ::FileUtils.mv MOVE_SRC_DIR + MOVE_FILE, MOVE_DEST_DIR + MOVE_FILE
116
+ test_dir.monitor
117
+ sleep(1)
118
+ log.pos= log_prev_pos
119
+ log.each_line do |line|
120
+ if (line.include?MOVE_SRC_DIR + MOVE_FILE)
121
+ assert_equal(true, line.include?(FileStatEnum::NON_EXISTING))
122
+ elsif (line.include?MOVE_DEST_DIR + MOVE_FILE)
123
+ assert_equal(true, line.include?(FileStatEnum::NEW))
124
+ elsif (line.include?MOVE_SRC_DIR or line.include?MOVE_DEST_DIR)
125
+ assert_equal(true, line.include?(FileStatEnum::CHANGED))
126
+ end
127
+ end
128
+ # old and new containing directories: 2
129
+ # removed file: 1
130
+ # new file: 1
131
+ assert_equal(4, log.lineno - log_prev_line)
132
+
133
+ # all files were moved to UNCHANGED
134
+ test_dir.monitor
135
+
136
+ # check that all entities moved to stable
137
+ log_prev_pos = log.pos
138
+ log_prev_line = log.lineno
139
+ (test_dir.stable_state + 1).times do
140
+ test_dir.monitor
141
+ end
142
+ sleep(1)
143
+ log.pos= log_prev_pos
144
+ log.each_line do |line|
145
+ assert_equal(true, line.include?(FileStatEnum::STABLE))
146
+ end
147
+ assert_equal(@numb_entities, log.lineno - log_prev_line)
148
+
149
+ log.close
150
+ end
151
+ end
152
+ end
153
+ end