18
18
import org .dspace .AbstractIntegrationTestWithDatabase ;
19
19
import org .dspace .app .launcher .ScriptLauncher ;
20
20
import org .dspace .app .scripts .handler .impl .TestDSpaceRunnableHandler ;
21
+ import org .dspace .builder .CollectionBuilder ;
22
+ import org .dspace .builder .CommunityBuilder ;
23
+ import org .dspace .builder .ItemBuilder ;
24
+ import org .dspace .content .Collection ;
25
+ import org .dspace .content .Community ;
26
+ import org .dspace .content .Item ;
21
27
import org .junit .Test ;
22
28
23
29
/**
@@ -40,4 +46,46 @@ public void testDefaultHealthcheckRun() throws Exception {
40
46
assertThat (messages , hasSize (1 ));
41
47
assertThat (messages , hasItem (containsString ("HEALTH REPORT:" )));
42
48
}
49
+
50
+ @ Test
51
+ public void testLegalCheck () throws Exception {
52
+ TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler ();
53
+ context .turnOffAuthorisationSystem ();
54
+ Community rootCommunity = CommunityBuilder .createCommunity (context )
55
+ .withName ("Parent Community" )
56
+ .build ();
57
+ Community community = CommunityBuilder .createSubCommunity (context , rootCommunity )
58
+ .withName ("Sub Community A" )
59
+ .build ();
60
+
61
+ Collection collection = CollectionBuilder .createCollection (context , community )
62
+ .withName ("Collection 1" )
63
+ .withSubmitterGroup (eperson )
64
+ .build ();
65
+
66
+ Item item = ItemBuilder .createItem (context , collection )
67
+ .withTitle ("Test Item Without Bitstream" )
68
+ .build ();
69
+
70
+ String [] args = new String [] { "health-report" , "-c" , "3" };
71
+ ScriptLauncher .handleScript (args , ScriptLauncher .getConfig (kernelImpl ), testDSpaceRunnableHandler , kernelImpl );
72
+
73
+ assertThat (testDSpaceRunnableHandler .getErrorMessages (), empty ());
74
+ List <String > messages = testDSpaceRunnableHandler .getInfoMessages ();
75
+ assertThat (messages , hasSize (1 ));
76
+ assertThat (messages , hasItem (containsString ("no license" )));
77
+ }
78
+ // NOVY TEST
79
+ // Pouzijes builder na vytvorenie Itemu bez bitstreamu (WorkspaceItemBuilder, ItemBUilder(
80
+ /**
81
+ * WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
82
+ * .withTitle("Test WorkspaceItem")
83
+ * .withIssueDate("2017-10-17")
84
+ * .withFulltext("simple-article.pdf", "/local/path/simple-article.pdf", pdf)
85
+ * .build();
86
+ *
87
+ * return witem;
88
+ */
89
+ // Zavolat report iba pre LegalCheck
90
+ // assertThat noLicense
43
91
}
0 commit comments