@@ -41,13 +41,32 @@ private JsonObject makeMetadata(String location) {
4141 return metadata ;
4242 }
4343
44- private ServiceLink addServiceLink (JsonArray content , String linkId , int serviceId , int siteId , String name , Set <Role > roles ) {
45- ServiceLink link = new ServiceLink (linkId , serviceId , siteId , name , roles );
44+ private ServiceLink addServiceLink (JsonArray content , String linkId , int serviceId , int siteId , String name , Set <Role > roles , boolean disabled ) {
45+ ServiceLink link = new ServiceLink (linkId , serviceId , siteId , name , roles , disabled );
4646 JsonObject jo = JsonObject .mapFrom (link );
4747 content .add (jo );
4848 return link ;
4949 }
5050
51+ @ Test
52+ public void allConstructors (){
53+ ServiceLink link = new ServiceLink ("abc123" , 1 , 123 , "Test Service 1" , Set .of ());
54+ assertEquals ("abc123" , link .getLinkId ());
55+ assertEquals (1 , link .getServiceId ());
56+ assertEquals (123 , link .getSiteId ());
57+ assertEquals ("Test Service 1" , link .getName ());
58+ assertEquals (Set .of (), link .getRoles ());
59+ assertEquals (false , link .isDisabled ());
60+
61+ link = new ServiceLink ("abc123" , 1 , 123 , "Test Service 1" , Set .of (), true );
62+ assertEquals ("abc123" , link .getLinkId ());
63+ assertEquals (1 , link .getServiceId ());
64+ assertEquals (123 , link .getSiteId ());
65+ assertEquals ("Test Service 1" , link .getName ());
66+ assertEquals (Set .of (), link .getRoles ());
67+ assertEquals (true , link .isDisabled ());
68+ }
69+
5170 @ Test
5271 public void loadContent_emptyArray_loadsZeroServiceLinks () throws Exception {
5372 JsonArray content = new JsonArray ();
@@ -62,10 +81,10 @@ public void loadContent_emptyArray_loadsZeroServiceLinks() throws Exception {
6281 @ Test
6382 public void loadContent_multipleServiceLinksStored_loadsAllServiceLinks () throws Exception {
6483 JsonArray content = new JsonArray ();
65- ServiceLink l1 = addServiceLink (content , "abc123" , 1 , 123 , "Test Service 1" , Set .of ());
66- ServiceLink l2 = addServiceLink (content , "abc123" , 2 , 123 , "test1" , Set .of (Role .MAPPER ));
67- ServiceLink l3 = addServiceLink (content , "ghi789" , 1 , 123 , "Test Service 1" , Set .of (Role .MAPPER , Role .SHARER ));
68- ServiceLink l4 = addServiceLink (content , "jkl1011" , 3 , 124 , "test2" , null );
84+ ServiceLink l1 = addServiceLink (content , "abc123" , 1 , 123 , "Test Service 1" , Set .of (), false );
85+ ServiceLink l2 = addServiceLink (content , "abc123" , 2 , 123 , "test1" , Set .of (Role .MAPPER ), true );
86+ ServiceLink l3 = addServiceLink (content , "ghi789" , 1 , 123 , "Test Service 1" , Set .of (Role .MAPPER , Role .SHARER ), false );
87+ ServiceLink l4 = addServiceLink (content , "jkl1011" , 3 , 124 , "test2" , null , true );
6988 when (cloudStorage .download ("locationPath" )).thenReturn (makeInputStream (content ));
7089
7190 final long count = serviceLinkStore .loadContent (makeMetadata ("locationPath" ));
@@ -77,9 +96,9 @@ public void loadContent_multipleServiceLinksStored_loadsAllServiceLinks() throws
7796 @ Test
7897 public void getServiceLink_multipleServiceLinksStored_findsCorrectServiceLink () throws Exception {
7998 JsonArray content = new JsonArray ();
80- ServiceLink l1 = addServiceLink (content , "abc123" , 1 , 123 , "Test Service 1" , Set .of ());
81- ServiceLink l2 = addServiceLink (content , "abc123" , 2 , 123 , "test1" , Set .of (Role .MAPPER ));
82- ServiceLink l3 = addServiceLink (content , "ghi789" , 1 , 123 , "Test Service 1" , Set .of (Role .MAPPER , Role .SHARER ));
99+ ServiceLink l1 = addServiceLink (content , "abc123" , 1 , 123 , "Test Service 1" , Set .of (), false );
100+ ServiceLink l2 = addServiceLink (content , "abc123" , 2 , 123 , "test1" , Set .of (Role .MAPPER ), true );
101+ ServiceLink l3 = addServiceLink (content , "ghi789" , 1 , 123 , "Test Service 1" , Set .of (Role .MAPPER , Role .SHARER ), false );
83102
84103 when (cloudStorage .download ("locationPath" )).thenReturn (makeInputStream (content ));
85104
@@ -98,7 +117,7 @@ public void getServiceLink_multipleServiceLinksStored_findsCorrectServiceLink()
98117 @ Test
99118 public void createService_nullRole_createsServiceLinkWithEmptySetOfRoles () throws Exception {
100119 JsonArray content = new JsonArray ();
101- ServiceLink sl = addServiceLink (content , "jkl1011" , 3 , 124 , "Test Service" , null );
120+ ServiceLink sl = addServiceLink (content , "jkl1011" , 3 , 124 , "Test Service" , null , false );
102121
103122 when (cloudStorage .download ("locationPath" )).thenReturn (makeInputStream (content ));
104123
0 commit comments