/
ProjectExplorerTracesFolderTest.java
1652 lines (1463 loc) · 77.1 KB
/
ProjectExplorerTracesFolderTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
* Copyright (c) 2016, 2019 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.integration.swtbot.tests.projectexplorer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportConfirmation;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizardPage;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.wizards.SWTBotImportWizardUtils;
import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
import org.eclipse.ui.IPageLayout;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
/**
* SWTBot test for testing Project Explorer trace folders (context-menu,
* import, etc).
*/
@RunWith(SWTBotJunit4ClassRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@SuppressWarnings({"restriction", "javadoc"})
public class ProjectExplorerTracesFolderTest {
private static final String RESOURCE_PROPERTIES = "Resource properties";
private static final class ImportConfirmationSupplier implements Supplier<ImportConfirmation> {
List<ImportConfirmation> fConfirmations = Lists.newArrayList(ImportConfirmation.CONTINUE);
public ImportConfirmationSupplier(ImportConfirmation... confirmations) {
fConfirmations = Lists.newArrayList(confirmations);
}
@Override
public ImportConfirmation get() {
return fConfirmations.isEmpty() ? null : fConfirmations.remove(0);
}
}
private static final String PROP_LAST_MODIFIED_PROPERTY = "last modified";
private static final String TEXT_EDITOR_ID = "org.eclipse.ui.DefaultTextEditor";
private static final String GENERIC_CTF_TRACE_TYPE = "Common Trace Format : Generic CTF Trace";
private static final String LTTNG_KERNEL_TRACE_TYPE = "Common Trace Format : Linux Kernel Trace";
private static final String LTTNG_UST_TRACE_TYPE = "Common Trace Format : LTTng UST Trace";
private static final String CUSTOM_TEXT_TRACE_TYPE = "Custom Text : TmfGeneric";
private static final String CUSTOM_XML_TRACE_TYPE = "Custom XML : Custom XML Log";
private static final @NonNull TestTraceInfo CUSTOM_TEXT_LOG = new TestTraceInfo("ExampleCustomTxt.log", CUSTOM_TEXT_TRACE_TYPE, 10, "29:52.034");
private static final @NonNull TestTraceInfo CUSTOM_XML_LOG = new TestTraceInfo("ExampleCustomXml.xml", CUSTOM_XML_TRACE_TYPE, 6, "22:01:20");
private static final @NonNull TestTraceInfo LTTNG_KERNEL_TRACE = new TestTraceInfo("kernel-overlap-testing", LTTNG_KERNEL_TRACE_TYPE, 1000, "04:32.650 993 664");
private static final @NonNull TestTraceInfo SIMPLE_SERVER1_UST_TRACE = new TestTraceInfo("simple_server-thread1", LTTNG_UST_TRACE_TYPE, 1000, "04:32.650 993 664");
private static final @NonNull TestTraceInfo SIMPLE_SERVER2_UST_TRACE = new TestTraceInfo("simple_server-thread2", LTTNG_UST_TRACE_TYPE, 1000, "04:32.650 993 664");
private static final @NonNull TestTraceInfo UST_OVERLAP_TESTING_UST_TRACE = new TestTraceInfo("ust-overlap-testing", LTTNG_UST_TRACE_TYPE, 1000, "04:32.650 993 664");
private static final String CLASHES_DIR_NAME = "z-clashes";
private static final @NonNull TestTraceInfo CLASHES_CUSTOM_TEXT_LOG = new TestTraceInfo("ExampleCustomTxt.log", CLASHES_DIR_NAME + "/ExampleCustomTxt.log", CUSTOM_TEXT_TRACE_TYPE, 11, "29:52.034");
private static final @NonNull TestTraceInfo CLASHES_CUSTOM_XML_LOG = new TestTraceInfo("ExampleCustomXml.xml", CLASHES_DIR_NAME + "/ExampleCustomXml.xml", CUSTOM_XML_TRACE_TYPE, 7, "22:01:20");
private static final @NonNull TestTraceInfo CLASHES_LTTNG_KERNEL_TRACE = new TestTraceInfo("kernel-overlap-testing", CLASHES_DIR_NAME + "/kernel-overlap-testing", LTTNG_KERNEL_TRACE_TYPE, 1001, "04:32.650 993 664");
private static final @NonNull TestTraceInfo CLASHES_SIMPLE_SERVER1_UST_TRACE = new TestTraceInfo("simple_server-thread1", CLASHES_DIR_NAME + "/simple_server-thread1", LTTNG_UST_TRACE_TYPE, 1001, "04:32.650 993 664");
private static final @NonNull TestTraceInfo CLASHES_SIMPLE_SERVER2_UST_TRACE = new TestTraceInfo("simple_server-thread2", CLASHES_DIR_NAME + "/simple_server-thread2", LTTNG_UST_TRACE_TYPE, 1001, "04:32.650 993 664");
private static final @NonNull TestTraceInfo CLASHES_UST_OVERLAP_TESTING_UST_TRACE = new TestTraceInfo("ust-overlap-testing", CLASHES_DIR_NAME + "/ust-overlap-testing", LTTNG_UST_TRACE_TYPE, 1001, "04:32.650 993 664");
private static final @NonNull TestTraceInfo LTTNG_KERNEL_TRACE_METADATA = new TestTraceInfo(LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE.getTraceName() + "/metadata", LTTNG_KERNEL_TRACE.getTraceType(), LTTNG_KERNEL_TRACE.getNbEvents(),
LTTNG_KERNEL_TRACE.getFirstEventTimestamp());
private static final @NonNull TestTraceInfo UNRECOGNIZED_LOG = new TestTraceInfo("unrecognized.log", "", 0, "");
private static final @NonNull TestTraceInfo CUSTOM_XML_LOG_AS_TEXT = new TestTraceInfo("ExampleCustomXml.xml", CUSTOM_TEXT_TRACE_TYPE, 0, "");
private static final @NonNull TestTraceInfo CLASHES_CUSTOM_XML_LOG_AS_TEXT = new TestTraceInfo("ExampleCustomXml.xml", CLASHES_DIR_NAME + "/ExampleCustomXml.xml", CUSTOM_TEXT_TRACE_TYPE, 0, "");
private static final TestTraceInfo[] ALL_TRACEINFOS = new TestTraceInfo[] {
CUSTOM_TEXT_LOG,
CUSTOM_XML_LOG,
LTTNG_KERNEL_TRACE,
SIMPLE_SERVER1_UST_TRACE,
SIMPLE_SERVER2_UST_TRACE,
UST_OVERLAP_TESTING_UST_TRACE,
CLASHES_CUSTOM_TEXT_LOG,
CLASHES_CUSTOM_XML_LOG,
CLASHES_LTTNG_KERNEL_TRACE,
CLASHES_SIMPLE_SERVER1_UST_TRACE,
CLASHES_SIMPLE_SERVER2_UST_TRACE,
CLASHES_UST_OVERLAP_TESTING_UST_TRACE
};
private static final Set<TestTraceInfo> CLASHING_TRACEINFOS = ImmutableSet.of(
CLASHES_CUSTOM_TEXT_LOG,
CLASHES_CUSTOM_XML_LOG,
CLASHES_LTTNG_KERNEL_TRACE,
CLASHES_SIMPLE_SERVER1_UST_TRACE,
CLASHES_SIMPLE_SERVER2_UST_TRACE,
CLASHES_UST_OVERLAP_TESTING_UST_TRACE);
// All normal traces plus the unrecognized trace
private static final int NUM_UNIQUE_TRACES = CLASHING_TRACEINFOS.size() + 1;
private static final File TEST_TRACES_PATH = new File(new Path(TmfTraceManager.getTemporaryDirPath()).append("testtraces").toOSString());
private static final String DEFAULT_PROJECT_NAME = "Tracing";
private static final String TRACE_PROJECT_NAME = "test";
private static final String MANAGE_CUSTOM_PARSERS_SHELL_TITLE = "Manage Custom Parsers";
private static SWTWorkbenchBot fBot;
private static final long DISK_ACCESS_TIMEOUT = 120000L;
private static String getPath(String relativePath) {
return new Path(TEST_TRACES_PATH.getAbsolutePath()).append(relativePath).toOSString();
}
/**
* Test Class setup
*
* @throws IOException
*/
@BeforeClass
public static void init() throws IOException {
TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);
SWTBotUtils.initialize();
/* Set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fBot = new SWTWorkbenchBot();
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();
SWTBotUtils.createProject(TRACE_PROJECT_NAME);
importCustomParsers();
}
/**
* Test class tear down method.
*/
@AfterClass
public static void tearDown() {
SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot);
SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot);
}
/**
* Test tear down method.
*/
@After
public void afterTest() {
SWTBotUtils.closeSecondaryShells(fBot);
}
private static void importCustomParsers() {
// FIXME: We can't use Manage Custom Parsers > Import because it uses a native dialog. We'll still check that they show up in the dialog
CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml"));
txtDefinitions[0].save();
CustomXmlTraceDefinition[] xmlDefinitions = CustomXmlTraceDefinition.loadAll(getPath("customParsers/ExampleCustomXmlParser.xml"));
xmlDefinitions[0].save();
SWTBotTreeItem traceFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
traceFolder.contextMenu("Manage Custom Parsers...").click();
SWTBotShell shell = fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).activate();
SWTBot shellBot = shell.bot();
// Make sure the custom text trace type is imported
shellBot.list().select(CUSTOM_TEXT_LOG.getTraceType());
// Make sure the custom xml trace type is imported
shellBot.radio("XML").click();
shellBot.list().select(CUSTOM_XML_LOG.getTraceType());
shellBot.button("Close").click();
shellBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT);
}
/**
* Test that the expected context menu items are there
* <p>
* Action : Trace Folder menu
* <p>
* Procedure :Select the Traces folder and open its context menu
* <p>
* Expected Results: Correct menu opens (Import, Refresh, etc)
*/
@Test
public void test3_01ContextMenuPresence() {
SWTBotTreeItem traceItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
final List<String> EXPECTED_MENU_LABELS = ImmutableList.of(
"Open Trace...",
"Open As Experiment...",
"",
"Import...",
"",
"New Folder...",
"Clear",
"",
"Import Trace Package...",
"Fetch Remote Traces...",
"",
"Export Trace Package...",
"",
"Manage Custom Parsers...",
"Manage XML analyses...",
"",
"Apply Time Offset...",
"Clear Time Offset",
"",
"Refresh");
List<String> menuLabels = traceItem.contextMenu().menuItems();
for (int i = 0; i < menuLabels.size(); i++) {
assertEquals(EXPECTED_MENU_LABELS.get(i), menuLabels.get(i));
}
fBot.closeAllEditors();
}
/**
* Test that the trace import wizard appears
* <p>
* Action : Trace Import Wizard
* <p>
* Procedure : Select Import
* <p>
* Expected Results: Trace Import Wizard appears
*/
@Test
public void test3_02Import() {
SWTBotTreeItem traceItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
SWTBotShell shell = openTraceFoldersImport(traceItem);
shell.bot().button("Cancel").click();
}
/**
* Test that the trace import wizard can import a single custom text trace
* <p>
* Action : Import single custom text trace (link to workspace)
* <p>
* <pre>
* Procedure : 1) Browse to directory ${local}/traces/import/
* 2) Select trace ExampleCustomTxt.log
* 3) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and
* 4) press Finish
* </pre>
* <p>
* Expected Results: Imported trace appear in Traces Folder and the Trace Type Tmf Generic is set. Make sure trace can be opened
*/
@Test
public void test3_03SingleCustomTextTrace() {
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
testSingleTrace(CUSTOM_TEXT_LOG, optionFlags);
}
/**
* <p>
* Action : Import Single custom XML trace (link to workspace)
* <p>
*
* <pre>
* Procedure : redo 3.1-3.3 but this time select ExampleCustomXml.xml
* </pre>
* <p>
* Expected Results: Imported trace appear in Traces Folder and the Trace
* Type "Custom XML log" is set. Make sure that trace can be opened
*/
@Test
public void test3_04SingleCustomXmlTrace() {
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
testSingleTrace(CUSTOM_XML_LOG, optionFlags);
}
/**
* <p>
* Action : Import LTTng Kernel CTF trace (link to workspace)
* <p>
*
* <pre>
* Procedure : redo 3.1-3.3 but this time select directory kernel-overlap-testing/
* </pre>
* <p>
* Expected Results: Imported trace appear in Traces Folder and the Trace
* Type "LTTng Kernel" is set. Make sure that trace can be opened
*/
@Test
public void test3_05SingleCtfTrace() {
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
testSingleTrace(LTTNG_KERNEL_TRACE, optionFlags);
}
/**
* <p>
* Action : Rename + copy import
* <p>
*
* <pre>
* Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
* 2) When dialog box appear select Rename
* </pre>
* <p>
* Expected Results: Traces are imported with new name that has a suffix (2)
* at the end. Make sure that imported traces are copied to the project.
*/
@Test
public void test3_06RenameCopyImport() {
testRenameCopyImport(CUSTOM_TEXT_LOG);
testRenameCopyImport(CUSTOM_XML_LOG);
testRenameCopyImport(LTTNG_KERNEL_TRACE);
}
private static void testRenameCopyImport(TestTraceInfo traceInfo) {
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES;
importTrace(optionFlags, ImportConfirmation.RENAME, traceInfo.getTraceName());
String renamed = toRenamedName(traceInfo.getTraceName());
verifyTrace(traceInfo, optionFlags, renamed);
}
/**
* <p>
* Action : Overwrite + copy import
* <p>
*
* <pre>
* Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
* 2) When dialog box appear select Overwrite
* </pre>
* <p>
* Expected Results: Existing traces are deleted and new traces are
* imported. Make sure that imported traces are copied to the project and
* can be opened
*/
@Test
public void test3_07OverwriteCopyImport() {
testOverwriteCopyImport(CUSTOM_TEXT_LOG);
testOverwriteCopyImport(CUSTOM_XML_LOG);
testOverwriteCopyImport(LTTNG_KERNEL_TRACE);
}
private static void testOverwriteCopyImport(TestTraceInfo traceInfo) {
String traceName = traceInfo.getTraceName();
SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName);
String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES;
importTrace(optionFlags, ImportConfirmation.OVERWRITE, traceName);
verifyTrace(traceInfo, optionFlags);
assertNotEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY));
}
/**
* <p>
* Action : Skip
* <p>
*
* <pre>
* Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
* 2) When dialog box appear select Skip
* </pre>
* <p>
* Expected Results: Make sure that no new trace is imported
*/
@Test
public void test3_08SkipImport() {
testSkipImport(CUSTOM_TEXT_LOG);
testSkipImport(CUSTOM_XML_LOG);
testSkipImport(LTTNG_KERNEL_TRACE);
}
private static void testSkipImport(TestTraceInfo traceInfo) {
String traceName = traceInfo.getTraceName();
SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName);
String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES;
importTrace(optionFlags, ImportConfirmation.SKIP, traceName);
verifyTrace(traceInfo, optionFlags);
assertEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY));
}
/**
* <p>
* Action : Default overwrite
* <p>
*
* <pre>
* Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" and select "Overwrite existing without warning"
* </pre>
* <p>
* Expected Results: Make sure that no dialog box appears (for renaming,
* overwriting, skipping) and existing traces are overwritten). Make sure
* trace can be opened
*/
@Test
public void test3_09OverwriteOptionImport() {
testOverwriteOptionImport(CUSTOM_TEXT_LOG);
testOverwriteOptionImport(CUSTOM_XML_LOG);
testOverwriteOptionImport(LTTNG_KERNEL_TRACE);
}
private static void testOverwriteOptionImport(TestTraceInfo traceInfo) {
String traceName = traceInfo.getTraceName();
SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName);
String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES;
importTrace(optionFlags, ImportConfirmation.CONTINUE, traceName);
verifyTrace(traceInfo, optionFlags);
assertNotEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY));
}
/**
* <p>
* Action : Import unrecognized
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import
* 3) Select trace unrecognized.log
* 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and
* 5) press Finish
* </pre>
* <p>
* Expected Results: unrecognized.log is imported with trace type unknown.
* The default text file icon is displayed. The trace, when opened, is
* displayed in the text editor.
*/
@Test
public void test3_10ImportUnrecognized() {
String traceName = UNRECOGNIZED_LOG.getTraceName();
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, traceName);
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
}
/**
* <p>
* Action : Import unrecognized (ignore)
* <p>
*
* <pre>
* Procedure : 1) redo 3.10, however unselect "Import unrecognized traces"
* </pre>
* <p>
* Expected Results: unrecognized.log is not imported
*/
@Test
public void test3_11ImportUnrecognizedIgnore() {
String traceName = UNRECOGNIZED_LOG.getTraceName();
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
int numTraces = tracesFolderItem.getItems().length;
SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, tracesFolderItem, traceName);
String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, traceName);
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
assertEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY));
assertEquals(numTraces, tracesFolderItem.getItems().length);
}
/**
* <p>
* Action : Import CTF trace by selection metadata file only
* <p>
*
* <pre>
* Procedure : 1) Redo 3.5, However only select metadata file instead of directory trace
* </pre>
* <p>
* Expected Results: Imported trace appear in Traces Folder and the Trace
* Type "LTTng Kernel" is set. Make sure that trace can be opened
*/
@Test
public void test3_12ImportCtfWithMetadataSelection() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
testSingleTrace(LTTNG_KERNEL_TRACE_METADATA, ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE);
}
/**
* <p>
* Action : Recursive import with auto-detection (Rename All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import
* 3) select directory import
* 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select "Rename All"
* </pre>
* <p>
* Expected Results: All Traces are imported with respective trace type set.
* Traces with name clashes are imported with suffix (2). 1 trace
* (unrecognized.log) is imported with trace type unknown. Make sure that
* traces can be opened which have a trace type set. The unknown trace type
* should open with the text editor.
*/
@Test
public void test3_13ImportRecursiveAutoRenameAll() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, ImportConfirmation.RENAME_ALL, "");
for (TestTraceInfo info : ALL_TRACEINFOS) {
String traceName = info.getTraceName();
if (CLASHING_TRACEINFOS.contains(info)) {
traceName = toRenamedName(traceName);
}
verifyTrace(info, optionFlags, traceName);
}
// Also check unrecognized file
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
}
/**
* <p>
* Action : Recursive import with auto-detection (Overwrite All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import/
* 3) select directory import
* 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select Overwrite All"
* </pre>
* <p>
* Expected Results: All Traces are imported with respective trace type set.
* Traces with name clashes are overwritten . 1 trace (unrecognized.log) is
* imported with trace type unknown. Make sure that traces can be opened
* which have a trace type set. The unknown trace type should open with the
* text editor.
*/
@Test
public void test3_14ImportRecursiveAutoOverwriteAll() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, ImportConfirmation.OVERWRITE_ALL, "");
for (TestTraceInfo info : CLASHING_TRACEINFOS) {
verifyTrace(info, optionFlags);
}
// All traces should have clashed/overwritten (plus the unrecognized trace)
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(NUM_UNIQUE_TRACES, tracesFolderItem.getItems().length);
// Also check unrecognized file
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
}
/**
* <p>
* Action : Recursive import with auto-detection (Skip All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import/
* 3) select directory import
* 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and uncheck "preserve folder structure"
* 5) press Finish
* 6) When dialog appears select Skip All"
* </pre>
* <p>
* Expected Results: All Traces are imported with respective trace type set. Traces with name
* clashes are not imported. 1 trace (unrecognized.log) is imported with
* trace type unknown. The unknown trace type should open with the text
* editor.
*/
@Test
public void test3_15ImportRecursiveAutoSkipAll() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, ImportConfirmation.SKIP_ALL, "");
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
for (TestTraceInfo info : ALL_TRACEINFOS) {
if (!CLASHING_TRACEINFOS.contains(info)) {
verifyTrace(info, optionFlags);
}
}
// All traces should have skipped (plus the unrecognized trace)
assertEquals(NUM_UNIQUE_TRACES, tracesFolderItem.getItems().length);
// Also check unrecognized file
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
}
/**
* <p>
* Action : Recursive import with auto-detection (test rename, overwrite and
* skip)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import/
* 3) select directory import
* 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select "Rename"
* 7) When dialog appears select "Overwrite"
* 8) When dialog appears select "Skip"
* </pre>
* <p>
* Expected Results: All Traces are imported with respective trace type set. Traces with name
* clashes are either renamed, overwritten or skipped as per dialog action.
* Make sure that traces can be opened which have trace type set. The
* unknown trace type should open with the text editor.
*/
@Test
public void test3_16ImportRecursiveAutoRenameOverwriteSkip() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
Supplier<ImportConfirmation> confirmationSupplier = new ImportConfirmationSupplier(
ImportConfirmation.RENAME, ImportConfirmation.OVERWRITE, ImportConfirmation.SKIP);
int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(optionFlags, confirmationSupplier, LTTNG_KERNEL_TRACE.getTracePath(), CLASHES_LTTNG_KERNEL_TRACE.getTracePath(), SIMPLE_SERVER1_UST_TRACE.getTracePath(), CLASHES_SIMPLE_SERVER1_UST_TRACE.getTracePath(),
SIMPLE_SERVER2_UST_TRACE.getTracePath(), CLASHES_SIMPLE_SERVER2_UST_TRACE.getTracePath(), UNRECOGNIZED_LOG.getTracePath());
verifyTrace(LTTNG_KERNEL_TRACE, optionFlags);
// Renamed trace
String renamed = toRenamedName(CLASHES_LTTNG_KERNEL_TRACE.getTraceName());
verifyTrace(CLASHES_LTTNG_KERNEL_TRACE, optionFlags, renamed);
// Overwritten trace
verifyTrace(CLASHES_SIMPLE_SERVER1_UST_TRACE, optionFlags);
// Skipped trace
verifyTrace(SIMPLE_SERVER2_UST_TRACE, optionFlags);
// Also check unrecognized file
verifyTrace(UNRECOGNIZED_LOG, optionFlags);
}
/**
* <p>
* Action : Recursive import with specific trace type 1 (Skip All) skip)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "Generic CTF Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"and
* 5) press Finish
* 6) When dialog appears select Skip All"
* </pre>
* <p>
* Expected Results: After selecting trace type, verify that button "Import
* unrecognized traces" is disabled. 4 CTF traces are imported with trace
* type "Generic CTF Trace" . Make sure that these traces can be opened
*/
@Test
public void test3_17ImportRecursiveSpecifyTraceTypeCTF() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(GENERIC_CTF_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, "");
final TestTraceInfo[] CTF_TRACEINFOS = new TestTraceInfo[] {
LTTNG_KERNEL_TRACE,
SIMPLE_SERVER1_UST_TRACE,
SIMPLE_SERVER2_UST_TRACE,
UST_OVERLAP_TESTING_UST_TRACE
};
for (TestTraceInfo info : CTF_TRACEINFOS) {
verifyTrace(info, optionFlags, info.getTraceName(), GENERIC_CTF_TRACE_TYPE);
}
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(CTF_TRACEINFOS.length, tracesFolderItem.getItems().length);
}
/**
* <p>
* Action : Recursive import with specific trace type 2 (Skip All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "LTTng Kernel Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) Press Finish
* 6) When dialog appears select Skip All"
* </pre>
* <p>
* Expected Results: After selecting trace type, verify that button "Import
* unrecognized traces" is disabled. One LTTng Kernel trace is imported with
* trace type "LTTng Kernel Trace". Make sure that this trace can be opened.
*/
@Test
public void test3_18ImportRecursiveSpecifyTraceTypeKernel() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(LTTNG_KERNEL_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, "");
verifyTrace(LTTNG_KERNEL_TRACE, optionFlags);
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(1, tracesFolderItem.getItems().length);
}
/**
* <p>
* Action : Recursive import with specific trace type 3 (Skip All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "LTTng UST Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) Press Finish
* 6) When dialog appears select Skip All"
* </pre>
* <p>
* Expected Results: After selecting trace type, verify that button "Import
* unrecognized traces" is disabled. 3 LTTng UST traces are imported with
* trace type "LTTng UST Trace". Make sure that these traces can be opened.
*/
@Test
public void test3_19ImportRecursiveSpecifyTraceTypeUST() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(LTTNG_UST_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, "");
final TestTraceInfo[] UST_TRACEINFOS = new TestTraceInfo[] {
SIMPLE_SERVER1_UST_TRACE,
SIMPLE_SERVER2_UST_TRACE,
UST_OVERLAP_TESTING_UST_TRACE
};
for (TestTraceInfo info : UST_TRACEINFOS) {
verifyTrace(info, optionFlags);
}
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(UST_TRACEINFOS.length, tracesFolderItem.getItems().length);
}
/**
* <p>
* Action : Recursive import with specific trace type 4 (Skip All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard (see 3.1-3.2)
* 2) Browse to directory ${local}/traces/import/
* 3) select directory import
* 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select Skip All"
* </pre>
* <p>
* Expected Results: All text files in directories are imported as trace and
* trace type "Tmf Generic" is set. Note that trace type validation only
* checks for file exists and that file is not a directory. Make sure that
* these traces can be opened. However traces with wrong trace type won't
* show any events in the table.
*/
@Test
public void test3_20ImportRecursiveSpecifyTraceTypeCustomText() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, "");
final TestTraceInfo[] TEXT_BASED_TRACEINFOS = new TestTraceInfo[] {
CUSTOM_TEXT_LOG,
CUSTOM_XML_LOG_AS_TEXT,
UNRECOGNIZED_LOG
};
for (TestTraceInfo info : TEXT_BASED_TRACEINFOS) {
verifyTrace(info, optionFlags, info.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
}
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(TEXT_BASED_TRACEINFOS.length, tracesFolderItem.getItems().length);
}
/**
* Action : Test the import wizard from workbench menu with project selected
* <p>
* <pre>
* Procedure : 1) Select Project "Test" in Project Explorer view
* 2) Open import wizard from menu File > Import... > Tracing > Trace Import
* 3) Browse to directory ${local}/traces/import/
* 4) Select trace ExampleCustomTxt.log
* 5) Keep <Auto Detection>, select "Create Links to workspace" and
* 6) press Finish
* </pre>
* <p>
* Expected Results: Verify that trace is imported to "Test" project and can be opened.
*/
@Test
public void test3_21ImportFromMenuProjectSelected() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME);
SWTBotShell shell = openWorkbenchMenuImport();
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath());
verifyTrace(CUSTOM_TEXT_LOG, optionFlags);
}
/**
* Action : Test the import wizard from workbench menu with no project selected
* <p>
* <pre>
* Procedure : 1) Clear selection in Project Explorer view
* 2) Open import wizard from menu File > Import... > Tracing > Trace Import
* 3) Browse to directory ${local}/traces/import/
* 4) Select trace ExampleCustomTxt.log
* 5) Keep <Auto Detection>, select "Create Links to workspace" and
* 6) press Finish
* </pre>
* <p>
* Expected Results: Verify that trace is imported to default "Tracing" project and can be opened.
*/
@Test
public void test3_22ImportFromMenuProjectNotSelected() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
SWTBotView projectExplorerBot = fBot.viewByTitle("Project Explorer");
projectExplorerBot.show();
projectExplorerBot.bot().waitUntil(Conditions.widgetIsEnabled(projectExplorerBot.bot().tree()));
projectExplorerBot.bot().tree().unselect();
SWTBotShell shell = openWorkbenchMenuImport();
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath());
verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_LOG.getTraceType(), DEFAULT_PROJECT_NAME);
SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot);
}
/**
* <p>
* Action : Recursive import with preserved folder structure
* <p>
*
* <pre>
* Procedure : 0) Delete all traces in project
* 1) Open Import wizard
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
* 5) press Finish
* </pre>
* <p>
* Expected Results: All matching traces are imported with trace type set.
* The folder "clashes" is imported with traces inside. Make sure that the
* traces can be opened.
*/
@Test
public void test3_29ImportRecursivePreserve() {
SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.CONTINUE, "");
verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE);
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(4, tracesFolderItem.getItems().length);
SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME);
assertEquals(2, clashesFolderItem.getItems().length);
}
/**
* <p>
* Action : Recursive import with preserved folder structure (Skip All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select "Skip All"
* </pre>
* <p>
* Expected Results: The wizard should finish quickly as no trace will be
* imported. Make sure that the traces can be opened.
*/
@Test
public void test3_30ImportRecursivePreserveSkipAll() {
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, "");
verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE);
SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
assertEquals(4, tracesFolderItem.getItems().length);
SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME);
assertEquals(2, clashesFolderItem.getItems().length);
//TOOD: verify that traces were actually skipped
}
/**
* <p>
* Action : Recursive import with preserved folder structure (Rename All)
* <p>
*
* <pre>
* Procedure : 1) Open Import wizard
* 2) Browse to directory ${local}/traces/import/
* 3) Select directory import
* 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
* 5) press Finish
* 6) When dialog appears select "Rename All"
* </pre>
* <p>
* Expected Results: All matching traces are imported with trace type set.
* The traces are renamed with suffix (2). The folder "clashes" is imported
* with traces inside. Make sure that the traces can be opened.
*/
@Test
public void test3_31ImportRecursivePreserveRenameAll() {
int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.RENAME_ALL, "");
verifyTrace(CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CUSTOM_TEXT_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CUSTOM_XML_LOG_AS_TEXT.getTraceName()), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(UNRECOGNIZED_LOG, optionFlags, toRenamedName(UNRECOGNIZED_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CLASHES_CUSTOM_TEXT_LOG.getTracePath()), CUSTOM_TEXT_TRACE_TYPE);
verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath()), CUSTOM_TEXT_TRACE_TYPE);